Search is not available for this dataset
query
stringlengths
7
355k
document
stringlengths
9
341k
metadata
dict
negatives
listlengths
0
101
negative_scores
listlengths
0
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
Fetch restaurants by a cuisine type with proper error handling.
static fetchRestaurantByCuisine(cuisine, callback) { // Fetch all restaurants with proper error handling DBHelper.fetchRestaurants((error, restaurants) => { if (error) { callback(error, null); } else { // Filter restaurants to have only given cuisine type const result...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "fetchRestaurantByCuisine(cuisine) {\n // Fetch all restaurants with proper error handling\n return this.fetchRestaurants().then(restaurants => restaurants.filter(restaurant => restaurant.cuisine_type === cuisine));\n }", "static fetchRestaurantByCuisine (cuisine) {\r\n return DBHelper.fetchRestaurants...
[ "0.79668534", "0.794467", "0.7753546", "0.77018327", "0.7694093", "0.7694093", "0.7694093", "0.7694093", "0.7694093", "0.7694093", "0.7694093", "0.7694093", "0.7694093", "0.76936364", "0.76722157", "0.76655513", "0.76655513", "0.7651263", "0.76425886", "0.7609804", "0.7607466...
0.7665566
25
Fetch restaurants by a neighborhood with proper error handling.
static fetchRestaurantByNeighborhood(neighborhood, callback) { // Fetch all restaurants DBHelper.fetchRestaurants((error, restaurants) => { if (error) { callback(error, null); } else { // Filter restaurants to have only given neighborhood const results = restaurants.fi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "static fetchRestaurantByNeighborhood(cb) {\n DBHelper.fetchRestaurants((error, restaurants) => {\n if (error) {\n cb(error, null);\n } else {\n const results = restaurants.filter(r => r.neighborhood == neighborhood);\n cb(null, results);\n }\n });\n }", "fetchRestaurant...
[ "0.8069725", "0.80578816", "0.79741454", "0.79326147", "0.79326147", "0.79326147", "0.79326147", "0.79326147", "0.79326147", "0.79326147", "0.79326147", "0.79326147", "0.7911809", "0.7911809", "0.7885722", "0.7867373", "0.78152436", "0.7814722", "0.7814157", "0.78116286", "0....
0.7903062
26
Fetch restaurants by a cuisine and a neighborhood with proper error handling.
static fetchRestaurantByCuisineAndNeighborhood(cuisine, neighborhood, callback) { // Fetch all restaurants DBHelper.fetchRestaurants((error, restaurants) => { if (error) { callback(error, null); } else { let results = restaurants; if (cuisine != 'all') { // filter by c...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "static fetchRestaurantByCuisineAndNeighborhood(cuisine, neighborhood) {\r\n // Fetch all restaurants\r\n return DBHelper.fetchRestaurants()\r\n .then(res => {\r\n \r\n let results = res;\r\n\r\n if (cuisine != 'all') { // filter by cuisine\r\n results = results.filter(r => r.c...
[ "0.84074694", "0.8403446", "0.831181", "0.82441616", "0.8184613", "0.81249666", "0.81249666", "0.81249666", "0.81249666", "0.81249666", "0.81249666", "0.81249666", "0.8122662", "0.8122662", "0.8122662", "0.8122662", "0.8122662", "0.8122662", "0.8122662", "0.8122662", "0.81226...
0.81140065
28
Fetch all neighborhoods with proper error handling.
static fetchNeighborhoods(callback) { // Fetch all restaurants DBHelper.fetchRestaurants((error, restaurants) => { if (error) { callback(error, null); } else { // Get all neighborhoods from all restaurants const neighborhoods = restaurants.map((v, i) => restaurants[i]....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function fetchNeighborhoods() {\n DBHelper.fetchNeighborhoods((error, neighborhoods) => { // eslint-disable-line no-undef\n if (error) { // Got an error\n console.error(error);\n } else {\n main.neighborhoods = neighborhoods;\n IndexDBHelper.storeNeighborhoods(neig...
[ "0.7946754", "0.7057579", "0.699078", "0.6985138", "0.6985138", "0.696733", "0.69514525", "0.69209933", "0.690837", "0.690837", "0.690837", "0.690837", "0.690837", "0.690837", "0.690837", "0.69062734", "0.689313", "0.6869584", "0.6864482", "0.6864482", "0.68632114", "0.6861...
0.6845989
36
Fetch all cuisines with proper error handling.
static fetchCuisines(callback) { // Fetch all restaurants DBHelper.fetchRestaurants((error, restaurants) => { if (error) { callback(error, null); } else { // Get all cuisines from all restaurants const cuisines = restaurants.map((v, i) => restaurants[i].cuisine_type) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function fetchCuisines() {\n DBHelper.fetchCuisines((error, cuisines) => { // eslint-disable-line no-undef\n if (error) { // Got an error!\n console.error(error);\n } else {\n main.cuisines = cuisines;\n IndexDBHelper.storeCuisines(cuisines); // eslint-disable-line...
[ "0.7879858", "0.7223122", "0.7173168", "0.7173168", "0.71661013", "0.7154812", "0.71521324", "0.7096084", "0.706611", "0.706611", "0.706611", "0.706611", "0.706611", "0.706611", "0.706611", "0.7060444", "0.7043844", "0.7043844", "0.7041222", "0.7041222", "0.70409405", "0.70...
0.7034309
34
Map marker for a restaurant.
static mapMarkerForRestaurant(restaurant, map) { // https://leafletjs.com/reference-1.3.0.html#marker const marker = new L.marker([restaurant.latlng.lat, restaurant.latlng.lng], { title: restaurant.name, alt: restaurant.name, url: DBHelper.urlForRestaurant(restaurant) }) m...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "static mapMarkerForRestaurant(restaurant, map) {\r\n // https://leafletjs.com/reference-1.3.0.html#marker\r\n const marker = new L.marker([restaurant.latlng.lat, restaurant.latlng.lng], {\r\n title: restaurant.name,\r\n alt: restaurant.name,\r\n url: DBHelper.urlForRestaurant(restaurant)\r\n ...
[ "0.8293384", "0.82433665", "0.8241444", "0.8240884", "0.82374436", "0.82374436", "0.82371354", "0.82353914", "0.823525", "0.8233243", "0.8220817", "0.8219921", "0.8219921", "0.82176477", "0.82159966", "0.82159966", "0.82159966", "0.82159966", "0.82159966", "0.82159966", "0.82...
0.82176936
13
This class represent one side of the cube
function SideUIClass(id, size) { this.id = id; this.size = size; this.validateArray = function(squareColors){ if (typeof squareColors.length === "undefined" || squareColors.length == 0 || typeof squareColors[0].length === "undefined" || squareColors[0].length != squareColors.length) { ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function Cube(){ \n this._geometry = new THREE.BoxGeometry( 1, 1, 1 );\n this._material = new THREE.MeshBasicMaterial( { color: 0x00ff00 } );\n this._mesh = new THREE.Mesh( this._geometry, this._material );\n}", "function CubeShape()\n\t{\n\t\tmxCylinder.call(this);\n\t}", "function Cube ...
[ "0.7020555", "0.69688654", "0.6944262", "0.6944262", "0.685061", "0.6652954", "0.6639043", "0.65217495", "0.65211064", "0.6458706", "0.6455728", "0.64391446", "0.6437665", "0.6422324", "0.64176637", "0.6361919", "0.635648", "0.63552076", "0.6322076", "0.62920594", "0.626786",...
0.0
-1
This class is the base building block for the cube. This class reprecent a square which is part of a cube side.
function SquareUIClass(color, row, col, size) { this.color = color; this.row = row; this.col = col; this.size = size; this.addColor = function(square) { switch (this.color) { case RED: square.addClass("btn-danger"); break; case YELLOW: squ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function Sqr(location, sideLength, clr){\r\n this.w = location;\r\n this.loc = sideLength;\r\n this.clr = clr;\r\n// Add instance variables to your constructor Function\r\n//What does a square need to know about itself??\r\n\r\n this.render = function(){\r\n fill(this.col);\r\n Rect(this.locX, this.locY...
[ "0.68378913", "0.66944516", "0.6564445", "0.65527385", "0.6453209", "0.6432351", "0.64312613", "0.64010495", "0.6382184", "0.63785803", "0.63546646", "0.63426083", "0.63244087", "0.62808657", "0.62808657", "0.62521327", "0.62148553", "0.62104326", "0.61833084", "0.6181281", "...
0.0
-1
Note: This can update the entity if the entity has primary key and it matches the same field in value.
static save(entity, value) { realm.write(() => realm.create(entity, value, true)); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "handlePrimaryKeyChange(key, value) {\n if(this.$key === key) {\n this.$exists = !isUndefined(value) && !isNull(value);\n }\n }", "function updateField(name, value) {\n const updatedEntity = Object.assign({}, entity, { [name]: value }); //create new object with the changes\n setE...
[ "0.64765936", "0.6446154", "0.6052998", "0.6028069", "0.5906815", "0.5859701", "0.5858154", "0.5749947", "0.56575054", "0.56460536", "0.56049263", "0.55874836", "0.5576598", "0.5552945", "0.5552733", "0.55524427", "0.5493519", "0.5468338", "0.5468338", "0.5468338", "0.5373659...
0.5479511
17
optional, default: false (this includes graphqltag for node_modules folder) authenticationType: 'Basic', // optional, default: 'Bearer' optional
errorHandler(error) { console.log('%cError', 'background: red; color: white; padding: 2px 4px; border-radius: 3px; font-weight: bold;', error.message) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "configureAuthentication(_properties) {\n let properties = _properties ? JSON.parse(_properties): null;\n if (properties) {\n let auth = properties.api && properties.api.authentication;\n let contextPath = {\n oauth: \"snap-oauth\",\n snap: \"snap-api\",\n flowable: \"flow-api\"...
[ "0.66059494", "0.6445079", "0.62452185", "0.605207", "0.58905023", "0.5784389", "0.5757697", "0.56757677", "0.56743175", "0.56581354", "0.5653146", "0.56128067", "0.55785704", "0.5578514", "0.55528927", "0.5550083", "0.55243176", "0.5504142", "0.54649985", "0.54222465", "0.53...
0.0
-1
Run ESLint on save
extend(config, { isDev, isClient }) { if (isDev && isClient) { config.module.rules.push({ enforce: 'pre', test: /\.(js|vue)$/, loader: 'eslint-loader', exclude: /(node_modules)/ }) } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async function onDidSave(document) {\n \n // vscode.window.showErrorMessage(document.fileName);\n if (document.fileName.endsWith('.git')){\n freshCompile(document.fileName.slice(0, -4));}\n else{\n freshCompile(document.fileName);}\n\n}", "extend(config, ctx) {\n // Run ESLint on s...
[ "0.62547535", "0.6194508", "0.6038548", "0.60146207", "0.5993493", "0.59701204", "0.59469837", "0.59121484", "0.591011", "0.59079164", "0.59071046", "0.5879183", "0.58421713", "0.58377033", "0.58366185", "0.58366185", "0.58366185", "0.58366185", "0.58366185", "0.58366185", "0...
0.0
-1
creation of the players
function createPlayers(){ document.getElementById("numbOfPlayers").disabled=true; document.getElementById("createPlayer").disabled=true; for(var a = 0, c = 0; a<13; a++){ for(var b = 0; b<4; b++){ deck[c] = new Card( a+1, b+1, c); c++; } } var numbOfPlayers = document.getElementById("numbOfPlayers")...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function createPlayer() {\n}", "createPlayer() {\n this.match.match_name = \"MATCH\" + Math.floor(Math.random() * Math.floor(1000));\n var date = new Date();\n this.match.match_date = date.getHours() + \":\" + date.getMinutes() + \":\" + date.getSeconds() + \" \" + date.getDate()...
[ "0.75141793", "0.7417792", "0.72596484", "0.72312593", "0.71981215", "0.7194241", "0.7150899", "0.7139583", "0.71368045", "0.7093302", "0.7074287", "0.70311034", "0.70220554", "0.7020218", "0.6884795", "0.68693376", "0.6820339", "0.6813245", "0.6799684", "0.67557913", "0.6725...
0.62008756
76
globals __VUE_SSR_CONTEXT__ IMPORTANT: Do NOT use ES2015 features in this file (except for modules). This module is a runtime utility for cleaner component module output and will be included in the final webpack user bundle.
function normalizeComponent ( scriptExports, render, staticRenderFns, functionalTemplate, injectStyles, scopeId, moduleIdentifier, /* server only */ shadowMode, /* vue-cli only */ components, // fixed by xxxxxx auto components renderjs // fixed by xxxxxx renderjs ) { // Vue.extend constructor expo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function Es(t,e,n,i,r,o,a,s){var u=(\"function\"===typeof n?n.options:n)||{};return u.__file=\"source.vue\",u.render||(u.render=t.render,u.staticRenderFns=t.staticRenderFns,u._compiled=!0,r&&(u.functional=!0)),u._scopeId=i,u}", "extend(config, ctx) {\n // if (process.server && process.browser) {\n if (...
[ "0.5848036", "0.57285064" ]
0.0
-1
.dirname, .basename, and .extname methods are extracted from Node.js v8.11.1, backported and transplited with Babel, with backwardscompat fixes Copyright Joyent, Inc. and other Node contributors. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation f...
function normalizeArray(parts, allowAboveRoot) { // if the path tries to go above the root, `up` ends up > 0 var up = 0; for (var i = parts.length - 1; i >= 0; i--) { var last = parts[i]; if (last === '.') { parts.splice(i, 1); } else if (last === '..') { parts.splice(i, 1); up++; ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function normalizeArray(parts,allowAboveRoot){// if the path tries to go above the root, `up` ends up > 0\nvar up=0;for(var i=parts.length-1;i>=0;i--){var last=parts[i];if(last==='.'){parts.splice(i,1);}else if(last==='..'){parts.splice(i,1);up++;}else if(up){parts.splice(i,1);up--;}}// if the path is allowed to g...
[ "0.6246232", "0.62140876", "0.6013123", "0.5982529", "0.5973695", "0.5966872", "0.58964515", "0.58964515", "0.58888525", "0.5883687", "0.58758354", "0.58038723", "0.5782002", "0.5782002", "0.5782002", "0.5782002", "0.5782002", "0.5782002", "0.5778279", "0.57694095", "0.576392...
0.0
-1
Try/catch helper to minimize deoptimizations. Returns a completion record like context.tryEntries[i].completion. This interface could have been (and was previously) designed to take a closure to be invoked without arguments, but in all the cases we care about we already have an existing method we want to call, so there...
function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function tryCatch(fn, obj, arg) { // 59\n try { // 60\n return { type: \"normal\", arg: fn.call(obj, arg) }; ...
[ "0.50709367", "0.506058", "0.4848837", "0.47916886", "0.47916886", "0.47916886", "0.47916886", "0.47916886", "0.47833902", "0.47833902", "0.47048774", "0.46885228", "0.46681565", "0.46560067", "0.46556818", "0.46556818", "0.46556818", "0.46373796", "0.46202448", "0.46134982", ...
0.0
-1
Dummy constructor functions that we use as the .constructor and .constructor.prototype properties for functions that return Generator objects. For full spec compliance, you may wish to configure your minifier not to mangle the names of these two functions.
function Generator() {}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function tempCtor() {}", "function temporaryConstructor() {}", "function TempCtor() {}", "function TempCtor() {}", "function TempCtor() {}", "function TempCtor() {}", "function TempCtor() {}", "function TempCtor() {}", "function HelperConstructor() {}", "function DummyClass() {\r\n // ...
[ "0.7217735", "0.70248765", "0.6952348", "0.6952348", "0.6952348", "0.6952348", "0.6952348", "0.6952348", "0.67607456", "0.66027665", "0.65726006", "0.65726006", "0.65726006", "0.6486774", "0.64440733", "0.63991326", "0.63939726", "0.63788396", "0.63788396", "0.6339717", "0.62...
0.0
-1
Helper for defining the .next, .throw, and .return methods of the Iterator interface in terms of a single ._invoke method.
function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function(method) { prototype[method] = function(arg) { return this._invoke(method, arg); }; }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function defineIteratorMethods(prototype){[\"next\",\"throw\",\"return\"].forEach(function(method){prototype[method]=function(arg){return this._invoke(method,arg);};});}", "function defineIteratorMethods(prototype){[\"next\",\"throw\",\"return\"].forEach(function(method){prototype[method]=function(arg){return th...
[ "0.7480765", "0.7480765", "0.7480765", "0.7480765", "0.7480765", "0.7480765", "0.7178587", "0.6994301", "0.6994301", "0.6972494", "0.69664305", "0.69664305", "0.69664305", "0.69664305", "0.69664305", "0.69664305", "0.69664305", "0.69664305", "0.69664305", "0.69664305", "0.696...
0.0
-1
this code defines the counterscore section
function Counter(props) { return ( <div className="card"> <div class="score" > <h2 id="score-count">score-count<span id="score-text"></span></h2> {props.count} </div> </div> ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function countScore(){\r\n\tlevel.score+=1;\r\n\t}", "function Score() { }", "function Resume_Minify_ScoreCounter(score)\n{\n\t//create a result array\n\tvar aResult = [];\n\t//fill it up\n\taResult[0] = score.Requests_Hints;\t\t\t//Count of all hints requested\n\taResult[1] = score.Requests_Cameras; \t\t//Cou...
[ "0.6935559", "0.67855775", "0.67636424", "0.6691147", "0.66019094", "0.64723474", "0.64683264", "0.6455982", "0.645176", "0.6437152", "0.6436618", "0.64292717", "0.6427652", "0.64158976", "0.640244", "0.64013034", "0.63874316", "0.635954", "0.6303079", "0.6286507", "0.6285585...
0.0
-1
Function call to populate the weather
function getCurrentWeather(URL, city) { // This API call gets the city by name. It returns the current weather and also the longitude/latitude // needed in order to get the 5 day forecast. The current weather could also be gathered from the 5 day // and the actual weather icon comes from that api call. ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function init(){\n getWeatherData();\n}", "function currentweatherPopulate() {\n\n let city = currentDay.name;\n let temp = tempConvertor(currentDay.main.temp);\n let humid = currentDay.main.humidity;\n let wind = currentDay.wind.speed;\n let icon = currentDay.weather[0].ico...
[ "0.7466772", "0.7181498", "0.7130509", "0.71201074", "0.7064396", "0.70052594", "0.694278", "0.69369096", "0.68998325", "0.68028325", "0.68018717", "0.6760851", "0.6760033", "0.6754874", "0.6733155", "0.6730301", "0.6721641", "0.67144656", "0.67100435", "0.67082155", "0.67010...
0.0
-1
Function and API calls to populate the 5 day forecast
function pop5Day (lat, lon) { var queryURL = "https://api.openweathermap.org/data/2.5/onecall?lat=" + lat + "&lon=" + lon + "&exclude=current,minutely,hourly,alerts&appid=" + apiKey $.ajax({ url: queryURL, method: "GET" }) // Callback function to populate the response data .then(func...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function fiveDayForecast(fcLat, fcLon, fcCity) {\n\n var queryURL = `https://api.openweathermap.org/data/2.5/onecall?lat=${fcLat}&lon=${fcLon}&exclude=hourly,minutely&appid=${APIKey}`;\n \n $.ajax({\n url: queryURL,\n method: \"GET\"\n }).then(function(response) {\n console.log(res...
[ "0.7530884", "0.7309457", "0.71177405", "0.7105057", "0.71034", "0.7096842", "0.7054", "0.70480305", "0.7028482", "0.7004237", "0.7004138", "0.69821167", "0.6939529", "0.6935769", "0.6932763", "0.6909297", "0.6867519", "0.6863562", "0.6843802", "0.682793", "0.682253", "0.68...
0.0
-1
Conversion of Kelvin to Fahrenheit
function kelToFar(temp) { return Math.round((temp) * 9/5 - 459.67, 0) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function kelvinToFahrenheit(kelvin) {\n return (kelvin - 273.15) * 1.8 + 32\n}", "function kelvinToFarenheit(K){\n return 1.8*K - 459.67;\n}", "function kelvin2Farenheit(kelvin)\n{\n return (9/5 * (kelvin - 273)) + 32;\n}", "function convertKelvinToFahrenheit(kelvin) {\n return ((kelvin - 273.15) * 9...
[ "0.83990073", "0.8397085", "0.8288403", "0.8269746", "0.81918734", "0.81783766", "0.80884326", "0.80710566", "0.8065091", "0.80442005", "0.796677", "0.7857606", "0.77220404", "0.76364887", "0.7635363", "0.76062447", "0.76055723", "0.75277996", "0.7429729", "0.7410812", "0.737...
0.0
-1
Function to render the cities to the left nav
function renderCities () { $("#cityList").empty(); for (i=0; i<cities.length; i++) { var cityDiv = $("<li>"); cityDiv.addClass("list-group-item savedCity"); cityDiv.attr("value", cities[i]); cityDiv.text(cities[i]); // needed to re-establish the on-click event listener ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "renderCities(cities, country) {\n const container = document.querySelector(\"#cities-list\");\n const header = document.querySelector(\".results-header\");\n //use lodash map iterate through objects collection\n header.innerHTML = `Cities with the most polluted air in ${country}:`\n //hide...
[ "0.6885734", "0.6674531", "0.6557766", "0.65330726", "0.6390843", "0.6363929", "0.63283676", "0.63181186", "0.6168606", "0.6141768", "0.6109285", "0.6103908", "0.608972", "0.6060911", "0.60575527", "0.604305", "0.6034664", "0.60278004", "0.6000916", "0.5993063", "0.59415627",...
0.5569211
42
Initializes the page pulling in the saved citys from local storage
function init() { var storedCities = JSON.parse(localStorage.getItem("cities")); // If cities were retrieved from localStorage, update the cities array if (storedCities !== null) { cities = storedCities; } // Render cities to the DOM renderCities(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function init() {\n // Parse Data In Local Storage\n let storedCities = JSON.parse(localStorage.getItem(\"cities\"))\n // Check if Local Storage Was Empty\n // console.log(storedCities);\n if (storedCities !== null) {\n recCities = storedCities; \n }\n ...
[ "0.86125994", "0.8525347", "0.83213776", "0.8283322", "0.8280028", "0.8079914", "0.79170096", "0.7909822", "0.7854915", "0.77133673", "0.767443", "0.76468706", "0.758889", "0.75575995", "0.7514657", "0.7499411", "0.7495963", "0.7485196", "0.73579776", "0.7336635", "0.7320994"...
0.848105
2
Looks to see if a city is in local storage
function addCity(city) { var storedCities = JSON.parse(localStorage.getItem("cities")); for (i=0; i<cities.length; i++) { if (storedCities[i] === city) { return } } cities.push(city); localStorage.setItem("cities", JSON.stringify(cities)); renderCities(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function isFoundInLocalDb(cityString) {\n if (localStorage.getItem(cityString) === null) {\n return false;\n } else {\n return true;\n }\n}", "function storeCitiesToLocalStorage(cityName){\n //Reading localstorage list if any\n var cityList = JSON.parse(localStorage.getItem('...
[ "0.82916087", "0.7517534", "0.74240035", "0.74168974", "0.7338145", "0.71484756", "0.71296716", "0.706592", "0.69661945", "0.69367987", "0.69194263", "0.6908543", "0.68985265", "0.6877416", "0.6853571", "0.6783195", "0.677231", "0.6734375", "0.6695587", "0.66928905", "0.66860...
0.6653811
21
Function for the event listener when clicking on a saved city.
function savedCityClick () { var city = $(this).text(); var queryURL = urlBase + city + "&appid=" + apiKey; getCurrentWeather(queryURL, city); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "saveSelectedCity (e) {\n const selectedCity = this.cityPlace[e]\n this.$store.commit('city/setName', selectedCity.key)\n this.$store.commit('city/setCountry', selectedCity.value)\n const cardinalsPoints = {\n south: selectedCity.south,\n north: selectedCity.north,\n east: s...
[ "0.7051046", "0.69265765", "0.68389225", "0.6707178", "0.66367644", "0.6636235", "0.65980846", "0.6557048", "0.6546922", "0.6511916", "0.65046036", "0.6470407", "0.646874", "0.6460857", "0.6460687", "0.6455351", "0.64531505", "0.6387891", "0.6384431", "0.6354159", "0.62637836...
0.74187964
0
`equivalentTimes` was originally written for Popcorn.js
function equivalent(testedTime, correctTime) { const tolerance = 0.0001; return (testedTime < (correctTime + tolerance)) && (testedTime > (correctTime - tolerance)); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "compareTimes() {\n console.log(\"compareTimes\")\n }", "function getTimes() {\n moment.tz.add([\n \"Europe/Moscow|MMT MMT MST MDST MSD MSK +05 EET EEST MSK|-2u.h -2v.j -3v.j -4v.j -40 -30 -50 -20 -30 -40|012132345464575454545454545454545458754545454545454545454545454545454545454595|-2ag2u.h...
[ "0.6401727", "0.59734726", "0.5766888", "0.56062967", "0.55384547", "0.5514459", "0.54574", "0.54457337", "0.54298705", "0.5372692", "0.5295296", "0.5290481", "0.5263054", "0.5252048", "0.5252048", "0.5252048", "0.5252048", "0.5252048", "0.5252048", "0.5252048", "0.5252048", ...
0.5386099
9
write functions to pass spec tests here outside the jQuery doc ready then call function within doc ready to get them to work and display the chart correctly in index.html
function extractTop10Tracks(tracks) { return tracks }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function makeCharts() {\n issueChart();\n countChart();\n averageChart();\n}", "function init() {\n charts(\"940\");\n}", "function main() {\n $(function() {\n // When document has loaded we attach FastClick to\n // eliminate the 300 ms delay on click events.\n Fas...
[ "0.6508224", "0.64714676", "0.62587225", "0.62499815", "0.61718667", "0.61301893", "0.6033126", "0.5963453", "0.59279525", "0.5920984", "0.5891226", "0.5878203", "0.5875478", "0.582738", "0.5825438", "0.5812074", "0.5780934", "0.5756986", "0.5750173", "0.5718413", "0.57012427...
0.0
-1
Save procedure price if was changed
priceSave (item) { // If price changed if (item.price != this.oldPrice) { this.PlaceService.changeService(item).then(() => { alertify.success("Сохранено", 3); }); } this.proceduresStatus = null; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function updateprice(){\n\n}", "function updatePrices() {\n}", "function store(price) {\n wallet.setPrice(price);\n console.log('the new price is ' + price);\n }", "function OTPPriceUpdate(value) {\n console.log(value, 'OTPPriceUpdate');\n\n setOTPSelectedOption(value)\n setPrice(va...
[ "0.6459681", "0.6454297", "0.6407227", "0.6219149", "0.6189208", "0.61873317", "0.6133293", "0.61268115", "0.60736", "0.60368925", "0.5888635", "0.5872833", "0.5843999", "0.58276254", "0.5819127", "0.58091456", "0.5795371", "0.5788042", "0.5784989", "0.5758743", "0.5751177", ...
0.76692134
0
When you click checkbox to choose new services, this function appends or removes from the global list
addToSelectedProcedures (item) { if (this.selectedProcedures.includes(item)) { _remove(this.selectedProcedures, (obj) => obj.id == item.id); } else { this.selectedProcedures.push(item); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function SyncServices()\n\t{\t\n\t\t$('input#hidden').each( function() {\n\t\t\tvar service = $(this).attr('name');\n\t\t\t\t\n\t\t\tif( !$( this ).is(':checked') )\n\t\t\t{\n\t\t\t\t//checkbox is checked - add service\n\t\t\t\tUpdateService(service, true, true );\n\t\t\t}\n\t\t\telse\n\t\t\t\tUpdateService(servic...
[ "0.66353464", "0.6102977", "0.60339785", "0.6011944", "0.60031646", "0.59905785", "0.5987865", "0.5958299", "0.5951092", "0.5818315", "0.57884526", "0.57767767", "0.5734083", "0.5726742", "0.571765", "0.5711523", "0.57028425", "0.56933504", "0.56860816", "0.5666263", "0.56519...
0.5488506
47
Satisfies the requirement for: start / stop / pause / continue stream Toggle live feed visibility
function StreamControls({ mediaRecorder, toggleFeedVisibility, visibleFeed, startCountdown, toggleStreamPlayback, isActive }) { const [recording, setRecording] = useState(false); const [paused, setPaused] = useState(false); function startRecording() { if (mediaRecorder && mediaRecorder.state === "inactive") { ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function toggle() {\n if (!isRunning) {\n // if the stream is not opened one elment, open the first element\n if(document.querySelectorAll('.item-container').length < 1) {\n eventFire(document.querySelector('#stream .silent.thumb'), 'click');\n }\n launchFullscreen(document.documentEl...
[ "0.7270045", "0.70023984", "0.63294494", "0.6281674", "0.6264371", "0.6213744", "0.61899745", "0.6172947", "0.6126836", "0.6105615", "0.60822093", "0.6040451", "0.60363656", "0.6024563", "0.5955171", "0.59516203", "0.59006834", "0.58804244", "0.5870089", "0.5855182", "0.58498...
0.5716272
33
Function to get all selected applicant.
static getAllSelection(){ let url = "http://localhost:3000/api/selected"; let token = this.getUserToken(); let config = {headers: {authorization: "Bearer " + token}}; return axios.get(url, config); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getApps() {\r\n return Array.from(_apps.values());\r\n}", "getAllApplications () : Promise<Array<AccountApplication>> {\n return this.makeRequest(\"applications\")\n }", "function getApps() {\r\n // Make a copy so caller cannot mutate the apps list.\r\n return Object.keys(apps).ma...
[ "0.67344475", "0.66857386", "0.6584609", "0.65372837", "0.6514239", "0.6504491", "0.6504491", "0.6504491", "0.6504491", "0.6504491", "0.6504491", "0.64869183", "0.64869183", "0.64869183", "0.64869183", "0.64869183", "0.64869183", "0.64869183", "0.64869183", "0.648574", "0.646...
0.52609164
95
Function to return user auth token
static getUserToken(){ let token = JSON.parse(localStorage.getItem('USER')).token; return token; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "getToken() {\n\t\treturn this._post(\"/api/user/token\");\n\t}", "function getUserToken(){\n\t\treturn $cookies.get('user.token');\n\t}", "function getUserToken () {\n return getCurrentUser().then((currentUser) => {\n return currentUser.getIdToken(true);\n }).then((token) => {\n ...
[ "0.81019825", "0.7477416", "0.74692917", "0.745122", "0.7422214", "0.7385261", "0.7336324", "0.7311919", "0.72975165", "0.72501415", "0.72194874", "0.7178124", "0.71668375", "0.7157205", "0.71332806", "0.71265745", "0.7112106", "0.7101996", "0.70990384", "0.7096556", "0.70888...
0.7504432
2
BOOTSTRAP POPOVER FOR DESCRIPTION
render() { return ( <div key={this.props.id} className="col-md-4 col-xs-4"> <Thumbnail src={this.props.image}/> <OverlayTrigger trigger="click" rootClose placement="bottom" overlay={ <Popover> <dt>Name</dt> <dd>{this.props.name}</dd> <dt>Brand</dt> <dd>{this.props.brand}</dd> ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "showDescription() {\n ui.toggleDescription();\n }", "showDescription() {\n this.hover = true;\n }", "desktopDescription(){}", "function toggleDescription() {\n self.showingDescription = !self.showingDescription;\n }", "function DisplayDesc() {\n\t\tif (props.powerPro.boss ...
[ "0.70774734", "0.66842484", "0.66561025", "0.65571624", "0.65127933", "0.65021425", "0.64718235", "0.6260201", "0.625639", "0.62501574", "0.6225266", "0.6215156", "0.62131935", "0.620775", "0.6193034", "0.61908984", "0.616989", "0.6139627", "0.610116", "0.6100747", "0.6086635...
0.0
-1
Colocamos un valor por defecto al constructor, por si no llaman al metodo lugar() este tendra ya valores de nommbreLugar y tipoDescripcion
constructor(nombreLugar='Tierra de mordor', tipoDescripcion='Es un lugar rodeado de arboles muertos y arena negra, donde no se puede ver nada por su densa niebla.') { this.nombreLugar = nombreLugar; this.tipoDescripcion = tipoDescripcion; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "constructor(color, velocidad, ruedas, motor, marca) {\n this.tipo = 'auto';\n this.color = color;\n this.velocidad = velocidad;\n this.ruedas = ruedas;\n this.motor = motor;\n this.vendido = true;\n this.marca = marca || 'Honda';\n }", "function Mascota(nombre,...
[ "0.6945102", "0.6737163", "0.6526619", "0.65248525", "0.6481552", "0.64609814", "0.64437175", "0.63764435", "0.630876", "0.6305117", "0.6227291", "0.6196389", "0.6193898", "0.6171527", "0.6143081", "0.607709", "0.6060041", "0.60493946", "0.5954385", "0.5945693", "0.5937432", ...
0.7844554
0
Function example: longestLogin(["serg22", "tester_2", "Prokopenko", "guest"]); longestLogin(["us2", "us1", "user3"]); ANSWER
function longestLogin(loginList){ let login = ''; for (let i = 0; i < loginList.length; i++){ if (loginList[i].length > login.length){ login = loginList[i]; } } console.log(login); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function longestString(strings) {\n\n}", "function longest(words) {\n\n}", "function longest(s1, s2) {\n s1 = s1.split(\"\");\n s2 = s2.split(\"\");\n var nstring = s1.concat(s2);\n nstring = nstring.sort();\n var result = [];\n for(var i = 0; i<nstring.length; i++){\n if(result.indexOf(...
[ "0.7193521", "0.7152807", "0.6467816", "0.6440011", "0.63852835", "0.6362505", "0.63511443", "0.63477904", "0.6326012", "0.6312546", "0.6288103", "0.62801564", "0.6264794", "0.62619287", "0.6259262", "0.62491536", "0.62439716", "0.6235678", "0.6231375", "0.6225978", "0.622532...
0.77918893
0
(C) 20022014 Asbru Ltd.
function webeditor_empty_content_fix(content) { return content; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private internal function m248() {}", "protected internal function m252() {}", "transient protected internal function m189() {}", "private public function m246() {}", "transient private protected internal function m182() {}", "transient private internal function m185() {}", "static private internal fun...
[ "0.6359733", "0.6201618", "0.60690147", "0.60652834", "0.5905612", "0.58622587", "0.58276314", "0.57451624", "0.56142974", "0.561326", "0.5612664", "0.560156", "0.55711156", "0.55423236", "0.55265", "0.5515389", "0.55073684", "0.5468569", "0.54157233", "0.54035246", "0.539869...
0.0
-1
Created on : Apr 13, 2017, 10:29:03 AM Author : eros
function criacaoFormularioUsuario($scope, $state, buscaAPIService, $stateParams, sairDoSistemaService, notificacaoProvider, $timeout, DTOptionsBuilder, helperService, $filter,buscaAPIService,$q) { var self = this; $scope.userDTO = sairDoSistemaService.validarLogin(); self.u = $scope.userDTO; if(!$s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private public function m246() {}", "private internal function m248() {}", "protected internal function m252() {}", "transient private internal function m185() {}", "transient private protected internal function m182() {}", "transient protected internal function m189() {}", "transient final protected i...
[ "0.65397316", "0.64452165", "0.6243004", "0.5972411", "0.5936631", "0.5884137", "0.5879471", "0.58372796", "0.5766925", "0.5749662", "0.5667407", "0.5662208", "0.56451803", "0.5641633", "0.556047", "0.5536917", "0.55117714", "0.5485024", "0.5452254", "0.54100734", "0.54027987...
0.0
-1
Update string 10,000 times
function updateString() { for( var i = 0 ; i <= 10000 ; i++ ) { someString = "updated string"; }; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function update(chunk) {\n if (typeof chunk === \"string\") return updateString(chunk);\n var length = chunk.length;\n totalLength += length * 8;\n for (var i = 0; i < length; i++) {\n write(chunk[i]);\n }\n }", "function update(chunk) {\n if (typeof chunk === \"string\") return updateStr...
[ "0.5936525", "0.5936525", "0.5936525", "0.58522296", "0.5677621", "0.56380665", "0.56301564", "0.55894613", "0.55228555", "0.54360163", "0.5435719", "0.5433552", "0.5431836", "0.54300565", "0.542776", "0.5418678", "0.5387233", "0.53821886", "0.5379682", "0.53772455", "0.53690...
0.80691373
0
Opens a zip file
async function openZip (zipPath) { // TODO: remove hardcode once Beaker supports HEAD requests // https://github.com/beakerbrowser/beaker/issues/826 let zipSize = await fetchZipSize(zipPath) if (zipSize === 0) { zipSize = 169316988448 console.log('fallback hardcoded zip size: ' + zipSize) } else { ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function ZFS(file) { const I = this // new ZFS(filename)\n I.file = file; I.open() // open .zip file\n}", "function openFile (bookFiles, dezip) {\n var reader = new FileReader();\n reader.onloadend = function () {\n dezip(reader.result);\n };\n reader.readAsB...
[ "0.6421147", "0.61527556", "0.5694858", "0.5628721", "0.5625593", "0.560185", "0.55945826", "0.55776316", "0.5518939", "0.5460969", "0.5386999", "0.53063595", "0.5295287", "0.5249298", "0.52085793", "0.51851475", "0.51572645", "0.51476943", "0.5139217", "0.5086371", "0.508566...
0.6683374
0
Given a zip file and a filename, extracts file data
async function getFile (zipFile, entryData) { const entryValues = {} Object.keys(entryData).forEach(k => { entryValues[k] = { value: entryData[k] } }) const entry = Object.create(yauzl.Entry.prototype, entryValues) const readStream = await zipFile.openReadStreamAsync(entry) const fileData = await conc...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function _getzipfile(zip, filePath) {\n var f = filePath;\n if (zip.files[f]) return zip.files[f];\n // f = file.toLowerCase(); if (zip.files[f]) return zip.files[f];\n // f = f.replace(/\\//g,'\\\\'); if (zip.files[f]) return zip.files[f];\n return null;\n}", "function readZipFile(codeVar){\r\n\r...
[ "0.68560857", "0.6428085", "0.632444", "0.630046", "0.62930816", "0.62930816", "0.62930816", "0.62930816", "0.62930816", "0.6290584", "0.62475944", "0.61686856", "0.61686856", "0.61686856", "0.61516386", "0.61173445", "0.6079471", "0.6076584", "0.6038599", "0.6027397", "0.596...
0.7327049
0
Reads bit range [start, end], inclusive. Returns buffers to concat.
async function readBufsForRange (reader, start, end) { // Kick off any fetches not yet started const pageStart = Math.floor(start / PAGE_SIZE) const pageEnd = Math.floor(end / PAGE_SIZE) for (let page = pageStart; page <= pageEnd; page++) { let promise = reader._pagePromiseCache[page] if (promise == nul...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function range(start, end) {\n\t if (end === undefined) {\n\t end = start;\n\t start = 0;\n\t }\n\t let res = []; //newArray(end-start,0);\n\t start = start | 0;\n\t for (let i = start; i < end; i++) res.push(i);\n\t return res;\n\t}", "function range(start, end) {\r\n\tif (end === undefined) {\r\n\t...
[ "0.59710354", "0.5878737", "0.5873055", "0.58542764", "0.58542764", "0.5812345", "0.58105326", "0.5807922", "0.576837", "0.5667192", "0.56137526", "0.55522525", "0.55466604", "0.5543013", "0.5521409", "0.54994446", "0.54798144", "0.5476106", "0.54665697", "0.54632", "0.544649...
0.6252921
0
function that populates and appends buttons
function populateButtons(topics, classToAdd, areaToAddTo) { $(areaToAddTo).empty(); for (let i = 0; i < topics.length; i++) { let a = $('<button>'); a.addClass(classToAdd); a.attr('data-type', topics[i]); a.text(topics[i]); $(areaToAddTo).append(a); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function displayButtons() {\n $(\"#myButtons\").empty();\n for (var i = 0; i < topics.length; i++) {\n var newButton = $('<button class=\"btn btn-danger\">');\n newButton.attr(\"id\", \"topic\");\n newButton.attr(\"data-search\", topics[i]);\n newButton.text(topics...
[ "0.7821704", "0.782126", "0.7801602", "0.7762158", "0.77243227", "0.76993936", "0.76842654", "0.76768345", "0.7598137", "0.7598121", "0.75943077", "0.7590853", "0.75660866", "0.7565801", "0.75588304", "0.7554787", "0.755082", "0.7541032", "0.7527028", "0.7526979", "0.75179213...
0.7414209
45
This function gets called every time the program needs to draw or move the sunflower image.
function component(width, height, color, x, y, type) { this.type = type; if (type == "image") { this.image = new Image(); this.image.src = color; } this.width = width; this.height = height; this.speedX = 0; this.speedY = 0; this.x = x; this.y = y; ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function displayApple(){\n noStroke();\n image(apple, appleX, appleY, appleSize, appleSize);\n appleY += speed;\n}", "function animate() {\n window.setTimeout(animate, 25);\n L10_Canvas.crc2.putImageData(imagedata, 0, 0);\n moveFishes();\n drawFishes();\n moveBubbles();\n ...
[ "0.6932107", "0.6891666", "0.6823953", "0.6792629", "0.676194", "0.67250407", "0.6722454", "0.6697299", "0.6684155", "0.66766363", "0.6648937", "0.6634934", "0.6629066", "0.6595089", "0.65911424", "0.6591137", "0.65764445", "0.6574785", "0.65664554", "0.6529777", "0.65285486"...
0.0
-1
After we have done the loading, nothing happens. Unless you click one of the 4 buttons on the HTML file. Each of those buttons calls one of the following functions:
function moveup() { myGamePiece.speedY = -1; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function onload(){\r\n // Task 4: Detect when the button is clicked.\r\n // console.log(\"button-pressed\") when it does\r\n // You may want to modify the html file.\r\n\r\n // Task 5: Detect the content of the button press\r\n // call sendMessage() with that message, and wait for the response.\r\n\...
[ "0.6807148", "0.66971064", "0.6675989", "0.6599838", "0.65969396", "0.6573038", "0.6558486", "0.65431005", "0.653871", "0.652734", "0.64525837", "0.64519197", "0.6445082", "0.6429562", "0.64031905", "0.6395405", "0.63773525", "0.6301642", "0.6298166", "0.6291312", "0.62888837...
0.0
-1
Now, if you look at the buttons on the HTML file, you'll notice they all call two functions. When you hold the mouse button down on each of them, they do the 4 functions above this line. This makes the sunflower move in the direction the button tells it to. When you release the mouse button, it does the function below,...
function clearmove() { myGamePiece.speedX = 0; myGamePiece.speedY = 0; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function mouseUp() { }", "function mouseup(){\n mouse_down = false;\n}", "function mouseReleased(){\n if(page === 6){\n apple_icon_moving = false\n orange_icon_moving = false\n banana_icon_moving = false\n pear_icon_moving = false\n box_icon_moving = false\n }\n}", "function mousePresse...
[ "0.64671504", "0.64642584", "0.6409263", "0.6371025", "0.63425404", "0.6313595", "0.63014114", "0.6298246", "0.62981516", "0.62934077", "0.62915045", "0.62741345", "0.62461275", "0.6238007", "0.6219298", "0.61872625", "0.61869687", "0.61793274", "0.61768913", "0.6172204", "0....
0.0
-1
now, there are five functions about this one. each of the starts or stops the sunflower moving. But that only tells the game where the sunflower SHOULD be. This function tells the game to update the screen to make the sunflower actually go there.
function updateGameArea() { myGameArea.clear(); myGamePiece.newPos(); myGamePiece.update(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function update() {\n if (ingame){\n if (direction == \"RIGHT\") snake.x = snake.x + 1;\n else if (direction == \"LEFT\") snake.x = snake.x - 1;\n else if (direction == \"UP\") snake.y = snake.y - 1;\n else if (direction == \"DOWN\") snake.y = snake.y + 1;\n\n check_borders(...
[ "0.70691717", "0.7031333", "0.673718", "0.67099947", "0.6709459", "0.6657939", "0.6612629", "0.65870315", "0.65834504", "0.65749234", "0.6562457", "0.6536575", "0.65250856", "0.65226203", "0.6513389", "0.65083", "0.6493208", "0.64869535", "0.6482281", "0.6482037", "0.64785784...
0.0
-1
Se ejecuta automaticamente cuando el componente va a ser montado.
componentWillMount() { this.loadBlockchainData(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function ejecutar(){\n Concurrent.Thread.create(caballo,\"inputCaballo1\",\"metrosRecorridos1\",100000);\n Concurrent.Thread.create(caballo,\"inputCaballo2\",\"metrosRecorridos2\",100000);\n Concurrent.Thread.create(caballo,\"inputCaballo3\",\"metrosRecorridos3\",100000);\n }", "execute(){\n\t\...
[ "0.58230746", "0.5735287", "0.56720245", "0.5601034", "0.5530604", "0.5516465", "0.53350586", "0.53103316", "0.52821004", "0.5264544", "0.52616847", "0.52480567", "0.522945", "0.51966536", "0.5159732", "0.51472926", "0.5107177", "0.509566", "0.5090216", "0.5056586", "0.504557...
0.0
-1
Esta funcion se encarga de conectarse a la blockchain y tener una conexion para hacerle peticiones.
async loadBlockchainData() { //Obteniendo un proveedor desde Metamask const web3 = new Web3(Web3.givenProvider || "http://localhost:8545"); //Solicitando autorizar el proveedor de Metamask window.ethereum.enable(); //Obteniendo todas las cuentas asociadas a la billetera const accounts = await...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async function connect() {\n try {\n // load the network configuration\n let ccp = JSON.parse(fs.readFileSync(config.conexionPath, 'utf8'));\n\n // Create a new file system based wallet for managing identities.\n const walletPath = path.join(process.cwd()+'/esc_core/wallet');\n ...
[ "0.7343702", "0.6349209", "0.62580407", "0.61642057", "0.6149359", "0.6133696", "0.6113696", "0.6067718", "0.60457313", "0.6036673", "0.5997615", "0.5928198", "0.59244794", "0.5918342", "0.58631766", "0.5789007", "0.57660425", "0.57412994", "0.572286", "0.5680021", "0.5670695...
0.6228502
3
Permite actualizar la cuanta actual con la que estara realizando peticiones, de forma automatica y es asignada al state account
async updateSelectedAccount() { const updateAccount = await this.state.web3.eth.getAccounts(); this.setState({ account: updateAccount[0] }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function update() {\n // Update user account\n Lottery.inpUserAddress.value = web3.eth.defaultAccount\n\n // Update Contract\n if (!web3.isAddress(Lottery.inpContractAddress.value)) {\n setErrorMessage(\"Invalid contract address\")\n return false;\n }\n Lottery.contractAddress = Lottery.inpContractAddr...
[ "0.604022", "0.59952974", "0.5774011", "0.57335955", "0.5723927", "0.56540835", "0.5630226", "0.5628356", "0.5623861", "0.55796885", "0.5574407", "0.5563841", "0.5531944", "0.55279493", "0.5506442", "0.5497708", "0.54947704", "0.5484982", "0.5479151", "0.5478209", "0.5459094"...
0.0
-1
Pemite realizar consultas al contrato ElectoralProcessContract para consultar cuales son las mesas que se tienen y de esta manera poder autidarlas
async listTables() { try { //Lista de mesas let listTables = []; //Obtiene el numero de mesas que hay registradas en el contrato ElectoralProcessContract let numTables = await this.state.electoralContract.methods.getNumberTables().call({ from: this.state.account }); //Itera el numer...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "verificaDados(){\n this.verificaEndereco();\n if(!this.verificaVazio()) this.criaMensagem('Campo vazio detectado', true);\n if(!this.verificaIdade()) this.criaMensagem('Proibido cadastro de menores de idade', true);\n if(!this.verificaCpf()) this.criaMensagem('Cpf deve ser válido', true...
[ "0.5971034", "0.58988476", "0.58372355", "0.57645774", "0.57188475", "0.5715515", "0.56356823", "0.5597703", "0.5539233", "0.54931676", "0.5480094", "0.5413868", "0.5404778", "0.5402511", "0.53913456", "0.5390271", "0.5375229", "0.5369892", "0.53695786", "0.53628314", "0.5353...
0.0
-1
Funcion que renderiza el componente si este sufre algun cambio
render() { let lTable = this.loadTable.bind(this); return ( <div style={{ marginTop: "70px" }}> <WidgetNavBar title="Auditar resultados" /> <ReactNotification ref={this.state.notificationDOMRef} /> <div className="input-group mb-3" style={{ marginTop: "110px", maxWidth: "400px", ma...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "render(){\n // Si la variable mostrarComponente es TRUE muestra el componente\n if(this.state.mostrarComponente){\n return(\n <div>\n <h4>Cilo desmontaje: ComponentWillUnMount</h4>\n <ComponenteADesmontar />\n <button ...
[ "0.6866172", "0.64312303", "0.63676393", "0.6258862", "0.6216761", "0.6209729", "0.60605204", "0.60056436", "0.60040027", "0.5986823", "0.59308946", "0.5905781", "0.5892602", "0.5883248", "0.5862445", "0.58550745", "0.58438295", "0.5832413", "0.58051753", "0.58051753", "0.579...
0.0
-1
Attach audio output device to video element using device/sink ID.
function attachSinkId(element, sinkId) { console.log("Attaching to: " + sinkId); if (typeof element.sinkId !== 'undefined') { element.setSinkId(sinkId) .then(function() { console.log('Success, audio output device attached: ' + sinkId); }) .catch(func...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function attachSinkId(element, sinkId) {\n if (typeof element.sinkId !== 'undefined') {\n element.setSinkId(sinkId)\n .then(function() {\n console.log('Success, audio output device attached: ' + sinkId);\n })\n .catch(function(error) {\n var errorMessage = error;\n if (error.name === 'S...
[ "0.77839255", "0.77839255", "0.7741903", "0.7708771", "0.7684869", "0.5987155", "0.5968974", "0.59504724", "0.5911343", "0.57742333", "0.57713044", "0.55608124", "0.555015", "0.54846925", "0.548198", "0.5480989", "0.5446279", "0.53598964", "0.5326302", "0.5290868", "0.5288053...
0.7777136
2
makes the tab opened on ytmp3.cc the active tab and starts the download
function getTab() { chrome.tabs.query({}, function(tabs) { for (var i = 0; i < tabs.length; i++) { if(tabs[i].url.includes("ytmp3.cc")) { chrome.tabs.update(tabs[i].id, {selected: true}); chrome.tabs.executeScript(null, {file: "/download.js"}); break...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function startDownload(){\n\n}", "open() {\r\n browser.url('');\r\n browser.pause(3000);\r\n // browser.windowHandleMaximize();\r\n // browser.pause(3000);\r\n }", "function yt() {\n const url = document.querySelector(\"#seeYt\").value;\n const ytWindow = window.open(url, '...
[ "0.6324901", "0.62103075", "0.61686873", "0.6140054", "0.6116603", "0.609868", "0.6086628", "0.60415816", "0.6025659", "0.59842354", "0.5955446", "0.5943813", "0.5935618", "0.590647", "0.5898232", "0.58841634", "0.58715004", "0.5860908", "0.58453447", "0.5834648", "0.58283645...
0.69841594
0
Ajax request for playlist
function request(){ if ($(this).text() === "Happy"){ queryURL = happyURL; } else if ($(this).text() === "Focus"){ queryURL = focusURL; } else if ($(this).text() === "Angry"){ queryURL = angryURL; } else if ($(this).text() === "Melancholy"){ queryURL = melancholyURL; }...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function loadPlaylist() {\n \n \n var embargo_str = (options.has_embargo) ? \" displaydatetime:[* TO NOW]\" : \"\";\n \n //LOAD THE JSON FOR THE PLAYLIST VIA SITE SEARCH\n var dataURL = 'https://www.washingtonpost.com/apps/national/proxy/methode/si...
[ "0.7466554", "0.7255654", "0.7195629", "0.7178049", "0.70967597", "0.70170915", "0.6972763", "0.6947564", "0.6936026", "0.6924139", "0.6889996", "0.687976", "0.6839525", "0.68167204", "0.6795048", "0.6785725", "0.6749788", "0.67354286", "0.67267776", "0.67206633", "0.6704868"...
0.0
-1
Verifies that password passed (in plain text) matches the password provided via `process.argv`.
function passValid(pass) { let hash = crypto.createHash('sha256'); hash.update(pass + salt); return password === hash.digest('base64'); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "checkPassword(pass) {\n // Hash the password and then check against the hash for extra security :^), I, however, ain't doing that here.\n const SECRETS = require(\"../secrets.json\");\n return SECRETS.channelPassword === pass;\n }", "function passEquals(pw) {\n\treturn pw !== \"password\";\n}", "func...
[ "0.6957493", "0.6799256", "0.6786138", "0.66655046", "0.65992343", "0.6541121", "0.6530069", "0.6431144", "0.6338424", "0.62717247", "0.6254273", "0.6242058", "0.62412554", "0.6233251", "0.62321603", "0.6215141", "0.6197895", "0.6181742", "0.61627996", "0.61093545", "0.610710...
0.64955086
7
Ends and Logs Connections which have either no password or an incorrect password.
function stopBadPass(res) { console.log('Request using incorrect password blocked.'); res.status(403); res.end(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function endConnections(){\n \n if(pool == undefined){\n log4js.shutdown(function(){});\n return;\n }\n\n pool.end(function(err){\n\n if(err){\n logger.error(error.message);\n }\n\n log4js.shutdown(function(){});\n\n });\n}", "async onConnectionError({ ...
[ "0.6018143", "0.5927452", "0.58759207", "0.554832", "0.54316765", "0.53937227", "0.53929776", "0.5283942", "0.5225385", "0.51728123", "0.5143215", "0.5138939", "0.5138939", "0.5138939", "0.5129061", "0.5126511", "0.51084864", "0.5082267", "0.5077098", "0.5076577", "0.50761104...
0.0
-1
Determines whether or not a message has been signed with the private key related to the set public key.
function isSignedMessage(mes, sign) { try { return crypto.createVerify('sha256') .update(mes) .verify(pubKey, sign, 'base64'); } catch(e) { console.log('!!ERROR: It looks like an invalid Public Key has been provided.!!'); console.log(e); return false; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function rsa2048Verify(rsaSign,publickey,message){\r\n var sig2 = new KJUR.crypto.Signature({\"alg\": \"SHA1withRSA\"});\r\n sig2.init(publickey);\r\n sig2.updateString(message);\r\n var isValid = sig2.verify(rsaSign);\r\n return isValid;\r\n}", "function VerifySignature(message) {\n var cipher...
[ "0.67833334", "0.639761", "0.63975173", "0.6376366", "0.6345802", "0.63243836", "0.62891364", "0.628037", "0.6241014", "0.6150254", "0.6019782", "0.5981105", "0.59237725", "0.5923427", "0.59147763", "0.59101266", "0.5880565", "0.5836666", "0.5809181", "0.5804233", "0.5794296"...
0.7167868
0
Builds the row with columns from the specified names. If the item parameter is specified, the memebers of the names array will be used as property names of the item; otherwise they will be directly parsed as text.
function _buildRowColumns(names, item) { var row = '<tr>'; if (names && names.length > 0) { $.each(names, function(index, name) { var c = item ? item[name+''] : name; if (c > 0) { row += '<td style="background-color:#f9de0e;">' + c + ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function _buildRowColumns(names, item) {\n var row = '<tr>';\n if (names && names.length > 0)\n {\n $.each(names, function(index, name) {\n var c = item ? item[name+''] : name;\n row += '<td>' + c + '</td>';\n });\n }\n row += '...
[ "0.8139054", "0.54174334", "0.5364656", "0.5364656", "0.5323949", "0.52973217", "0.522302", "0.5202401", "0.5133278", "0.5017195", "0.49811295", "0.4928874", "0.49248797", "0.49126258", "0.4907285", "0.4897498", "0.48965102", "0.4859163", "0.4855396", "0.48367396", "0.4835111...
0.7533987
1
Builds and sets the headers of the table.
function _setHeaders() { // if no headers specified, we will use the fields as headers. _headers = (_headers == null || _headers.length < 1) ? _fields : _headers; var h = _buildRowColumns(_headers); if (_table.children('thead').length < 1) _table.prepend('<thead></thead>'); _tab...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function _setHeaders() {\n // if no headers specified, we will use the fields as headers.\n _headers = (_headers == null || _headers.length < 1) ? _fields : _headers;\n var h = _buildRowColumns(_headers);\n if (_table.children('thead').length < 1) _table.prepend('<thead></thead>');\n ...
[ "0.8041064", "0.7427154", "0.7359339", "0.7338739", "0.7334914", "0.7326361", "0.7287563", "0.72644055", "0.7234858", "0.7200094", "0.7150007", "0.7150007", "0.7080833", "0.7059675", "0.70336956", "0.7027252", "0.7020162", "0.69713336", "0.69707686", "0.6943567", "0.69380575"...
0.80553526
0
Get Data from API
function createCorsRequest(method, url) { var xhr = new XMLHttpRequest(); if ("withCredentials" in xhr) { console.log("withCredentials"); xhr.open(method, url, false); xhr.send(); console.log("Status: " + xhr.status); console.log("Readystate: " + xhr.readyState); ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getData() {\n const apiName = 'sbrestapi';\n const path = '/alerts';\n const myInit = {\n // OPTIONAL\n headers: {}, // OPTIONAL\n };\n\n return API.get(apiName, path, myInit).catch(err => {\n console.log('There has been a problem with your fetch operation: ' + err);\n throw err;\n });\n...
[ "0.7604231", "0.72175014", "0.7149688", "0.7087765", "0.7078953", "0.7068448", "0.70175165", "0.70153064", "0.70038164", "0.6982071", "0.6967451", "0.6966868", "0.6950984", "0.6946703", "0.6946703", "0.6937254", "0.6923085", "0.69211924", "0.69167966", "0.69016874", "0.687680...
0.0
-1
2. Invoke the method by passing the params
handleDelete() { deleteRecord(this.recordId) .then(() => { console.log("record is deleted"); }) .catch((error) => { console.log(JSON.stringify(error)); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "call_instance_method(method_name, parameter_list, context, thread_info, callside) {\n \n }", "async invoke(ctx, args) { }", "invokeMethod(methodName, params = null, ...actions) {\r\n return this.invokeMethodImpl(methodName, params, actions, opQuery([], null));\r\n }", "async invoke(hub, m...
[ "0.72164595", "0.6775522", "0.6732579", "0.65682364", "0.6566641", "0.6566641", "0.65654606", "0.6390145", "0.63845456", "0.6286284", "0.62859195", "0.6282941", "0.6198259", "0.6175816", "0.61437154", "0.61366135", "0.6109985", "0.60616815", "0.60616815", "0.6061572", "0.6046...
0.0
-1
_Bonus_: It seems some of the directors had directed multiple movies so they will pop up multiple times in the array of directors. How could you "clean" a bit this array and make it unified (without duplicates)?
function getAllDirectors (arr) { let directors = arr.map((elem) => { return elem.director }) return directors }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getUniqueDirectors(array) {\n\n const uniqueDirectors = array.map(movie => movie.director);\n let uniqueDirectorsArray = uniqueDirectors.filter((director, index) => uniqueDirectors.indexOf(director) === index)\n return uniqueDirectors;\n\n}", "function removeDuplicates(moviesArray) {\n let all...
[ "0.7699448", "0.76206493", "0.7113605", "0.70797616", "0.69683164", "0.6878722", "0.6745467", "0.6556475", "0.63958603", "0.6232579", "0.61912847", "0.604131", "0.60143864", "0.60029334", "0.5969625", "0.59299666", "0.59111774", "0.58882844", "0.5869329", "0.58687335", "0.583...
0.57372737
37
Iteration 2: Steven Spielberg. The best? How many drama movies did STEVEN SPIELBERG direct?
function howManyMovies(arr) { let dramas = arr.filter((elem) => { return elem.director == "Steven Spielberg" && elem.genre.includes("Drama") }) return dramas.length }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function howManyMovies(movies){\n if (movies == 0){}\n else {\n var dramaFilms = [];\n for (var i = 0; i < movies.length; i++){\n for (var j = 0; j < movies[i].genre.length; j++){\n if (movies[i].genre[j] === 'Drama'){\n dramaFilms.push(movies[i])\n }\n }\n}\n var stevenFilms = dramaFilms.filter(...
[ "0.6617275", "0.6436965", "0.63935304", "0.6373856", "0.63585055", "0.6348497", "0.6329065", "0.6311355", "0.6304019", "0.6273799", "0.62604845", "0.62210584", "0.6216211", "0.61922413", "0.61780244", "0.61596185", "0.61344904", "0.61335886", "0.6112443", "0.6111675", "0.6106...
0.0
-1
Iteration 3: All scores average Get the average of all scores with 2 decimals
function scoresAverage(arr) { if(arr.length == 0){ return 0 } else{ let total = arr.reduce((sum, elem, index)=>{ if(!elem.score){ return sum } else{ return sum + elem.score } },0) return +((total / arr.length).toFixed(2)) } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function average (scores){\n\t//add all scores\n\tvar total = 0; \n\tscores.forEach(function(score){\n\t\ttotal += score;\n\t});\n\t//divide by total number of scores\n\tvar avg = total/scores.length;\n\t//round\n\treturn Math.round(avg);\n}", "function average(scores) {\n // code to calculate the average\n su...
[ "0.80156404", "0.7824625", "0.7797403", "0.7752094", "0.7671371", "0.758326", "0.7517981", "0.75143623", "0.7480949", "0.7470602", "0.7418412", "0.73173404", "0.7254491", "0.7240649", "0.72257835", "0.7190113", "0.71883446", "0.7177829", "0.71716017", "0.715157", "0.71022767"...
0.7812683
2
Iteration 4: Drama movies Get the average of Drama Movies
function dramaMoviesScore(arr){ let dramas = arr.filter((elem) => { if(elem.genre.includes("Drama")){ return elem } }) let total = dramas.reduce((sum,elem) => { return sum + elem.score },0) return +((total / dramas.length).toFixed(2)) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function calculateMovieAverage() {\n\tfor (let i = 0; i < movies.length; i++) {\n\t\tlet sumOfRatings = movies[i].ratings.reduce((a, b) => a + b, 0);\n\t\tmovies[i].average = sumOfRatings / movies[i].ratings.length;\n\t}\n}", "function dramaMoviesRate(movies) {\n let drama = movies.filter(function(elem){\n ...
[ "0.8195051", "0.8133739", "0.8051801", "0.80033594", "0.79627013", "0.79452586", "0.78804696", "0.78683484", "0.7863598", "0.78051156", "0.77834606", "0.7776138", "0.77496237", "0.7729559", "0.77051526", "0.77004", "0.76946247", "0.7688573", "0.76878446", "0.7665411", "0.7645...
0.7369078
58
Iteration 5: Ordering by year Order by year, ascending (in growing order)
function orderByYear(arr) { let clone = JSON.parse(JSON.stringify(arr)) clone.sort((first, second) => { if(first.year > second.year){ return 1 } else if(first.year < second.year){ return -1 } else{ if(first.title > second.title){ return 1 } else i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function orderByYear(someArr){\n const order = someArr.sort((a, b) => a.year > b.year ? 1 : -1)\n return order;\n}", "function orderByYear(arr) {\n let byYear = [...arr].sort((s1, s2) => {\n if (s1.year > s2.year) return 1;\n else return -1\n })\n return byYear\n}", "sortAlbumsYear...
[ "0.7390359", "0.7218352", "0.7198732", "0.7182031", "0.71694976", "0.7130612", "0.7123765", "0.7110612", "0.7094403", "0.7083622", "0.7080556", "0.7073832", "0.7060499", "0.70454687", "0.70370054", "0.69959843", "0.6990349", "0.69867873", "0.69492877", "0.6941885", "0.6918608...
0.69343585
20
Iteration 6: Alphabetic Order Order by title and print the first 20 titles
function orderAlphabetically(arr) { let clone = JSON.parse(JSON.stringify(arr)) clone.sort((first, second) =>{ if(first.title > second.title){ return 1 } else if(first.title < second.title){ return -1 } else{ return 0 } }) return clone.map((elem) => { return e...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function orderAlphabetically(array){\n let titles = array.map(i=>i.title)\n if (array.length <= 20) {\n for (i = 0; i<array.length; i++) {\n console.log(titles.sort()[i]);\n }\n } else {\n for (i = 0; i<20; i++) {\n console.log(titles.sort()[i]);\n }\n }\n}", "fu...
[ "0.7854309", "0.78189206", "0.76172334", "0.75634915", "0.7545806", "0.75417334", "0.7513637", "0.749227", "0.74561447", "0.73990625", "0.73636514", "0.733148", "0.7330749", "0.7306044", "0.728582", "0.72601825", "0.72452337", "0.7235337", "0.722019", "0.7199861", "0.71972895...
0.710424
34
BONUS Iteration 7: Time Format Turn duration of the movies from hours to minutes
function turnHoursToMinutes() {}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function turnHoursToMinutes (movie){\n for (var i=0; i<movie.length;i++){\n var horas=parseInt(movie[i].duration.split(\" \")[0].toString().replace('h',''));\n var minutos=parseInt(movie[i].duration.split(\" \")[1].toString().replace('min',''));\n var tiempo=(horas*60)+minutos\n movie[i].dur...
[ "0.81435776", "0.7869911", "0.7805964", "0.7801346", "0.7801346", "0.7791275", "0.7754529", "0.76837075", "0.7663584", "0.7604025", "0.7591778", "0.7589738", "0.7580736", "0.7562729", "0.7521191", "0.749423", "0.748639", "0.74627745", "0.7459902", "0.74548185", "0.74400896", ...
0.0
-1
BONUS Iteration 8: Best yearly score average Best yearly score average
function bestYearAvg() {}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function bestYearAvg() {\n \n}", "function bestYearAvg() {\n\n}", "function bestYearAvg(movies){\n movies.sort((a,b) => {\n if (a.year < b.year) {return -1}\n if (a.year > b.year) {return 1}\n return 0;\n });\n let bestAvg = 0;\n let year = 0, \n sum = 0,\n ...
[ "0.82748574", "0.82166505", "0.76753616", "0.7672128", "0.75098896", "0.7493532", "0.7205393", "0.7192978", "0.71877223", "0.71674395", "0.71103007", "0.7072492", "0.70186466", "0.70118773", "0.69909126", "0.6975005", "0.6938358", "0.6937227", "0.69234204", "0.6917714", "0.69...
0.8531928
5
Ideally, these actions should not be sent back to client. Duplicates definition in middleware
function isWiredActionType(actionType: string): boolean { const internalActionTypes = [ actionTypes.AQUEDUX_CLIENT_CHANNEL_JOIN, actionTypes.AQUEDUX_CLIENT_CHANNEL_LEAVE, actionTypes.AQUEDUX_CHANNEL_SNAPSHOT ] return internalActionTypes.indexOf(actionType) !== -1 || hydratedActionTypes.in...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "defaultAction(req, res, callback) {\n return callback(\"Invalid action\");\n }", "function middleware(request, response, next) {}", "function notfound_action(){\n \n res.status = 200;\n \n var action, output, name;\n \n // setup path names to look through\n var names = req.path.s...
[ "0.6375891", "0.634058", "0.629848", "0.60528696", "0.59818095", "0.5859372", "0.5850579", "0.5830577", "0.5781077", "0.57600564", "0.57467353", "0.57097596", "0.57017577", "0.5695973", "0.56856114", "0.56775486", "0.56703323", "0.5662347", "0.56604034", "0.56053984", "0.5603...
0.0
-1
Fetches an API response and normalizes the result JSON according to schema. This makes every API response have the same shape, regardless of how nested it was.
function callApi (endpoint, schemas, typeSchemas, options, clientId) { // checkif endpoint already contains base asi url or base web url const fullUrl = (endpoint.indexOf(API_ROOT) !== -1) || (endpoint.indexOf(API_WEB_ROOT) !== -1) ? endpoint : API_ROOT + endpoint return fetch(fullUrl, options) .then...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function callApi(endpoint, option, schema) {\n \n const fullUrl = (endpoint.indexOf(API_ROOT) === -1) ? API_ROOT + endpoint : endpoint;\n\n return fetch(fullUrl, option)\n .then(response => {\n if (response.status === 204) {\n return { json: undefined, response: response };\n }\n return...
[ "0.642104", "0.6235247", "0.61318964", "0.5474913", "0.5422778", "0.53710175", "0.5340457", "0.52613896", "0.524101", "0.5210034", "0.51810825", "0.51587605", "0.51535267", "0.50957394", "0.5089278", "0.50853986", "0.5043688", "0.50417215", "0.50286657", "0.50271326", "0.5021...
0.5984257
3
title, href, total_time, total_listen, image
constructor(props) { super(props); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getStatsForMyImages() {\n\n}", "function ImageObject(title,url){\n this.name=title;\n this.alt=title;\n this.id=title;\n this.url=url;\n this.clicks=0;\n this.views=0;\n}", "function seeAuctionsWithNameAndImage() {\n\n}", "function loadData(count, time, score, meta, reload) {\n\t\t//Laad nieuw...
[ "0.6208676", "0.5864323", "0.5761222", "0.5574276", "0.5560801", "0.552262", "0.55015576", "0.54912025", "0.5474366", "0.5441432", "0.5417192", "0.5392684", "0.537844", "0.53737694", "0.53659606", "0.5352398", "0.5327967", "0.53249925", "0.5319927", "0.5303334", "0.53025544",...
0.0
-1
TODO Here is where we handle all of our business logic, given the information you need in the controller, what methods will you need to do when this class is first 'constructed'? NOTE You will need this code to persist your data into local storage, be sure to call the store method to save after each change
addListItem (newListItemData, listId){ let list = _store.State.lists.find(list => list.id == listId) list.listsItems.push(newListItemData) console.log(list) _store.saveState() }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "static manupulateData(){\r\n const todo = Store.getDataFromLocalStorage()\r\n\r\n todo.forEach(ele => {\r\n const ui = new Ui()\r\n ui.createTodo(ele)\r\n });\r\n }", "Store() {\n\n }", "init() {\n this.isUpdating = false;\n this.errors = {};\n ...
[ "0.6025653", "0.60112154", "0.5907257", "0.5900967", "0.5841276", "0.583263", "0.5815773", "0.5815177", "0.57879585", "0.5729308", "0.5715995", "0.5704889", "0.57003075", "0.5699496", "0.568424", "0.56705016", "0.5664318", "0.5650521", "0.562412", "0.5617765", "0.56142354", ...
0.0
-1
Determine if we're running in a standard browser environment This allows axios to run in a web worker, and reactnative. Both environments support XMLHttpRequest, but not fully standard globals. web workers: typeof window > undefined typeof document > undefined reactnative: navigator.product > 'ReactNative' nativescript...
function isStandardBrowserEnv() { if (typeof navigator !== 'undefined' && (navigator.product === 'ReactNative' || navigator.product === 'NativeScript' || navigator.product === 'NS')) { return false; } return ( typ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function isStandardBrowserEnv() {\n if (typeof navigator !== 'undefined' && (navigator.product === 'ReactNative' ||\n navigator.product === 'NativeScript' ||\n navigator.product === 'NS')) {\n return false;\n ...
[ "0.8076825", "0.8072832", "0.8062283", "0.80414546", "0.8034036", "0.8034036", "0.80318993", "0.802113", "0.802085", "0.802085", "0.802085", "0.802085", "0.802085", "0.802085", "0.802085", "0.802085", "0.802085", "0.802085", "0.802085", "0.802085", "0.802085", "0.802085", ...
0.0
-1
return 0 for ok email
function validate(email) { if (validateEmail(email)) { return true } else { return false } return false; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function emailSuccess() {}", "function isOkEmail() {\n\n //The program looks there is the right format.\n let indexOfAt = emailUser.value.indexOf('@');\n let textBeforeAt = emailUser.value.slice(0, indexOfAt);\n let textAfterAt = emailUser.value.slice(indexOfAt+1, emailUser.value.leng...
[ "0.6832014", "0.67434293", "0.6701693", "0.6633609", "0.6628185", "0.6538383", "0.6262115", "0.61232686", "0.60847396", "0.60808206", "0.6041294", "0.6037413", "0.6023064", "0.59842074", "0.5956794", "0.5954488", "0.5929943", "0.59239995", "0.59221697", "0.58882964", "0.58812...
0.0
-1
The inline function returns are necessary to prevent all replaced things from being the same
function insertCharset(str) { return str.replace(/&#173;|&#8203;|<wbr>/g, function() { return randomListItem(charRandom); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function dummyReturn(){\n}", "function nonewFun() {}", "hacky(){\n return\n }", "replaceSucceeded() {}", "function TMP(){return;}", "function TMP(){return;}", "function noReturn() {}", "function evalsafeContextedReturns(_codeOriginal_, _context0_, _context1_) {\n return evalsafeCon...
[ "0.5923975", "0.589534", "0.58656585", "0.58200574", "0.5814775", "0.5814775", "0.5785269", "0.57424223", "0.569522", "0.5651085", "0.56267756", "0.5601042", "0.55544907", "0.5551424", "0.5511675", "0.548228", "0.548228", "0.5474758", "0.5464891", "0.54634094", "0.5416233", ...
0.0
-1
13 console.log(fib(77)); // 5527939700884757 eslintdisablenextline requirejsdoc
function fib2(n) { let a = 1; let b = 1; for (let i = 3; i <= n; i++) { let c = a + b; a = b; b = c; } return b; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function fib(n) {\n\t// Write code here\n}", "function fib(n) {\n \n}", "function fibonacci( x ) {\n // code here\n}", "function fibonacci(n) {\n // YOUR CODE HERE\n}", "function sumFibonacci(num) {\n //your code here\n}", "function allFib(n) {\n for (let i = 0; i < n; i++) {\n console.log(`fib a...
[ "0.7637822", "0.74721783", "0.7297981", "0.7153162", "0.70310986", "0.6563419", "0.6512599", "0.637862", "0.63489014", "0.6333454", "0.63066226", "0.61945444", "0.61914253", "0.61673754", "0.61481917", "0.6139679", "0.61082864", "0.6107843", "0.60652196", "0.60599434", "0.605...
0.5872607
59
generate option value for consolidated subsidiary match among names with hierarchy to find all children
function constructConsolidatedIdArray(allOptions, parent) { var results = [ '-' + parent.value, parent.value ]; allOptions.filter(isChildOf(parent)).forEach(function(row) { results.push(row.value); }); return JSON.stringify(results); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function matchBySelectValueName(option, parentOption, stateValue) {\n return (\n Array.isArray(option.parentValueIds) &&\n option.parentValueIds\n .map((id) => {\n const parentOptionValue = parentOption.values.find(\n (value) => value.id === id\n )\n return get(parentOptio...
[ "0.5761275", "0.55443347", "0.5503234", "0.5486269", "0.5346009", "0.53106755", "0.5295036", "0.52496713", "0.5204692", "0.52024865", "0.5073182", "0.5073182", "0.5059027", "0.5053559", "0.5037883", "0.5015985", "0.5013556", "0.49987966", "0.49977294", "0.4974802", "0.4964483...
0.50805897
10
encode/decode websocket data / Good source:
function encodeMessage(data){ var len = data.length; var message = []; /* Set header to text frame */ message[0] = 129; /* Calculate payload data length and format message accordingly */ if(len <= 125) { message[1] = len; } else if (len >= 126 && len < 65535) { message[1] = 126; message[...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function create_ws() {\n // Create WebSocket connection.\n socket = new WebSocket(server_adress);\n\n socket.onopen = function(event) {\n console.log(\"OPENED\");\n };\n\n\n socket.onmessage = function(event) {\n let length = event.data.size;\n let offset = exports.buffer_ptr();...
[ "0.6118607", "0.6089545", "0.5991207", "0.5952473", "0.5950534", "0.59136117", "0.58179176", "0.5808111", "0.58073884", "0.5776851", "0.5752803", "0.57391346", "0.57391346", "0.56862116", "0.56824017", "0.5668998", "0.56539613", "0.5645205", "0.5642241", "0.56128925", "0.5611...
0.6215547
0
API code TO SEND THE USER NAME AND SCORE TO API, RECURSIVE FUNCTION TO FIX FAILS
function getUserId (numberOfTries = 8) { if (numberOfTries < 1 ) { console.log(`We tried 8 times and did get fail anyways.`); return; } const settings = { method: 'GET', data: { op: 'insert', key: apiKey, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function updateScore(game,score,username,func){ //use this only for high score\n options.path=\"/updateScore\"\n var request = http.request(options, function(response) {\n console.log('Status: ' + response.statusCode);\n response.setEncoding('utf8');\n response.on('data', function (res...
[ "0.6697373", "0.62974536", "0.6252587", "0.6110202", "0.6060226", "0.6041357", "0.6036867", "0.6026779", "0.6026257", "0.60080004", "0.6006366", "0.5988635", "0.598473", "0.5977425", "0.5973547", "0.5971478", "0.5946781", "0.59390116", "0.5926886", "0.5920864", "0.5919721", ...
0.0
-1
API code to get the data of user and score from the api
function viewHighscore (numberOfTries = 8) { if (numberOfTries < 1 ) { console.log(`We tried 8 times and did get fail anyways.`); return; } const settings = { method: 'GET', data: { op: 'select', key: apiKey, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getOwnScores(req,res) {\n var userId = req.params.userId;\n var username = req.params.username;\n noteModel\n .getOwnScores(userId,username)\n .then(function (response) {\n res.send(response);\n });\n }", "function listUsersScore(re...
[ "0.68703836", "0.6864574", "0.66967875", "0.6443809", "0.6371544", "0.62339276", "0.6206613", "0.6186548", "0.61623085", "0.61214393", "0.6103298", "0.610316", "0.6079598", "0.60151917", "0.60107845", "0.6000914", "0.6000515", "0.59969133", "0.59632945", "0.59543425", "0.5937...
0.0
-1
script run = true
function google_ga(trans_type,action_type,content_type,action_name,content_name) { if (google_script_state) { ga(trans_type,action_type,content_type,action_name,content_name); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function run() {\n\n }", "function run() {\n\n}", "run () {\n }", "function run() {\n }", "function run() {}", "Run() {\n\n }", "firstRun() { }", "function runScript() {\n\tconsole.time(\"index\");\n var job = tabs.activeTab.attach({\n \tcontentScriptFile: [self.data.url(\"models_50_wif/b...
[ "0.7079421", "0.70756465", "0.69580585", "0.686399", "0.6760722", "0.67296565", "0.65801525", "0.6561015", "0.65054953", "0.6462346", "0.63878614", "0.6274598", "0.62506545", "0.6236862", "0.6236862", "0.6236862", "0.6236862", "0.6236862", "0.6236862", "0.61588204", "0.615716...
0.0
-1
Utility function for removing spaces and punctuation from a string
function simplifyName(name){ var idName = name; idName = idName.replace(/ /g,''); idName = idName.replace("'",''); idName = idName.replace(/[.,\/#!$%\^&\;:{}=\-_`~]/g,""); return idName; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function removePunctuation(sentence){\n return sentence.replace(/[^\\w\\s]/g,'');\n}", "function cleanspace(str){return str.replace(/[^\\w\\s]/gi, ' '); }", "function removePunctuation(strInput){ \n let puncRemove = strInput.filter(char => arrayPunc.indexOf(char) === -1);\n return puncRemove;\n}", ...
[ "0.8173827", "0.7851381", "0.7533885", "0.7388975", "0.70789725", "0.70737976", "0.70676666", "0.70038164", "0.69599175", "0.6919168", "0.69164646", "0.68383926", "0.68251973", "0.6776219", "0.6751783", "0.6751775", "0.67369133", "0.67215437", "0.66960615", "0.66906804", "0.6...
0.0
-1
Utility function for sorting an object
function sortProperties(obj){ // convert object into array var sortable=[]; for(var key in obj) if(obj.hasOwnProperty(key)) sortable.push([key, obj[key]]); // each item is an array in format [key, value] // sort items by value sortable.sort(function(a, b) { return a[1]-b[1]; // compare numbers }); re...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function objectSort(a, b) {\r\n return a.age - b.age;\r\n}", "sort (sort = {}) {\n let obj = Helpers.is(sort, 'Object') ? sort : { default: sort };\n Object.keys(obj).forEach((key, idx) => {\n Array.prototype.sort.call(this, (a, b) => {\n let vals = (Helpers.is(...
[ "0.7742808", "0.7693476", "0.7635521", "0.7443405", "0.71438056", "0.7095512", "0.7041688", "0.70105106", "0.6965455", "0.69382405", "0.6916498", "0.68818635", "0.68801755", "0.68506116", "0.6849933", "0.68342733", "0.6815312", "0.67870176", "0.6786368", "0.678558", "0.677932...
0.6402299
85
Use the default values (the last set values) for redrawing the graphic on resize
function redrawGraphic(){ waitForFinalEvent(function(){ widthGraphic = $("#graphic").width(); // Only redraw the graphic if the width changed // Fixes unecessary redraw on iOS Safari if (widthGraphic != widthGraphicOld){ //d3.select("svg").remove(); d3.select("#yAxis").remove(); //createGraphic("gra...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function resize() {\n getNewSize();\n rmPaint();\n}", "function changeSettings() {\n originalWidth = width;\n originalHeight = height;\n xCentreCoord = 0;\n yCentreCoord = 0;\n }", "resize() {\n var factor = 1; //multiply by one - so no resizing \n this.selected = !this.selecte...
[ "0.72478116", "0.68161947", "0.6726762", "0.6712459", "0.6637975", "0.6537734", "0.6525458", "0.65051174", "0.6495322", "0.6436692", "0.6373661", "0.6328007", "0.6323586", "0.6323502", "0.63146025", "0.63141376", "0.62810826", "0.62728816", "0.6264463", "0.6258667", "0.623842...
0.0
-1
=============================== | load Tweets (if included) | ===============================
function showTweet(){ $( ".tweet" ).each(function( index ) { var tweet = $(this)[0]; var id = $(this).data("tweet"); twttr.widgets.createTweet( id, tweet, { conversation : 'none', // or all cards : 'visible', // or visible //linkColor : '#900', // default is blue ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function loadTweets() {\n\t\t$.ajax({\n\t\t\turl: '/tweets',\n\t\t\tmethod: 'GET',\n\t\t\tsuccess: function(tweets) {\n\t\t\t\tconsole.log('getting tweets...');\n\t\t\t\trenderTweet(tweets);\n\t\t\t}\n\t\t});\n\t}", "function loadTweets() {\n $.ajax({\n type: 'GET',\n url: '/tweets',\n success:...
[ "0.81382406", "0.80812716", "0.80709034", "0.8015725", "0.8006328", "0.80028135", "0.7976783", "0.78870463", "0.78656656", "0.7808841", "0.7716679", "0.756743", "0.7536099", "0.7477132", "0.7459325", "0.73944104", "0.73830086", "0.73593396", "0.7355412", "0.73300904", "0.7282...
0.0
-1
functions for all the CRUD operations
async function sendData() { let ref = doc(db, "Student", usn.value); //collection for two parameter , doc for 3 parameter const docref = await setDoc( //addDoc for two parametr ,setDoc for 3 parameter ref, { Name: name.value, Age: age.value, USN: usn.v...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function handlerCRUD(fullObject, operationType) {\n\n\n //console.log(fullObject); // OK\n //console.log(operationType); // OK\n\n let helpers = {\n statusID: function (valueNeeded) {\n\n let newStatus;\n\n statuses.forEach(function (currentValue) {\n if (curren...
[ "0.61818165", "0.60301596", "0.6012411", "0.59831035", "0.5946975", "0.59046924", "0.5834277", "0.5806775", "0.572892", "0.5724246", "0.56757647", "0.5658332", "0.56556875", "0.5646198", "0.5617909", "0.56067485", "0.56059974", "0.55783546", "0.5567527", "0.55442524", "0.5539...
0.0
-1
Returns the serializeBinary method for the Message class
function createSerializeBinary() { return ts.factory.createMethodDeclaration( undefined, undefined, undefined, ts.factory.createIdentifier("serializeBinary"), undefined, undefined, [], ts.factory.createUnionTypeNode([ ts.factory.createTypeR...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "_serialize() {\n let clazz = this.__clazz__ || 'org.arl.fjage.Message';\n let data = JSON.stringify(this, (k,v) => {\n if (k.startsWith('__')) return;\n return v;\n });\n return '{ \"clazz\": \"'+clazz+'\", \"data\": '+data+' }';\n }", "function serialize(message) {\n if (...
[ "0.6061215", "0.59766555", "0.5845905", "0.5785318", "0.57770133", "0.562074", "0.562074", "0.5468039", "0.5468039", "0.5468039", "0.5468039", "0.5468039", "0.5468039", "0.5468039", "0.5468039", "0.5468039", "0.5468039", "0.5468039", "0.5468039", "0.5468039", "0.5468039", "...
0.62126607
0
Adding github to the preexisting parameters
constructor(name, id, email, github) { super(name, id, email) this.github = github }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async addPrInfoToCommit(commit) {\n const modifiedCommit = Object.assign({}, commit);\n if (!modifiedCommit.labels) {\n modifiedCommit.labels = [];\n }\n if (modifiedCommit.pullRequest) {\n const info = await this.git.getPr(modifiedCommit.pullRequest.number);\n ...
[ "0.6156765", "0.6099234", "0.6072326", "0.60505354", "0.59965247", "0.59965247", "0.58648527", "0.5806313", "0.580446", "0.5745375", "0.5731331", "0.5659588", "0.5628301", "0.5618257", "0.5614405", "0.5610816", "0.5609091", "0.55984", "0.5586773", "0.5571942", "0.55371225", ...
0.555567
20
Write a function that takes in a nonempty string and that returns a boolean representing whether the string is a palindrome. A palindrome is defined as a string that's written the same forward and backward. Note that singlecharacter strings are palindromes.
function isPalindrome(string) { // use for loop with two pointers // if pointer A = pointer B, take them off the string // if pointer overlaps return true (use while) let pointer1 = 0; let pointer2 = string.length - 1; while (pointer2 > pointer1) { if (string[pointer1] !== string[pointer2]) { re...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function palindrome(str) {\n return true;\n}", "function palindrome(str) {\r\n // Good luck!\r\n return true;\r\n}", "function isPalindrome(str) {\n\n}", "function palindrome(str){\r\n return reverseString(str) === str;\r\n}", "function isPalindrome(string) {\n\n function reverse() {\n ...
[ "0.8788691", "0.86771727", "0.8585384", "0.85210437", "0.84384924", "0.84182197", "0.8372688", "0.83511657", "0.8349794", "0.8348083", "0.8338777", "0.8332726", "0.83160424", "0.8314052", "0.8309408", "0.8308381", "0.8302648", "0.8294097", "0.8288814", "0.8277683", "0.8275146...
0.0
-1
CAESAR CIPHER ENCRYPTOR Give a nonempty string of lowercase letters and a nonnegative integer representing a key, write a function that returns a new string obtained by shifting every letter in the input string by k positions in the alphabet, where k is the key. Note that letters should 'wrap' around the alphabet; in o...
function caesarCipherEncryptor(string, key) { // Write your code here. // Create a var representing the alphabet // for loop: for each letter of the string, // find that letter's index in the alphabet. add 2 to that. // return alphabet with the new index // if it goes past 26, subtract 26 const alphabet ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function caesarCipherEncryptor(string, key) {\n // Write your code here.\n if (key === 0) return string;\n let result = \"\";\n let alphabet = \"abcdefghijklmnopqrstuvwxyz\";\n for (let i = 0; i < string.length; i++) {\n console.log(\"char\", string[i]);\n //grab the current char from input and find at ...
[ "0.7869986", "0.7851291", "0.7604236", "0.76010156", "0.7548623", "0.7544451", "0.75118095", "0.7494165", "0.7445399", "0.7418837", "0.73786944", "0.7366419", "0.73470455", "0.7310322", "0.71823174", "0.7167239", "0.7116971", "0.7039609", "0.7002961", "0.69951683", "0.6949242...
0.78829545
0
ASSUMES: m1 & m2 NOT empty array m1 & m2 EQUAL length m1 & m2 are COLUMN MATRIX!!! RETURNS: element wise addition
function mAdd(m1,m2){ mAddTest(m1,m2) const newM = new Array(m1.length) for(let i=0;i<m1.length;i++){ newM[i] = [m1[i][0]+m2[i][0]] } return newM }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function matrixAdd (array1, array2){\n var arr1 = []\n var arr2 = []\n var sum = 0\n for ( let i = 0 ; i < array1.length ; i ++ ){ \n arr1.push(array1[i])\n arr1.push(array2[i])\n i++\n arr2.push(array1[i])\n arr2.push(array2[i])\n }\n ...
[ "0.7920876", "0.7871137", "0.76638365", "0.7592919", "0.7492902", "0.7465085", "0.74623585", "0.74374205", "0.7287609", "0.7221722", "0.715797", "0.68903", "0.68523604", "0.6768754", "0.67531514", "0.67348236", "0.6719286", "0.6711647", "0.6708198", "0.6648773", "0.6636239", ...
0.7951624
0
ASSUMES: m and v NOT empty m[0].length and v.length SAME (Matrix Vector) RETURNS: COLUMN
function mMulti(m,v){ mMultiTest(m,v) const newM = new Array(m.length) let sum for(let i=0;i<m.length;i++){ newM[i] = new Array() sum=0 for(let j=0;j<v.length;j++){ sum += m[i][j] * v[j][0] } newM[i][0] = sum } return newM }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function mat_vector(m, v) {\n\tvar m11 = m[0], m12 = m[1], m13 = m[2], m21 = m[3], m22 = m[4], m23 = m[5];\n\tvar v11 = v[0], v21 = v[1];\n\treturn [m11*v11 + m12*v21 + m13,\n\t\t\tm21*v11 + m22*v21 + m23];\n}", "function matrix_vector( M, v){\n\t\t\n\t\tb = [0.0, 0.0, 0.0];\n\t\tfor(i=0; i<3; i++){\n\t\t\tfor(j...
[ "0.63639975", "0.63216597", "0.59910643", "0.58607274", "0.5856042", "0.58262426", "0.5805873", "0.5805579", "0.5718825", "0.5671774", "0.56438965", "0.5525904", "0.5514066", "0.5482771", "0.54297215", "0.5399872", "0.5365462", "0.53615797", "0.5343267", "0.53276205", "0.5291...
0.5149076
30
RETURNS: Deep copy of matrix or vector
function mCopy(m){ mCopyTest(m) const newM = new Array(m.length) for(let i=0;i<m.length;i++){ newM[i] = new Array(m[0].length) for(let j=0;j<m[0].length;j++){ newM[i][j] = m[i][j] } } return newM }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "copy() {\r\n let result = new Matrix(this.rows,this.cols);\r\n result.data = this.data.slice(0);\r\n return result;\r\n }", "copy() {\n const m = this.matrix;\n const copyM = JSON.parse(JSON.stringify(m));\n return new Matrix(copyM);\n }", "function copyMat...
[ "0.80527264", "0.7960018", "0.75281155", "0.7316007", "0.72076505", "0.7173246", "0.7131338", "0.7044726", "0.68964356", "0.6836515", "0.6817493", "0.6791413", "0.6791413", "0.6791413", "0.6791413", "0.67782843", "0.6671777", "0.6644324", "0.66269994", "0.6610465", "0.6534019...
0.63695395
24
ASSUMES: RETURNS: VECTOR with sigmoid applied
function mSig(m){ mSigTest(m) const newM = new Array(m.length) for(let i=0;i<m.length;i++){ newM[i] = [sig(m[i][0])] } return newM }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function sigmoid(x) {\n return 1/(1 + exp(-x));\n }", "function sigmoid(x){\n\treturn 1/(1 + Math.exp(-x));\n}", "function dsigmoid(x) {\n return x * (1-x);\n}", "function dsigmoid(x) {\n return x * (1 - x);\n}", "sigmoid(x) {\n return 1 / (1 + Math.exp(-x));\n }", "function sigmoid(v...
[ "0.7801455", "0.77767193", "0.7660192", "0.76296765", "0.7627772", "0.7377707", "0.7321413", "0.72719115", "0.7180001", "0.7180001", "0.7137308", "0.69777095", "0.67454875", "0.6182642", "0.61314535", "0.6109405", "0.61089426", "0.608751", "0.6053366", "0.59996426", "0.596121...
0.0
-1
RETURNS: A 1D array with a 2D arr / vector
function toVector(arr){ toVectorTest(arr) const newM = new Array(arr.length) for(let i=0;i<arr.length;i++){ newM[i] = [arr[i]] } return newM }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function toVector(arr)\n\t\t\t{\n\t\t\t\treturn concat.apply([], arr);\n\t\t\t}", "function toVector(arr) {\n return concat.apply([], arr);\n}", "function toVector(arr) {\n return concat.apply([], arr);\n}", "function get1DArray(input){\r\n var result = [];\r\n for (var i=0; i<input.length; i++) {\r\...
[ "0.72918475", "0.7179027", "0.7179027", "0.71663094", "0.7094936", "0.6864896", "0.6854663", "0.6854663", "0.6854663", "0.6854663", "0.6854663", "0.6854663", "0.6854663", "0.6854663", "0.6854663", "0.6854663", "0.6843938", "0.68073964", "0.6739601", "0.6725231", "0.6719568", ...
0.71005106
4
This depends on whether there is enough page height available or not
function resize_form_controls() { var windowHeight = window.innerHeight; var panelHeight = $("#right_panel").height() + $(".navbar").height(); logger("Window Height: " + windowHeight + " vs. Panel Height: " + panelHeight); if (windowHeight < panelHeight) { $("#right_panel").css("width", "100%"); $("#right_panel...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function calculateHeightPage(){\n if(!$('.height-inner-page').length) return false;\n var header_height = $('header').outerHeight();\n\t\tvar footer_height = $('footer').outerHeight();\n\t\tvar real_height_inner_page = $('.height-inner-page').outerHeight();\n\t\tvar calculate_inner_page = $(window).height() ...
[ "0.7318908", "0.7000866", "0.69804335", "0.694214", "0.6921648", "0.6917113", "0.6879112", "0.68284196", "0.6797529", "0.6795273", "0.67935395", "0.67930853", "0.679217", "0.679217", "0.679217", "0.6769992", "0.67494494", "0.67371905", "0.67371905", "0.67265445", "0.6710796",...
0.0
-1
render the triangles in animation loop running 60/sec
function render(){ fc++; requestAnimationFrame(render); var currentconfig = { scale: {_x: stage.scale._x, _y:stage.scale._y}, position: {_x: stage.position._x, _y:stage.position._y}, canvasWidth: renderer.view.width, canvasHeight: renderer.view.height } if(fc % 15 ===...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function drawTriangles () { \n\n context.drawImage(c, 0, 0) // redraw bg image when subtracting rectangles\n global.finalRatio = global.GOLDENRATIO*global.ratioModifier\n global.triangleWidth = Math.round(innerWidth*global.finalRatio) // set horizontal distance from top left\n global.triangleH...
[ "0.66381174", "0.6410593", "0.6399671", "0.6353909", "0.6331809", "0.63294727", "0.632407", "0.6287929", "0.62617373", "0.6239275", "0.62343496", "0.61864763", "0.61695325", "0.6154979", "0.61329263", "0.61250824", "0.6123273", "0.6121813", "0.6107163", "0.60716355", "0.60678...
0.0
-1
Load the app on window load
function loadApp() { setTimeout(function () { document.getElementById("loading").style.display= 'none'; document.getElementById("whiteboard").style.visibility= 'visible'; }, 1500); initApp(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function loadApplication() {\n console.log(\"Application loaded\");\n // Load directly to the main menu\n configureUI(displayMainMenu());\n\n}", "function loadApp() {\n console.log(\"loadApp\");\n displayHomePage();\n}", "function initApp() {\n\tinitSounds();\n\tinitSensors();\n\tshowWelcome();\n}",...
[ "0.74776626", "0.7428855", "0.71605366", "0.7136403", "0.6994182", "0.69849193", "0.6981435", "0.6944029", "0.6939918", "0.6928744", "0.6914961", "0.6912198", "0.691125", "0.6896162", "0.6870403", "0.6845306", "0.68330604", "0.68161047", "0.6810985", "0.6773611", "0.6727854",...
0.6704401
21
To create multiple objects with the same structure and behavior (methods), use a factory or a constructor. Factory function
function createCircle(radius) { return { radius, draw: function () {} } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function Factory(){}", "function factory() {}", "function factory() {}", "function NewObj(){}", "function objectFactory() {\n\n var obj = new Object(),\n\n Constructor = [].shift.call(arguments);\n\n obj.__proto__ = Constructor.prototype;\n\n var ret = Constructor.apply(obj, arguments);\n\n return t...
[ "0.7198765", "0.7130342", "0.7130342", "0.6768864", "0.6707244", "0.6681607", "0.66647494", "0.6634475", "0.659137", "0.6554708", "0.65030193", "0.6497314", "0.6497314", "0.6490331", "0.6490331", "0.6490331", "0.646961", "0.6393629", "0.638023", "0.6371244", "0.6371244", "0...
0.0
-1