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
Find the largest palindrome made from the product of two 3digit numbers.
function abc(num) { loop1: for (i = num; i.toString().length >= num.toString().length; i--) { pal = parseInt(i.toString() + i.toString().split('').reverse().join('')) for (x = num; x.toString().length >= num.toString().length; x--) { if (pal % x === 0 && (pal / x).toString().length === num.toString().length) return `Largest palindrome: ${pal}, Components ${x} * ${pal/x} ` } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function largestPalendrome() {\n\n // start by assuming the largest found is 0\n let largest = 0;\n\n // for each 3 digit number\n for (let i = 999; i > 99; i--) {\n\n /*\n * for every other 3 digit number that produces\n * a product with the first 3 digit number that's\n * larger than the large...
[ "0.8244534", "0.79137754", "0.77638936", "0.7744406", "0.7543545", "0.68317336", "0.6761058", "0.6756271", "0.6684387", "0.66421425", "0.66368604", "0.66197836", "0.6540573", "0.6489629", "0.64078575", "0.636488", "0.6334653", "0.6264511", "0.6263654", "0.62555104", "0.625545...
0.79189456
1
List all bookings in a table plus a cancel button that holds the id of the booking
showBookings(response) { let personalBookingInfo = document.getElementById("personal-booking-info"); let personalBookings = document.getElementById("personal-bookings"); let content = ``; if (response.information < 1) { let personalBookings = document.getElementById("personal-bookings"); content += `<div>inga bokade tider</div>`; personalBookings.innerHTML = content; } else { personalBookings.style.display = "block"; response.information.forEach(function(element) { content += ` <div> <p>${element.treatment}</p> <p>${element.date}</p> <p>${element.time}</p> <button class="cancel-button" id=${ element.ID } onClick="cancelBooking(this.id)"> <i class="fas fa-trash-alt fa-2x"></i>Avboka </button></div> `; }); personalBookingInfo.innerHTML = content; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function bookTableBtn(id){\n \n const view = document.getElementById(id);\n const bookTable = document.createElement(\"button\");\n bookTable.addEventListener(\"click\", ()=>{\n\n clearWindow();\n bookingsPageLoader();\n })\n bookTable.id = \"book-table-btn\";\n bookTable.innerHT...
[ "0.6308748", "0.6302586", "0.62772274", "0.62118506", "0.62086123", "0.5888925", "0.5875566", "0.58715487", "0.58000684", "0.5748666", "0.57371956", "0.57310873", "0.5730759", "0.57293814", "0.57255167", "0.57251644", "0.5648247", "0.56460303", "0.5605753", "0.5601088", "0.55...
0.60699606
5
&& = e ?? = V > V = V V > F = F F > ? = F
function compra(trab1, trab2) { const compraSorvete = trab1 || trab2 const compraTv = trab1 && trab2 //const comprarTv32 = !!(trab1 ^ trab2) const manterSaudavel = !compraSorvete const compraTv32 = trab1 != trab2 return { compraSorvete, compraTv, compraTv32, manterSaudavel } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function and(x, z) { return x != null ? z : x }", "function AND(args) {\n args = args.slice()\n let right\n let left = args.shift()\n while (args.length) {\n right = args.shift()\n left = E.LOGICAL(left, '&&', right)\n }\n\n return left\n}", "function and(x) {\n return function(y) {\n retur...
[ "0.64363074", "0.6230843", "0.61691487", "0.6071608", "0.60433304", "0.60108465", "0.5991677", "0.5984529", "0.59299135", "0.586097", "0.58285284", "0.58285284", "0.58285284", "0.58285284", "0.58285284", "0.58285284", "0.58285284", "0.58285284", "0.57639575", "0.5740278", "0....
0.0
-1
Generates the surface procedure
function compileSurfaceProcedure(vertexFunc, faceFunc, phaseFunc, scalarArgs, order, typesig) { var key = [typesig, order].join(',') var proc = allFns[key] return proc( vertexFunc, faceFunc, phaseFunc, pool.mallocUint32, pool.freeUint32) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "createSurface() {\n let controlPoints = [];\n for (var i = 0, k = 0; i < this.nPointsU; i++) {\n let uPoint = [];\n for (var j = 0; j < this.nPointsV; j++, k++) {\n this.controlPoints[k].push(1);\n uPoint.push(this.controlPoints[k]);\n }\...
[ "0.69514656", "0.6635534", "0.65917426", "0.65917426", "0.6431906", "0.6343412", "0.6314351", "0.6134876", "0.6055668", "0.60374963", "0.59640545", "0.5880201", "0.58474845", "0.58474845", "0.58474845", "0.5828926", "0.5808765", "0.5808765", "0.57948244", "0.57175183", "0.569...
0.6677741
1
The actual plugin constructor
function jCheckBox(element, options) { this.element = element; // jQuery has an extend method which merges the contents of two or // more objects, storing the result in the first object. The first object // is generally empty as we don"t want to alter the default options for // future instances of the plugin this.settings = $.extend({}, defaults, options); this.settings.parentClass = this.settings.parentClass.startsWith(".") ? this.settings.parentClass : "." + this.settings.parentClass; this._defaults = defaults; this._name = pluginName; this.init(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "constructor() {\n super();\n this._init();\n }", "constructor() {\n\t\t// ...\n\t}", "consructor() {\n }", "constructor() {\r\n super()\r\n this.init()\r\n }", "init() {\n }", "constructor()\n {\n this.init();\n }", "function contruct() {\n\n ...
[ "0.7422684", "0.7349132", "0.7314277", "0.73003334", "0.7299704", "0.7292701", "0.72775894", "0.72354233", "0.7233936", "0.7181569", "0.71798736", "0.71798736", "0.71798736", "0.71798736", "0.71798736", "0.71761876", "0.7157667", "0.71499527", "0.71496284", "0.71496284", "0.7...
0.0
-1
Add menu script update link
function update_link() { $('#side_navi').append('<p><a href="#" id="farmer_update" onclick="update_script()">Update '+SCRIPT.name+'</a></p>'); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function install_menu() {\n let config = {\n name: script_id,\n submenu: 'Settings',\n title: script_title,\n on_click: open_settings\n };\n wkof.Menu.insert_script_link(config);\n }", "function installMenu() {\n wkof.Menu.insert_script_link(...
[ "0.7260296", "0.71842474", "0.7151768", "0.68889284", "0.66425437", "0.646941", "0.6463191", "0.6381814", "0.63699275", "0.6367864", "0.6360849", "0.6348565", "0.6292368", "0.6149883", "0.60756356", "0.60742766", "0.60204", "0.5928667", "0.592414", "0.5909938", "0.59097916", ...
0.7613079
0
user's lat and long are fetched but this infor is currently not used.
componentDidMount() { //location services this.watchId = navigator.geolocation.watchPosition( (position) => { this.setState({ latitude: position.coords.latitude, longitude: position.coords.longitude, error: null, }); }, (error) => this.setState({ error: error.message }), { enableHighAccuracy: true, timeout: 20000, maximumAge: 1000, distanceFilter: 10 }, ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function gotCoords(userName, lat, lng, googleObj) {\n\n //filter out 0,0\n if ( lat == 0 && lng == 0) {\n console.log('Filtering out 0,0 for ' + userName);\n didNotGetCoords(userName);\n } else {\n $.each(results, function() {\n\n ...
[ "0.6990313", "0.6823541", "0.6806169", "0.67533064", "0.6730048", "0.659132", "0.6577917", "0.6528015", "0.6474209", "0.63835984", "0.63603014", "0.63484365", "0.634534", "0.63404894", "0.6323457", "0.63218486", "0.63180345", "0.6316302", "0.630425", "0.6276265", "0.62749135"...
0.0
-1
updates: memory, timeout, runtime and layers properties
updateLambdas(callback) { series([staging, production].map(FunctionName=> { return function update(callback) { series([ function updateFunctionConfiguration(callback) { setTimeout(function rateLimit() { lambda.updateFunctionConfiguration({ FunctionName, MemorySize: memory, Timeout: timeout, Runtime: runtime, Layers: layers, }, callback) }, 200) }, function updateFunctionConcurrency(callback) { if (concurrency === 'unthrottled') { setTimeout(function rateLimit() { lambda.deleteFunctionConcurrency({ FunctionName, }, callback) }, 200) } else { setTimeout(function rateLimit() { lambda.putFunctionConcurrency({ FunctionName, ReservedConcurrentExecutions: concurrency, }, callback) }, 200) } } ], callback) } }), callback) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "updateLayers() {\n\t\tvar s = (new Date()).getTime();\n\n\t\t\n\t\tthis.tgBB.render();\n\n\t\t//console.log('updateLayers : ' + ((new Date()).getTime() - s) + 'ms')\n\t}", "initialize(){this._saveInstanceProperties();// ensures first update will be caught by an early access of\n// `updateComplete`\nthis._request...
[ "0.57207394", "0.5713238", "0.5707786", "0.5665807", "0.56588286", "0.55453724", "0.54681456", "0.5463319", "0.5417314", "0.54079026", "0.53964555", "0.5386223", "0.5377737", "0.53741384", "0.5373711", "0.5357061", "0.5348451", "0.53328246", "0.53199685", "0.5277604", "0.5275...
0.0
-1
updates state=enabled|disabled for scheduled functions
updateScheduledState(callback) { if (isScheduled) { series([staging, production].map(FunctionName=> { return function update(callback) { if (state === 'disabled') { setTimeout(function rateLimit() { cloudwatch.disableRule({ Name: FunctionName, }, callback) }, 200) } else { setTimeout(function rateLimit() { cloudwatch.enableRule({ Name: FunctionName, }, callback) }, 200) } } }), callback) } else { callback() } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function _(){this.state.eventsEnabled||(this.state=W(this.reference,this.options,this.state,this.scheduleUpdate))}", "toggleEnabled() {\n let { enabled, scheduledRestart } = this.state;\n enabled = !enabled;\n //If the select boxes are no longer enabled, reset the scheduled restart time and ...
[ "0.68644005", "0.68377197", "0.6545934", "0.6545934", "0.64584535", "0.6416128", "0.6416128", "0.6416128", "0.6416128", "0.6414262", "0.6414262", "0.62776065", "0.62683696", "0.6240283", "0.6240283", "0.6240283", "0.6240283", "0.62242657", "0.62186015", "0.6198962", "0.617845...
0.7258236
0
sync lambda timeout to queue visability
updateQueueVisability(callback) { if (isQueue) { series([staging, production].map(FunctionName=> { return function update(callback) { waterfall([ function getQueueUrl(callback) { setTimeout(function rateLimit() { sqs.getQueueUrl({ QueueName: FunctionName }, callback) }, 200) }, function getQueueAttr({QueueUrl}, callback) { setTimeout(function rateLimit() { sqs.setQueueAttributes({ QueueUrl, Attributes: { VisibilityTimeout: ''+timeout // cast to string } }, callback) }, 200) } ], callback) } }), callback) } else { callback() } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "onTimeout() {}", "function _timeoutHandler() {\n\tvar currentTaskIndex = this._struct.findIndex(function(task) { return ! task.completed });\n\n\tif (!currentTaskIndex < 0) {\n\t\tconsole.log('Async-Chainable timeout on unknown task');\n\t\tconsole.log('Full structure:', this._struct);\n\t} else {\n\t\tconsole.l...
[ "0.69637847", "0.6469003", "0.6116767", "0.6077579", "0.60534376", "0.60168606", "0.5928488", "0.5923359", "0.5923359", "0.5923359", "0.59105486", "0.5901081", "0.5901081", "0.5877331", "0.5858896", "0.5848681", "0.5846446", "0.57998204", "0.5793356", "0.57111317", "0.5688692...
0.5464215
46
Create graphdata as count of all albumids in watchlist object array
function createGraphData() { for (var item in $scope.myWatchlistData) { if (findIndexFromId($scope.graphData, 'albumId', $scope.myWatchlistData[item]['albumId']) > -1) { $scope.graphData[findIndexFromId($scope.graphData, 'albumId', $scope.myWatchlistData[item]['albumId'])]['count'] += 1; } else { $scope.graphData.push({ 'albumId': $scope.myWatchlistData[item]['albumId'], 'count': 1 }); } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "dump(albumId, updateCounts = true) {\n return new Promise((resolve, reject) => {\n const tagged = {};\n const opts = { count: 1000 }; // batch size for hscan\n if (albumId && albumId !== ALBUM_ALL) {\n // pattern match\n opts.match = `${albumId}${ALBUM_DELIM}*`;\n }\n cons...
[ "0.6124445", "0.5977314", "0.5788596", "0.5679312", "0.5676466", "0.55802757", "0.5572946", "0.5571088", "0.5505164", "0.5503802", "0.5494125", "0.5488272", "0.5486973", "0.5483269", "0.54712486", "0.5431309", "0.54191947", "0.5418644", "0.5418281", "0.5403805", "0.53901243",...
0.863871
0
utility function to find index of element from an array
function findIndexFromId(array, attr, value) { for (var i = 0; i < array.length; i += 1) { if (array[i][attr] === value) { return i; } } return -1; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function findIndex(arr, val) {\n\n}", "function Array_IndexOf (arr, elem) \r\n\t\t{\r\n\t\t\tvar len = arr.length;\r\n\t\r\n\t\t\tvar from = Number(arguments[2]) || 0;\r\n\t\t\tfrom = (from < 0) ? Math.ceil(from) : Math.floor(from);\r\n\t\t\tif (from < 0) {\r\n\t\t\t\tfrom += len;\r\n\t\t\t}\r\n\t\r\n\t\t\tfor (...
[ "0.8180848", "0.7980769", "0.79550725", "0.7945269", "0.7872993", "0.7820332", "0.7818143", "0.78048295", "0.779784", "0.7711799", "0.7695667", "0.7689847", "0.7675559", "0.76550025", "0.76342946", "0.76318353", "0.76135814", "0.76135814", "0.760514", "0.7592592", "0.75883263...
0.0
-1
Obtencion de los dispositivos de usuario
function getUserDevices(ownPage){ $.getJSON(ip + '/proc/ldev', function(data) { $.each(data, function(device, value) { setDevice(device, value); }); if(ownPage){ $('#devices').listview('refresh'); } /** *Funcion para el borrado de un dispositivo **/ $('#devices .delete').on('click', function(event){ clearstatusBar('#opciones'); $.mobile.showPageLoadingMsg(); var parent = $(this).parent(); var current = parent.attr('id'); var devices = {}; var count = 0; var numDevice = 0; $('#devices li').each(function(index){ count++; var name = $(this).attr('id').substring($(this).attr('id').indexOf('-')+1,$(this).attr('id').length); if(devices[name] != undefined) return; devices[name] = {}; devices[name]['Modelo'] = $(this).jqmData('model'); if(current == $(this).attr('id')){ devices[name]['Estado'] = '0'; numDevice = index; }else{ devices[name]['Estado'] = '1'; } }); if(count > 1 && numDevice < $('#devices li').length -1){ $.ajax({ url: ip + "/proc/upd", type: "POST", data: {dvs: JSON.stringify(devices)}, dataType: "json", success: function(data){ $.mobile.hidePageLoadingMsg(); clearstatusBar('#opciones'); parent.remove(); $('#devices').listview('refresh'); }, error:function(data){ getError(); } }); }else{ $.mobile.hidePageLoadingMsg(); errorMessage("NO PUEDE ELIMINAR EL DISPOSITIVO CONECTADO",'#opciones'); } }); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function precargarUsers() {\n fetch(`${baseUrl}/${groupID}/${collectionID}`, {\n 'method': 'GET'\n }).then(res => {\n return res.json();\n }).then(json => {\n if (json.status === 'OK') {\n mostrarDatos(json.usuarios);\n };\n });...
[ "0.64612114", "0.6320564", "0.62163293", "0.6115631", "0.6084112", "0.6062655", "0.60608524", "0.60418004", "0.6000003", "0.5972347", "0.59686095", "0.59621507", "0.59513193", "0.5893137", "0.5890757", "0.58859926", "0.5864487", "0.5858913", "0.58549774", "0.5852098", "0.5846...
0.0
-1
Obtiene la lista de autorizaciones del servidor
function getAuthorizationList(ownPage){ $.mobile.showPageLoadingMsg(); $.ajax({ url: ip + '/proc/notif', type: "POST", dataType:'json', success: function(data){ var exist = false; $('#notifcollap').children().remove(); $.each(data, function(type, notiflist) { fillNotifCollapsible(type, notiflist); exist = true; }); if(!exist){ $('#none-n').show(); }else{ $('#none-n').hide(); } if(ownPage){ $('#notifcollap').find('ul:jqmData(role=listview)').listview({refresh:true}); $('#notifcollap').find('div:jqmData(role=collapsible)').collapsible({refresh:true}); $('#notifcollap').trigger('updatelayout'); } $.mobile.hidePageLoadingMsg(); /** * Funcion para la apertura/renovacion de una autorizacion */ $('#notifcollap div[class=ui-btn-text]').on('click', function(event){ $('#e-general').remove(); var notif = $(this).parent().parent(); //$('#consolidado').jqmData('url','#consolidado?status='+notif.jqmData('status')+'&id='+notif.jqmData('token')); var request = {}; request.status = notif.jqmData('status'); request.id = notif.jqmData('token'); if(request.status == '0'){ var message = $('<p />', {text: "Ingrese La Palabra Clave"}), input = $('<input />', {val: ''}), ok = $('<button />', { text: 'Renovar', click: function() { $.mobile.loadingMessage = 'Peticion nuevo token...'; $.mobile.showPageLoadingMsg(); request.keyword = input.val(); authorizationRequest(request, ownPage); } }), cancel = $('<button />', { text: 'Cancelar', click: function() { } }); dialogue( message.add(input).add(ok).add(cancel), 'Renovación de Token' ); }else{ request.keyword = ""; authorizationRequest(request, ownPage); } }); }, error:function(data){ getError(); } }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async function getUserList() {\n\n // Connection properties\n var options = {\n method: 'GET',\n uri: conf.API_PATH + `5808862710000087232b75ac`,\n json: true\n };\n\n return (await request(options)).clients;\n}", "function getListUserAuthorized() {\n var ListUserAuthorized = []...
[ "0.56960315", "0.5675037", "0.5630781", "0.55908024", "0.5401772", "0.53878295", "0.5387547", "0.5357297", "0.5338439", "0.53228277", "0.5309519", "0.5299918", "0.52995", "0.5299421", "0.52747273", "0.52488047", "0.5237548", "0.5227446", "0.52270454", "0.5217478", "0.5216663"...
0.0
-1
Funcion que pide la renovacion de autorizacion o el detalle de la misma
function authorizationRequest(request, ownPage){ $.ajax( { url:ip + '/proc/authr', type:'POST', data:request, dataType:'json', success:function(data){ if(data.status == '0'){ //$.mobile.showPageLoadingMsg(); getAuthorizationList(ownPage); $.mobile.loadingMessage = 'Cargando...'; }else{ $.mobile.changePage(ip + "/entorno.html#e-general"); } }, error:function(data){ getError(); } }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "privado(){\r\n if(this.persona.datosDecision.totalSemanasCotizadas >= 1250){\r\n this.todaLaVida();\r\n this.diezYears();\r\n let valorpensiontv = this.persona.datosLiquidacion.pIBLtv * 0.9;\r\n let valorpension10 = this.persona.datosLiquidacion.pIBL10A * 0.9;\r\n...
[ "0.60483885", "0.601568", "0.5949759", "0.5853529", "0.58236545", "0.58167493", "0.58128524", "0.5810448", "0.57900435", "0.57078075", "0.56972444", "0.56622636", "0.5654308", "0.5653972", "0.5613923", "0.5613923", "0.5561367", "0.55543137", "0.5538544", "0.5510873", "0.55105...
0.0
-1
Obtencion de informacion de usuario para el entorno
function getUserInfo(container){ $.mobile.showPageLoadingMsg(); $.get("prop.cf", function(data) { ip = data; $.getJSON(ip + '/proc/usinf', function(data) { if(container){ $(container + " #textpn").val(data.name); $(container + " #textpc1").val(data.email); }else{ $('#titulo span').html('').html('HOLA '+ data.name); } $.mobile.hidePageLoadingMsg(); }); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getUsuarioActivo(nombre){\n return{\n uid: 'ABC123',\n username: nombre\n\n }\n}", "function getUserInfo() {\n\t\t\treturn User.getUser({\n\t\t\t\tid: $cookieStore.get('userId')\n\t\t\t}).$promise.then(function(response) {\n\t\t\t\tswitch(response.code) {\n\t\t\t\t\tcase 0: {\n\t\t\t...
[ "0.69986004", "0.67455757", "0.6551598", "0.64366454", "0.616726", "0.61376405", "0.61194557", "0.61050934", "0.6097539", "0.60850793", "0.607371", "0.6073525", "0.6069421", "0.6067295", "0.6066685", "0.60583115", "0.59952646", "0.5970645", "0.59702724", "0.5970188", "0.59594...
0.0
-1
STORE THE SELECTED MOVIE ID IN SESSION STORAGE
function movieSelected(id) { sessionStorage.setItem("movieId", id); window.location = "movie.html"; return false; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "idTosessionStorage() {\n sessionStorage.setItem('movieId', this.$props.movie.id)\n }", "function movieSelected(id) {\n sessionStorage.setItem(\"movieID\", id);\n window.location = \"movie_info.html\";\n return false;\n}", "function movieSelected(id) {\n sessionStorage.setItem('movieId',...
[ "0.748828", "0.7287274", "0.7222114", "0.71639663", "0.7132509", "0.71151716", "0.71033", "0.6987505", "0.6820459", "0.68126756", "0.6789727", "0.6764957", "0.66900706", "0.6683581", "0.6661903", "0.6658874", "0.6645345", "0.65850264", "0.6565707", "0.6555096", "0.6552764", ...
0.71781385
3
GETTING THE MOVIE WHICH IS SELECTED
function getMovie() { //GETTING THE ID FROMSESSION STORAGE let movieId = sessionStorage.getItem("movieId"); axios .get("https://www.omdbapi.com?apikey=af465f0e&i=" + movieId) .then(response => { console.log(response); let movie = response.data; let imdbid = movie.imdbID; // UPDATING THE UI WITH THE SELECTED MOVIE INFO let output = ` <div class="container__single"> <div class="container__single__img"> <img class="img__single" src="${movie.Poster}" alt="" /> </div> <div class="container__single__details"> <h1 class="container__single__details-name">${movie.Title}</h1> <div class="container__single__details-details"> <div class="details-year" title="Release Date"> <img src="img/calendar.svg" class="icon"> ${movie.Year} </div> <div class="details-director" title="Movie Director"> <img src="img/announcer.svg" class="icon"> ${movie.Director} </div> <div class="details-time" title="Total time"> <img src="img/time.svg" class="icon"> ${movie.Runtime} </div> <div class="details-rating" title="Internet Movie Database Value"> <img src="img/award.svg" class="icon"> </div> <div class="details-rating" title="Internet Movie Database Value"> <img src="img/cinema.svg" class="icon">${movie.Genre} </div> </div> <div class="container__single__details-plot"> ${movie.Plot} </div> <div class="container__single__buttons"> <a href="https://www.imdb.com/title/${ movie.imdbID }" target="_blank" title="IMDB" class="button details__imdb"> IMDB <span class="imdb__score">${ movie.imdbRating }</span> </a> <a href="${ movie.Website }" title="" target="_blank"class="button details__imdb">WEBSITE </a> <a href="#" title="IMDB" class="button details__imdb" onclick="openModal('${imdbid}')"> <img src="img/cinema.svg" alt="CINEMA" class="icon"> <span class="imdb__score">MOVIE</span> </a> </div> <a class="button details__go-back" href="index.html"> BACK </a> </div> </div> `; document.querySelector(".container").innerHTML = output; }) .catch(err => { console.log(err); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "selectedMovie(movie) {\n // Display selected movie\n this.displaySingleMovie(movie)\n }", "getChosenMovie () {\n\t\t\t\treturn chosenMovie;\n\t\t\t}", "function get_selected_element() {\n\n return iframe.find(\".yp-selected\");\n\n }", "function changeEpisode(elem)\n{\n ...
[ "0.62852544", "0.6280957", "0.6211339", "0.6146908", "0.61173874", "0.60681915", "0.60443956", "0.60355026", "0.59734154", "0.5973105", "0.59705323", "0.5817383", "0.5800106", "0.57726836", "0.57621896", "0.5751974", "0.5705925", "0.56992465", "0.56617665", "0.5660168", "0.56...
0.0
-1
create or update userprofile with custom attributes in braze
async upsertUserBatchToBraze(customers, iBatch, iBrazeThread, iRetryAttempt) { const externalIds = customers.map(doc => doc.external_id); const previouslyUnProcessedCustomers = customers.filter(element => element.sent_to_braze === false).map(element => element.external_id); // eslint-disable-next-line no-param-reassign delete customers.sent_to_braze; const recursiveStack = { response: [] }; let results = []; logger.debug(`(Repository/sync2braze.upsertUserBatchToBraze) # BATCH ${iBatch} THREAD ${iBrazeThread}, Attempt ${iRetryAttempt}, inserting into braze # ${externalIds}, previouslyUnProcessedCustomers # ${previouslyUnProcessedCustomers} `); const payLoad = { api_key: env.brazeApiKey, user_aliases: customers, }; const config = { responseType: 'json', }; const url = `${env.brazeUrl}/users/alias/new`; this.responseFromBRAZE = await axios.post(url, payLoad, config) .catch(async (error) => { logger.error(`(Repository/sync2braze.upsertUserBatch) # BATCH ${iBatch} THREAD ${iBrazeThread}, Attempt ${iRetryAttempt}, Error inserting into braze # ${error} ########### ${externalIds}`); if (iRetryAttempt < env.retryAttempts) { results = await this.upsertUserBatchToBraze(customers, iBatch, iBrazeThread, iRetryAttempt + 1); } else { //results = await cafService.markFailedUserBatchToBraze(externalIds, iBatch, iBrazeThread, iRetryAttempt); } recursiveStack.response.push({ status: error.response.status, message: ` BATCH ${iBatch} THREAD ${iBrazeThread}, Attempt ${iRetryAttempt}, ${error.response.data.message}` }); results.response.forEach(element => recursiveStack.response.push({ status: element.status, message: element.message })); return recursiveStack; }); const { data } = this.responseFromBRAZE || {}; if (data !== undefined) recursiveStack.response.push(data); if (data !== undefined && data.message === 'success') { //results = await cafService.markSuccessUserBatchToBraze(externalIds, iBatch, iBrazeThread); results.response.forEach(element => recursiveStack.response.push({ status: element.status, message: element.message })); } this.responseFromBRAZE = recursiveStack; if (iRetryAttempt === 1) logger.info(`(Repository/sync2braze.upsertUserBatch) # BATCH ${iBatch} THREAD ${iBrazeThread}, Attempt ${iRetryAttempt}, inserted into braze, response: `, this.responseFromBRAZE.response); return this.responseFromBRAZE; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "updateProfile() {}", "updateUserDetails() {\n if (!activeUser()) return;\n $(conversations_area).find(`[data-user-id=\"${activeUser().id}\"] .sb-name,.sb-top > a`).html(activeUser().get('full_name'));\n $(conversations_area).find('.sb-user-details .sb-profile').setProfile();\n ...
[ "0.70500886", "0.6707564", "0.66551083", "0.66373837", "0.6555475", "0.6445452", "0.63568383", "0.63512313", "0.6323436", "0.63232476", "0.6309686", "0.6270852", "0.62625605", "0.62533236", "0.62440443", "0.62314564", "0.6195408", "0.6183087", "0.6167332", "0.6167222", "0.615...
0.0
-1
1) Asks the user for an integer input 2) output the sum of all the odd integers between 1 and then integer that the user inputted, inclusive (this means include 1 and the number if odd). 3) MUST use a loop presented in the lesson to solve the problem.
function countIt(){ let x = parseInt(document.getElementById("user-number").value); let sum = 0; for( let i = 0 ; i <= x ; i++) if ( i % 2 != 0 ) sum += i; document.getElementById("output").innerHTML = sum; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function oddSum() {\n let n = parseInt(document.getElementById(\"n\").value);\n\n//PROCESSING calculate the user number and find all odd numbers less than user number. If number is more than 100, send alert to user. Create a counting loop and Add odd numbers and \t\tuser number together for sum or total.\t\n ...
[ "0.78147507", "0.75655115", "0.7520747", "0.72813064", "0.71681833", "0.7134655", "0.7118102", "0.7045841", "0.70093495", "0.7004406", "0.69922763", "0.6961209", "0.692283", "0.6893716", "0.68915975", "0.68898493", "0.68693507", "0.6857046", "0.6849742", "0.6839474", "0.68303...
0.71555126
5
Renders the 'Translations' tab.
function renderTranslationsTab() { log('Updating translations:', config.translations); updateTranslationsTab(); const $tbody = $('div.translator-em tbody.translations-body'); // Remove all rows $tbody.children().remove(); const langs = Object.keys(config.translations).sort(); if (langs.length) { // Create rows for (const key of langs) { /** @type TranslationData */ const language = config.translations[key]; const $row = getTemplate('translations-row'); $row.attr('data-name', language.name); $row.find('[data-key]').each(function() { const $this = $(this); const name = $this.attr('data-key') ?? ''; if (['name','localized-name','iso','coverage','updated'].includes(name)) { $this.text(language[name]); } }); $row.find('[data-action]').attr('data-name', language.name); $tbody.append($row) } } else { $tbody.append(getTemplate('translations-empty')); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "onTranslation() {\n }", "function renderTranslation(jsonLanguage) {\n let index = 0;\n $.each(jsonLanguage, function(key, value) {\n $(elementsToTranslate[index]).text(value);\n index++;\n });\n }", "function getTranslations() {\r\n return translations;\r\n }", "...
[ "0.59520274", "0.5877778", "0.57859194", "0.57017756", "0.561128", "0.548846", "0.5477214", "0.54496366", "0.5421672", "0.53985286", "0.53985286", "0.5394087", "0.5393753", "0.53291297", "0.53180015", "0.53131676", "0.53131676", "0.53131676", "0.5262238", "0.52555954", "0.517...
0.75680906
0
endregion region Packages Renders the table on the 'Packages' tab.
function renderPackagesTab() { log('Updating packages:', config.packages); const $tbody = $('div.translator-em tbody.packages-body'); // Remove all rows $tbody.children().remove(); const keys = sortByVersion(config.packages); if (keys.length) { // Create rows for (const key of keys) { /** @type PackageData */ const package = config.packages[key]; const $row = getTemplate('packages-row'); $row.attr('data-version', package.version); $row.find('[data-key]').each(function() { const $this = $(this); const name = $this.attr('data-key'); if (name == undefined) return; if (name == 'version') { $this.text(package.version); } else if (name == 'type') { $this.text(package.upgrade ? 'Upgrade' : 'Full Install'); } else if (name == 'size') { $this.html((package.size / 1024 / 1024).toFixed(1) + 'M'); } }); $row.find('[data-action]').attr('data-version', package.version); $tbody.append($row) } } else { $tbody.append(getTemplate('packages-empty')); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function Packages()\n {\n\tRenderHeader(\"Packages\");\n \tRenderPresentPackageBox();\n \tRenderUpgradeOptionsBox();\n \tRenderSeeDowngradeOptionsBox();\n \treturn;\t\t\t\n }", "function getPackages() {\n\tvar lImage;\n\tinitializeDB();\n\t\n\tdb.transaction( function( tx ) {\n\t\ttx.executeSql( \"SELECT * FROM ...
[ "0.7688612", "0.6095892", "0.5980909", "0.58574325", "0.5855525", "0.58353907", "0.57516766", "0.5669934", "0.56421596", "0.5564887", "0.5543537", "0.5458237", "0.54402024", "0.5410779", "0.5331439", "0.53298044", "0.5315721", "0.5308434", "0.53001904", "0.5283787", "0.525389...
0.7913512
0
endregion region Debug Logging Logs a message to the console when in debug mode
function log() { if (!config.debug) return let ln = '??' try { const line = ((new Error).stack ?? '').split('\n')[2] const parts = line.split(':') ln = parts[parts.length - 2] } catch { } log_print(ln, 'log', arguments) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "debugLog (message) {\n if (GEPPETTO.G.isDebugOn()) {\n this.getConsole().debugLog(message);\n }\n }", "debug(message) {\n this.write_to_log(`DEBUG: ${message}\\n`);\n }", "logDebug(message) {\n if (this.logLevel < 30 /* DEBUG */)\n return;\n console.log(me...
[ "0.8221516", "0.8127128", "0.8096896", "0.8068758", "0.80152476", "0.79515815", "0.79455936", "0.79309076", "0.7927016", "0.7920443", "0.79035854", "0.7868446", "0.7843745", "0.7826098", "0.78101444", "0.7776278", "0.77609086", "0.7751001", "0.77506346", "0.77109003", "0.7703...
0.0
-1
Logs a warning to the console when in debug mode
function warn() { if (!config.debug) return let ln = '??' try { const line = ((new Error).stack ?? '').split('\n')[2] const parts = line.split(':') ln = parts[parts.length - 2] } catch { } log_print(ln, 'warn', arguments) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function DEBUG2() {\n if (d) {\n console.warn.apply(console, arguments)\n }\n}", "setDebugMode() {\n console.warn(\"setDebugMode is deprecated. use @ledgerhq/logs instead. No logs are emitted in this anymore.\");\n }", "function debug(msg) {\n if (options.debug) console.error(msg)\n}", "f...
[ "0.7632096", "0.7585421", "0.75344104", "0.74679637", "0.7422684", "0.7407089", "0.7379819", "0.7266728", "0.7265931", "0.7209506", "0.7201648", "0.71940553", "0.71874505", "0.7176466", "0.7176203", "0.71513224", "0.7149455", "0.71428907", "0.71136856", "0.71114206", "0.70993...
0.680642
42
Logs an error to the console when in debug mode
function error() { let ln = '??' try { const line = ((new Error).stack ?? '').split('\n')[2] const parts = line.split(':') ln = parts[parts.length - 2] } catch { } log_print(ln, 'error', arguments) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function debug(msg) {\n if (options.debug) console.error(msg)\n}", "function devlog(msg)\n{\n customError(\"Dev\", msg, -1, true, false);\n}", "function debug () {\n if (!debugEnabled) { return; }\n console.log.apply(console, arguments);\n }", "function debugCallback(err) {\n if (err) {\n...
[ "0.80752504", "0.7333473", "0.726685", "0.72649795", "0.721907", "0.7143552", "0.71384215", "0.71104836", "0.7097985", "0.70591235", "0.7035026", "0.7023152", "0.70201844", "0.7007882", "0.69369704", "0.6927487", "0.69074583", "0.6884496", "0.6877196", "0.68650967", "0.685533...
0.0
-1
Sets the default state to 0;15.85714285
function main() { addEventListeners(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "setNormal() {\n this.currentState = shtState.NORMAL;\n }", "function defaultValues(){\n\tbluValue=0;\n\thueRValue=0;\n\tinvtValue=0;\n\tbrightnValue=1;\n\tsepiValue=0;\n\tgraysaValue=0;\n\topaciValue=1;\n\tsatuvalue=1;\n\tcontrstValue=1;\n}", "setZero() {\n _instance.setZero()\n }", "initia...
[ "0.6230407", "0.6144764", "0.6048823", "0.60411686", "0.60046524", "0.5983926", "0.5929528", "0.5809219", "0.5771334", "0.57673436", "0.5750765", "0.57436895", "0.5716781", "0.57066023", "0.56919336", "0.5684994", "0.568031", "0.5662246", "0.5651908", "0.56385154", "0.5636762...
0.0
-1
Logger constructor path log directory node nodeId app application name writeInterval flush log to disk interval writeBuffer buffer size 64kb keepDays delete files after N days, 0 to disable toFile write log types to file toStdout write log types to stdout
function Logger(options) { const { path, node } = options; const { writeInterval, writeBuffer, keepDays } = options; const { toFile, toStdout } = options; this.active = false; this.path = path; this.node = node; this.writeInterval = writeInterval || 3000; this.writeBuffer = writeBuffer || 64 * 1024; this.keepDays = keepDays || 0; this.options = { flags: 'a', highWaterMark: this.writeBuffer }; this.stream = null; this.reopenTimer = null; this.flushTimer = null; this.lock = false; this.buffer = []; this.file = ''; this.toFile = logTypes(toFile); this.toStdout = logTypes(toStdout); this.open(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function loggerConstructor () { // 'private' properties\n let folderName = 'logs';\n let rootPath = __basedir;\n let maxFileSize = 1 * 1024 * 1024; // 1Mb\n let nFolderPath = path.join(rootPath, folderName);\n let oFolderPath = path.join(nFolderPath, 'pas...
[ "0.66316384", "0.6213382", "0.59326875", "0.5902909", "0.58307755", "0.58197993", "0.5802454", "0.57567525", "0.5694818", "0.5627106", "0.55963695", "0.55963695", "0.55963695", "0.55477667", "0.55477667", "0.5485831", "0.54696065", "0.5381219", "0.5357346", "0.53321844", "0.5...
0.6809766
0
NOTE: this is an ES6 function, so we should ship a polyfill There's actually also the chance that a purejs solution ends up faster than the native one because we don't have to deal with the edge case of +/ Inf
function tanh(x) { // it's important to clip it because javascript's // native Math.tanh returns NaN for values of x // whose absolute value is greater than 400 var y = Math.exp(2 * Math.max(-100, Math.min(100, x))); return (y - 1) / (y + 1); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function f(a) {\n a = +a;\n return +abs(a);\n }", "function Infinity() {}", "function linear(t) {\n return +t;\n}", "function fract(v){\n\treturn v-Math.floor(Math.abs(v))*Math.sign(v);\n}", "function linear(t) {\n return +t;\n}", "function linear(t) {\n return +t;\n}", "function linear(t) ...
[ "0.6349776", "0.618278", "0.5896321", "0.58753586", "0.5873672", "0.5873672", "0.5873672", "0.5873672", "0.5873672", "0.5873672", "0.5873672", "0.5873672", "0.5873672", "0.5863211", "0.5851961", "0.5816546", "0.5816546", "0.57953286", "0.57920533", "0.5775253", "0.5773295", ...
0.0
-1
set a vector as the elementwise product of two others
function setmulvec(dest, a, b){ for(var i = a.length; i--;) dest[i] = a[i] * b[i]; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function vector_product(a, b) {\n return a.x * b.y - a.y * b.x;\n}", "function multiple(){\n results.value = Number(a.value) * Number(b.value);\n }", "function addmulvec(dest, a, b){\n for(var i = a.length; i--;) dest[i] += a[i] * b[i];\n}", "function product(a, b) {\n a = (0 in arguments) ? a...
[ "0.74677026", "0.7085743", "0.7004867", "0.69605833", "0.69461644", "0.6898884", "0.68982893", "0.6879464", "0.6866489", "0.6790204", "0.677751", "0.6737516", "0.6719198", "0.67145056", "0.66751516", "0.6660845", "0.6595616", "0.65816575", "0.6572185", "0.6543904", "0.6529034...
0.7573702
0
add the elementwise product of two vectors to another
function addmulvec(dest, a, b){ for(var i = a.length; i--;) dest[i] += a[i] * b[i]; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function vector_product(a, b) {\n return a.x * b.y - a.y * b.x;\n}", "function dotProduct(a, b) {\n return a.reduce(function (sum, v, i) {\n return sum + (v * b[i]);\n }, 0);\n}", "function vectorAdd(a, b) {\n\treturn [ a[0] + b[0], a[1] + b[1] ];\n}", "function vecAddInPlace(a, b) {\n for (...
[ "0.7678153", "0.7377385", "0.7313809", "0.7152705", "0.7035703", "0.6997022", "0.69657123", "0.69481725", "0.6922437", "0.68786275", "0.68783504", "0.68415916", "0.6811938", "0.6758713", "0.6722696", "0.6712463", "0.67064494", "0.6699543", "0.6693455", "0.6685542", "0.6674893...
0.77976996
0
create a 2d matrix
function mat(r, c){ var arr = []; for(var i = 0; i < r; i++) arr[i] = new Float32Array(c); return arr; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function make2DMatrix(x, y) {\r\n let arr = new Array(x);\r\n for (i = 0; i < y; i++) {\r\n arr[i] = new Array(y);\r\n }\r\n return arr;\r\n}", "_createMatrix () {\n let matrix = Array(...Array(200)).map(() => Array(200).fill(0))\n return matrix\n }", "function createMatrix() {\n return [1, 0,...
[ "0.76562464", "0.7465585", "0.73593915", "0.7246944", "0.7239497", "0.70181197", "0.6939512", "0.69109595", "0.6892012", "0.68851894", "0.6849108", "0.6846859", "0.6843586", "0.68155", "0.68092054", "0.6808653", "0.6797211", "0.6770082", "0.67631006", "0.6726451", "0.66961014...
0.0
-1
clear a 2d matrix
function rmat(m){ for(var i = 0; i < m.length; i++) for(var j = 0; j < m[i].length; j++) m[i][j] = NaN; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function clear()\n{\n\tfor(var i = 0; i < this.size.x; i++)\n\t{\n\t\tthis.matrix[i] = [];\n\t\tfor(var j = 0; j < this.size.y; j++)\n\t\t{\n\t\t\tthis.matrix[i][j] = 0; \n\t\t}\n\t}\n\n\tif(this.size.x == this.size.y)\n\t{\n\t\tfor(i = 0; i < this.size.x; i++)\n\t\t{\n\t\t\tthis.matrix[i][i] = 1;\n\t\t}\n\t}\n}",...
[ "0.85050935", "0.7979537", "0.75602686", "0.73172045", "0.7123585", "0.7005172", "0.69464165", "0.6944757", "0.6940709", "0.6930679", "0.6888453", "0.68865687", "0.68712157", "0.68508446", "0.68372715", "0.6832435", "0.6829997", "0.682384", "0.6805917", "0.6791867", "0.679059...
0.0
-1
returns the index of the maximal element
function max_index(n){ var m = n[0], b = 0; for(var i = 1; i < n.length; i++) if(n[i] > m) m = n[b = i]; return b; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function findMaxItem(arr) {\n let len = arr.length\n let max = -Infinity\n let index = -1\n\n while (len--) {\n if (arr[len] > max) {\n max = arr[len]\n index = len\n }\n }\n return { index, max }\n }", "get maxIndex() {\n return Number(this.getAttribute(\"max\")...
[ "0.7659736", "0.75277543", "0.75142074", "0.74478006", "0.74185216", "0.7382815", "0.7375305", "0.7373277", "0.736681", "0.7282791", "0.7269045", "0.71506506", "0.7141066", "0.71338856", "0.7114232", "0.71062475", "0.70754445", "0.70227444", "0.7011901", "0.6970003", "0.69545...
0.7871901
0
returns the maximal element according to a metric
function max_element(n, metric){ var m = metric(n[0]), b = n[0]; for(var i = 1; i < n.length; i++){ var v = metric(n[i]); if(v > m){ m = v; b = n[i]; } } return b; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function msMax() {\n\t\tlet max1 = msSingle.reduce((a, b) => {\n\t\t\treturn a[1] > b[1] ? a : b;\n\t\t});\n\n\t\treturn parseInt(max1[0]); //function being reduced has 2 key/value pairs in each object. reducing to max in value index 1 then returning value index 0;\n\t}", "finalMax(measure) {\n var subsc...
[ "0.6608896", "0.64870214", "0.6480787", "0.646891", "0.64675325", "0.63979", "0.6376412", "0.6286211", "0.62834084", "0.626417", "0.6255048", "0.6236694", "0.62311286", "0.62240356", "0.6222924", "0.61820006", "0.6175195", "0.61678094", "0.6156411", "0.6154091", "0.61538976",...
0.8359975
0
delete items from Purchase Details
function fDelete(e){ //e is for event num = e.target.index; // index of the element that triggered the event //if quantity > 1 //remove one quantity from item in itemlist object //alert("num: " + num); /*for testing purposes*/ if (order.itemlist["item"+num].quantity > 0) { //delete 1 quantity order.itemlist["item"+num].quantity -= 1 //alert("quantity: " + order.itemlist["item"+num].quantity); //Change the display of quanity on screen newtext = "Description: " + order.itemlist["item"+num].description + " Price: $" + order.itemlist["item"+num].price + " Quantity: " + order.itemlist["item"+num].quantity; //create textnode newtextnode = document.createTextNode(newtext); //indicate div for text details var changediv = document.getElementById("itemdiv" + num); //change text background color for testing purposes //changediv.style.backgroundColor = "orange"; //replace with new item details changediv.replaceChild(newtextnode, changediv.childNodes[0]); } //if quanity < 1 if (order.itemlist["item"+num].quantity < 1) { //indicate div for text details var changediv = document.getElementById("itemdiv" + num); //indicate div for button var btndiv = document.getElementById("btndiv" + num); //disable display of text details changediv.style.display = "none"; //disable display of button btndiv.style.display = "none"; } recal(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "deleteItem(item){\n delete this.inventory[item];\n }", "delete(item) {\n console.log(item);\n this.items = this.items.filter((e) => e.code !== item);\n this.totalTtc = 0;\n this.items.forEach(data => {\n this.totalTtc += data.prix * data.qte;\n });\n }",...
[ "0.6641823", "0.6585227", "0.65353537", "0.6497504", "0.6493218", "0.64514565", "0.64318055", "0.6429407", "0.64257586", "0.64257586", "0.63943756", "0.63864386", "0.6322192", "0.63207597", "0.63115853", "0.6275129", "0.6264065", "0.6250838", "0.62324023", "0.62319344", "0.62...
0.0
-1
eslintdisable nocontinue, noloopfunc, nocondassign
function flattenStrings(array) { return array.reduce(function (flattenedArray, value) { var lastIndex = flattenedArray.length - 1; var last = flattenedArray[lastIndex]; if (typeof last === 'string' && typeof value === 'string') { flattenedArray[lastIndex] = last + value; } else { flattenedArray.push(value); } return flattenedArray; }, []); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function noassignmentsallowedinforinhead() {\n try {\n eval('for (var i = 0 in {}) {}');\n }\n catch(e) {\n return true;\n }\n}", "function getE4_1() {\n return;\n // eslint-disable-next-line no-unreachable\n <div className=\"hello\">Coucou !</div>;\n}", "function bug1() {\n var x;\n ...
[ "0.5774863", "0.5750085", "0.5734431", "0.5676386", "0.5627439", "0.55544835", "0.55349535", "0.54938036", "0.54889214", "0.5486365", "0.5416049", "0.5415988", "0.5362029", "0.5358237", "0.53558713", "0.53437126", "0.53312", "0.53312", "0.532513", "0.5320171", "0.5316175", ...
0.0
-1
Funzione che appende l'oggetto che gli passo per argomento nell'html
function aggiungiHtml(elemento) { var risorsa = $('#entry-template').html(); var template = Handlebars.compile(risorsa); var html = template(elemento); $('.classe').append(html); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function _getRulaiHtml(content){\n\n}", "renderHTML() {\n \n }", "render(){return html``}", "function html() {\n\t// Your code here\n}", "function html_ajouterCarte(strhtml){\n\t\t//console.log(\"strhtml=\"+strhtml);\n\t\t$(strhtml).appendTo(\"body\");\n\t\tstrhtml=\"\";\n\t}", "function editHtm...
[ "0.61201257", "0.6096355", "0.60631657", "0.6031912", "0.6011876", "0.5960875", "0.5960875", "0.59575075", "0.59364164", "0.5896256", "0.5842666", "0.5837261", "0.58341783", "0.5825683", "0.5814964", "0.57953787", "0.5792038", "0.5791597", "0.57855177", "0.57483983", "0.57304...
0.58468235
10
const log = logger(path.relative(process.cwd(), __filename));
async function getEvent(id) { return elastic_service_1.getDocumentByIDFromES(id, enum_1.ESIndex.EVENT, axios_helper_1.ESDefaultClient, event_model_1.EVENT_SUMMARY_FIELDS).catch(async () => { return firestore_service_1.getFirestoreDocById(enum_1.Collection.EVENTS, id, event_model_1.EVENT_SUMMARY_FIELDS); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function log(message) {\n console.log(path.basename(__filename) + \": \" + message);\n}", "function logger() {}", "initLogger(name = '') {\n let path = this.logPath;\n name = name.length > 0 ? name : this.logFileName;\n this.logFileName = name;\n\n // Create the directory if not exists.\n if ...
[ "0.69969976", "0.6814384", "0.6713451", "0.6607845", "0.63977337", "0.63814545", "0.62060595", "0.61489296", "0.6130831", "0.6130831", "0.6130831", "0.60234183", "0.60137546", "0.5995711", "0.5964574", "0.5931782", "0.592032", "0.59125596", "0.5907824", "0.5907824", "0.590755...
0.0
-1
create new block at top of parent wait a few seconds, delete block
function createNotification(className,parent,childAfter,msg,time){ this.box = document.createElement('div'); this.box.className = `notification ${className}`; this.box.appendChild(document.createTextNode(msg)); parent.insertBefore(this.box,childAfter); // Timeout setTimeout(function(){ document.querySelector(".notification").remove() },time*1000); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function runBlock(cb) {\n self.runBlock({\n block: block,\n root: parentState\n }, function (err, results) {\n if (err) {\n // remove invalid block\n console.log('Invalid block error:', err);\n blockchain.delBlock(block.header.hash(), cb);\n } else {...
[ "0.61534977", "0.6072856", "0.6069489", "0.6042758", "0.5978341", "0.57718354", "0.57688075", "0.5756602", "0.57433856", "0.57396436", "0.5699329", "0.5671317", "0.5664781", "0.5660195", "0.56533253", "0.56265855", "0.56209886", "0.56189394", "0.5613453", "0.5613453", "0.5591...
0.0
-1
Height of the segment between two colors
function scroll() { var i = Math.floor(el.scrollTop / height), // Start color index d = el.scrollTop % height / height, // Which part of the segment between start color and end color is passed c1 = colors[i], // Start color c2 = colors[(i+1)%length], // End color h = c1[0] + Math.round((c2[0] - c1[0]) * d), s = c1[1] + Math.round((c2[1] - c1[1]) * d), l = c1[2] + Math.round((c2[2] - c1[2]) * d); el.style['background-color'] = ['hsl(', h, ', ', s+'%, ', l, '%)'].join(''); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function colorDistance(e1, e2) {\n //console.log(\"e1e2a: \", e1, e2);\n e1 = tinycolor(e1);\n e2 = tinycolor(e2);\n //console.log(\"e1e2b: \", e1, e2);\n var rmean = (e1._r + e2._r) / 2;\n var r = e1._r - e2._r;\n var g = e1._g - e2._g;\n var b = e1._b - e2....
[ "0.6067617", "0.5923109", "0.5923109", "0.58534306", "0.5836574", "0.5824854", "0.5768035", "0.57196987", "0.5686142", "0.5662685", "0.5656996", "0.560739", "0.55476165", "0.55286306", "0.552595", "0.55210596", "0.55152446", "0.5503273", "0.54753935", "0.54726887", "0.5470188...
0.0
-1
I chose this because it is easily returnable
function getRandomAnimal() { return animals [Math.floor(Math.random() * animals.length)]; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private public function m246() {}", "private internal function m248() {}", "protected internal function m252() {}", "transient protected internal function m189() {}", "transient private protected internal function m182() {}", "obtain(){}", "transient private internal function m185() {}", "static priv...
[ "0.64226854", "0.61902624", "0.61198574", "0.5912929", "0.5818785", "0.5747588", "0.5722773", "0.5703197", "0.5698384", "0.5698052", "0.56391764", "0.55132246", "0.5511206", "0.54511756", "0.5445516", "0.5418085", "0.54027176", "0.5400303", "0.5383679", "0.5372618", "0.536604...
0.0
-1
Handle the hello button click event
function mediaClick(e, data) { page = 0; $('#imgs').load('/admin/mediaSelector', addImgClickHandler); $(data.popup).children("#next").click(function(e) { $('#imgs').load('/admin/mediaSelector?page=' + ++page, addImgClickHandler); }); // Wire up the submit button click event $(data.popup).children("#submit") .unbind("click") .bind("click", function(e) { // Get the editor var editor = data.editor; // Get the full url of the image clicked var fullUrl = $(data.popup).find("#imgToInsert").val(); // Insert the img tag into the document var html = "<img src='" + fullUrl + "'>"; editor.execCommand(data.command, html, null, data.button); // Hide the popup and set focus back to the editor editor.hidePopups(); editor.focus(); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function clickedTheButton(){\r\n greet();\r\n}", "function sayThings() {\n console.log(\"this button is clicked!\")\n}", "handleButton() {}", "buttonClicked() {\n alert(\"buttonclicked of button\");\n }", "function click() {\n\n setName('Ram')\n setAge(21)\n // console.log(\"bu...
[ "0.71643645", "0.6864264", "0.68227446", "0.65295833", "0.65237904", "0.6506343", "0.64828604", "0.64685696", "0.6457361", "0.6389808", "0.6373787", "0.63552034", "0.6343141", "0.6315122", "0.6309889", "0.6289918", "0.6289918", "0.62849605", "0.6269798", "0.62382096", "0.6226...
0.0
-1
Use this if something is never supposed to have a value. Not even `undefined`. For example, `never[]` can be, ```ts const arrayOfNever = array(never()); ``` The only value that will satisfy this mapper is the empty array.
function never() { return function (name, mixed) { throw error_util_1.makeMappingError({ message: name + " must be never", inputName: name, actualValue: mixed, expected: "never", }); }; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function Array$empty() {\n return [];\n }", "function Array$empty() {\n return [];\n }", "function requireValue(isset) {\n if (!isset) {\n throw new Error(\"reduce of empty array with no initial value\");\n }\n }", "function arrayHandler(callback, allTruthyMode) {\n ...
[ "0.5621741", "0.5621741", "0.5577489", "0.5539898", "0.5457381", "0.5457381", "0.5441638", "0.5441638", "0.5438645", "0.5438645", "0.5438645", "0.5438645", "0.5438645", "0.5438645", "0.5438645", "0.5438645", "0.5438645", "0.5438645", "0.5438645", "0.5438645", "0.5438645", "...
0.5986685
0
the percentege of uplloading
inPrograss(e) { this.setState({ loading: e, }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "percentage() {\n if(this.totalCount) {\n return parseInt((this.loadedCount * 100) / this.totalCount);\n }\n }", "totaluploadprogress () {\n }", "function onUploadProgress(e) {\r\n\tif (e.lengthComputable) {\r\n\t\tvar percentComplete = parseInt((e.loaded + totalUploaded) * 100 / ...
[ "0.7468788", "0.72321033", "0.7127788", "0.71086574", "0.70900893", "0.70777595", "0.70772684", "0.7003854", "0.6979116", "0.69360465", "0.68071735", "0.66319937", "0.66287345", "0.662738", "0.66210145", "0.6612678", "0.6591412", "0.64922047", "0.6488697", "0.6478371", "0.647...
0.0
-1
restores the entries and adds them to pokedex entries
function restoreEntries( storedEntries ) { // convert the stored entries // from a string back to an object // with the pokemonIds as keys and // the stringified entries as values let restoredEntries = JSON.parse( storedEntries ); // convert the entry strings back to // objects and then add them to the // pokedex entries for ( let i = 1; i <= 151; i++ ) { // have to use object[ key ] notation let entryString = restoredEntries[ i ]; let entry = JSON.parse( entryString ); pokedexEntries.push( entry ); } // loop return; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function deleteMarkers() {\n clearMarkers();\n markers = [];\n choiceMarkers = [];\n searchResMarkers = [];\n}//deleteMarkers", "nuke() {\n this._clearSpatialIndex();\n this.byId = [];\n this.fieldIndexes = {};\n this.fieldsToIndex.forEach(field => {\n this.fieldIndexes[field] = {};\n });...
[ "0.54110515", "0.5402046", "0.5352943", "0.53236425", "0.53165203", "0.5305262", "0.5258091", "0.5242506", "0.5242101", "0.5137043", "0.51300323", "0.5115131", "0.5111485", "0.51015997", "0.5101113", "0.50692147", "0.50648636", "0.50505054", "0.5040968", "0.50399214", "0.5016...
0.69865996
0
this function is called on loading the page...it updates the grades dropdown
function load() { data['data'].list.map(function(val) { var g=val.name; var add='<option value="'+g+'">'+g+'</option>'; $('.grade').append(add); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function dropDownSelection(event) {\n var selectDd = document.querySelector('#gradeLevel');\n document.getElementById(\"results\").innerHTML = selectDd.value;\n\n\n}", "function renderGrades(){\n // Get subject from standardID.\n standardSubjectID = _.find(...
[ "0.6815747", "0.6620479", "0.65655345", "0.6530438", "0.65079117", "0.64780426", "0.6359", "0.6338445", "0.6287839", "0.6253726", "0.6186056", "0.6135482", "0.6120613", "0.61059046", "0.606915", "0.5985211", "0.5905751", "0.5900585", "0.5863018", "0.58614504", "0.58566236", ...
0.59660846
16
this function updates the subjects dropdown on clicking any grade
function setsubs(grade) { $('.sub').html(''); $('.sub').append('<option value="no">SUBJECTS</option>'); data['data'].list.map(function(val) { if(val.name==grade) { val.subjectList.map(function(v) { var s=v.name; var add='<option value="'+s+'">'+s+'</option>'; $('.sub').append(add); }); } }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "selectSubject(event) {\n\n let subjects = document.getElementsByClassName('subject');\n\n for (let i = 0; i < subjects.length; i++) {\n subjects[i].className = 'subject';\n }\n\n event.target.className = 'subject selected';\n\n //update the selected id\n this.setState({\n subjectSelecte...
[ "0.65726906", "0.6491116", "0.6424302", "0.64040977", "0.6280794", "0.6280423", "0.626298", "0.6253107", "0.62371063", "0.62352073", "0.62029254", "0.6176851", "0.6151119", "0.6121563", "0.61044115", "0.6094283", "0.6090541", "0.60407686", "0.5956725", "0.5935502", "0.5925065...
0.72468215
0
it updates the subsubjects in navigation bar on clicking the the subject
function subsubs(subject) { if(window.innerWidth>1024) { $('.side').html(''); $('.side').append(' <h1><b>LOGO</b></h1> <h4><b>CONTENTS</b></h4>'); } else if(window.innerWidth<768) { $('#navi').html(''); } var e=document.getElementsByClassName('grade')[0]; var gra=e.options[e.selectedIndex].value; grade=gra; sub=subject; data.data.list.map(function(val) { if(val.name==gra) { val.subjectList.map(function(va){ if(va.name==subject) { $('#sel').html(""); va.subSubjectList.map(function(v) { subsub=v.name; if(window.innerWidth<=768) { var s='<a class="chap">'+v.name+'</a>'; $('#mySidenav').append(s); $('#mySidenav').append('<div ><ul id="'+v.name+'" class="chapter"></ul></div>'); $('.chap').on('click',{subsub:v.name},showit); v.chapterList.map(function(c) { console.log(c); $('#'+v.name).append('<li><a >'+c.name+'</a></li>'); }); } else if(window.innerWidth>=1024) { var s='<p ><b class="subsub" >'+v.name+'</b></p>'; subsub=v.name; $('.side').append(s); $('.side').append('<div ><ul id="'+v.name+'" class="chapter"></ul></div>'); v.chapterList.map(function(c) { console.log(c); $('#'+v.name).append('<li><a >'+c.name+'</a></li>'); }); $('.subsub').on('click',{subsub:v.name},showit); } }); } }); } }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "toggleSubject (addedSub){\n const foundSubject = _.find(this.state.subjects, subject => subject.name === addedSub);\n foundSubject.isCompleted = !foundSubject.isCompleted;\n this.setState ({subjects : this.state.subjects});\n }", "function lijstSubMenuItem() {\n\n if ($...
[ "0.65367115", "0.5998079", "0.58859354", "0.58568424", "0.5854699", "0.58327657", "0.5800105", "0.5792945", "0.5792188", "0.57488364", "0.56903684", "0.5645654", "0.5645014", "0.56170017", "0.5615744", "0.55638194", "0.5516076", "0.5513796", "0.54779595", "0.5471836", "0.5463...
0.6626903
0
this updates the chapters pertaining to the grade ,subject,and subs
function expand(event) { console.log(grade); console.log(sub); console.log(subsub); event.stopPropagation(); event.stopImmediatePropagation(); q=event.data.subsub; data.data.list.map(function(val) { if(val.name==grade) { val.subjectList.map(function(va){ if(va.name==sub) { va.subSubjectList.map(function(v) { if(v.name==q) { if(v.chapterList.length==0) { $('#'+q).append('<p class="no">No Chapters Found!</p>'); } v.chapterList.map(function(c){ console.log(c); $('#'+q).append('<li><a >'+c.name+'</a></li>'); }); } }); } }); } }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function assignChapter() {\n manageSubjectService.getNotLinkedSubjectList($scope.selectedSubject).then(notLinkedSubjectSuccess, notLinkedSubjectError);\n $scope.selectedSubject.SubjectId;\n }", "function updateStory() {\n\t\t// create name of chapter using index\n\t\tvar chapter = 'c...
[ "0.6058868", "0.5937801", "0.57670647", "0.56407297", "0.55875355", "0.55870765", "0.54140896", "0.54101104", "0.53019536", "0.52546513", "0.5243919", "0.51861906", "0.5107657", "0.5088137", "0.50529665", "0.50448847", "0.50438166", "0.5006679", "0.49857074", "0.49446723", "0...
0.49177915
25
You can extend webpack config here
extend(config, ctx) { // Use vuetify loader const vueLoader = config.module.rules.find((rule) => rule.loader === 'vue-loader') const options = vueLoader.options || {} const compilerOptions = options.compilerOptions || {} const cm = compilerOptions.modules || [] cm.push(VuetifyProgressiveModule) config.module.rules.push({ test: /\.(png|jpe?g|gif|svg|eot|ttf|woff|woff2)(\?.*)?$/, oneOf: [ { test: /\.(png|jpe?g|gif)$/, resourceQuery: /lazy\?vuetify-preload/, use: [ 'vuetify-loader/progressive-loader', { loader: 'url-loader', options: { limit: 8000 } } ] }, { loader: 'url-loader', options: { limit: 8000 } } ] }) if (ctx.isDev) { // Run ESLint on save if (ctx.isClient) { config.module.rules.push({ enforce: "pre", test: /\.(js|vue)$/, loader: "eslint-loader", exclude: /(node_modules)/ }); } } if (ctx.isServer) { config.externals = [ nodeExternals({ whitelist: [/^vuetify/] }) ]; } else { config.plugins.push(new NetlifyServerPushPlugin({ headersFile: '_headers' })); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "extend (config, { isDev, isClient }) {\n // if (isDev && isClient) {\n // config.module.rules.push({\n // enforce: 'pre',\n // test: /\\.(js|vue)$/,\n // loader: 'eslint-loader',\n // exclude: /(node_modules)/\n // })\n // }\n if (process.server && p...
[ "0.75780183", "0.7486256", "0.74535376", "0.7388344", "0.73616195", "0.72877634", "0.7282417", "0.7211369", "0.71547335", "0.7107632", "0.70970905", "0.7090317", "0.7045734", "0.7035934", "0.70036227", "0.699704", "0.69930667", "0.6985959", "0.69833404", "0.6973784", "0.69592...
0.67343605
47
Uses JQuery to retrieve JSON data from the server and provides easy methods for reading values, with default values where the data is not present.
function ConfigurationReader() { "use strict"; var myCfg = null; var myIsValid = false; var timer = null; var myUrl = null; var loadTime = new Date().getTime(); this.Read = function( url, doAutomaticPageReloads ) { myUrl = url; var jqxhr = $.ajax( { cache: false, dataType: "json", url: url, async: false, error: OnError, success: OnSuccess } ); if( typeof doAutomaticPageReloads !== 'undefined' && doAutomaticPageReloads ) { timer = setInterval( CheckConfig, this.GetNum( "configurationCheck", "interval", 300 ) * 1000 ); // Interval is specified in seconds. } return myIsValid; } this.IsValid = function() { return myIsValid; } /////////////////////////////////////////////////////////////////////////////////// // // /////////////////////////////////////////////////////////////////////////////////// this.GetString = function( objectName, parameterName, defaultValue ) { var res = defaultValue; if( myCfg ) { if( myCfg.hasOwnProperty( objectName ) ) { var obj = myCfg[objectName]; if( obj.hasOwnProperty( parameterName ) ) { res = myCfg[objectName][parameterName]; } else { console.log( "Parameter name " + parameterName + " does not exist in object " + objectName ); } } else { console.log( "Object " + objectName + " does not exist in data" ); } } return res; } /////////////////////////////////////////////////////////////////////////////////// // // /////////////////////////////////////////////////////////////////////////////////// this.GetNum = function( objectName, parameterName, defaultValue ) { var res = this.GetString( objectName, parameterName, "" ); var returnVal = defaultValue; // Compare with conversion of types if( res != "" ) { returnVal = Number( res ); } return returnVal; } /////////////////////////////////////////////////////////////////////////////////// // // Gets an JSON object from the specified path. // If provided, reads data from the json object, otherwise from the // Read()'d configuration file. // /////////////////////////////////////////////////////////////////////////////////// this.GetPath = function( path, json ) { var obj = null; if( json ) { // Read from the provided JSON object obj = json } else { // Read from our own config obj = myCfg; } var parts = path.split('.'); if( parts && obj ) { for( var i = 0; obj != null && i < parts.length; ++i ) { obj = obj[parts[i]]; } } else { console.log( "Invalid arguments" ); } return obj; } /////////////////////////////////////////////////////////////////////////////////// // // /////////////////////////////////////////////////////////////////////////////////// this.GetConfig = function() { return myCfg; } /////////////////////////////////////////////////////////////////////////////////// // // /////////////////////////////////////////////////////////////////////////////////// var OnError = function( jqXHR, textStatus, errorThrown ) { console.log( "Failed to retrieve configuration: " + errorThrown ); } /////////////////////////////////////////////////////////////////////////////////// // // /////////////////////////////////////////////////////////////////////////////////// var OnSuccess = function( data, textStatus, jqXHR ) { myCfg = data; myIsValid = true; } /////////////////////////////////////////////////////////////////////////////////// // // /////////////////////////////////////////////////////////////////////////////////// var CheckConfig = function() { $.ajax( myUrl, { type : 'HEAD', success : function( response, status, xhr) { var lastModified = new Date(xhr.getResponseHeader('Last-Modified')).getTime(); if( lastModified > loadTime ) { console.log( "Configuration updated, reloading page." ); window.location.reload( true ); } } } ); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getJSONData() {\n var flickrURL = '';\n \t$.getJSON( flickrURL, successFn );\n }", "function getDataGeneric(data){\n\t$(\"#name\").text(data.name);\n\t$(\"#age\").text(data.age);\n\t$(\"#city\").text(data.city);\n\t$(\"#phone\").text(data.phone);\n\treturn null;\n}", "function getData(){\r\n\r\n ...
[ "0.61113566", "0.59356743", "0.58619654", "0.57936305", "0.57239026", "0.5714991", "0.5685514", "0.5680944", "0.56294584", "0.5623071", "0.55958116", "0.55767137", "0.5570527", "0.5568481", "0.55626404", "0.55615795", "0.5558882", "0.55380696", "0.55314183", "0.5528306", "0.5...
0.0
-1
Need a function to reset the grid
function resetGrid() { gridPositionsi = [0]; gridPositionsj = [0]; userMoves = [0]; id =0; $('.gridsquare'+width).removeClass('cursor'+width); $('.gridsquare'+width).removeClass('correct-square') $('.gridsquare'+width).removeClass('incorrect-square'); $('#0').html('<div class="cursor'+width+'"></div>'); $('.cursor'+width).addClass('animated infinite pulse') }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "reset() {\n this.grid = this.getEmptyBoard();\n }", "reset() {\n this.grid = this.getEmptyBoard();\n }", "function reset() {\n gridPoints = []; // resets the gridPoints so that it clears the walls etc. on reset.\n gridPointsByPos = [];\n openSet.clear();\n closedSet.clear();\n gctx.clearRect(0...
[ "0.83484364", "0.8308205", "0.8278953", "0.8206096", "0.8068026", "0.8009608", "0.80082285", "0.79260457", "0.7789357", "0.7734374", "0.7668583", "0.76646554", "0.76610285", "0.76539534", "0.76490134", "0.76361537", "0.7632493", "0.7606759", "0.7602909", "0.7567277", "0.75448...
0.8049341
5
Need a function to reset lives
function resetLives() { userLives = 10; $('#lives').text("Lives: " + userLives); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function resetPlayer() {\n\tif (lives > 0) {\n\t\tlives = lives - 1;\n\t\ttransform.position = startPosition;\n\t} else {\n\t\tgamestatusscript.gameLost();\n\t}\n}", "function reset() {\r\n guessed = [];\r\n lives = 10;\r\n random = pick();\r\n}", "function resetScoreAndLives() {\n game.data.lives ...
[ "0.73831874", "0.7332971", "0.73039055", "0.70436746", "0.7025757", "0.70033675", "0.6965189", "0.694154", "0.6867566", "0.6858811", "0.6793899", "0.67694503", "0.67402697", "0.66950506", "0.6686128", "0.6605397", "0.65793794", "0.6569927", "0.6569582", "0.65667677", "0.65648...
0.699366
6
Need a function to reset score
function resetScore() { userScore = 0; $('#score').text("Score: " + userScore); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "resetScore() {\n this.score = INITIAL_SCORE;\n }", "function resetScores()\n{\n // Hier coderen we de code om de scores te resetten\n // @TODO: Scores resetten\n}", "function resetScore() {\n DATA['score'] = 0;\n}", "function reset(){\n score=0;\n gameTime=0;\n updateScore();\n}",...
[ "0.8867914", "0.86587924", "0.86068213", "0.8500483", "0.84534246", "0.840592", "0.8358558", "0.8357903", "0.8273073", "0.82224226", "0.8169834", "0.8128132", "0.80751544", "0.80510736", "0.8032543", "0.7994251", "0.7963447", "0.79145676", "0.7914545", "0.78930986", "0.787495...
0.79705226
16
Total reset function required
function reset() { resetGrid(); resetLives(); resetScore(); generateRandomPath(width); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function reset() { }", "function reset() {\n\n }", "Reset() {}", "function reset() {\n // noop\n }", "function reset() {\r\n // noop\r\n }", "function reset() {\n resetFunc();\n }", "Reset() {\n\n }", "reset() {}", "reset() {}", "reset() {}", "reset() {\n\n...
[ "0.85252094", "0.83683425", "0.81355315", "0.79589045", "0.7941677", "0.7937401", "0.7930193", "0.7920179", "0.7920179", "0.7920179", "0.78147584", "0.77735215", "0.77343374", "0.773287", "0.76025814", "0.75925", "0.75690013", "0.7558921", "0.752817", "0.75146127", "0.7511546...
0.0
-1
Need a function that displays the path, a "hint" when user is stuck
function getHint() { if (userLives === 1) { $('.message').text("Not enough lives"); return setTimeout(function() {$('.message').text("");},500) } userLives--; $('#lives').text("Lives: " + userLives); for (var i=0; i<randomPath.length; i++) { $('#'+randomPath[i]).addClass('correct-square'); setTimeout(resetGrid, 500); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function go(path){\n var str=\"\";\n var ppp_length=path.length;\n var now_path = path.substr(5,4096);\n if(ppp_length<=8)\n str='/';\n window.document.getElementById('now_path').innerHTML = '<b>'+showText(191)+'&nbsp;'+str+now_path+'</b>';\n getContent('DirList','/cgi-bin/firmwareDir.cgi?'+path);\n parent.calcHei...
[ "0.64416975", "0.5980173", "0.5941654", "0.5736951", "0.5677874", "0.5539459", "0.54162407", "0.5403036", "0.5397665", "0.53637505", "0.5290354", "0.5284796", "0.5279465", "0.5183245", "0.5153009", "0.5120453", "0.51124567", "0.5096842", "0.5074719", "0.506877", "0.50578827",...
0.5190372
13
Need to be able to dynamically create grids of different sizes on the page
function generateGridAndPath() { $('.grid').empty(); width = parseInt($(this).val()); for (var i=0; i < Math.pow(width,2); i++) { var $gridsquare = $('<li></li>').addClass("gridsquare"+width); $('.grid').append($gridsquare.attr("id", i)); } $('#0').html('<div class="cursor'+width+'"></div>'); $('.cursor'+width).addClass('animated infinite pulse'); generateGrid(width); generateRandomPath(width); $('.gridsquare'+width).on('click', playGameClick); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function createGrid(width, height) {\n\n}", "function defaultGrid(){\n gridSize(24)\n createDivs(24)\n}", "function generage_grid() {\n\n for (var i = 0; i < rows; i++) {\n $('.grid-container').append('<div class=\"grid-row\"></div>');\n }\n\n\n $('.grid-ro...
[ "0.7948172", "0.7745427", "0.7556815", "0.7531779", "0.75066775", "0.74354285", "0.7434743", "0.7421246", "0.7409579", "0.74045193", "0.73549855", "0.7346344", "0.73324805", "0.7331964", "0.7320261", "0.73148906", "0.72654855", "0.7243752", "0.72427386", "0.7232452", "0.71879...
0.0
-1
need an async function to the await to work, so move it out of addEventListner
async function activeSW(){ log('service worker activated'); const cacheKeys = await caches.keys(); cacheKeys.forEach(cacheKey => { if (cacheKey !== getCacheName()){ caches.delete(cacheKey); } }) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "await_event(event_id) {\n\t\treturn (new Promise((resolve, reject) => {\n\t\t\tthis.once(event_id, (...args) => {\n\t\t\t\tresolve(args);\n\t\t\t});\n\t\t}));\n\t}", "async function handleListenerStartedEvent() {\n logger.verbose( `handleListenerStartedEvent` );\n\n try {\n await switchListener( true );\n ...
[ "0.5973394", "0.5855486", "0.582677", "0.5826309", "0.5804028", "0.57115096", "0.5695176", "0.5688138", "0.56259805", "0.556896", "0.55519176", "0.55075943", "0.5457466", "0.5449183", "0.5432646", "0.5429643", "0.5428998", "0.54077303", "0.53803176", "0.53714705", "0.5367078"...
0.0
-1
Loads books from API and displays them
function loadAndDisplayBooks() { loadBooks().then(books => { displayBooks(books); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getBooks () {\n fetch(bookUrl)\n .then(resp => resp.json())\n .then(books => {\n renderBooks(books);\n window.allBooks = books\n }) //aspirational code to renderBooks(books)\n }", "function loadBooks() {\n const data = {\n method: 'G...
[ "0.82725877", "0.8218832", "0.79952663", "0.7955844", "0.7954256", "0.79439634", "0.78776014", "0.7864113", "0.7864113", "0.783025", "0.7827786", "0.77346975", "0.76987123", "0.75853086", "0.75837064", "0.7548711", "0.7483367", "0.74821115", "0.7426545", "0.72910607", "0.7275...
0.7971548
3
Setup of form to add a book
function setupBookForm() { $('form').submit(event => { console.log("Form submitted"); event.preventDefault(); // prevents default form behaviour (reloads the page) const book = { title: $('#title').val(), author: $('#author').val(), numPages: parseInt($('#pages').val()) }; axios .post(apiBooksUrl, book) .then(response => response.data) // turns to a promise of book .then(addedBook => { console.log("Added book", addedBook); loadAndDisplayBooks(); // to refresh list }) .catch(error => console.error("Error adding book!", error)); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function addBook(e){\n //Get form values\n const title = document.getElementById('title'),\n author = document.getElementById('author'),\n isbn = document.getElementById('isbn');\n \n const book = new Book(title.value, author.value, isbn.value);\n\n //Required field validators\n if((title.value...
[ "0.7606774", "0.7325594", "0.7281635", "0.7264169", "0.72609466", "0.72008187", "0.7123661", "0.70424515", "0.7016988", "0.69835234", "0.6931781", "0.69203365", "0.6768865", "0.6753087", "0.6731367", "0.6715575", "0.66724545", "0.66723686", "0.66310775", "0.6630188", "0.65950...
0.7309602
2
Gets books from API and returns a promise of books
function loadBooks() { // We return the promise that axios gives us return axios.get(apiBooksUrl) .then(response => response.data) // turns to a promise of books .catch(error => { console.log("AJAX request finished with an error :("); console.error(error); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getBooks() {\n return fetch(`${BASE_URL}/books`).then(res => res.json())\n}", "function getAllBooks(){\n fetch(baseURL)\n .then(res => res.json())\n .then(books => listBooks(books))\n }", "function getBooks () {\n fetch(bookUrl)\n .then(resp => resp.json())\n ...
[ "0.83203167", "0.7973104", "0.7963448", "0.763164", "0.7533445", "0.75301814", "0.7432739", "0.7395338", "0.73341495", "0.73229825", "0.7319471", "0.7303611", "0.72731405", "0.72635376", "0.7253552", "0.725244", "0.72445744", "0.7194339", "0.71327794", "0.71327794", "0.710257...
0.7831064
3
Displays books on the HTML
function displayBooks(books) { let html = "<ul>"; for (const book of books) { html += "<li>" + book.title + "</li>"; } html += "</ul>"; const resultDiv = document.getElementById("result"); resultDiv.innerHTML = html; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "static displayBooks() {\n\t\tconst books = Store.getBooks();\n\t\tbooks.forEach(function (book) {\n\t\t\tconst ui = new UI();\n\t\t\tui.addBookToList(book);\n\t\t});\n\t}", "function showBooks(books) {\n\t$.each(books, function(i) {\n\t\t$(\"#booksList\").append(\"<div class='book well col-xs-12'>\");\n\t\t$(\"....
[ "0.7499043", "0.748745", "0.74284804", "0.7315881", "0.72672355", "0.7237166", "0.7209685", "0.72015923", "0.71824443", "0.7138698", "0.70897335", "0.70288706", "0.7025082", "0.69566774", "0.6899583", "0.6888446", "0.68803066", "0.687425", "0.68641305", "0.68470144", "0.68215...
0.73523515
3
HIN file syntax defines the atom record as follows: atom 0 1 2 3 4 5 6 7 8 9 10 11...
parseMolecule(index, atomRecords, result) { let {atoms, bonds} = result, inc = atoms.length, // total number of atoms added into the structure previously spaceRE = /\s+/; for (let i = 0, len = atomRecords.length; i < len; i++) { let items = atomRecords[i].trim().split(spaceRE); atoms.push({el: items[3], x: +items[7], y: +items[8], z: +items[9], mol: index}); for (let j = 11, cn = 2 * items[10] + 11; j < cn; j += 2) { if (items[j] - 1 > i) { bonds.push({ iAtm: i + inc, jAtm: items[j] - 1 + inc, type: items[j + 1] }); } } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function atom() {\n return wrap('atom', and(colwsp(opt(cfws)), star(atext, 1), colwsp(opt(cfws)))());\n }", "function atom() {\n return wrap('atom', and(colwsp(opt(cfws)), star(atext, 1), colwsp(opt(cfws)))());\n }", "function atom() {\n return wrap('atom', and(colwsp(opt(cfws)), sta...
[ "0.5838967", "0.5838967", "0.5838967", "0.5838967", "0.5483527", "0.51380134", "0.51278424", "0.48925424", "0.4785278", "0.47623178", "0.47552785", "0.47388017", "0.46880043", "0.46853593", "0.46841925", "0.46841925", "0.46386337", "0.46261704", "0.46120533", "0.4604639", "0....
0.44713432
40
MOL2 file syntax defines the atom record as follows: atom_id atom_name x y z atom_type [subst_id [subst_name [charge [status_bit]]]] 0 1 2 3 4 5 6 7 8 9 MOL2 file syntax defines the bond record as follows: bond_id origin_atom_id target_atom_id bond_type [status_bits] 0 1 2 3 4
parseMolecule(index, atomRecords, bondRecords, result) { let {atoms, bonds} = result, inc = atoms.length, // total number of atoms added into the structure previously spaceRE = /\s+/; for (let rec of atomRecords) { let items = rec.trim().split(spaceRE); let dotPos = items[5].indexOf("."); // atom_type may look like "C.3" atoms.push({ el: (dotPos > -1) ? items[5].slice(0, dotPos) : items[5], x: +items[2], y: +items[3], z: +items[4], mol: index }); } for (let rec of bondRecords) { let items = rec.trim().split(spaceRE); let type = [...this.bondTypes].find(x => x[1] === items[3]); bonds.push({ iAtm: items[1] - 1 + inc, jAtm: items[2] - 1 + inc, type: type && type[0] || "s" }); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "parseMolecule(index, atomRecords, result) {\n let {atoms, bonds} = result,\n inc = atoms.length, // total number of atoms added into the structure previously\n spaceRE = /\\s+/;\n for (let i = 0, len = atomRecords.length; i < len; i++) {\n let items = atomRecords[i].t...
[ "0.5408055", "0.51413727", "0.50928223", "0.5089889", "0.50736403", "0.5037518", "0.49817997", "0.4725309", "0.46532357", "0.45925558", "0.45044145", "0.44910482", "0.44699952", "0.4374528", "0.43132514", "0.43111685", "0.42993292", "0.4295641", "0.42842823", "0.42659193", "0...
0.56767416
0
execute function process comment lines from ticket file
execute (scriptLine){ var commentPattern = /^\s*;.*$/; if (commentPattern.test(scriptLine)) { //nothing to do } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function comment(){\n for (line ; line < linesLength ; line++){\n if (lines[line].substring(0, 15) === '***************') {\n line++;\n //console.log('Start of comment : ' + line);\n break;\n }\n }\n\n // Finding end of comment and Specie\n ...
[ "0.62108886", "0.5952279", "0.589611", "0.578029", "0.5769955", "0.56133115", "0.5559377", "0.55359894", "0.5489046", "0.537496", "0.53247315", "0.53075457", "0.5297904", "0.52690166", "0.5256436", "0.52426994", "0.522597", "0.5210778", "0.5205768", "0.51891327", "0.51859057"...
0.57697344
5
end search form text box
function getParameters() { var searchString = window.location.search.substring(1) , params = searchString.split("&") , hash = {} ; for (var i = 0; i < params.length; i++) { var val = params[i].split("="); hash[unescape(val[0])] = unescape(val[1]); } return hash; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function searchthis(e){\n $.search.value = \"keyword to search\";\n $.search.blur();\n focused = false;\n needclear = true;\n}", "function doneTyping() {\n if ((self.searchText !== '') && !(arrayContains(self.searchText, searchedText))) {\n queryStudents(self.searchText);\n }\n }", "function se...
[ "0.7414379", "0.7051382", "0.70342606", "0.6978512", "0.6891893", "0.6890908", "0.6885837", "0.6885837", "0.6853726", "0.68502516", "0.6845715", "0.6837867", "0.6826718", "0.6779468", "0.67707056", "0.67707056", "0.67707056", "0.67588645", "0.6752016", "0.6751049", "0.6709136...
0.0
-1
Create visual and gameplay components
init() { // create three.js mesh var material = new THREE.MeshPhongMaterial({ color: 0xf0f0f0 }); this.mesh = new THREE.Mesh(this.createGeometry(this.body.shapes[0]), material); // add collision callback this.body.addEventListener("collide", this.onCollide); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "create() {\n\t\tinitBoxes(this, COLORS.MAIN_BOX, COLORS.MAIN_BOX_BORDER);\n\n\t\t// create map\n\t\tthis.createMap();\n\n\t\t// create player animations\n\t\tthis.createAnimations();\n\n\t\t// user input\n\t\tthis.cursors = this.input.keyboard.createCursorKeys();\n\n\t\t//animted Objects\n\t\tthis.gpu = this.add.s...
[ "0.6888091", "0.68424267", "0.6838295", "0.6827801", "0.6767483", "0.6732144", "0.6714417", "0.66746575", "0.66616255", "0.6615365", "0.65791345", "0.65403277", "0.6536283", "0.64984596", "0.64923626", "0.6483388", "0.64797354", "0.6474457", "0.6469181", "0.646713", "0.644026...
0.0
-1
Populates edge array based on vertices and faces.
computeEdges() { // array of arrays of edges this.edges = []; // map of vertex pairs to edge indices var vertexPairs = new Map(); let len = this.body.shapes[0].vertices.length; var faces = this.body.shapes[0].faces; faces.forEach(f => { var loop = []; for (var i = 0; i < f.length; i++) { // get index of each point var a = f[i]; var b = f[(i + 1) % f.length]; if (vertexPairs.has(a * len + b)) { loop.push(vertexPairs.get(a * len + b)); } else { // create new edge var edge = {a: a, b: b}; var reverse = {a: b, b: a}; edge.reverse = reverse; reverse.reverse = edge; // save edge vertexPairs.set(a * len + b, edge); vertexPairs.set(b * len + a, reverse); loop.push(edge); } } this.edges.push(loop); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function faceEdges(face) {\n var n = face.length,\n edges = [];\n for (var a = face[n - 1], i = 0; i < n; ++i) {\n edges.push([a, a = face[i]]);\n }return edges;\n}", "function faceEdges(face) {\n var n = face.length,\n edges = [];\n for (var a = face[n - 1], i = 0; i < n; ++i) edges.push([a, a...
[ "0.6657784", "0.64646196", "0.64646196", "0.6414725", "0.63792056", "0.6263822", "0.6261526", "0.6238883", "0.6238728", "0.6108731", "0.60213214", "0.6017071", "0.5946632", "0.5846974", "0.5739629", "0.5691505", "0.567306", "0.5646524", "0.55966413", "0.5534578", "0.5532781",...
0.69835246
0
Copy position from physics simulation to rendered mesh
update() { this.mesh.position.copy(this.body.position); this.mesh.quaternion.copy(this.body.quaternion); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "setWorldPosition(position, update = false){ \n let new_pos = this.getParentSpaceMatrix().getInverse().times(position)\n let pp_r_s_inv = Matrix3x3.Translation(new_pos).times(\n Matrix3x3.Rotation(this.getRotation()).times(\n Matrix3x3.Scale(this.getScale())\n ...
[ "0.6462523", "0.6387515", "0.63394743", "0.6281849", "0.6277799", "0.62772626", "0.62642735", "0.62021154", "0.6199623", "0.61876595", "0.6187237", "0.61652184", "0.61549556", "0.61295533", "0.60690415", "0.60180783", "0.60169667", "0.60156226", "0.60047966", "0.5997315", "0....
0.70207316
0
used to test help button and initial help
function testHelp(clock) { // wait for help to show clock.tick(seconds(5)); expectVisible('.introjs-overlay', true); expectVisible('.introjs-helperLayer', true); // click on overlay to hide it $('.introjs-overlay').click(); clock.tick(seconds(1)); expectVisible('.introjs-overlay', false); expectVisible('.introjs-helperLayer', false); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "validateHelpPage() {\n return this\n .waitForElementVisible('@helpHeaderSection', 10000, () => {}, '[STEP] - Help Header Title should be displayed')\n .assert.urlContains('/help', '[STEP] - User should be in Help/FAQ page');\n }", "function onHelpButtonClick() {\n\t\t\talert(\"帮助:\\n\\n\" +\n\t\t...
[ "0.74781185", "0.74300337", "0.7404455", "0.7330481", "0.73244095", "0.7259618", "0.7173479", "0.7173479", "0.71550924", "0.7093998", "0.7081885", "0.69987667", "0.695053", "0.69404507", "0.6928448", "0.68828213", "0.6874604", "0.6825527", "0.68130076", "0.6754303", "0.673574...
0.7099856
9
Scaffolding for candidate UI
function describe_ui(suffix, extra_options, f) { describe('Candidate UI' + suffix, function() { beforeEach(function() { // Recover initial HTML. Done before, not after the test, // to observer effect of failures. if (PAGE_HTML === undefined) PAGE_HTML = $('#page').html(); else $('#page').html(PAGE_HTML); // mock time (AJAX will be mocked by test server) this.clock = sinon.useFakeTimers(); this.server = TestServer(); this.server.init(); var my_ui_options = $.extend(true, {}, this.server.ui_options, extra_options); this.ui = window.ui = CandidateUi(my_ui_options); this.ui.init(); this.exit_url = null; this.ui.exit = $.proxy(function(url) { this.exit_url = url; }, this); }); afterEach(function() { this.ui.shutdown(); this.clock.restore(); this.server.shutdown(); // remove the modal overlay for convenience $('.jqmOverlay').hide(); }); f.apply(this); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "static get description () {\n return 'Scaffold login and sign up views and routes'\n }", "function generateUI() {\n var modelToolBar = new ModelToolbar();\n mainParent.append(modelToolBar.ui);\n setLocation(mainParent, modelToolBar.ui, 'left', 'top');\n // modelToolBar.updateInputLength()...
[ "0.6063511", "0.59587824", "0.59498256", "0.58957344", "0.57996815", "0.5713462", "0.5586659", "0.55831087", "0.551896", "0.5446022", "0.5402638", "0.53669614", "0.53393465", "0.5308828", "0.5302059", "0.5300904", "0.5295102", "0.52810425", "0.5279187", "0.5278665", "0.526636...
0.0
-1
Ace refuses to render all changes immediately
function renderChanges() { ui.editor.ace.renderer.updateFull(true); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function editOnCompositionStart(){this.setRenderGuard();this.setMode('composite');this.update(EditorState.set(this.props.editorState,{inCompositionMode:true}));}", "function setupEditor() {\n window.editor = ace.edit(\"editor\");\n editor.setTheme(\"ace/theme/monokai\");\n editor.getSession().setMode(\"ace/mo...
[ "0.64449835", "0.63343364", "0.6219092", "0.60903287", "0.598501", "0.5948566", "0.58068204", "0.57846594", "0.5771719", "0.57518935", "0.5746964", "0.57378614", "0.57146156", "0.571317", "0.5712021", "0.56476974", "0.56461096", "0.5621992", "0.56145036", "0.56118566", "0.559...
0.7972766
0
to decode to avoid xss
function decodeHtml(input) { if(input) { input = input.toString().replace(/</g, "&lt;").replace(/>/g, "&gt;"); } return input; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function decode(string){\n\n}", "function decode_utf8( s ) \n{\n\t return decodeURIComponent( escape( s ) );\n}", "function decodeData(strVal){\n\tvar strVal=decodeURIComponent(escape(window.atob(strVal)));\n\treturn strVal;\n}", "atou(str) {\n return decodeURIComponent(escape(window.atob(str)));\n }", ...
[ "0.72625", "0.69519615", "0.68761516", "0.6797415", "0.6758572", "0.6681174", "0.6624218", "0.66225636", "0.6599266", "0.6588658", "0.6571841", "0.6565639", "0.6559191", "0.65473646", "0.65468675", "0.65347415", "0.65347415", "0.65347415", "0.65347415", "0.65347415", "0.65344...
0.6194196
62
function to upload file
function uploadFile(uploadObject) { // console.log(uploadObject); showProgressAnimation(); /* Create a FormData instance */ var formData = new FormData(); /* Add the file */ formData.append("file", uploadObject.file.files[0]); formData.append("fkId", uploadObject.fkId); formData.append("uploadType", uploadObject.type); formData.append("folderType", uploadObject.folderType); $.ajax({ url: 'uploadFile', // point to server-side dataType: 'text', // what to expect back from server, if anything cache: false, contentType: false, processData: false, data: formData, type: 'post', success: function(response){ uploadObject.hideProgressAnimation(); if(uploadObject.message && uploadObject.message != '') { showMessageContent('Success', uploadObject.message); } if(uploadObject.url && uploadObject.url != '') { window.location.href = uploadObject.url; } }, error:function(){ uploadObject.hideProgressAnimation(); if(uploadObject.message && uploadObject.message != '') { showMessageContent('Success', uploadObject.message); } } }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function upload(form) {\n \n}", "function fileUpload() {\n\tvar files = this.files;\n\tvar sendData = new FormData();\n\tsendData.append('tree', properties.toLink());\n\tsendData.append('types', properties.typesAllowed);\n\tsendData.append('action', 'upload');\n\tif (files.length > 1) {\n\t\tfor (var f = 0; f...
[ "0.75428915", "0.7433304", "0.7418696", "0.73646015", "0.7199819", "0.7199819", "0.7193945", "0.7149087", "0.71321636", "0.7034713", "0.6992788", "0.69916475", "0.6976573", "0.6976573", "0.6962732", "0.69055647", "0.68996537", "0.687574", "0.6833955", "0.68222314", "0.6822231...
0.687976
17
function to only enter number for text box
function onlyEnterNumberTextBox(id) { $("#" + id).keydown(function (e) { // Allow: backspace, delete, tab, escape, enter and . if ($.inArray(e.keyCode, [46, 8, 9, 27, 13, 110, 190]) !== -1 || // Allow: Ctrl+A (e.keyCode == 65 && e.ctrlKey === true) || // Allow: home, end, left, right, down, up (e.keyCode >= 35 && e.keyCode <= 40)) { // let it happen, don't do anything return; } // Ensure that it is a number and stop the keypress if ((e.shiftKey || (e.keyCode < 48 || e.keyCode > 57)) && (e.keyCode < 96 || e.keyCode > 105)) { e.preventDefault(); } }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function onlyNum(obj,event){\n\tvar num_regx=/^[0-9]*$/;\n\tif( !num_regx.test(obj.value) ) {\n\t\talert('숫자만 입력하실 수 있습니다.');\n\t\tobj.value = obj.value.substring(0, obj.value.length-1 );\n\t}\n}", "function numberTextField(e,elementId)\n{\n var reg = /[\\b0-9]/;\n var v = document.getElementById(elementId).v...
[ "0.7703949", "0.76587", "0.7606104", "0.7605462", "0.7569377", "0.74869925", "0.73793125", "0.73667973", "0.73271775", "0.7282426", "0.727135", "0.72620213", "0.7261236", "0.72301495", "0.72201645", "0.7187337", "0.7186212", "0.71597195", "0.71134293", "0.71053606", "0.709513...
0.7741312
0
get status for device
function generateEquipmentStatus(status) { if(status == 0) { return "M&#7899;i"; } else if (status == 1) { return "&#272;ang s&#7917; d&#7909;ng"; } else if (status == 2) { return "&#272;&#227; h&#7871;t b&#7843;o h&#224;nh"; } else if (status == 3) { return "H&#7887;ng"; } return ""; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getStatus() {\n\tapi({ data: \"cmd=getstatus\" },syncStatus);\n}", "function getStatus() {\n return status;\n }", "function device_status(){\n if(node.sensor.status.initialized === false){\n node.status({fill:\"red\",shape:\"ring\",text:\"disconnected\"});\n return false;\...
[ "0.74225074", "0.7170568", "0.68568045", "0.68129474", "0.6784828", "0.6770338", "0.6741032", "0.6738368", "0.6730217", "0.6682201", "0.6650397", "0.66277647", "0.66277647", "0.66277647", "0.66277647", "0.66277647", "0.66277647", "0.66277647", "0.66277647", "0.66277647", "0.6...
0.0
-1
show message for all project.For example : add or delete or edit
function showMessageContent(type, content, time) { $("#SuccessMessageComponent").hide(); $("#WarningMessageComponent").hide(); $("#ErrorMessageComponent").hide(); var message = '<i class="uiIcon' + type + '"></i> ' + content; var id = '#' + type + 'MessageComponent'; var timeDisplay = 3000; $(id).html(message); $(id).show(); window.scrollTo(0,0); if(time) timeDisplay = time; setTimeout(function(){ $(id).hide(); }, timeDisplay); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function _viewProjectList() {\n const userProjects = todo.returnAll().slice(1);\n _renderPanel(projectPanel, renderList, userProjects);\n }", "function showSpecialProjects(projects, warning) {\n\t\tif ( !projects.length ) {\n\t\t\treturn;\n\t\t}\n\n\t\t$overview.append('<label><b style=\"color: ...
[ "0.6352057", "0.6288841", "0.6192942", "0.6075279", "0.5966763", "0.5913197", "0.5725014", "0.57233995", "0.5720598", "0.5719984", "0.5676664", "0.5662341", "0.5659792", "0.5619457", "0.5598176", "0.55812556", "0.55101365", "0.5494593", "0.54943275", "0.5482633", "0.54698634"...
0.0
-1
generate attached file to show image in a popup
function generateAttachImage(data, folderType, hideDeletion) { var files = data.attachFiles; if(files) { var gallery = '<div class="gallery clearfix" style = "display:none">'; var out = '<div class="gallery clearfix" style = "padding-bottom: 5px;">'; for(var i = 0; i < files.length; i++) { var file = files[i]; var type = file.attachName.substring(file.attachName.lastIndexOf('.') + 1, file.attachName.length).toUpperCase(); var tmp = ''; if(folderType == FOLDER.TYPE.PLAN) { tmp = 'images/upload-plan/'; } else if(folderType == FOLDER.TYPE.RESOURCE) { tmp = 'images/upload-resource/'; } else if (folderType == FOLDER.TYPE.USER) { tmp = 'images/upload-user/'; } else { tmp = 'images/upload/'; } var style = 'padding-top: 5px'; if(i == (files.length - 1)) style = 'padding-top: 5px; padding-bottom: 5px'; if(type == 'JPG' || type == 'PNG' || type == 'JPEG') { gallery += '<a href="../' + tmp + file.attachUrl +'" rel="prettyPhoto"></a>'; out += '<div style = "' + style + '" id = "file_upload_' + file.attachId + '"><a href="../' + tmp + file.attachUrl +'" rel="prettyPhoto"> <span class = "fa fa-file-image-o"></span>&nbsp;' + file.attachName + '</a>&nbsp;&nbsp;'; if(!hideDeletion) { out += '<a title = "X&#243;a &#7843;nh" style = "font-size: 14px; color: black" class = "fa fa-trash-o" onclick = "deleteFileUpload(' + file.attachId + ')"></a>'; } out += '</div>'; } else { out += '<div style = "' + style + '" id = "file_upload_'+ file.attachId +'">'; out += '<a href = "./download?fileId=' + file.attachId +'" ><span class = "fa fa-download"></span>&nbsp;' + file.attachName + '</a>&nbsp;&nbsp;'; if(!hideDeletion) { out += '<a title = "X&#243;a t&#7879;p" style = "font-size: 14px; color: black" class = "fa fa-trash-o" onclick = "deleteFileUpload(' + file.attachId + ')"></a>'; } out += '</div>'; } } gallery += '</div>'; out += '</div>'; $("#attachedFile").html(gallery + out); $(".gallery:gt(0) a[rel^='prettyPhoto']").prettyPhoto({animation_speed:'fast',slideshow:10000, hideflash: true}); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function popupPDF () {\n\t\t\tconsole.log('in gen pdf preview png!!!!');\n\t\t\t//create_jpg_web ();\n\t\t\t$.fancybox.open([\n\t\t\t\t\t{ href : '#modal-save-pdf', \n\t\t\t\t\t\ttitle : 'Сохранить в PDF'\n\t\t\t\t\t}\n\t\t\t\t], {\n\t\t\t\t\t\tmaxWidth\t: 800,\n\t\t\t\t\t\tmaxHeight\t: 600,\n\t\t...
[ "0.69799316", "0.674146", "0.665985", "0.6515765", "0.64396024", "0.6371164", "0.6338172", "0.6332785", "0.6329465", "0.63094586", "0.6285271", "0.62588", "0.6224544", "0.62155706", "0.6159119", "0.6153507", "0.6140625", "0.6131744", "0.60976803", "0.608874", "0.60765636", ...
0.63494265
6
get status for device
function generateStaffGrade(grade) { return grade; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getStatus() {\n\tapi({ data: \"cmd=getstatus\" },syncStatus);\n}", "function getStatus() {\n return status;\n }", "function device_status(){\n if(node.sensor.status.initialized === false){\n node.status({fill:\"red\",shape:\"ring\",text:\"disconnected\"});\n return false;\...
[ "0.74225074", "0.7170568", "0.68568045", "0.68129474", "0.6784828", "0.6770338", "0.6741032", "0.6738368", "0.6730217", "0.6682201", "0.6650397", "0.66277647", "0.66277647", "0.66277647", "0.66277647", "0.66277647", "0.66277647", "0.66277647", "0.66277647", "0.66277647", "0.6...
0.0
-1
to check integer number
function checkIntegerNumber(val) { if (val && val == parseInt(val, 10)) return true; else return false; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function isInteger(num) {\n return Number.isInteger(num);\n }", "function isInteger(val){\n\t return isNumber(val) && (val % 1 === 0);\n\t }", "function isInteger(num) {\n return Number.isInteger(num);\n ...
[ "0.79454833", "0.78599507", "0.7818623", "0.7720341", "0.77046514", "0.76716554", "0.7630565", "0.7594714", "0.75703096", "0.7519234", "0.7514641", "0.7508093", "0.7483174", "0.74765253", "0.7472882", "0.7458364", "0.74458337", "0.74269265", "0.74126005", "0.74040747", "0.739...
0.7685961
5
using for link to other screen
function getParameterByName(name) { name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]"); var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"), results = regex.exec(location.search); return results === null ? "" : decodeURIComponent(results[1].replace(/\+/g, " ")); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function onClicked() {\r\n\t\ttablet.gotoWebScreen(APP_URL);\r\n\t}", "function showLink(value){\n\t\t\tif(value == 'ok'){\n\t\t\t\tif(KCI.util.Config.getHybrid() == true){\n\t\t\t\t\tif(KCI.app.getApplication().getController('Hybrid').cordovaCheck() == true){\n\t\t\t\t\t\t//hybrid childbrowser function\n\t\t\t\...
[ "0.66194016", "0.64562356", "0.638622", "0.6311572", "0.62608695", "0.6227897", "0.62130463", "0.6202837", "0.6198967", "0.6162746", "0.6156251", "0.612266", "0.60810935", "0.60781974", "0.606363", "0.60516167", "0.6048693", "0.6040257", "0.6031418", "0.59875435", "0.5977943"...
0.0
-1
to decode to avoid xss
function decodeHtml(input) { if(input) { input = input.toString().replace(/</g, "&lt;").replace(/>/g, "&gt;"); } return input; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function decode(string){\n\n}", "function decode_utf8( s ) \n{\n\t return decodeURIComponent( escape( s ) );\n}", "function decodeData(strVal){\n\tvar strVal=decodeURIComponent(escape(window.atob(strVal)));\n\treturn strVal;\n}", "atou(str) {\n return decodeURIComponent(escape(window.atob(str)));\n }", ...
[ "0.7260899", "0.6950549", "0.6874789", "0.6796341", "0.6756925", "0.66800505", "0.66241497", "0.66220486", "0.65980935", "0.65868855", "0.65714866", "0.65649956", "0.65593284", "0.6545912", "0.6545362", "0.65332586", "0.65332586", "0.65332586", "0.65332586", "0.65332586", "0....
0.6150016
74
ds format: dd/mm/yyyy HH24:MM:ss trungnq for forensic and eventsearching screen
function dateSplit(ds){ var first_part = ds.split(" ")[0]; var second_part = ds.split(" ")[1]; var part1 = first_part.split("/"); var day = part1[0]; var month = part1[1]; var year = part1[2]; var part2 = second_part.split(":"); var hour = part2[0]; var minute = part2[1]; var second = part2[2]; return new Date (year, month, day, hour, minute, second); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function dateFormat(datum){\n \t\t\tvar day = datum.getDay();\n \t\t\tvar date = datum.getDate();\n \t\t\tvar month = datum.getMonth();\n \t\t\tvar year = datum.getYear();\n \t\t\tvar hour = datum.getHours();\n \t\t\tvar minutes = datum.getMinutes();\n\t\t}", "function FormatDS( now ) \n{\n\tvar strDate = '';\t\...
[ "0.5766929", "0.5734247", "0.5713218", "0.56753457", "0.5669677", "0.56169856", "0.55971366", "0.55718", "0.55640167", "0.55525404", "0.5496398", "0.54739535", "0.5470611", "0.5446928", "0.54096514", "0.5398155", "0.53889805", "0.5381987", "0.53757536", "0.53556895", "0.53441...
0.0
-1
convert date id to date
function convertDateIdToString(dateString) { if(dateString == null || dateString == '' ) return ""; dateString = dateString.toString(); var result = dateString.substr(6,2) + "-" + dateString.substr(4,2) + "-" + dateString.substr(0,4); return result; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function toYYYYMMDD (n) {\n const d = new Date(n)\n return d.toISOString().split('T')[0]\n }", "function getDateId() {\n\tvar date = new Date();\n\tvar year = date.getFullYear();\n\tvar month = date.getMonth()+1;\n\tvar day = date.getDate();\n\treturn year+month+day;\n}", "convertDate(...
[ "0.68168473", "0.656949", "0.65142363", "0.65084946", "0.6493539", "0.6490043", "0.6417927", "0.6417708", "0.64116424", "0.6380895", "0.63783115", "0.63737583", "0.6370005", "0.6330993", "0.62723917", "0.62697387", "0.62652177", "0.6244952", "0.62377936", "0.62369275", "0.619...
0.6851724
0
is double or float
function isNumeric(n) { n = n + " "; n = n.trim(); return !isNaN(parseFloat(n)) && isFinite(n); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function _isDouble(v) {\n return _isNumber(v) && String(v).indexOf('.') !== -1;\n}", "function _isDouble(v) {\n return _isNumber(v) && String(v).indexOf('.') !== -1;\n}", "function _isDouble(v) {\n return _isNumber(v) && String(v).indexOf('.') !== -1;\n}", "function _isDouble(v) {\n return _isNumber(v) &...
[ "0.7141945", "0.7141945", "0.7141945", "0.7141945", "0.7141945", "0.6872179", "0.6829385", "0.67016983", "0.6689993", "0.6681835", "0.66473734", "0.6580803", "0.65445846", "0.6510305", "0.6507027", "0.6498687", "0.6470935", "0.6436761", "0.6411602", "0.6398541", "0.6397144", ...
0.0
-1
convert 3.75 > Km3 + 750;
function getRelativeString(relativePosition) { var returnString = ''; if(relativePosition != null) { var kmIndex = parseInt(relativePosition, 10); var mIndex = Math.round(relativePosition * 1000 - kmIndex * 1000); mIndex = parseInt(mIndex, 10); if(mIndex == 0) { returnString = "KM"+kmIndex; } else { returnString = "KM"+kmIndex + " + " + mIndex; } return returnString; } else { return 'N/A'; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function transformFromHpaToMmHg() {\r\n return (weatherData.main.pressure * 0.75).toFixed(); \r\n}", "function ConvertKmToMile(km){\n\n return km * 0.621371;\n}", "function celsius2Kelvin(celsius)\n{\n //+ will become string\n return celsius + 273;\n}", "function convert (celsius){\n var fahrenheit = (...
[ "0.6471825", "0.64436144", "0.6260976", "0.62577456", "0.6250466", "0.62439", "0.6224104", "0.62137693", "0.6184228", "0.6142076", "0.6082632", "0.6064512", "0.60542715", "0.60488147", "0.603059", "0.60111564", "0.601083", "0.5951301", "0.59428924", "0.5935585", "0.5921103", ...
0.0
-1
compare to time now
function compareDateObject(date1, date2){ if(date1 == null) return false; if(date2 == null) return false; var date1Long = date1.getTime(); var date2Long = date2.getTime(); if(date1Long - date2Long > 0) return '>'; if(date1Long - date2Long == 0) return '='; if(date1Long - date2Long < 0) return '<'; else return ''; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async timeToCompare(context, date) {\n try {\n\n let d = new Date(date),\n hour = \"\" + d.getHours(),\n minute = \"\" + d.getMinutes(),\n second = \"\" + d.getSeconds();\n\n if (hour.length < 2) hour = \"0\" + hour;\n if (minute.length < 2) minute = \"0\" + minute;\n if...
[ "0.7006593", "0.6780284", "0.6663341", "0.65964013", "0.6583219", "0.65678114", "0.6375527", "0.6354358", "0.63407445", "0.62671477", "0.621365", "0.62041", "0.6188115", "0.6152722", "0.6151531", "0.6137242", "0.61364424", "0.6131348", "0.6127262", "0.6123112", "0.6119807", ...
0.0
-1
to convert date string to date in format dd/MM/yyyy hh:mm:ss
function convertString2DateInFormat_ddMMyyyyhhmm(dateString){ if(dateString == null || dateString == '' ) return ""; var dateReturn = null; var arr = dateString.split(" "); if(arr == null) return null; var arr_dd = arr[0].split("/"); if(arr_dd == null || arr_dd.length != 3) return null; var arr_hh = arr[1].split(":"); if(arr_hh == null || arr_hh.length != 3) return null; var day = arr_dd[0]; var month = arr_dd[1]; var year = arr_dd[2]; var hour = arr_hh[0]; var minute = arr_hh[1]; var second = arr_hh[2]; dateReturn = new Date(year, parseInt(month) -1, day, hour, minute, second, 0); return dateReturn; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function stringToDate(str) {\n var dArr = str.split(\"/\");\n var date = new Date(Number(dArr[2]), Number(dArr[1]) - 1, dArr[0]);\n return date;\n }", "function toDate(dateStr) {\n var parts = dateStr.split(\"/\");\n return new Date(parts[2], parts[1] - 1...
[ "0.71635157", "0.7156967", "0.7077563", "0.707642", "0.70628875", "0.69925976", "0.68711185", "0.68680215", "0.68421715", "0.67853636", "0.67035383", "0.66725105", "0.66259825", "0.6623011", "0.6623011", "0.6622127", "0.6621933", "0.661842", "0.66081494", "0.6607467", "0.6588...
0.6662004
12
loc trong danh sach list shipment nhung ban ghi co thuoc list filter
function filterListShipment(listShipment, listFilter, type) { if(listFilter == null || typeof listFilter == 'undefined' || listFilter.length == 0) { return listShipment; } var result = []; if(type == 'goodsType') { for(var i = 0; i < listShipment.length; i++) { var shipment = listShipment[i]; if(containInArray(listFilter, shipment.goodsTypeId)) { result.push(shipment); } } } else if (type == 'truckType') { for(var i = 0; i < listShipment.length; i++) { var shipment = listShipment[i]; if(containInArray(listShipment, shipment.truck.truckTypeId)) { result.push(trucking); } } } return result; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function filterTullkontor () {\n \t\tjq('#tullkontorList').DataTable().search(\n \t\tjq('#tullkontorList_filter').val()\n \t\t).draw();\n }", "function fn_GetLyingList(ULDSNO, tdRoute, LyingListGridType) {\n\n if (LyingListGridType == 'MULTI') {\n fun_GetSearchPanel(\"ManifestLyingSearch\...
[ "0.6643504", "0.6268424", "0.61791396", "0.61511546", "0.615063", "0.6102413", "0.608919", "0.6088079", "0.60877067", "0.60346866", "0.60154617", "0.6014422", "0.6010308", "0.6001903", "0.596896", "0.59465367", "0.591485", "0.59135884", "0.58975846", "0.58967066", "0.5888888"...
0.59272736
16
loc trong danh sach list trucking nhung ban ghi co thuoc list filter
function filterListTrucking(listTrucking, listFilter, type) { if(listFilter == null || typeof listFilter == 'undefined' || listFilter.length == 0) { return listTrucking; } var result = []; if(type == 'goodsType') { for(var i = 0; i < listTrucking.length; i++) { var trucking = listTrucking[i]; if(containInArray(listFilter, trucking.goodsTypeId)) { result.push(trucking); } } } else if (type == 'truckType') { for(var i = 0; i < listTrucking.length; i++) { var trucking = listTrucking[i]; if(containInArray(listFilter, trucking.truck.truckTypeId)) { result.push(trucking); } } } return result; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function filterTullkontor () {\n \t\tjq('#tullkontorList').DataTable().search(\n \t\tjq('#tullkontorList_filter').val()\n \t\t).draw();\n }", "function filter(kataKunci) {\n var filteredItems = []\n for (var j = 0; j < items.length; j++) {\n var item = items[j];\n var namaItem =...
[ "0.6816938", "0.6768787", "0.66336614", "0.64897716", "0.64856297", "0.6345117", "0.63441306", "0.63094324", "0.624039", "0.62154496", "0.6214688", "0.61778706", "0.617683", "0.61766", "0.6146734", "0.6143912", "0.61029947", "0.6100971", "0.60939157", "0.6084795", "0.60750437...
0.0
-1
for submitting the form
function submitHandler(e) { e.preventDefault(); const validations = []; const formValues = {}; for (const [idName, idRef] of Object.entries(references)) { validations.push(validateCore(idName, idRef.current.value)); formValues[idName] = idRef.current.value; } startLoading(); Promise.all(validations).then((vResolved) => { const formIsValid = !vResolved.includes(false); if (formIsValid) { // the contribution object to be added to users list const contObj = { stamp: Date.now(), amount: parseInt(formValues.amount), }; const body = { userName: formValues.userName, contObject: contObj, }; // console.log("form is submitting..."); sendRequest({ method: "POST", route: server.routes.newContribution, body: body, }).then((resObj) => { if (resObj.status === 200) { dispatchGlobal( addContributionThnuk( formValues.userName, contObj, resObj.payload.recentString ) ); // here we have to reset the form clearFields(references); dispatchValidator(vActions.RESETALL()); setTimeout(() => { resetStatus(); }, 3000); } }); } else { // console.log("form is not valid"); resetStatus(); } }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function formPOST(){\n\n\tthis.submit();\n\n}", "submitForm(e) {\n e.preventDefault();\n window.M.updateTextFields();\n let data = Util.getDataElementsForm(e.target, false);\n\n MakeRequest({\n method: 'post',\n url: 'actividad/post',\n data : data\n ...
[ "0.76602423", "0.7627084", "0.7453644", "0.73816425", "0.72610617", "0.7252629", "0.7212578", "0.720708", "0.71929467", "0.7170223", "0.7162225", "0.7160522", "0.7074013", "0.7072439", "0.70672363", "0.7060008", "0.7054841", "0.70433164", "0.70400107", "0.7035165", "0.6986809...
0.6582753
70
Function definitions: hoisted during runtime
function _interpretPostContent(post) { post.date = Date(post.date_unix_seconds); return post; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function hoistedFunction() {\n console.log('I work, even if they call me before my definition.');\n}", "function hello(){\n console.log(\"Function Declaration\")\n} // function declaration hoistinga uchraydi", "function hoistingFunc()\n{ \n console.log('hoisting ordinary fufunc')\n \n}", "function ...
[ "0.7158267", "0.7141122", "0.6796504", "0.668962", "0.66577816", "0.6456341", "0.63211906", "0.6318158", "0.6203987", "0.61959285", "0.61643493", "0.6099638", "0.6075248", "0.60441387", "0.6004128", "0.59631336", "0.5947582", "0.59128636", "0.58873403", "0.5886882", "0.586915...
0.0
-1
Method to add the click listeners to close the window by event delegation when clicking the close button or in the outside part of the modal.
setListeners() { this.element.addEventListener('click', (event) => { const target = event.target; if (target === this.closeButton || target === this.element) { this.close(); } }) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function addCloseEventListeners() {\n\n\t/**\n\t * Clicking on the close button wlil close the modal.\n\t */\n\tconst closeButtons = document.querySelectorAll( \".js--modal-close\" );\n\n\tArray.from( closeButtons ).forEach( ( button ) => {\n\t\tbutton.addEventListener( \"click\", ( e ) => {\n\t\t\te.preventDefaul...
[ "0.74046826", "0.7239345", "0.70638525", "0.6959805", "0.6781788", "0.66485083", "0.6623619", "0.65894294", "0.658725", "0.6539153", "0.6523101", "0.64997965", "0.64426386", "0.64291006", "0.6390743", "0.637758", "0.63728076", "0.63572246", "0.63566554", "0.63349235", "0.6268...
0.6713158
5
upload downloadimages/img.png get its github url find local images by startWiths(../) replace remove local images this function can be combined into another function the difference lies in checking url counts equality and use another name to upload after upload, remove file
async function replaceLocalImagesInMarkdown() { let markdownContent = fs.readFileSync(pathToMarkdownFile).toString() let imageUrls = extractImageUrls(markdownContent, '../') if (!imageUrls.length) { console.log('No local image need to be replaced!') return } const directoryPath = path.join(__dirname, imageDir); const localImages = fs.readdirSync(directoryPath) if (imageUrls.length !== localImages.length) { console.error('Markdown images count is not equal to local images count', imageUrls.length, localImages.length) process.exit(1) } for (let i = 0; i < localImages.length; i++) { const imageUrl = imageUrls[i] const imagePath = imageDir + '/' + localImages[i] let retry = true while (retry) { try { githubImageUrl = await uploadImage(imagePath, pathToMarkdownFile) retry = false } catch(e) { console.log(e, '\nRetry uploading') } } githubImageUrl = githubImageUrl.replace('githubusercontent', 'gitmirror') markdownContent = markdownContent.replace(imageUrl, githubImageUrl) console.log('Rewriting md file...\n') fs.writeFileSync(pathToMarkdownFile, markdownContent) } // TODO delete images console.log('Replacing local images is done!') }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async function deleteUrlImages(urls) {\n // console.log(\"deleteUrlImages: \", urls);\n // for (const index in urls) {\n // const url = urls[index];\n // const bucket = storage.bucket(bucketName);\n // const fullname = url.split(\"/\").pop();\n // const filename = fullname.substr(0, fullname.lastInde...
[ "0.6163581", "0.6091988", "0.6052586", "0.59308547", "0.5896459", "0.58694506", "0.58634764", "0.5844229", "0.5826304", "0.5721929", "0.5721841", "0.5714957", "0.56649005", "0.56630576", "0.5652016", "0.56379426", "0.56037974", "0.5602023", "0.5599512", "0.55979747", "0.55782...
0.5968913
3
============================================================================== ===== MANUAL MODE FUNCTIONS ================================================== ==============================================================================
function init_manual(){ // Make sure the map is coloring by district affiliation setColoring(getColor_District); redraw(); // Populate the div with content var ele = document.getElementById("district_container"); ele.innerHTML = getDistrictDisplay(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getMode(){\n return mode;\n}", "get mode() {}", "get mode(){ return this.base_opt[0]; }", "get mode() { return this._mode; }", "get mode() { return this._mode; }", "function modeSwitch(mode) {\n\tresetViews();\n resetCameras();\n\tswitch(mode) {\n\t\tcase \"absolute\":\n\t\t\tupdateShipDat...
[ "0.6973231", "0.68088305", "0.6434935", "0.6432921", "0.6432921", "0.6408197", "0.6395246", "0.6301568", "0.62704146", "0.62602615", "0.6181941", "0.6139256", "0.6129871", "0.6109933", "0.610147", "0.60807335", "0.60807335", "0.60286295", "0.6021024", "0.60146755", "0.5989114...
0.0
-1
Control events are processed here. This is called when Alexa requests an action (IE turn off appliance).
function handleControl(event, context) { if (event.header.namespace === 'Alexa.ConnectedHome.Control') { /** * Retrieve the appliance id and accessToken from the incoming message. */ let accessToken = event.payload.accessToken; let applianceId = event.payload.appliance.applianceId; let deviceid = event.payload.appliance.additionalApplianceDetails.deviceId; let message_id = event.header.messageId; let param = ""; let index = "0"; let state = 0; let confirmation; let funcName; log("Access Token: ", accessToken); log("DeviceID: ", deviceid); if (event.header.name == "TurnOnRequest") { state = 1; confirmation = "TurnOnConfirmation"; funcName = "onoff"; } else if (event.header.name == "TurnOffRequest") { state = 0; confirmation = "TurnOffConfirmation"; funcName = "onoff"; } else if (event.header.name == "SetPercentageRequest") { state = event.payload.percentageState.value; confirmation = "SetPercentageConfirmation"; funcName = "setvalue"; } else if (event.header.name == "IncrementPercentageRequest") { let increment = event.payload.deltaPercentage.value; state += increment; if (state > 100) { state = 100; } confirmation = "IncrementPercentageConfirmation"; funcName = "setvalue"; } else if (event.header.name == "DecrementPercentageRequest") { let decrement = event.payload.deltaPercentage.value; state -= decrement; if (state < 0) { state = 0; } confirmation = "DecrementPercentageConfirmation"; funcName = "setvalue"; } let options = { method: 'POST', url: particleServer, headers: { 'cache-control': 'no-cache', authorization: 'Bearer ' + accessToken, 'content-type': 'application/json' }, body: { inputs: [{ intent: 'Alexa.ConnectedHome.Control', payload: { devices: deviceid, confirmation: confirmation, state: state, funcName: funcName } }] }, json: true }; request(options, function (error, response, body) { if (error) throw new Error(error); let headers = { authorization: "Bear " + accessToken, namespace: 'Alexa.ConnectedHome.Control', name: body.payload.commands, payloadVersion: '2', messageId: message_id }; let payloads = {}; let result = { header: headers, payload: payloads }; context.succeed(result); }); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function handleControl(event, context) {\n var requestType=event.header.name;\n var responseType=event.header.name.replace(\"Request\",\"Confirmation\");\n var headers = {\n namespace: \"Alexa.ConnectedHome.Control\",\n name: responseType,\n ...
[ "0.69838643", "0.6960366", "0.6899015", "0.6748353", "0.63826334", "0.6018675", "0.593839", "0.57300425", "0.57023305", "0.56880707", "0.5606107", "0.55317867", "0.54922414", "0.54922414", "0.54922414", "0.5454328", "0.54481095", "0.5441287", "0.54377955", "0.5417028", "0.541...
0.71767503
0
A function that takes as input the coordinates of an edges and gives out the coordinates of the location where its cost should be mentioned Uses a little trigonometry :)
function getEdgeCostLocation(x1, y1, x2, y2) { var midx = (x1 + x2) / 2; var midy = (y1 + y2) / 2; var angle = Math.atan((x1 - x2) / (y2 - y1)); var coords = { x: midx + 8 * Math.cos(angle), y: midy + 8 * Math.sin(angle) } return coords; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function squareAroundPoint(nearLat, nearLong, edge) {\n // Ideally, we should do a geospatial query for a circle around the target point. We approximate this\n // by a square.\n var dist = edge / 2 * 1609.34; // convert miles to meters\n var point = new google.maps.LatLng(nearLat, nearLong);\n var e...
[ "0.60282046", "0.5972613", "0.5940183", "0.5937488", "0.59330994", "0.59179926", "0.5848582", "0.5832108", "0.5809546", "0.5809546", "0.5731715", "0.57182956", "0.569109", "0.5689905", "0.5665226", "0.56597245", "0.5636308", "0.5621863", "0.56040365", "0.5544962", "0.55060184...
0.7299202
0
An agent to draw queues for bfs and dfs
function QueueDrawAgent(selector, h, w, problem, options) { this.canvas = document.getElementById(selector); this.canvas.innerHTML = ''; this.two = new Two({ height: h, width: w }).appendTo(this.canvas); this.problem = problem; this.nodeRadius = 25; this.options = options; this.iterate = function() { this.two.clear(); var frontier = this.problem.frontier; for (var i = 0; i < frontier.length; i++) { node = this.problem.nodes[frontier[i]]; var x = (i) * 30 + 40; var y = 20; var rect = this.two.makeRectangle(x, y, this.nodeRadius, this.nodeRadius); rect.fill = options.nodes.frontier.fill; if (frontier[i] == this.problem.nextToExpand) { rect.fill = options.nodes.next.fill; } var text = this.two.makeText(node.text, x, y); if (this.options.showCost) { t = this.two.makeText(node.cost, x, y + 30); } } this.two.update(); } this.iterate(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function Queues(){}", "bfs(startingNode) {\n\n // create a visited array \n var visited = [];\n for (var i = 0; i < this.noOfVertices; i++)\n visited[i] = false;\n\n // Create an object for queue \n var q = new d3.Queue();\n\n // add the starting node to the q...
[ "0.69330865", "0.64254475", "0.62320113", "0.6164747", "0.614109", "0.6127348", "0.6077769", "0.6013089", "0.5983192", "0.59683716", "0.59651506", "0.5961588", "0.5953414", "0.5931509", "0.5908765", "0.58413005", "0.58215636", "0.58113825", "0.5804999", "0.58030593", "0.57872...
0.62235034
3
TODO refactor, could be written more efficiently.
render() { if (this.props.winner == this.props.user) { return ( <div className='well winner justify-content-center'> <h1 className='text-center'> YOU won this round! </h1> <img className='win-img' src='https://media.giphy.com/media/qDWSxfium1oRO/giphy.gif' alt='win' /> <h2 className='text-center'> Double win! You also draw next! </h2> <button className='btn btn-color next-game' onClick={() => { this.props.socket.emit('clear-guesses') this.props.socket.emit('clear-all'); this.props.socket.emit('new-game') } }>Next Game</button> </div> ) } if (!this.props.winner && !this.props.winningGuess) { return ( <div className='well winner justify-content-center'> <h1 className='text-center'> Times up! No winner this round! </h1> <img className='win-img' src='https://media.giphy.com/media/ZO91JK6HBDeCMQXkK4/giphy.gif' alt='win' /> <h2 className='text-center'> You are drawing next </h2> <button className='btn btn-color next-game' onClick={() => { this.props.socket.emit('new-game'); this.props.socket.emit('clear-all'); this.props.socket.emit('clear-guesses'); }}>Next Game</button> </div> ) } else { return ( <div className='well winner justify-content-center'> <h1 className='text-center'> {this.props.winner} won this round! They guessed "{this.props.winningGuess}" </h1> <img className='win-img' src='https://media.giphy.com/media/3owyoXMzSPGjbsQ5uE/giphy.gif' alt='draw' /> <h2 className='text-center'> You are drawing next </h2> <button className='btn btn-color next-game' onClick={() => { this.props.socket.emit('clear-guesses') this.props.socket.emit('clear-all'); this.props.socket.emit('new-game') } }>Next Game</button> </div> ) } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private internal function m248() {}", "private public function m246() {}", "protected internal function m252() {}", "transient private protected internal function m182() {}", "static private internal function m121() {}", "transient protected internal function m189() {}", "transient private internal fun...
[ "0.6487205", "0.63883483", "0.61986494", "0.5969549", "0.58850664", "0.58524513", "0.57921946", "0.57486063", "0.5717127", "0.5630512", "0.56111544", "0.5509816", "0.54524904", "0.54350907", "0.5424734", "0.5420489", "0.53336334", "0.5322705", "0.53204036", "0.52042747", "0.5...
0.0
-1
Prompts to begin app
function search() { inquirer.prompt({ name: "action", type: "list", message: "Choose what you would like to do:", choices: options }) .then(function (answer) { switch (answer.action) { case options[0]: viewDepartment(); break; case options[1]: viewRole(); break; case options[2]: viewEmp(); break; case options[3]: updEmp(); case options[4]: addDepartment(); break case options[5]: addRole(); break case options[6]: addEmp(); break case options[7]: connection.end(); break } }) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function startApp(){\n inquirer.prompt({\n name: 'start',\n type: 'list',\n message: 'What would you like to do?',\n choices: [\n 'Department',\n 'Role',\n 'Employee',\n 'Update Employee Role',\n ...
[ "0.7791148", "0.7675745", "0.75078005", "0.733279", "0.7310327", "0.7191449", "0.71553755", "0.71243256", "0.7113125", "0.7075114", "0.7039836", "0.70304775", "0.696117", "0.6931649", "0.69136083", "0.6898819", "0.68431145", "0.6843104", "0.6830701", "0.6817978", "0.6797977",...
0.0
-1