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
Force a number between 0 and 1
function clamp01(val) { return Math.min(1, Math.max(0, val)); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function normalize(value) {\n\tif (value > 1) {\n\t\tvalue = 1;\n\t} else if (value < 0) {\n\t\tvalue = 0;\n\t}\n\treturn value;\n}", "function clamp01(val) {\n return Math.min(1, Math.max(0, val));\n }", "function clamp01(val) {\n return Math.min(1, Math.max(0, val));\n}", "function clamp01...
[ "0.697331", "0.69500285", "0.69342405", "0.68928826", "0.68928826", "0.68928826", "0.68928826", "0.68928826", "0.68928826", "0.68928826", "0.68928826", "0.68928826", "0.68928826", "0.68928826", "0.68928826", "0.68928826", "0.68928826", "0.68928826", "0.68928826", "0.68928826", ...
0.6934323
8
Need to handle 1.0 as 100%, since once it is a number, there is no difference between it and 1 <
function isOnePointZero(n) { return typeof n === 'string' && n.indexOf('.') !== -1 && parseFloat(n) === 1; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getPositivePercentValue(val) { return val / currentSerie.maxRange * 100; }", "function unit (value) {\n\t return low.number(value) &&\n\t value >= 0.0 && value <= 1.0\n\t}", "function checkPercent(num1, num2){\n\n ans = (100 - (num1/num2)*100).toFixed(2);\n ...
[ "0.7110365", "0.6761169", "0.6752703", "0.6752703", "0.6747399", "0.6747399", "0.6747399", "0.6747399", "0.6747399", "0.6747399", "0.67081654", "0.6641506", "0.66197264", "0.6612297", "0.66091263", "0.65953225", "0.6594697", "0.65871036", "0.6580351", "0.6580351", "0.6580351"...
0.0
-1
Check to see if string passed in is a percentage
function isPercentage(n) { return typeof n === 'string' && n.indexOf('%') !== -1; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function isPercentage(n) {\n return typeof n === 'string' && n.includes('%');\n }", "function isPercentage(n) {\n return typeof n === 'string' && n.includes('%');\n}", "function isPercentage(n) {\n return typeof n === \"string\" && n.indexOf('%') != -1;\n}", "function isPercentage(n) {\...
[ "0.88259184", "0.8814171", "0.8745915", "0.8745915", "0.8745915", "0.8745915", "0.8745915", "0.8745915", "0.8745915", "0.8745915", "0.8745915", "0.8745915", "0.8745915", "0.8745915", "0.8745915", "0.8745915", "0.8745915", "0.8745915", "0.8745915", "0.8745915", "0.8745915", ...
0.8737567
43
Return a valid alpha value [0,1] with all invalid values being set to 1
function boundAlpha(a) { a = parseFloat(a); if (isNaN(a) || a < 0 || a > 1) { a = 1; } return a; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "get Alpha0() {}", "set Alpha0(value) {}", "function boundAlpha(a) {\n a = parseFloat(a);\n if (isNaN(a) || a < 0 || a > 1) {\n a = 1;\n }\n return a;\n }", "function boundAlpha(a) {\n a = parseFloat(a);\n\n if (isNaN(...
[ "0.7020302", "0.698041", "0.68436056", "0.6829902", "0.6809745", "0.6776762", "0.6739752", "0.6733045", "0.67188567", "0.67188567", "0.67188567", "0.67188567", "0.67188567", "0.67188567", "0.67188567", "0.67188567", "0.67188567", "0.67188567", "0.67188567", "0.67188567", "0.6...
0.6782859
11
Replace a decimal with it's percentage value
function convertToPercentage(n) { if (n <= 1) { return Number(n) * 100 + "%"; } return n; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function pctChange(val){\r\n if(val > 0){\r\n return '' + val + '%';\r\n }else if(val < 0){\r\n return '' + val + '%';\r\n }\r\n return val;\r\n }", "function pctChange(val){\r\n if(val > 0){\r\n return '' + val + '%';\r\n }else if(val...
[ "0.7397558", "0.7397558", "0.7397558", "0.7397558", "0.7397558", "0.7397558", "0.73852247", "0.73460466", "0.7261995", "0.7165849", "0.7157337", "0.7123517", "0.7108929", "0.7013729", "0.7009938", "0.6997692", "0.6986538", "0.69737834", "0.6965283", "0.69514245", "0.6943916",...
0.6692231
95
Force a hex value to have 2 characters
function pad2(c) { return c.length === 1 ? '0' + c : String(c); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function hex(val) {\n\t\t\tval = val.toString(16);\n\t\t\tif (val.length < 2) val = '0'+val;\n\t\t\treturn val;\n\t\t}", "function hex(val) {\n var hex_rep = val.toString(16);\n return (hex_rep.length === 1) ? '0' + hex_rep : hex_rep;\n}", "function twoCh (val) {\n val = '0' + String(val)\n return val....
[ "0.7199072", "0.718944", "0.67827487", "0.6780733", "0.6724398", "0.6659148", "0.6604266", "0.6589613", "0.658292", "0.65805215", "0.6560533", "0.6553308", "0.65487784", "0.65487784", "0.6537162", "0.65317774", "0.6530349", "0.65280503", "0.65211016", "0.651357", "0.651244", ...
0.0
-1
load image data and store in gl texture class
function loadTexture(texLoc) { var tex = gl.createTexture(); tex.image = new Image(); tex.loaded = false; tex.image.onload = function() { bindLoadedTexture(tex); }; tex.image.src = texLoc; return tex; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function loadTexture () {\n \n var image = new Image();\n // Create a texture object \n lennaTxt.textureObj = gl.createTexture(); \n image.onload = function() {\n\n initTexture(image, lennaTxt.textureObj);\n\n // Make sure there is a redraw after the loading of the texture\n dra...
[ "0.76946276", "0.76858264", "0.76387453", "0.7548712", "0.7527524", "0.74792486", "0.74625117", "0.72703123", "0.72700757", "0.7262551", "0.72341263", "0.7080008", "0.7066674", "0.70069516", "0.69925106", "0.6976", "0.697082", "0.69701123", "0.69537026", "0.6952048", "0.69494...
0.68476474
32
Create a preview for the Share Page. This excludes/trims out some elements such as Social buttons, Site logo, etc.
function createSharePreview(data, contentTag) { var element = $("<div>", {id: contentTag + data.id + "SharePreview"}); //add trimmed version of title element (for preview) element.append(createTitleElementForPreview(data, contentTag)); element.append(createMainImageElement(data, contentTag)); if (data.type == ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function showPreview() {\n \n setPreviewElements();\n \n // get the post body\n var strBody; \n if (RichEdit.mode == RichEdit.DESIGN_MODE) { \n strBody = getDesignModeHtml();\n if (Detect.IE()) strBody = RemoveLinksWithinTags(strBody);\n } \n if (RichEdit.mode == RichEdit.HTM...
[ "0.6552219", "0.6095948", "0.59494835", "0.5780115", "0.57792646", "0.57533216", "0.57514894", "0.5749693", "0.5739364", "0.5731745", "0.57101816", "0.5700379", "0.5625627", "0.5600076", "0.55977803", "0.5570637", "0.5555127", "0.55406415", "0.55117124", "0.5508406", "0.54960...
0.69269544
0
Create a simple version of the thumbnail element to be displayed on the sidebars Should not include the SocialStatusActions bar.
function createSidebarElement(data, contentTag, createLink) { var element = $("<div>", {class: "thumbnailElement"}); if(createLink) { var imageLink = $("<a>", {href: data.link}).append(createEntityImageElement(data, contentTag)); element.append(imageLink); } else { element.append(createEntityImageElement(data...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function generateThumbnailElement() {\n var element;\n element += \"<a class='fancybox-button' rel='fancybox-button' href='images/Zetica_RASC_DC_main.png' title='Screenshot of main dash board'>\";\n element += \"<img class='thumbnail' src='images/Zetica_RASC_DC_main.png' alt='' />\";\n ...
[ "0.68759525", "0.6696797", "0.66057134", "0.6525761", "0.6240075", "0.61413836", "0.61093223", "0.60615206", "0.59822744", "0.5948959", "0.5947787", "0.5931339", "0.5901281", "0.5865284", "0.586461", "0.5845612", "0.578581", "0.5772723", "0.5737329", "0.57174766", "0.570173",...
0.63244814
4
Create the header element for the main challenge page.
function createTitleElement(data, contentTag) { var titleElement = $("<div>", {id: contentTag + data.id + "TitleSection", class: "titleSection"}); var logo = $("<img>", {src: "/images/branding/captionify_logo_tiny_inverse.png"}); var entityTypeTitle = $("<p>", {class: "entityTypeTitle"}); if (data.type == "entry")...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function buildHeader() {\r\n $(\"#header\").html(\r\n `\r\n A2 / ${meArr[0].fName} ${meArr[0].lName} / ${meArr[0].id} / ${meArr[0].user}\r\n <hr>\r\n `\r\n );\r\n $(\"#header\").addClass(\"header\");\r\n}", "function _initHeader() {\n\t\tpage.header.classList.add('wl-header');\n\t\t\t\t\n\t\tpag...
[ "0.729994", "0.7271522", "0.7259008", "0.72465646", "0.6936915", "0.6927743", "0.6907465", "0.68941975", "0.6890132", "0.68741584", "0.6838151", "0.68214434", "0.6769844", "0.67334604", "0.67224014", "0.66963685", "0.6681151", "0.66666216", "0.66645527", "0.6639271", "0.66286...
0.0
-1
Create the header element for the main challenge page.
function createTitleElementForPreview(data, contentTag) { var titleElement = $("<div>", {id: contentTag + data.id + "TitleSection", class: "centerDisplayHeader"}); var title = $("<h1>", {class: "main-title"}).append(data.caption); if (data.type == "challenge") { titleElement.append($("<hr>", {class: "low-top-ma...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function buildHeader() {\r\n $(\"#header\").html(\r\n `\r\n A2 / ${meArr[0].fName} ${meArr[0].lName} / ${meArr[0].id} / ${meArr[0].user}\r\n <hr>\r\n `\r\n );\r\n $(\"#header\").addClass(\"header\");\r\n}", "function _initHeader() {\n\t\tpage.header.classList.add('wl-header');\n\t\t\t\t\n\t\tpag...
[ "0.7300316", "0.7272433", "0.7259227", "0.72460854", "0.6936833", "0.69268304", "0.6905828", "0.6893727", "0.6890995", "0.68749934", "0.6838185", "0.6821483", "0.67704535", "0.6733387", "0.6722023", "0.66963017", "0.66814107", "0.6666442", "0.66632354", "0.66411614", "0.66303...
0.0
-1
Send data to server and report response
function sendData(data, callback) { $.ajax({ type: data.method, data: data.data, url: data.url, dataType: data.dataType }).done((response)=> { //DEBUG console.log("Data sent"); if(callback !== undefined) { callback(response); } }) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "_sendData() {\n\n }", "function send(data)\n\t{\n\t\tres.status(200).send(JSON.stringify(data));\n\t}", "function sendPostResponse() {\n\t\t\t\t\t\n\t\t\t\t\tvar delaySend = false;\n\t\t\t\t\t// build appropriate response\n\t\t\t\t\tswitch(command) {\n\t\t\t\t\t\tcase 'end':\n\t\t\t\t\t\tcase 'continue':\n\...
[ "0.6616032", "0.6520763", "0.6436238", "0.6419222", "0.6392131", "0.62804943", "0.6172208", "0.61676764", "0.6153329", "0.61501414", "0.6144028", "0.6142414", "0.61162025", "0.610397", "0.6095465", "0.6084069", "0.6063183", "0.60335755", "0.60304683", "0.60262096", "0.6009670...
0.5590957
94
If the user has gone for unconventional casing of collection names, they'll have to get them right (i.e. Meteor's Mongo.Collection names as string) in the Mongol config manually Changes the first character of a string to upper case
function firstToUpper(text) { return text.charAt(0).toUpperCase() + text.substr(1); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function snakeCaseToCamelCase(s) {\n return s.toLowerCase().replace(/(\\_\\w)/g, function(m) {return m[1].toUpperCase();});\n}", "camelize(s){\n return s.replace (/(?:^|[-_])(\\w)/g, function (_, c) {\n return c ? c.toUpperCase () : '';\n })\n }", "function MaybeAdd_S(collectionNam...
[ "0.61858284", "0.618158", "0.6033191", "0.60029376", "0.5977457", "0.593041", "0.591284", "0.5828758", "0.5795261", "0.57780635", "0.57288826", "0.57050633", "0.5691849", "0.5690203", "0.56827235", "0.5676339", "0.5665168", "0.5635436", "0.5633981", "0.56321377", "0.56288695"...
0.0
-1
Gets transaction history for all tokens for an address. Can also specify block height, but defaults to 0.
async getHistoricalSlpTransactions (addressList, fromBlock = 0) { // Build SLPDB or query from addressList const orQueryArray = [] for (const address of addressList) { const cashAddress = SLP.SLP.Address.toCashAddress(address) const slpAddress = SLP.SLP.Address.toSLPAddress(address) const...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async getTransactions (addr) {\n try {\n // Get transaction history for the address.\n const transactions = await this.bchjs.Electrumx.transactions(addr)\n if (!transactions.success) {\n throw new Error(`No transaction history could be found for ${addr}`)\n }\n\n // Sort the tran...
[ "0.678019", "0.6317619", "0.61984956", "0.61959994", "0.617503", "0.60488737", "0.59698284", "0.58288765", "0.5777384", "0.5707268", "0.56887335", "0.56668204", "0.5645385", "0.56282824", "0.56282824", "0.55507183", "0.5547342", "0.5540692", "0.54898417", "0.54794186", "0.547...
0.57213056
9
============================ DOM METHODS ============================ cache DOM elements
function cacheDom($container) { DOM.template = ` <div class="app-shell-head"> <div class="app-shell-head-logo"> <h1>No Framework</h1> </div> <div class="app-shell-head-nav"> <ul> <li><a hr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function cacheDOM() {\n\n DOM.loader = document.getElementById('Loader');\n DOM.viewMode = document.getElementById('ViewMode');\n DOM.editMode = document.getElementById('EditMode');\n\n DOM.searchdrugname = document.getElementById('SearchDrugName');\n DOM.todate = document.getEle...
[ "0.7270566", "0.71733177", "0.71683407", "0.70252913", "0.7021459", "0.6954643", "0.6812754", "0.67981535", "0.67691356", "0.6737148", "0.67232776", "0.6613098", "0.659707", "0.6522693", "0.65005803", "0.65005803", "0.65005803", "0.65005803", "0.64899457", "0.6431542", "0.643...
0.5690357
61
========================== EVENT HANDLERS =========================== handle URI hashchange events
function onHashChange(event) { app.router.router(location.hash.slice(1)); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function hashChanged(e){\n\t\trespondToState();\n\t}", "function onWindowHashChange(event) {\n\n readURL();\n\n }", "function checkAndComputeHashChange(evt) {\n //Extracting hash, or null if there is nothing to extract\n var currentHash = null;\n\n // Current hash is superseeded ...
[ "0.78269273", "0.75339097", "0.75118756", "0.7496425", "0.74476147", "0.73802733", "0.71672124", "0.7165437", "0.70277435", "0.6881947", "0.67986727", "0.67874193", "0.67830086", "0.6749403", "0.6675729", "0.6579212", "0.6543003", "0.6484132", "0.6478781", "0.645227", "0.6450...
0.67866665
12
============================= CALLBACKS ============================= / ========================== PUBLIC METHODS =========================== initialize module
function init($container) { cacheDom($container); $container.html( DOM.template ); /* bind & trigger 'hashchange' event AFTER all feature modules are configured and initialized. Otherwise they will not be ready to handle the trigger event, which is used to...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "initialize() {\n //\n }", "async init () {}", "_init() {\n this.add(this.callback);\n }", "onInitialize (callback) {\n return callback(null)\n }", "init() {\n }", "function init(cb){\n\n}", "async initialize() {\n\n }", "async initialize() {\n\n }"...
[ "0.7287516", "0.728402", "0.71822804", "0.7133674", "0.7132277", "0.71248245", "0.71046644", "0.71046644", "0.7070156", "0.7070156", "0.70467025", "0.6979878", "0.6964012", "0.6962269", "0.6955364", "0.69456303", "0.6927253", "0.6923151", "0.6921976", "0.6916401", "0.6916401"...
0.0
-1
Accessed via the on screen 'Host Game' and 'Join Game' buttons. The function sends the user's chosen name to the server to ensure it is available for use
function submitName(hosting) { playerName = $("#nameInput").val(); if (hosting) getAjax("https://webgamesdev-blaircalderwood.c9.io/saveName?name=" + playerName, hostWait); else getAjax("https://webgamesdev-blaircalderwood.c9.io/checkName?name=" + playerName, checkName); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function sendName() {\n\tvar clientMsg = document.getElementById('enterName');\n\tif (clientMsg.value) {\n\t\tPlayerName = clientMsg.value;\n\t\tvar data = JSON.stringify({\n\t\t\t'newName' : $(\"#enterName\").val()\n\t\t})\n\t\tsocketConn.send(data);\n\t\tdocument.getElementById('title').innerHTML = \"Welcome to ...
[ "0.7607731", "0.73946065", "0.7136719", "0.7104839", "0.701779", "0.6902459", "0.67834866", "0.6767566", "0.6726199", "0.662657", "0.65805465", "0.65355575", "0.65211", "0.6449625", "0.6448279", "0.64400506", "0.6435515", "0.64225155", "0.64203924", "0.64024085", "0.63939756"...
0.707363
4
Called if the user wishes to join a game. Creates a list of all of the available hosts and displays on screen.
function checkName(availability) { var playerList = $("#playerList"); playerList.html(""); var newHTML = ""; if (availability !== "false") { availability = JSON.parse(availability); if (availability.length == 0) { playerList.html("<h2 style='color: white;'><b>There are no...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function updateLobby(){\n var $startButton = $('#startButton');\n\n $('#numPlayers').html(clientGame.users.length);\n\n if(clientUser.isHost){\n $startButton.show();\n $('#lobbyCode').html(clientUser.room);\n $('#lobbyDisplay').show();\n }\n\n if(clientGame.users.length >= MIN_P...
[ "0.6033216", "0.5880964", "0.5865336", "0.58643943", "0.5843389", "0.5832632", "0.56979996", "0.56642026", "0.5633303", "0.5614218", "0.55973536", "0.55948997", "0.55424845", "0.55245066", "0.5516533", "0.5483288", "0.54792356", "0.54606414", "0.5457999", "0.54569966", "0.545...
0.55289644
13
Called after a host is selected from the list. Informs the server of this selection and starts the game
function selectHost(listItem) { console.log($(listItem).data('index')); console.log(hostList[$(listItem).data('index')]); getAjax("https://webgamesdev-blaircalderwood.c9.io/selectHost?name=" + playerName + "&selectedName=" + hostList[$(listItem).data('index')], playGame); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function HostGame() {\n\t// Your code goes here for hosting a game\n\tprint(\"Complete this method in Multiplayer.js\");\n}", "selectOption() {\n switch ( this.index ) {\n case 0:\n this.scene.start( 'GameScene' );\n break;\n }\n }", "function onStart(data) {\n\t\tconsole.log(\"Player...
[ "0.5947738", "0.58840704", "0.5822474", "0.5740065", "0.57329327", "0.5701396", "0.5649041", "0.5634967", "0.55494195", "0.5527553", "0.5503711", "0.5497301", "0.5494891", "0.54491544", "0.5444033", "0.543518", "0.5426914", "0.54094696", "0.5399872", "0.5398048", "0.5387267",...
0.5683561
6
Set the team colour and play the game
function playGame(data) { playerTeam = "red"; console.log(JSON.parse(data)); startGame(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function switchTeams() {\n // Determine the current team\n if(playerOne) {\n playerColour = \"#F07167\";\n playerName = \"One\";\n playerOne = false;\n }\n else {\n playerColour = \"#5386E4\";\n playerName = \"Two\";\n playerOne = true;\n }\n}", "playerTea...
[ "0.74868804", "0.68950874", "0.68333", "0.66687995", "0.6662496", "0.6653981", "0.6636463", "0.6630085", "0.6574894", "0.65073204", "0.6431633", "0.6430924", "0.63725466", "0.6339973", "0.6303468", "0.6295066", "0.6285475", "0.62608385", "0.6253034", "0.6219611", "0.6217846",...
0.0
-1
If the player has chosen to be a host inform them that the game will start once a player joins then periodically check the server for a joined player
function hostWait(availability) { var playerList = $("#playerList"); if (availability !== "false") { playerList.html("<h1 style='color: white;'><b>Game created. Waiting for player to join</b></h1>"); hostTimer = setInterval(function () { getAjax("https://webgamesdev-blaircalderwo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function onJoined(player) {\n this.broadcast.emit('joined', player);\n playerDB[this.id] = player;\n\n if (_.size(playerDB) === minPlayers) {\n this.broadcast.emit('resume');\n if (!hasStarted) startNewGame(); }\n if (_.size(playerDB) < minPlayers)\n this.emit('pause', 'Waiting for...
[ "0.680986", "0.67659676", "0.6540254", "0.640956", "0.64039236", "0.64020187", "0.6374153", "0.63527673", "0.6328559", "0.6315698", "0.6307075", "0.6301805", "0.62557805", "0.6249954", "0.6235176", "0.62245786", "0.6217455", "0.6216811", "0.62101674", "0.61828893", "0.6179464...
0.6842982
0
Play the game once another player joins the host
function playerJoined(data) { if (data !== "false") { playerTeam = "blue"; console.log(data); clearInterval(hostTimer); startGame(); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function joinGameAsPlayer() {\n // check if ingame true\n\n}", "function onJoined(player) {\n this.broadcast.emit('joined', player);\n playerDB[this.id] = player;\n\n if (_.size(playerDB) === minPlayers) {\n this.broadcast.emit('resume');\n if (!hasStarted) startNewGame(); }\n if (_.si...
[ "0.75125355", "0.7173943", "0.714324", "0.7057411", "0.6922838", "0.68488336", "0.68099576", "0.6808624", "0.6743228", "0.67412204", "0.6723833", "0.66974586", "0.6661325", "0.6660465", "0.6655671", "0.66463023", "0.66405976", "0.66383713", "0.66271824", "0.6624626", "0.66020...
0.0
-1
Game methods Handler for game over
function gameover() { ctx.font = "30px Arial"; ctx.fillText("Game Over.", canvas.width / 2 - 70, canvas.height / 2 - 125); ctx.fillText("You failed to collect 100 coins.", canvas.width / 2 - 200, canvas.height / 2 + 50); ctx.fillText("Better luck next time!", canvas.width / 2 - 150, canvas.height / ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "handleGameOverEvent() {\n \n }", "function gameOver(){\n \tconsole.log(\"game over\");\n \t_onGameOver();\n }", "gameOverAction() {\n\n }", "function gameOver() {\r\n disableActions();\r\n }", "function gameover() {\n home();\n }", "function handleEndGame() {...
[ "0.8064792", "0.7979514", "0.7927798", "0.7532013", "0.7529385", "0.74688035", "0.74382144", "0.7341418", "0.7328889", "0.7314911", "0.731264", "0.7221155", "0.7202873", "0.7170271", "0.7148913", "0.70977855", "0.7097312", "0.7093442", "0.70688665", "0.7033931", "0.70244396",...
0.0
-1
Tesla bike mode toggle
function modeOn() { if (teslaUsed) return; document.getElementById("teslaMode").style.display = "none"; $("#normalMode").fadeIn("slow"); yeah.play(); hero.teslaSpeed(); teslaMode = teslaUsed = true; themeMusic.pause(); rideMusic.play(); setTimeout(modeOff, 10E3); // tesla mo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "changeMode() {\n this.attendBooths = !this.attendBooths;\n }", "function switchwater() {\n clearTimeout(timeout);\n if (this.value === \"on\") {\n showpies()\n d3.select(\".waterswitchlabel\").text(\"hide\");\n }else if(this.value === \"off\"...
[ "0.7494418", "0.69864136", "0.69582963", "0.6931047", "0.68621725", "0.674524", "0.6630584", "0.6580049", "0.6500136", "0.649807", "0.6486934", "0.6474748", "0.6465462", "0.6429087", "0.63831294", "0.63564", "0.6353443", "0.6346272", "0.6318024", "0.6311344", "0.629699", "0...
0.6576809
8
Pause menu Pause menu item higlights
function highlight(selectedMenuButton, startX, buttonSpacing, sideLength) { var buttonX = startX + selectedMenuButton * buttonSpacing; var buttonY = 180; ctx.beginPath(); ctx.moveTo(buttonX, buttonY); ctx.lineTo(buttonX, buttonY + sideLength); ctx.lineTo(buttonX + sideLength, buttonY + s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function PauseMenu() {\n\tDisable();\n\tpauseMenu.SetActive(true);\n}", "function pauseGame()\n {\n toMenu();\n }", "function pauseMenu()\n{\n\tif(!paused)\n\t{\n\t\tnoLoop();\n\t\tdocument.getElementsByClassName(\"menu\")[0].style.visibility = \"visible\";\n\t\tdocument.getElementById(\"menubackd...
[ "0.7423328", "0.7410938", "0.71459734", "0.6814597", "0.6740315", "0.6649941", "0.6597782", "0.6557966", "0.65388423", "0.65388423", "0.65388423", "0.65388423", "0.65388423", "0.6506823", "0.64950746", "0.6476747", "0.6476671", "0.6408526", "0.6407757", "0.63894457", "0.63865...
0.0
-1
Handle pause menu item actions
function menuButtonAction(selectedMenuButton) { switch (selectedMenuButton) { case 0: console.log("Resume"); onPause = false; break; case 1: muteAll(); console.log("Mute: " + audio.muted); break; case 2: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function pauseGame()\n {\n toMenu();\n }", "function PauseMenu() {\n\tDisable();\n\tpauseMenu.SetActive(true);\n}", "function onPauseClick(e) \n\t{\n\t\tvar btn = e.target,uploader = btn.parent('li').data('uploader');\n\t\tif (btn.hasClass('paused'))\n\t\t{\n\t\t\tbtn.removeClass('paused').text('P...
[ "0.72669137", "0.70513964", "0.7003554", "0.6821036", "0.68064356", "0.67873573", "0.67745453", "0.6763676", "0.6654791", "0.6654791", "0.6654791", "0.6654791", "0.6654791", "0.6645825", "0.6556135", "0.64825284", "0.6469094", "0.6456911", "0.6453248", "0.6450847", "0.641001"...
0.6462921
17
Draw and update loops Update game objects
function update(modifier) { if (onPause) return; if (gameEnded) return; hero.move(modifier); // Check for collision with coin if ( hero.x <= (coin.x + 32) && coin.x <= (hero.x + 32) && hero.y <= (coin.y + 32) && coin.y <= (hero.y + 32) ) { +...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "update(){\r\n this.draw();\r\n }", "function update() {\r\n paintCanvas();\r\n platformCalc();\r\n\r\n springCalc();\r\n\r\n playerCalc();\r\n player.draw();\r\n\r\n base.draw();\r\n\r\n updateScore();\r\n }", "function drawUpdate() {\r\n\tdrawBread();\r\n\tdrawEggs();\r\n\tdraw...
[ "0.77521133", "0.77041286", "0.7697821", "0.76267815", "0.75727016", "0.7520414", "0.75116956", "0.7452909", "0.742998", "0.7429398", "0.7389475", "0.73120975", "0.7309836", "0.73015183", "0.7297821", "0.727027", "0.72687626", "0.72606695", "0.7254832", "0.7252793", "0.724235...
0.0
-1
Used in a few methods
function showFriends (friends, requests) { friendsList = new Array(); var monthNames = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"]; var sessionUserFriends = new Array(); $.ajaxSetup({async:false}); $.getJSON( "/ap...
{ "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() {}", "transient protected internal function m189() {}", "transient private internal function m185() {}", "static private internal fun...
[ "0.6864618", "0.6784703", "0.6627525", "0.6566266", "0.65453255", "0.6436847", "0.62372714", "0.6204061", "0.60951394", "0.59664935", "0.58976895", "0.5896599", "0.58810943", "0.5847244", "0.5803387", "0.574468", "0.5742194", "0.57390755", "0.56669056", "0.5614568", "0.553028...
0.0
-1
Retrieve the latest 10 visit records from the database.
function getVisits() { const query = datastore .createQuery('visit') .order('timestamp', {descending: true}) .limit(10); return datastore.runQuery(query); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getTop10(){\n return DBA.query(\"SELECT * FROM friend order by debt desc LIMIT 10\")\n .then(function(result){\n return DBA.getAll(result);\n });\n }", "function getTop10() {\n return DBA.query(\"SELECT * FROM friend order by case when debt <> 0 then 0 else ...
[ "0.68726987", "0.6422646", "0.6406893", "0.6278072", "0.6083001", "0.6007861", "0.59923613", "0.594611", "0.5940676", "0.5833504", "0.5825082", "0.57180023", "0.5667082", "0.5596197", "0.5544506", "0.554035", "0.5512036", "0.54962313", "0.54822475", "0.54357296", "0.5424521",...
0.6929433
0
Print all declared variables into the variables window
function printVars() { var d = ""; var p = ""; var l = ""; var c = ""; var g = ""; var total = ""; for (var i = 0; i < distanceVariables.length; i++) //Add all declared distance variables to the total string d += distanceVariables[i] + ', '; if (d.length > 0) total += 'Distance: ' + d + '<br>';...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function allVariablesInfo() {\n\t\tconsole.log(\"------ ALL VARIABLE DUMP ------\");\n\t\tconsole.log(\"intervalId: \" + intervalId);\n\t\tconsole.log(\"cardsArray: \" + cardsArray);\n\t\tconsole.log(\"urlArray: \" + urlArray);\n\t\tconsole.log(\"indexArray: \" + indexArray);\n\t\tconsole.log(\"userName: \" + user...
[ "0.7094985", "0.68958986", "0.68497837", "0.66139877", "0.6266587", "0.6182594", "0.61807835", "0.613657", "0.612772", "0.6110597", "0.6102192", "0.6074247", "0.6070382", "0.6051512", "0.5997169", "0.5991477", "0.5991405", "0.59837765", "0.5978515", "0.5953418", "0.59428924",...
0.7348042
0
Creates a ticket record with a transcation, because it does not affect the user's balance.
*embark( opts ) { return yield this.create( Object.assign( { state: 'embark' }, opts ) ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function createTransaction(companyName, companyId, invoiceNum, vendorId, total, sheetId) {\n\tdb.Transaction.create({\n\t\tcompanyName: companyName,\n\t\tcompanyId: companyId,\n\t\tinvoiceNumber: invoiceNum,\n\t\tvendorId: vendorId,\n\t\ttotal: total,\n\t\tSheetId: sheetId\n\t}).then(function(result) {\n\t\tconsol...
[ "0.63817275", "0.6319082", "0.5935524", "0.5924071", "0.5889112", "0.58450174", "0.5819944", "0.57774484", "0.57746947", "0.5772336", "0.56946933", "0.56917506", "0.56846786", "0.56675637", "0.56560266", "0.56527", "0.56390005", "0.5631934", "0.56262815", "0.5617149", "0.5591...
0.0
-1
start up a new view
start () { // Draw the starting point for the view with no elements }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function startDemo() {\n View.set('Demo');\n }", "function View(){}", "function start_view() {\n editor_visibility(true);\n button_visibility('view-mode');\n d3.json(resource_url(), editor_callback);\n}", "function View() {}", "function View() {}", "function View() {}", "function Vie...
[ "0.701524", "0.69787675", "0.68638796", "0.68558776", "0.68558776", "0.68558776", "0.68558776", "0.6834062", "0.6746637", "0.6746637", "0.6727239", "0.6727239", "0.6727239", "0.6701964", "0.6623613", "0.66230017", "0.6588227", "0.653526", "0.64618266", "0.64604014", "0.644816...
0.0
-1
remove an element from the view
removeElements (elems, checkFunc) { // checkFunc returns true if an element is to be deleted super.removeElements (elems, checkFunc); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "remove() {\n this.element.remove();\n }", "removeElement() {\n this.el.parentNode.removeChild(this.el);\n }", "remove() {\n this.#el.remove();\n }", "remove() {\n this._item = null;\n this.render();\n }", "static remove(v) {\n // Find view\n let element = UI.fin...
[ "0.7981867", "0.78307074", "0.77686954", "0.76853126", "0.76306564", "0.7523564", "0.7446553", "0.73669815", "0.7355129", "0.7351387", "0.7310213", "0.7310213", "0.73044103", "0.7286139", "0.71340036", "0.7130333", "0.709504", "0.7091897", "0.7091897", "0.7091897", "0.7091897...
0.0
-1
Is an element in the model
isElementOverModel (element) { // NTS: Element here is the div return this.modelDivHelper.elementOver (element); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "exists() {\n const model = internal(this).model;\n return internal(model).entities.contains(this);\n }", "exists() {\n const entity = internal(this).entity;\n const model = entity.model();\n return internal(model).components.contains(this);\n }", "exists() {\n ...
[ "0.68909407", "0.6845366", "0.66831887", "0.6643839", "0.6643839", "0.65860516", "0.6530226", "0.6459609", "0.64591455", "0.6441547", "0.63800496", "0.63611186", "0.63603073", "0.63396454", "0.62792826", "0.6209021", "0.614156", "0.61385864", "0.6131184", "0.60934806", "0.609...
0.7098495
1
draw an element within the model
drawWithinModel (element) { var pos = this.modelDivHelper.randomPosition (); element.moveTo (pos); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "drawWithinModel (element, data) {\n if (!data) return false;\n\n var x = data.x;\n var y = data.y;\n\n var pos = this.modelDivHelper.fromOffset ({\n top: y,\n left: x\n })\n\n element.moveTo ({\n top: pos.top,\n left: x\n });\n }", "draw(){\n for(var i=0;i<this.el...
[ "0.7502172", "0.7336168", "0.67988414", "0.67674524", "0.67574775", "0.66090405", "0.6583478", "0.6583478", "0.6583478", "0.65318805", "0.65171903", "0.64971775", "0.6470053", "0.64528096", "0.64528096", "0.64528096", "0.64528096", "0.63865876", "0.6370154", "0.63249534", "0....
0.80786836
0
Initialise the 'map' object
function init(watch, vlon, vlat) { if(!window.localStorage["capCodes"]) { $("#popupSettings").show(); } if (window.localStorage["useOfflineMaps"]=="true"){ if (window.localStorage["versionCodeMaps"]){ $.ajax({ url: 'http://api.brandweer.smapps.nl/php/checkMapsVersion.php', typ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function initMap() {\n}", "function initMap() {\n map = new ExploreMap();\n}", "function Init()\n{\n // write code here\n map = {};\n}", "function initialize() {\n\t\tmap = new FilmMap();\n\t\tmap.init();\n\t}", "function init(){\n basemap();\n}", "function makeMap() {\r\n\tif (map == \"\") {\r...
[ "0.8546145", "0.82486826", "0.77228105", "0.7696373", "0.76866585", "0.74044913", "0.737132", "0.73662925", "0.7362525", "0.7347119", "0.7342288", "0.7322779", "0.7316433", "0.7302484", "0.7302484", "0.73008025", "0.7285567", "0.7263903", "0.7237762", "0.7215421", "0.7202635"...
0.0
-1
Check if Audio permissions have been granted
async function checkAudioPermissions() { const { status: currentStatus } = await Audio.getPermissionsAsync(); var foundStatus = currentStatus; if (currentStatus !== "granted") { const { status } = await Audio.requestPermissionsAsync(); foundStatus = status; } setFinalStatus(foundStatus =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function checkPermissions(){\n navigator.permissions.query(\n { name: 'microphone' } \n).then( (permissionStatus) => {\n if(permissionStatus.state === 'granted'){\n permissionGiven = true;\n }\n permissionStatus.onchange = function(){\n console.log(\"Permission changed to \" + this.state);...
[ "0.7143428", "0.67506075", "0.6198663", "0.6155736", "0.60678184", "0.60586697", "0.60382956", "0.6028152", "0.59688294", "0.5947757", "0.5939496", "0.5869214", "0.58435255", "0.58253676", "0.5822022", "0.5809896", "0.5800668", "0.5787599", "0.5777358", "0.576218", "0.5704466...
0.8441793
0
Handles clicks on bus stops
stopClickHandler(clickedMarker) { const newMarkers = [...this.state.markers]; newMarkers.forEach(marker => marker.showInfo = false) const index = this.state.markers.findIndex(marker => marker.stopId === clickedMarker.stopId) fetch(`http://localhost:3000/busStopRoutes?stopId=${clickedMarker.stopId}`) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "onStopClicked(){\n console.log(\"in stop\");\n }", "onStopClick ()\n {\n clearInterval(this.interval);\n this.interval = null;\n this.lastUpdated = null;\n }", "function handleStop() {\n\tif (DEBUG) console.log(\"stopping\");\n\tRUNNING = false;\n\tdocument.getElementById(\...
[ "0.67307806", "0.64553356", "0.64529073", "0.6376212", "0.63190734", "0.62553", "0.62223023", "0.6203779", "0.61972874", "0.6087015", "0.6072994", "0.6041493", "0.6038377", "0.6016616", "0.5989622", "0.5969243", "0.5966519", "0.59410876", "0.5927369", "0.59247065", "0.5892315...
0.0
-1
Run this every time $scope.columns changes until it's valid
function whileColumnsNotSet() { // Only act when the data has been filled in if ($scope.data.length > 0) { // Auto-generate columns if the user hasn't created them yet. if ($scope.columns.length === 0) { $scope.columns = Object.keys($scope.data[0]) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function updateTableColumns(){\n //filters = $scope.tableColumns; //master filter list from client \n $scope.columns = _.filter($scope.tableColumns,function(d){\n return d.enabled;\n });\n\n filters = $scope.columns; //master filter list from client \n\n $scope.columns.forEach(function(d){\n ...
[ "0.66543657", "0.66176385", "0.6168537", "0.6089675", "0.6088393", "0.6072732", "0.6038212", "0.6009294", "0.6008942", "0.5997622", "0.5996906", "0.5965973", "0.5963296", "0.5923757", "0.59179205", "0.58917594", "0.58879924", "0.5886539", "0.5877658", "0.5826572", "0.5821213"...
0.75833666
0
Listen for activity change
function createAlert(alertMsg) { swal(alertMsg); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function setActivity( newActivity ){\n active = newActivity;\n\n Broadcaster.sendMessage({\n action: \"sync:activitystatechanged\"\n });\n }", "function checkActivity() {\n\t//console.log(\"checkActivity initialized\");\n\t// Check for changing tab\n\tchrome.tabs.onActivated.addListener(...
[ "0.6580184", "0.6537273", "0.64944816", "0.64236736", "0.6253558", "0.6128478", "0.6117339", "0.5944971", "0.5769448", "0.5751328", "0.5738848", "0.5656026", "0.5628511", "0.55881435", "0.55862886", "0.558213", "0.5581029", "0.55524373", "0.55502987", "0.5516592", "0.55164754...
0.0
-1
Load all the models
function preload() { focusedClassifier = ml5.imageClassifier(focusedModelUrl + "model.json"); suspiciousClassifier = ml5.imageClassifier(suspiciousModelUrl + "model.json"); identityClassifier = ml5.imageClassifier(identityModelUrl + "model.json"); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async loadModels() {\n let allModels = [];\n\n for (const [, modulePath] of this.api.modules.modulesPaths) {\n const modelFiles = this.api.utils.recursiveDirectoryGlob(\n `${modulePath}/models`\n );\n const processedModels = await this.processModelsFiles(modelFiles);\n allModels = ...
[ "0.78804576", "0.7476595", "0.74610734", "0.72173923", "0.71037567", "0.7049784", "0.69906527", "0.698745", "0.6904202", "0.68425536", "0.682218", "0.6809184", "0.66772324", "0.6634388", "0.6632286", "0.6626054", "0.6541132", "0.6540636", "0.6528715", "0.648328", "0.6477898",...
0.56694543
92
Getting Local IP Credit: License: get the IP addresses associated with an account
function getIPs(callback){ var ip_dups = {}; //compatibility for firefox and chrome var RTCPeerConnection = window.RTCPeerConnection || window.mozRTCPeerConnection || window.webkitRTCPeerConnection; var useWebKit = !!window.webkitRTCPeerConnection; //bypass naive webrtc blocking us...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function get_local_ip_addresses(){\n if (ipAddr ) return ipAddr; //only do detecion once..\n ipAddr = [];\n\n console.error(\"Detecting Local IP Addresses..\");\n var ifaces=os.networkInterfaces();//this doesn't work on windows node implementation yet :( - April 5 2012\n for (var dev in ifaces) {\n var ali...
[ "0.60917526", "0.5985592", "0.58596265", "0.5794315", "0.57123977", "0.57016426", "0.5685063", "0.5672106", "0.56478524", "0.5611032", "0.56073093", "0.55810225", "0.5544526", "0.553363", "0.5519785", "0.550567", "0.5502778", "0.5497876", "0.5497876", "0.5470629", "0.5469188"...
0.48293158
99
expects req.body to have the following properties: user_id, event_id, and url.
function addOne(req,res){ console.log('creating new photo record with these parameters:', req.body); new Photo(req.body) .save(); res.status(201).end(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function processEvent(event) {\n const { body, pathParameters, queryStringParameters, requestContext } = event\n const { httpMethod, resourceId, resourcePath, requestId } = requestContext\n\n return {\n body: body && bourne.parse(body),\n queryStringParameters,\n pathParameters\n }\n}", "function pa...
[ "0.5974095", "0.56907916", "0.56128657", "0.5512529", "0.5489679", "0.5488833", "0.54032236", "0.5390964", "0.5373585", "0.53668725", "0.5361418", "0.53590405", "0.5356401", "0.53562057", "0.535396", "0.5341948", "0.5330537", "0.53244305", "0.5305189", "0.52658135", "0.526463...
0.0
-1
deletes a photo record from the DB, if it exists and the request is coming from that photo's owner. does NOT do anything to remove the photo from the S3 server!
function deleteOne(req,res){ Photo.where({id:req.params.id}).fetch({ }).then(function (record) { //delete the record if(record && record.user_id===req.params.user_id){ record.destroy() .on('destroyed',function(){ res.status(204).end(); }); //unauthorized ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "deletePhoto() {\n\n // Get user\n let user = this.get('model');\n let url = this.get('photoDataUrl');\n\n // Delete the photo\n const deleteRequest = this.get('ajax').delete(url);\n\n // Handle success\n deleteRequest.then(()=> {\n user.set('photo', null);\n this.ge...
[ "0.7379382", "0.7121202", "0.702769", "0.6947689", "0.6945123", "0.6939087", "0.68380606", "0.68118435", "0.67688876", "0.66963196", "0.6637784", "0.65715617", "0.6556134", "0.6502259", "0.64808965", "0.647015", "0.6423695", "0.63899374", "0.6388753", "0.63829637", "0.6363212...
0.74250066
0
You can extend webpack config here
extend(config, ctx) { config.devtool = "source-map"; // Run ESLint on save if (ctx.isDev && ctx.isClient) { config.module.rules.push({ enforce: "pre", test: /\.(js|vue)$/, loader: "eslint-loader", exclude: /(node_modules)/, options: { ...
{ "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.6904401
30
bring json data outside init function
function init() { // CODE BLOCK FOR GEO JSON - TODD //API call to get geojson data // var queryUrl = "https://earthquake.usgs.gov/fdsnws/event/1/query?format=geojson&starttime=2009-01-01&endtime=2016-12-31&minmagnitude=5.0"; // d3.json(queryUrl, createMarkers); // function ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "init() {\n this.jsonInit(this.definition());\n }", "loadJsonData() {\n }", "function initialize(){\n\t\tgetJSON('https://gist.githubusercontent.com/akashravi7/ce6dbf5a91716613ec09aac2544b99d3/raw/23028c2ab28a430518c0dac267df51747d4b7d72/cirtual_challenge_data.json', function(err, data) {\n\t\tif (...
[ "0.7589096", "0.71528536", "0.7144123", "0.68626344", "0.6799998", "0.6773986", "0.6693344", "0.6621298", "0.6606983", "0.6587856", "0.65825105", "0.6454052", "0.6403727", "0.6363049", "0.63208723", "0.6315785", "0.63129276", "0.62983274", "0.6298279", "0.6287776", "0.6257915...
0.0
-1
function to update scatter graph based on drop down menu
function updatePlotly1(newdata) { var scatter = document.getElementById("scatter"); Plotly.restyle(scatter, "y", [newdata]) //.transition() //.duration(500); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function optionChanged() {\n\tdropDownMenu=d3.select('#selDataset');\n\tid=dropDownMenu.property('value');\n\tconsole.log(id);\n\tbuildPlot(id);\n\n}", "function optionChanged(selection) {\n // Select the input value from the form\n plottingAll(selection);\n}", "function dropdownSelectionOutgoing(s){\n ...
[ "0.74026465", "0.7319989", "0.7293176", "0.72400236", "0.72052276", "0.7185148", "0.7173529", "0.7129572", "0.71075475", "0.710705", "0.70660293", "0.7036008", "0.6953544", "0.6947332", "0.6915941", "0.6905649", "0.6853474", "0.6847892", "0.6847575", "0.6846496", "0.6846493",...
0.0
-1
function to update line graph
function updatePlotly2(newdata) { var line = document.getElementById("line"); Plotly.restyle(line, "y", [newdata]) // Plotly.restyle(line, "title", raw_data.points[0].state + ": Socioeconomic Variable vs Years") }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function update(data) {\n\n //Axis x and x\n x.domain([0, d3.max(data, function (d) { return d.ser1 })]);\n VisAreaExam.selectAll(\".theXaxis\").transition()\n .duration(3000)\n .call(xAxis);\n\n\n y.domain([0, d3.max(data, function (d) { return d.ser2 })]);\n VisAreaExam.selectAll(\"....
[ "0.78057003", "0.7684312", "0.75358534", "0.7460255", "0.733014", "0.7275364", "0.72472525", "0.7223915", "0.7212249", "0.7212249", "0.71923", "0.71633786", "0.7152209", "0.7143433", "0.71418065", "0.7138339", "0.71289486", "0.705408", "0.70463413", "0.7035713", "0.7023042", ...
0.65225315
58
Once the first button is clicked, obtains the question, and prompts the user to answer If correct, says well done, if not incorrect and ultimately disables the button.
function getQuestion() { var a = prompt('During prohibition this family of rum makers invited Americans to Cuba for weekend-long parties?') if (a.toLowerCase() === 'bacardi') { alert('Well Done. Correct answer') score += 200; scoreHtml.innerHTML = `Your score is ${score}`; } els...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function clickOn1(){if(goodAnswer == 1){ correctAnswerClick(1); }else{ badAnswerClick(1); }}", "function checkIfCorrect(){\r\n $('main').on('click', 'input', function(){\r\n if($(this).val() == store.questions[store.questionNumber + 1].correctAnswer){ \r\n isCorrect();\r\n lockChoice(); \r\n ...
[ "0.7386091", "0.7234757", "0.71444976", "0.7104841", "0.7082574", "0.7009352", "0.6966756", "0.69638264", "0.69555324", "0.69440645", "0.6884822", "0.68793184", "0.6870026", "0.68619543", "0.6852012", "0.6846754", "0.6845304", "0.6827115", "0.67874604", "0.6753395", "0.674359...
0.6787769
18
grabs the category 2 questions and answers
function cat2GetQuestion() { var a = prompt('During prohibition this family of rum makers invited Americans to Cuba for weekend-long parties?') if (a.toLowerCase() === 'bacardi') { alert('Well Done. Correct answer') score += 200; scoreHtml.innerHTML = `Your score is ${score}`; } ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function catAndQuest() {\n\tstart.style.display = 'none';\n\tshowButtons();\n\n\tdocument.getElementById('points').innerHTML= 'Points: ' + (points);\n\tdocument.getElementById('count').innerHTML= 'Question ' + (++count) + ' \\/ 5';\n\n\tcurrentCategory = Questions.map(function(question) {\n \treturn question.ca...
[ "0.6656284", "0.6258781", "0.61843073", "0.60125124", "0.60113764", "0.5986626", "0.59525925", "0.5921638", "0.5877596", "0.58503914", "0.5736733", "0.5727946", "0.57093734", "0.566588", "0.56413424", "0.5635739", "0.5629488", "0.55980146", "0.557718", "0.5572312", "0.5564866...
0.0
-1
grabs the category 3 questions and answers for button clicks
function cat3GetQuestion() { var a = prompt('During prohibition this family of rum makers invited Americans to Cuba for weekend-long parties?') if (a.toLowerCase() === 'bacardi') { alert('Well Done. Correct answer') score += 200; scoreHtml.innerHTML = `Your score is ${score}`; } ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function handleClick(evt, categories) {\n let target = evt.target;\n let card = (target.nodeName==='DIV') ? $(target): (target.nodeName==='I'|| target.nodeName==='P') ? $(target.parentElement):null;\n if(!card) return;\n let id =card.attr('data-question-id');\n let clues = categories.map((cat)=>cat....
[ "0.7173908", "0.705716", "0.7039542", "0.6945906", "0.68714017", "0.67493844", "0.6740799", "0.6570802", "0.6488817", "0.64866155", "0.6478255", "0.64500886", "0.6439402", "0.6427764", "0.64196986", "0.641746", "0.6414192", "0.64105237", "0.6407239", "0.6385811", "0.63805646"...
0.0
-1
grabs the category 4 questions and answers for button clicks
function cat4GetQuestion() { var a = prompt('During prohibition this family of rum makers invited Americans to Cuba for weekend-long parties?') if (a.toLowerCase() === 'bacardi') { alert('Well Done. Correct answer') score += 200; scoreHtml.innerHTML = `Your score is ${score}`; } ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function handleClick(evt, categories) {\n let target = evt.target;\n let card = (target.nodeName==='DIV') ? $(target): (target.nodeName==='I'|| target.nodeName==='P') ? $(target.parentElement):null;\n if(!card) return;\n let id =card.attr('data-question-id');\n let clues = categories.map((cat)=>cat....
[ "0.7114467", "0.70292634", "0.7012401", "0.6989246", "0.69848377", "0.68208677", "0.6675645", "0.6664732", "0.66629434", "0.66455823", "0.65906304", "0.6587857", "0.6586657", "0.6577875", "0.6562168", "0.65439963", "0.6522107", "0.64620334", "0.6456641", "0.6450588", "0.64499...
0.0
-1
grabs the category 5 questions and answers for button clicks
function cat5GetQuestion() { var a = prompt('During prohibition this family of rum makers invited Americans to Cuba for weekend-long parties?') if (a.toLowerCase() === 'bacardi') { alert('Well Done. Correct answer') score += 200; scoreHtml.innerHTML = `Your score is ${score}`; //adds sco...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function catAndQuest() {\n\tstart.style.display = 'none';\n\tshowButtons();\n\n\tdocument.getElementById('points').innerHTML= 'Points: ' + (points);\n\tdocument.getElementById('count').innerHTML= 'Question ' + (++count) + ' \\/ 5';\n\n\tcurrentCategory = Questions.map(function(question) {\n \treturn question.ca...
[ "0.70810145", "0.69278586", "0.69266534", "0.6882105", "0.68200064", "0.6741211", "0.66292983", "0.66099536", "0.65152615", "0.6509749", "0.6509027", "0.64908683", "0.6487811", "0.6487213", "0.6464664", "0.64395803", "0.6433287", "0.64297", "0.6426858", "0.6426793", "0.638816...
0.0
-1
Check the validity of every text input field on the page. Scans all of the text input objects and checks their validity, marking them as appropriate.
function checkAll() { jQuery("input[type='text']").each(function() { check(this, this.name); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function SP_ValidateTextFields() {\n\tvar pageList = new String(mcEditablePages).split(','),\n\t\ttxtVal = '';\n\n\tif (SP_Trim(pageList) !== '') {\n\t\tfor (var i = 0, l = pageList.length; i < l; ++i) {\n\t\t\tvar pageId = +SP_Trim(pageList[i]) + 1;\n\t\t\t\n\t\t\tif (pageId > 2) {\n\t\t\t\tif (pageId < 10) {\n\t...
[ "0.6774404", "0.652038", "0.6452121", "0.64267635", "0.6405952", "0.63158256", "0.61016744", "0.6033227", "0.60007226", "0.5946982", "0.59259695", "0.5924209", "0.5905389", "0.5897733", "0.589414", "0.5891856", "0.58488107", "0.5831492", "0.5828405", "0.58168656", "0.5785732"...
0.67898405
0
Handling all of our errors here by alerting them
function handleError(error) { if (error) { alert(error.message); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function errorHandler(){\n\tconsole.log (\"Sorry, your data didn't make it. Please try again.\");\n}", "function errorHandler(err) {\n //alert(\"An error occured\\n\" + err.message + \"\\n\" + err.details.join(\"\\n\"));\n }", "function handleError() {\n // TODO handle errors\n /...
[ "0.743475", "0.72963834", "0.7179921", "0.70530874", "0.7008686", "0.69549143", "0.69403315", "0.68935585", "0.68892765", "0.6887014", "0.6877672", "0.68568206", "0.68559664", "0.6825405", "0.6795624", "0.6783796", "0.6783796", "0.6780673", "0.67690265", "0.6758418", "0.67513...
0.65968233
44
loadCanvas requests for the canvas object from the server for the project which the user wants to view. Once the canvas has been loaded, we hook the socket handlers and canvas handlers and reset the state.
loadCanvas(projectName, sessionIdentifier) { console.log(`Received a request to loadCanvas, name: ${projectName}, ${sessionIdentifier}`); api.getCanvasJSON(projectName) .then((json)=> { var canvas = this.state.canvas; if (canvas == null) { canvas = new fabric.Canvas('c', { ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function startload() {\n\n //Create dafault canvas\n data = [];\n drawCanvas(data);\n}", "function initCanvas() {\n if(isDebugged) {\n debug.style.display = \"block\";\n } else {\n debug.style.display = \"none\";\n }\n\n console.log(\"initializing canvas\");\n\n //var canva...
[ "0.6364244", "0.6246386", "0.6001338", "0.5937645", "0.5885124", "0.5881181", "0.57793874", "0.5762909", "0.57481426", "0.5748008", "0.57478243", "0.5712874", "0.5711636", "0.5706335", "0.5683533", "0.5635245", "0.56325436", "0.562728", "0.5611441", "0.5604249", "0.55875516",...
0.77625835
0
socketEventHandlers wire up the socket events to the changes that needs to be done to the existing canvas.
socketEventHandlers(canvas) { console.log(`Received a request to wire up the socket handlers`); if (canvas == null ) { console.log(`Canvas not loaded, not wiring any event handlers`); return; } /** * EVENT: `object:removed` is fired by the server sockets * when the client is con...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function newConnection(socket) {\n var thisID;\n console.log('new connection: ' + socket.id);\n //store all user IDs here paired with their socket ID\n allSocketID[IDindex] = socket.id;\n\n socket.on(\"newDrawing\", sendNewDrawings);\n socket.on(\"newMouseClick\", sendNewMouseClick);\n socket....
[ "0.7245851", "0.70319295", "0.6935654", "0.676414", "0.6668445", "0.65967804", "0.64809453", "0.64160585", "0.6388941", "0.6358625", "0.63468975", "0.63435316", "0.6316243", "0.62764585", "0.6244935", "0.62273943", "0.6221573", "0.6205302", "0.61922723", "0.6181605", "0.61789...
0.7423278
0
canvasEventHandlers add handlers to the events from the canvas. This is done to emit out the operations done by the user to the canvas.
canvasEventHandlers(canvas) { if (canvas == null) { return; } console.log(`Received a request to wire up the canvas event handlers`); /** * **/ canvas.on('object:added', (e) => { if (e.target.id != null) { return; } e.target.id = uuid4(); /** ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function addMouseHandler(canvas) {\n canvas.addEventListener('mousemove', onMouseMove, false);\n canvas.addEventListener('mousedown', onMouseDown, false);\n canvas.addEventListener('mouseup', onMouseUp, false);\n canvas.addEventListener('mouseleave', onMouseLeave, false);\n}", "function addEventListe...
[ "0.69039375", "0.65847284", "0.62147784", "0.62026954", "0.6158443", "0.6106269", "0.60887194", "0.60559267", "0.59441614", "0.59267914", "0.5907307", "0.5902268", "0.5897914", "0.5835577", "0.57913905", "0.5755768", "0.5753119", "0.573581", "0.5726149", "0.5708495", "0.56991...
0.70403683
0
The canvas object interacts with a lot of external components through props. Therefore whenever the data from the external components will change, this function will be fired. Therefore, we have to check which prop got updated and act accordingly.
componentWillReceiveProps(nextProps) { /** * CHECK 1: In case the user decides to update the project, the canvas component * needs to wipe the state and load the new state by the project which the user needs to load. **/ if ((nextProps.project) && (!this.props.project || (this.props.proj...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "componentDidUpdate() {\n this.updateCanvas();\n }", "componentDidUpdate() {\n\t\tthis.updateCanvas();\n\t}", "componentDidMount() {\n this.updateCanvas();\n }", "componentDidMount() {\n\t\tthis.updateCanvas();\n\t}", "componentDidUpdate(){\n if(this.state.receivedData === true){\n ...
[ "0.67546654", "0.65000534", "0.6456552", "0.63013315", "0.6215605", "0.6085862", "0.60461456", "0.6041053", "0.6027793", "0.6017596", "0.60150176", "0.6004579", "0.59986645", "0.5973891", "0.595521", "0.5947185", "0.5945451", "0.59381604", "0.59240776", "0.5921171", "0.592056...
0.6200775
5
Attach events with the file selector. Handle event to add the image object to the canvas.
handleFileChosen(e) { const file = e.target.files[0]; const reader = new FileReader(); reader.onload = (f) => { var data = f.target.result; fabric.Image.fromURL(data, (img) => { const canvas = this.state.canvas; var oImg = img.set({left: 10, top: 10, angle: 0}).sc...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function handleFileSelect(e) {\n // Prevent default behavior (Prevent file from being opened)\n e.stopPropagation()\n e.preventDefault()\n\n var files = e.dataTransfer.files; // FileList object.\n\n // files is a FileList of File objects\n for (var file of files) {\n // Only process image ...
[ "0.66384536", "0.6547662", "0.6533073", "0.6492321", "0.6393522", "0.6393005", "0.6346745", "0.6268474", "0.62222224", "0.621685", "0.61217564", "0.61156315", "0.61010206", "0.60947216", "0.60679346", "0.6065609", "0.602728", "0.6021624", "0.6015729", "0.6013611", "0.6013068"...
0.5526799
71
(c) 2013, Vladimir Agafonkin Simplify.js, a highperformance JS polyline simplification library mourner.github.io/simplifyjs to suit your point format, run search/replace for '.x' and '.y'; for 3D version, see 3d branch (configurability would draw significant performance overhead) square distance between 2 points
function getSqDist(p1, p2) { var dx = p1.x - p2.x, dy = p1.y - p2.y; return dx * dx + dy * dy; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "static DistanceToPolyLine() {}", "function PlanarCoordinates() {\n var x1 = parseFloat(document.getElementById('x1').value);\n var y1 = parseFloat(document.getElementById('y1').value);\n var x2 = parseFloat(document.getElementById('x2').value);\n var y2 = parseFloat(document.getElementById('y2').valu...
[ "0.60633314", "0.5999512", "0.59498507", "0.59498507", "0.59498507", "0.5885217", "0.58582973", "0.5858165", "0.5854511", "0.5834683", "0.58291197", "0.5813229", "0.57998943", "0.5761992", "0.57534385", "0.57127863", "0.5689662", "0.56413347", "0.56315917", "0.5596026", "0.55...
0.0
-1
square distance from a point to a segment
function getSqSegDist(p, p1, p2) { var x = p1.x, y = p1.y, dx = p2.x - x, dy = p2.y - y; if (dx !== 0 || dy !== 0) { var t = ((p.x - x) * dx + (p.y - y) * dy) / (dx * dx + dy * dy); if (t > 1) { ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function pointToSegmentDistance(p, p1, p2) {\n return Math.sqrt(_sqClosestPointOnSegment(p, p1, p2, true));\n } // @function closestPointOnSegment(p: Point, p1: Point, p2: Point): Number", "function distPointToSegmentSquared(lineX1,lineY1,lineX2,lineY2,pointX,pointY){\n\tvar vx = lineX1 - pointX;\n\tvar vy =...
[ "0.7448752", "0.7203919", "0.69966125", "0.6907675", "0.6904694", "0.68293625", "0.6785856", "0.6779031", "0.6773959", "0.6759039", "0.6759039", "0.67589915", "0.67589915", "0.6752613", "0.6752613", "0.6752613", "0.6752613", "0.6752613", "0.6752613", "0.6752613", "0.67452157"...
0.6706104
28
rest of the code doesn't care about point format basic distancebased simplification
function simplifyRadialDist(points, sqTolerance) { var prevPoint = points[0], newPoints = [prevPoint], point; for (var i = 1, len = points.length; i < len; i++) { point = points[i]; if (getSqDist(point, prevPoint) > sqTolerance) {...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "calculer_distance() {}", "function vectorOfPoints(lat1, lon1, lat2, lon2,displayed_text,displayed_distance,manipulation=0,\n fontLocation=\"Helvetica\", fontSizeLocation=25, fontDistance=\"Helvetica\", fontSizeDistance=25, displayed_amount) {\n var start = 500;\n var length = 490;\n var length_of_text = Math...
[ "0.66135", "0.65656066", "0.6478036", "0.6122248", "0.6035298", "0.59903383", "0.5951771", "0.5913733", "0.59086144", "0.5862187", "0.5859816", "0.5853953", "0.5847556", "0.5845976", "0.5842801", "0.5840065", "0.58126515", "0.5790343", "0.5779425", "0.57688594", "0.5750044", ...
0.0
-1
simplification using RamerDouglasPeucker algorithm
function simplifyDouglasPeucker(points, sqTolerance) { var last = points.length - 1; var simplified = [points[0]]; simplifyDPStep(points, 0, last, sqTolerance, simplified); simplified.push(points[last]); return simplified; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function simplifyDouglasPeucker(points, tolerance) {\n if (points.length <= 1)\n return points;\n tolerance = typeof tolerance === 'number' ? tolerance : 1;\n var sqTolerance = tolerance * tolerance;\n\n var last = points.length - 1;\n\n var simplified = [points[0]];\n simplifyDPStep(point...
[ "0.64976543", "0.6339499", "0.63385683", "0.62610877", "0.62479746", "0.60853577", "0.60853577", "0.60853577", "0.60853577", "0.58547807", "0.56972253", "0.550185", "0.54968834", "0.5467309", "0.54425293", "0.54268134", "0.5425359", "0.5425282", "0.54250246", "0.5411238", "0....
0.6331441
3
both algorithms combined for awesome performance
function simplify(points, tolerance, highestQuality) { if (points.length <= 2) return points; var sqTolerance = tolerance !== undefined ? tolerance * tolerance : 1; points = highestQuality ? points : simplifyRadialDist(points, sqTolerance); points = simplifyDouglasPeuck...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function countInverse(array) {\n\n split(0, array.length - 1);\n // console.log(\"Result:\" + array);\n //console.log(count);\n //console.log(perf + ' ' + array.length * Math.log(array.length));\n\n function split(left, right) {\n // console.log('Split ' + left + \" \" + right)\n ...
[ "0.5465113", "0.5394016", "0.53889096", "0.5325411", "0.53094393", "0.528801", "0.52777106", "0.52777106", "0.52777106", "0.52777106", "0.52743876", "0.52589023", "0.525832", "0.5248231", "0.52325493", "0.5228325", "0.52262664", "0.5204541", "0.51805574", "0.51718116", "0.516...
0.0
-1
Helpers any helper functions should go here or else delete this section
function checkBinaryExpression(node) { if (node.operator !== "*") { return; } if (node.left.type !== "BinaryExpression" || node.left.operator !== "%") { return; } // now check if there for parenthesis if (isNodeGro...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "protected internal function m252() {}", "private internal function m248() {}", "private public function m246() {}", "function _____SHARED_functions_____(){}", "function customHandling() { }", "static private protected internal function m118() {}", "function DWRUtil() { }", "static private internal fu...
[ "0.63125706", "0.62489855", "0.6078946", "0.60310477", "0.5998751", "0.59112424", "0.585116", "0.5807876", "0.57480556", "0.57155704", "0.56312793", "0.56084144", "0.560638", "0.5592031", "0.5592031", "0.5589507", "0.5521872", "0.5520454", "0.55159193", "0.5469997", "0.538382...
0.0
-1
The start game function. This is called when the user selects their hero. Also starts the quiz timer.
function startGame() { questionCounter = 0; score = 0; checkAnswer(); getNewQuestion(); let interval = setInterval(function countDown() { document.getElementById('timeleft').innerHTML = count; count--; if (count === -1) { clearInterval(interval); game...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function startGame() {\n\t\n\t// fill the question div with new random question\n\tgenerateQuestion();\n\t\n\t// start the timer\n\tmoveProgressBar();\n}", "function startGame(){\n countdown();\n question();\n solution();\n }", "function gamestart() {\n\t\tshowquestions();\n\t}", "fun...
[ "0.7799971", "0.7639776", "0.7559177", "0.7500063", "0.7481945", "0.74772626", "0.7415231", "0.73832184", "0.7350409", "0.73384356", "0.73202044", "0.73149437", "0.7293272", "0.7264103", "0.72516346", "0.72413516", "0.72177243", "0.7201931", "0.7194044", "0.71801066", "0.7122...
0.0
-1
Increments the number of questions answered by the users.
function answeredQuestions() { let oldScore = parseInt(document.getElementById("score").innerText); document.getElementById("score").innerText = ++oldScore; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function incrementUserScore() {\n score++;\n incrementCorrectAnswers(score);\n}", "function increaseQuestionNumber () {\n questionNum++;\n}", "function increment() {\n questionCount += 1\n print()\n}", "incrementQuestionIndex() {\n this.questionIndex++;\n }", "function updateQuesti...
[ "0.7438201", "0.7145669", "0.7117028", "0.7105106", "0.70021075", "0.698156", "0.69574434", "0.69432694", "0.6902724", "0.6761216", "0.67571336", "0.6749331", "0.6726031", "0.6710179", "0.6698115", "0.6698115", "0.6640196", "0.6637876", "0.6606172", "0.65869445", "0.65212023"...
0.6330719
29
Increments number of correct answers
function correctAnswers() { let correct = parseInt(document.getElementById("correct").innerText); document.getElementById("correct").innerText = ++correct; // Prints a message to the user when they are finsh the quiz depending on the number of correct answer they got. if (correct >= 8) { ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function correctAnswer(){\n\t\tcorrect++;\n\t\talert(\"You are Right! Good job!\");\n\t}", "function incrementUserScore() {\n score++;\n incrementCorrectAnswers(score);\n}", "function answerIsCorrect() {\n let oldScore = parseInt(document.getElementById('correct').innerText);\n document.getElementB...
[ "0.7506454", "0.7297836", "0.7228835", "0.7122142", "0.707227", "0.7055368", "0.70547473", "0.7037534", "0.7001269", "0.69981766", "0.69769126", "0.69749004", "0.69361925", "0.6856821", "0.68513274", "0.68229043", "0.681701", "0.6812813", "0.68032295", "0.67638296", "0.672940...
0.69354105
13
Generates a new Question for the user at random. When the user hits the max number of questions, displays the total correct answers and returns them to the index page.
function getNewQuestion() { if (availableQuestions.length === 0 || questionCounter >= MAX_QUESTIONS) { answered.style.display = "block"; gameArea.style.display = "none"; setTimeout(() => { return window.location.assign("index.html"); }, 5000); } questionCounter++...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function generateQuestion(){\n if (questionNumber < STORE.length){\n return createQuestion(questionNumber);\n } else {\n $('.questionBox').hide();\n finalScore();\n $('.questionNumber').text(10);\n }\n}", "function generateQuestion() {\n if (questionNumber < STORE.length) {\n return createThin...
[ "0.77796054", "0.7756688", "0.7717645", "0.7597787", "0.74832994", "0.746358", "0.725497", "0.7226084", "0.7216839", "0.7184676", "0.7029003", "0.70101386", "0.6989532", "0.69629836", "0.69607955", "0.6913286", "0.6879473", "0.6866974", "0.6848631", "0.6847055", "0.68349105",...
0.73491526
6
Check the users answer with the answer assigned to the question. if the correct answer is selected it will flash green if incorrect answer is selected it will flash red When the user answers the answeredQuestions function is called and adds 1 to answered questions. then a new question is called.
function checkAnswer() { choices.forEach(choice => { choice.addEventListener("click", e => { const selectedChoice = e.target; const selectedAnswer = selectedChoice.dataset.number; if (selectedAnswer == currentQuestion.answer) { correctAnswers(); ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function checkAnswer() {\n if (userAnswer === currentQuestion.correctAnswer) {\n // add to the number of correct answers\n points++;\n\n // color the answers green\n answerContainers[questionNumber].style.color = \"darkgreen\";\n }\n // if answer is wrong or...
[ "0.7897109", "0.77493775", "0.7647124", "0.7600718", "0.75299877", "0.7521023", "0.75147676", "0.7513234", "0.7509634", "0.75034237", "0.7496145", "0.74936205", "0.7484624", "0.7479934", "0.7476231", "0.74475247", "0.743487", "0.7423216", "0.74201787", "0.741961", "0.74110985...
0.0
-1
createevent handler that will take care of the action following buttonclick
function formValidator() { //create object that will save user's input (empty value) let feedback = []; //create an array that will save error messages (empty) let errors = []; //check if full name has a value if (fn.value !== ``){ //if it does, save it ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "_buttonClickHandler() { }", "function handleBtnClick(event) {\n handleEvent(event);\n}", "handleButtonClick(){\n\t\tconsole.log(\"handleButtonClick\");\n\n\t\teventsActions.createEvent(this.state.event);\n\t}", "function addButtonEvent() {\n\t\t\tbtnList.begin.click(API.begin);\n\t\t\tbtnList.fastBackward...
[ "0.74795", "0.7245802", "0.71543264", "0.71363235", "0.7092918", "0.70748556", "0.69361126", "0.6912846", "0.6860353", "0.68476045", "0.6841287", "0.6814548", "0.6767831", "0.67658603", "0.6747482", "0.6712902", "0.66801757", "0.6676491", "0.6669899", "0.6662341", "0.65224665...
0.0
-1
Quantidade de nodos na lista
constructor(){ this.#head = null //Não tem nada no inicio this.#tail = null //Não tem nada no fim this.#count = 0 //console.log({head:this.#head,tail:this.#tail, count:this.#count}) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "list_possibles() {\n let factor = 1;\n\n this.nodes.forEach(node => {\n if (node.solved) return;\n factor = factor * node.possibles.length;\n console.log(`${node.index} (${node.possibles.length}): ${node.possibles}`);\n });\n\n console.log(factor);\n ...
[ "0.63570416", "0.6128068", "0.6127085", "0.6127085", "0.6127085", "0.6114253", "0.6085129", "0.5987742", "0.595744", "0.5924772", "0.5877235", "0.58651674", "0.58453244", "0.58389914", "0.58309674", "0.5818841", "0.58185536", "0.5806585", "0.57771623", "0.577686", "0.5763988"...
0.0
-1
functions checker and square selection, and sends needed information to the jumps and moves functions
function checkerSelection(evt){ if(scores.winner !== null) return; evt.stopImmediatePropagation(); const target = evt.target; if((target.attributes.player.value === playerTurn) && (pieceSelected === true)) { selectedPieceArray[0].classList.remove('selected') } if((target.attributes....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function move(square, checker){\n let a = checker.getAttribute('position')\n let b = square.getAttribute('position')\n let x = a[0] - b[0];\n let y = a[2] - b[2];\n \n if(checker.getAttribute('player') === 'red' || checker.classList.contains('king')){\n if((moves.redMove.x[0] === x && moves...
[ "0.67167026", "0.63931566", "0.6362687", "0.6252553", "0.6229671", "0.6203372", "0.61696637", "0.6137955", "0.6136557", "0.6127263", "0.6116682", "0.6079645", "0.606677", "0.6061115", "0.6059619", "0.6045442", "0.6035845", "0.6033937", "0.60067326", "0.5968475", "0.5954777", ...
0.6292248
3
These are all the jump functions,readyJump pulls positioning and then sends to jump which sorts through its conditionals to restrict movement. passes the info to landing which sets all the new attributes for checkers and squares
function readyJump(checkerToJump, checkerJumping){ const checker = checkerJumping[0]; if(checker.classList.contains('red-checker') || checker.classList.contains('king')){ const a = checkerToJump.getAttribute('position'); const x = a[0]; const y = a[2]; const coordinateX = mo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function SetJump(){\n // when in ground.\n if(chrAnimator.GetInteger(\"Jump\") == 0){\n // execute only when State tag is InIdle or InMove , moveDirection use jumpSpeed.\n \t\tif(stateInfo.IsTag(\"InIdle\") || stateInfo.IsTag(\"InMove\")){\n\t\t\tchrAnimator.SetInteger(\"Jump\", 1);\n\t\t\tmoveDirect...
[ "0.66348064", "0.64777076", "0.64380187", "0.63898766", "0.6371627", "0.6213481", "0.6184622", "0.6174869", "0.615205", "0.60862476", "0.6012542", "0.6006214", "0.59886855", "0.59523505", "0.58697534", "0.5811874", "0.5811874", "0.5811363", "0.5811363", "0.578108", "0.5760559...
0.7819165
0
Move takes information from the event listeners and deteremines what moves can be made. attributes changes all attributes of affected variables
function move(square, checker){ let a = checker.getAttribute('position') let b = square.getAttribute('position') let x = a[0] - b[0]; let y = a[2] - b[2]; if(checker.getAttribute('player') === 'red' || checker.classList.contains('king')){ if((moves.redMove.x[0] === x && moves.redMove.x[1...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "updateVariables(move) { }", "onMove() {\n }", "function makeMove(e) {\n if(e.target.id >= 1 && e.target.id <= 9 && !e.target.classList.contains('selected')) {\n //Increment selected fields counter\n logic.incrementCount();\n //Save selected field to data array\n ...
[ "0.6527476", "0.61412174", "0.60426694", "0.597991", "0.5963429", "0.5938276", "0.59213257", "0.59196496", "0.58691597", "0.58071864", "0.5776585", "0.5759536", "0.57540345", "0.57334983", "0.56958467", "0.5680657", "0.56699306", "0.5666327", "0.56624585", "0.56609684", "0.56...
0.5744989
13
render calls most states of teh board for porper displaying and resetting of some variables
function render(){ renderScores(); adjustTurn(); getWinner(); clearSelection(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "render () {\n\t\tthis.renderBoard();\n\t\tthis.renderPieces();\n\t\t$writeInnerHTML( this.view.$maxVal, this.model.maxTimes );\n\t\t$writeInnerHTML( this.view.$minVal, this.model.minTimes );\n\t\tthis.view.alocatePieces( this.model.finalPositionsArr, this.model.baseNumber, this.model.getPieceSize(), this.model.gut...
[ "0.74622923", "0.7435086", "0.74126196", "0.7365913", "0.73468083", "0.7179453", "0.714653", "0.7064487", "0.695454", "0.6856445", "0.68561935", "0.67753696", "0.6755406", "0.67445165", "0.67428374", "0.6707459", "0.66955084", "0.66738045", "0.66696435", "0.66603583", "0.6657...
0.7141427
7
clears out variables for moving pieces, to ensure your selection isnt stuck on one piece.
function clearSelection(){ pieceSelected = false; selectedPieceArray = []; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function clearState() {\n checkerState.SelectedPiece = 0;\n checkerState.Moves = [];\n clearAvaliableMoves();\n }", "function resetSelectedPieceProperties() {\n selectedPiece.pieceId = -1;\n selectedPiece.pieceId = -1;\n selectedPiece.isKing = false;\n selectedPiece.seventhSpa...
[ "0.7557008", "0.7360702", "0.72830176", "0.7155398", "0.7151814", "0.71513706", "0.71375734", "0.7112783", "0.7007227", "0.6982755", "0.694606", "0.69125783", "0.6896265", "0.68417966", "0.6828861", "0.6748818", "0.66831374", "0.6612797", "0.66119754", "0.6599995", "0.6596954...
0.75840014
0
messages for displaying turn and changes turn
function adjustTurn(){ if(playerTurn === scores.player1){ playerTurn = scores.player2; }else{ playerTurn = scores.player1; }; if(playerTurn === scores.player1){ message.innerHTML = `Player 1, it's your turn!` } if(playerTurn === scores.player2){ message.innerHTML ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function whosTurn() {\n var player = players[turns % players.length];\n io.emit('message', player.username + \"'s turn.\");\n io.emit('disable new game button');\n io.emit('disable draw buttons');\n io.emit('hide drawTotal button');\n io.to(player.id).emit('enable draw buttons');\n io.to(playe...
[ "0.69121546", "0.687066", "0.6802712", "0.6795273", "0.67542875", "0.6659891", "0.65957487", "0.65927786", "0.658349", "0.6574533", "0.65706223", "0.65672344", "0.65439785", "0.65221107", "0.6520007", "0.65104324", "0.65081334", "0.64775103", "0.64729244", "0.6459391", "0.644...
0.6597892
6
messages for displaying winner and setting winner to not null
function getWinner(){ if(scores.redPieceCount === 0){ scores.winner = scores.player2; message.innerHTML = `Player 2 Wins!!` }else if(scores.blackPieceCount === 0){ scores.winner = scores.player1; message.innerHTML = `Player 1 Wins!!` } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function winnerMessage(winner) {\n if(winner === null){\n return \"The election was a draw\";\n } else {\n return winner.name + \" has won the election with \" + winner.numVotes + \" votes!\";\n }\n}", "displayWinner() {\n var winningPiece = game.isXTurn ? 'x' : 'o'\n if(game.singleplayer ...
[ "0.76860887", "0.75306946", "0.7440918", "0.73189133", "0.71730393", "0.7112599", "0.70165324", "0.6940664", "0.6917972", "0.68613064", "0.6855601", "0.6809187", "0.6806214", "0.68059593", "0.67786574", "0.676251", "0.6755796", "0.67547226", "0.6747418", "0.6746496", "0.67348...
0.67754245
15
resets scores to initial value
function resetScores(){ scores.redPieceCount = 12; scores.blackPieceCount = 12 scores.blackPiecesTaken = 0; scores.redPiecesTaken = 0; scores.winner = null; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "resetScore() {\n this.score = INITIAL_SCORE;\n }", "function resetScores () {\n STORE.questionNumber = 0;\n STORE.score = 0;\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...
[ "0.8799559", "0.8590413", "0.8227633", "0.81451786", "0.80929905", "0.8034288", "0.79725057", "0.79371303", "0.7865464", "0.7740946", "0.77105963", "0.76449907", "0.7644272", "0.7621771", "0.7608756", "0.7599136", "0.7582135", "0.75774467", "0.75774467", "0.75762147", "0.7562...
0.8219066
3
changes teh scores for rendering in the HTML
function changeScore(checkerJumping){ if(checkerJumping[0].getAttribute('player') === 'red'){ scores.blackPiecesTaken += 1; scores.blackPieceCount -= 1; }else{ scores.redPiecesTaken += 1; scores.redPieceCount -= 1; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function updateScores() {\n scope.$el.find('.js-score-value').text(model.prediction[team])\n }", "function update_score(int) {\n\t\t\t\tvar temp = $(\"#p4_score_p\" + int).html();\n\t\t\t\t$(\"#p4_score_p\" + int).html(temp * 1 + 1);\n\t\t\t}", "function scoreRender(score) {\r\n document.querySelector(\"....
[ "0.7440499", "0.7292678", "0.7201522", "0.71488065", "0.7132246", "0.71283525", "0.71221596", "0.70614517", "0.70462286", "0.7015283", "0.70075697", "0.70004684", "0.69564724", "0.69542754", "0.6952572", "0.6950539", "0.6943838", "0.6943838", "0.6943838", "0.69419974", "0.694...
0.0
-1
As it says, initializes the board and HTML
function init(){ renderScores(); setBoard(); createCheckers(); message.innerHTML = `Player 1! It's your turn!` playerTurn = redCheckers.player; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function init() {\n board = [\n [0, 0, 0, 0, 0, 0], // col 0\n [0, 0, 0, 0, 0, 0], // col 1\n [0, 0, 0, 0, 0, 0], // col 2\n [0, 0, 0, 0, 0, 0], // col 3\n [0, 0, 0, 0, 0, 0], // col 4\n [0, 0, 0, 0, 0, 0], // col 5\n [0, 0, 0, 0, 0, 0], // col 6\n ];\n turn = 1;\n winner = null;\n ...
[ "0.7800516", "0.7778611", "0.7613053", "0.7500126", "0.74285966", "0.7408889", "0.74082214", "0.73941857", "0.73787", "0.7356297", "0.73463017", "0.7292929", "0.7283129", "0.7205108", "0.71646607", "0.71534073", "0.7142169", "0.7141624", "0.71282685", "0.71280503", "0.7063935...
0.0
-1
maps board with coordinates for location, adds event listener to each board and gives occupied/false attribute
function setBoard(){ for(let i = 0; i <boardSquares.length; i++){ boardSquares[i].setAttribute('position', checkerBoard[i]); boardSquares[i].addEventListener('click', selectSquare) boardSquares[i].setAttribute('occupied', false) } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function fnDefineOwnShips() {\n var canvasElement = event.target;\n var x = event.pageX - canvasElement.offsetLeft;\n var y = event.pageY - canvasElement.offsetTop;\n // console.log(\"canvas\", \"x\", x, \"y\", y);\n x = Math.floor(x / cellSize);\n y = Math.floor(y / cellSize);\n // console.lo...
[ "0.7194841", "0.68090653", "0.6807705", "0.6807705", "0.66033745", "0.6507173", "0.6483182", "0.6472713", "0.64552313", "0.6399648", "0.6310518", "0.63006574", "0.62952214", "0.62745374", "0.62573063", "0.62547225", "0.62419695", "0.61896867", "0.6184246", "0.6179523", "0.616...
0.6974312
1
maps scores to HTML
function renderScores(){ scoreElements.rpCount.innerText = scores.redPieceCount; scoreElements.bpTaken.innerText = scores.blackPiecesTaken; scoreElements.bpCount.innerText = scores.blackPieceCount; scoreElements.rpTaken.innerText = scores.redPiecesTaken; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function displayScores() {\n score0El.innerText = score0;\n score1El.innerText = score1;\n }", "function scoreRender(score) {\r\n document.querySelector(\".score-text\").textContent = `${score}/15`;\r\n}", "function displayscores() {\n\tlet timeto = endTime;\n\tif(!timeto)\n\t\ttimeto = Date....
[ "0.7096706", "0.6999947", "0.6993814", "0.6993255", "0.6927396", "0.684066", "0.68365484", "0.6833092", "0.6720782", "0.6703221", "0.66980773", "0.66679126", "0.6605189", "0.65986174", "0.6524589", "0.65030587", "0.6487864", "0.64643604", "0.645853", "0.6441438", "0.64095736"...
0.6933744
4
remoevs all checkers from the board for reinitializing game for replay
function removeCheckers(){ let element = document.querySelectorAll('.checker') element.forEach(el => { el.classList.add('removed-item') setInterval(function(){ el.remove(el); }, 1000) }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "resetBoard() {\n this._gameBoard = [\"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\",];\n this._gameOver = false;\n this._tiedGame = false;\n this.changePlayer(); //alternate between starting players \n }", "function resetBoard() {\n\t\tfor (var i = $boxes.length -1; i>= 0; i--...
[ "0.6719374", "0.668401", "0.65839607", "0.6555811", "0.64943814", "0.6416507", "0.6387107", "0.6357958", "0.6341639", "0.63103175", "0.6298702", "0.6293949", "0.6276319", "0.6269247", "0.6233462", "0.6228677", "0.6214269", "0.62102896", "0.6181398", "0.6179985", "0.6170144", ...
0.0
-1
creates all checekers for board and gives need attributes and event listeners
function createCheckers(){ setTimeout(function(){ for(let i = 0; i < 12; i++){ const checker = document.createElement('div'); boardSquares[i].appendChild(checker); checker.setAttribute('class', redCheckers.class) checker.setAttribute('player', redCheckers.pla...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "DrawBoard() {\n let tilesDiv = document.querySelector('div.tiles');\n let tilesCount = 0;\n let chekersCount = 0;\n\n for (let row in this.board) {\n let line = document.createElement('div');\n line.classList.add('tileRow');\n\n for (let col in this.boar...
[ "0.6612058", "0.6552171", "0.6393154", "0.62792814", "0.6239571", "0.622302", "0.62188095", "0.6194041", "0.61886483", "0.6188465", "0.6136618", "0.61191946", "0.6076637", "0.6055133", "0.60543627", "0.60397345", "0.6028204", "0.600336", "0.6000856", "0.59612745", "0.5939071"...
0.5935959
21
button click to create pieces and init the board state
function play(){ removeCheckers(); resetScores(); init(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "initBoard () {\n\t\tthis.clearBoard();\n\t\t/* Init piece-list */\n\t\t/* White */\n\t\tthis.pieces = [\n\t\t\tnew Lance(COLOR.WHITE, position.toIdx(1, 'a')),\n\t\t\tnew Knight(COLOR.WHITE, position.toIdx(2, 'a')),\n\t\t\tnew Silver(COLOR.WHITE, position.toIdx(3, 'a')),\n\t\t\tnew Gold(COLOR.WHITE, position.toIdx(...
[ "0.70079833", "0.6941289", "0.68768877", "0.68552625", "0.68412477", "0.6840341", "0.6826767", "0.680173", "0.67855483", "0.6744685", "0.6695829", "0.6665456", "0.66579187", "0.66380817", "0.66362363", "0.6595308", "0.6595108", "0.65874755", "0.6582731", "0.6552948", "0.65478...
0.0
-1
logic for determining if checker becomes a king by its positioning on last row
function isKing(checker){ if(((checker.getAttribute('player') === 'red') && (parseInt(checker.getAttribute('position')[0]) === 8)) || ((checker.getAttribute('player') === 'black') && (parseInt(checker.getAttribute('position')[0]) === 1))){ checker.classList.add('king'); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function kingAPiece(row, col, checkerId) {\n if (!document.getElementById(checkerId).classList.contains(\"king\")) {\n var index = findCheckerIndex(checkerId);\n document.getElementById(checkerId).style.display = \"none\";\n occupiedArray[row][col] = checkerArray[index + 24];\n occupiedArray[row][col]...
[ "0.68560785", "0.6586238", "0.6571466", "0.65194166", "0.6422348", "0.6355778", "0.63287264", "0.63280874", "0.63062996", "0.62871784", "0.6227442", "0.618528", "0.6164938", "0.61636585", "0.61331385", "0.6123381", "0.61155885", "0.61094856", "0.610511", "0.60921", "0.6063764...
0.6169972
12
generates a list of the closest drivers from closest > furthest from a shipment
getDriversByDistance(shipment, drivers) { return Object.keys(drivers) .map(driverId => { const driver = {}; const driverInfo = drivers[driverId]; driver.id = driverId; driver.distance = getDistanceFromLatLonInKm( dri...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "getClosestDrivers(drivers, numDrivers) {\n const closestDrivers = [];\n for (let i = 0; i < numDrivers; i++) {\n // mutates state since no driver should be able to get the same shipment dispatch request twice\n const driver = drivers.shift();\n closestDrivers.push(dri...
[ "0.73471206", "0.6019572", "0.6010095", "0.5911546", "0.5909738", "0.58114684", "0.5744339", "0.5739504", "0.57383835", "0.5661521", "0.56573236", "0.5644666", "0.5581555", "0.5532974", "0.55060905", "0.5492927", "0.5474122", "0.5471324", "0.5456285", "0.54526764", "0.544407"...
0.72244996
1
creates a map of all drivers in relation to each shipment
generateMap(shipments, drivers) { return Object.keys(shipments).reduce((acc, shipmentId) => { const shipment = shipments[shipmentId]; const driversByDistance = this.getDriversByDistance(shipment, drivers); acc[shipmentId] = driversByDistance; return acc; }...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "getDriversByDistance(shipment, drivers) {\n return Object.keys(drivers)\n .map(driverId => {\n const driver = {};\n const driverInfo = drivers[driverId];\n driver.id = driverId;\n driver.distance = getDistanceFromLatLonInKm(\n ...
[ "0.6920579", "0.580128", "0.5501277", "0.5387298", "0.5313142", "0.5200428", "0.5182846", "0.51654667", "0.51564246", "0.5125721", "0.49854875", "0.49698514", "0.49319738", "0.4908692", "0.4867601", "0.48634398", "0.4838435", "0.48367408", "0.4827721", "0.48115906", "0.480363...
0.8046336
0
sends a shipment dispatch request to a driver
sendDispatch(shipmentId, driverId) { return axios.post( `http://challenge.shipwithbolt.com/driver/${driverId}/dispatch`, { shipmentId: `${shipmentId}` } ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "dispatchShipmentToClosestDriver(shipmentId, closestDrivers) {\n return Promise.all(closestDrivers.map(async driver => {\n try {\n if (!driver) {\n return new Promise(resolve => {\n resolve(-1);\n })\n }\n ...
[ "0.6402538", "0.57778025", "0.57734895", "0.5730074", "0.5723557", "0.56068397", "0.55499685", "0.5512268", "0.5466123", "0.54442525", "0.54306924", "0.541052", "0.538164", "0.53559345", "0.5350821", "0.53417486", "0.5320301", "0.53060275", "0.52634096", "0.5248084", "0.52413...
0.80934453
0
sends out shipment dispatch requests to a certain number of drivers
dispatchShipmentToClosestDriver(shipmentId, closestDrivers) { return Promise.all(closestDrivers.map(async driver => { try { if (!driver) { return new Promise(resolve => { resolve(-1); }) } ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "sendDispatch(shipmentId, driverId) {\n return axios.post(\n `http://challenge.shipwithbolt.com/driver/${driverId}/dispatch`, {\n shipmentId: `${shipmentId}`\n }\n );\n }", "function sendQueuedTelemetry() {\n return function (dispatch, getState) {\n ...
[ "0.63527167", "0.56450933", "0.55078465", "0.5485037", "0.5413124", "0.5330164", "0.5324918", "0.5291146", "0.52799433", "0.5189634", "0.5150662", "0.51440126", "0.5129534", "0.5097057", "0.5090693", "0.5075886", "0.50726515", "0.5054376", "0.502575", "0.5016733", "0.50118905...
0.64502
0
shifts off and returns a specified number of closest drivers to a shipment in the map
getClosestDrivers(drivers, numDrivers) { const closestDrivers = []; for (let i = 0; i < numDrivers; i++) { // mutates state since no driver should be able to get the same shipment dispatch request twice const driver = drivers.shift(); closestDrivers.push(driver); ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "getDriversByDistance(shipment, drivers) {\n return Object.keys(drivers)\n .map(driverId => {\n const driver = {};\n const driverInfo = drivers[driverId];\n driver.id = driverId;\n driver.distance = getDistanceFromLatLonInKm(\n ...
[ "0.68952304", "0.5908076", "0.5786438", "0.5605985", "0.55695796", "0.55464226", "0.5518283", "0.54965645", "0.5452233", "0.5450421", "0.54329836", "0.5354728", "0.53479964", "0.53319097", "0.5297232", "0.5286951", "0.5285497", "0.527174", "0.5270312", "0.52591014", "0.524791...
0.72180086
0
This function plays a random animal in Chinese The user then clicks the corresponding animal. If the animal chosen matches the Chinese audio, the element is removed from the array and the element is dropped from the div
function play_random() { isQuiz = true; bigPic.innerHTML = "What animal name did I just say in Chinese?"; randomAudio.pause(); randomNum = loadrandom(); myelement = customArray[randomNum]; randomAudio = myelement.chinRec; randomAudio.play(); randomID = myelement; chinCharDiv.style.display = "block"; chinCharP...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function clickForSound() {\n const animalButtons = document.querySelectorAll(\".animal\");\n animalButtons.forEach((animalButton, i) => {\n animalButton.addEventListener(\"click\", (e) => {\n const nthOfType = i + 1;\n const audioToPlay = document.querySelector(\n `audio:nth-of-type(${nthOfTy...
[ "0.6445464", "0.6413106", "0.6381681", "0.62791395", "0.6261219", "0.6240075", "0.6104454", "0.60793704", "0.6047562", "0.604401", "0.6043979", "0.60416263", "0.60390174", "0.6030555", "0.603004", "0.60200727", "0.6017038", "0.6013949", "0.60125357", "0.5987001", "0.5984312",...
0.6860537
0
TODO Do we query PouchDB everytime or query once and filter the results? Right now PouchDBFind doesn't have $regex or $text so we must resort to query()
search(now, old) { return db.drugs.query(`function(doc) { if ( ~ doc.name.indexOf('${now}')) emit(true) }`) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getFilteredDocs() {\n // Store all docs filtered by search term\n let filteredDocs;\n\n if (dbState.search == \"\") {\n // If no search term is entered, then just gather all docs\n filteredDocs = db.find({});\n } else {\n // Create a regular expression of search term\n ...
[ "0.6418547", "0.6241504", "0.6179134", "0.6110259", "0.60359144", "0.5875973", "0.5871292", "0.5839579", "0.58269817", "0.5821991", "0.579857", "0.57728595", "0.5768338", "0.57520616", "0.56886154", "0.5679285", "0.5660296", "0.5626581", "0.5619099", "0.5618026", "0.560215", ...
0.5741009
14
find value from dictionary
function find(type, key) { if (type.includes(":")) { const split = type.split(":"); type = split[0]; key = split[1]; } let term = dictionary[type] ? dictionary[type].get(key) : null; return term; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "search(key) {\r\n const hash = this.calculateHash(key);\r\n if(this.values.hasOwnProperty(hash) && this.values[hash].hasOwnProperty(key)) {\r\n return this.values[hash][key];\r\n } else {\r\n return null;\r\n }\r\n }", "function searchValueInMap(map, value) {\r\n\tvar returnValue = null;\r...
[ "0.7278344", "0.68904334", "0.6707081", "0.6688855", "0.66054714", "0.6601259", "0.6549421", "0.6537347", "0.65324754", "0.652812", "0.6499752", "0.6487881", "0.6487881", "0.6487881", "0.6487881", "0.6487881", "0.6487881", "0.6487881", "0.6487881", "0.6487881", "0.6487881", ...
0.6063205
63
record to dictionary cache the given values
async function record(dicts, props, yyyymmdd) { //dicts = Set or Array if (Array.isArray(dicts)) { dicts = new Set(dicts); } if (dicts.size < 1) return; const unregisteredTerms = [...dicts].filter(value => { const kv = value.split(":"); if(kv.length !== 2 || kv[1] === "0") {...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function cacheAvroRecordDef(cache, key, value) {\n if (key) {\n cache[key] = value;\n }\n}", "function addToCache(keyword, values)\n{\n// create a new array entry in the cache\noCache[keyword] = new Array();\n// add all the values to the keyword's entry in the cache\nfor(i=0; i<values.length; i++)\noCache[k...
[ "0.66324735", "0.62935287", "0.6261955", "0.62458533", "0.6065846", "0.592073", "0.5777107", "0.566723", "0.566723", "0.5622205", "0.55955243", "0.55955243", "0.55955243", "0.55689114", "0.55689114", "0.55680084", "0.5546002", "0.5520695", "0.5511593", "0.54717004", "0.544777...
0.5186202
45
Solution using ...rest operator
function sumRest(...args) { let totalSum = 0; args.forEach(num => { return totalSum += num; }) return totalSum; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function sum_rest(...args){\r\n return args.reduce((accumulator, currentValue) => accumulator + currentValue); //using reduce...\r\n} //Rest Operator", "function rest(...arg)\n{\n /*let sum=0;\n for(let i in arg) sum+=arg[i];\n return sum;*/\n return arg.reduce((a,b)=> a+b);\n}", "function f4(o, ...
[ "0.64802843", "0.6248222", "0.6221492", "0.62004554", "0.6163664", "0.6147492", "0.6072119", "0.6053397", "0.60270363", "0.60250646", "0.6018447", "0.60101306", "0.60081583", "0.6007422", "0.5967722", "0.59413105", "0.5873057", "0.5868492", "0.5847508", "0.58438164", "0.58223...
0.5317346
83