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
Replace all macros in str str string to modify arrMacro array of Macro objects
function ReplaceMacros(str, arrMacro) { for (var i = 0; i < arrMacro.length; ++i) { var macro = arrMacro[i]; str = str.replace(new RegExp("(" + macro.name + ")", "g"), macro.value) } return str; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function macroize(s) {\n // apply macros and aliases\n s = s + '';\n let orig_s = s;\n s = s.trim();\n let ws = s.split(' ');\n try {\n for (let i = 0; i < macros.length; i++) {\n if (ws[0] === macros[i].n) {\n s = s.replace(macros[i].n, macros[i].v) ;\n ...
[ "0.6673812", "0.5989005", "0.58225214", "0.5610063", "0.5609665", "0.5409655", "0.53995997", "0.53995997", "0.5367866", "0.5357582", "0.5352327", "0.53404677", "0.5304689", "0.5271176", "0.5265872", "0.523394", "0.51858467", "0.51683503", "0.5098597", "0.50925016", "0.5073776...
0.8530385
0
init custom build rule for .asm files
function InitAsmTool(VCFile) { var cfgs = VCFile.FileConfigurations; for (var i = 1; i <= cfgs.Count; ++i) { var cfg = cfgs.Item(i); if ((typeof(cfg.Tool.ToolKind) != "undefined" && cfg.Tool.ToolKind != "VCCustomBuildTool") || cfg.Tool.ToolName != "Custom Build Tool") { cfg.Tool = cfg.ProjectConfiguration.FileTools.Item("VCCustomBuildTool"); } var tool = cfg.Tool; tool.Description = "Compiling .asm file..."; tool.Outputs = "$(IntDir)\\$(InputName).obj"; tool.CommandLine = AS + " /c /nologo /D" + PLATFORM + " /Fo" + tool.Outputs + " /W3 /Zi /Ta" + VCFile.RelativePath; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "Compile() {\n\n }", "function build_with_env() {\n\t\tModule.asm = asm(glb, env, buf);\n\n\t\treturn Module.asm;\t\n\t}", "build () {}", "function VersionCompiler() {\n}", "function compile() {\n\n}", "function Compiler() {\n}", "_init() {\n this._addBreakpoints();\n this._generateRules();\n ...
[ "0.5803729", "0.5650234", "0.55918556", "0.55865663", "0.5504604", "0.5418106", "0.5333403", "0.52670074", "0.5220873", "0.5182348", "0.5177439", "0.5162542", "0.5162182", "0.5137506", "0.51132065", "0.51006746", "0.50104666", "0.49911433", "0.49291447", "0.48841283", "0.4880...
0.6108414
0
FilterDef class FilterDef .ctor
function FilterDef(name, id, filter, type, exclude) { this.Name = name; this.Id = id; this.Filter = filter; this.Type = type; this.Exclude = exclude; this.Folder = null; this.Files = new Array(); this.exclFolders = null; this.exclFiles = null; this.FilterDefs = new Array(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function Filter(whichFilter) {\n console.log(\"Filter\");\n this.name = whichFilter;\n }", "constructor(filterTypeId) {\n super(filterTypeId);\n // this.filterTypeId = filterTypeId;\n }", "function makeFilter(obj) {\n\tobj.prog = null;\n\tobj.init = filterInit;\n\tobj.destroy ...
[ "0.7720102", "0.68919206", "0.66993725", "0.6699263", "0.6640853", "0.6545508", "0.65024525", "0.6419045", "0.63303655", "0.62232566", "0.61833596", "0.6171196", "0.6137809", "0.6133725", "0.60998535", "0.6088792", "0.6088498", "0.60811305", "0.60811305", "0.60811305", "0.608...
0.7481858
1
add subfilter to object
function filterAddFilter(filter) { this.FilterDefs.push(filter); return this; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function addFilter() {\n if (filterAllowedIdsArr.length > 0) {\n createFilter();\n }\n}", "addFilter(filter) {\n this.configFilterList.push(filter);\n }", "addFilter(filter, option) {\n\t\tthis.applyFilter(filter, option);\n\n\t\treturn this;\n\t}", "function setFilters(){}", "function setFi...
[ "0.6331375", "0.6302531", "0.62107164", "0.60189617", "0.60189617", "0.60189617", "0.60189617", "0.60189617", "0.60189617", "0.60189617", "0.60189617", "0.60189617", "0.5961619", "0.59554505", "0.5939239", "0.59227437", "0.5896321", "0.5888511", "0.5888511", "0.5888511", "0.5...
0.6661714
0
add files to object folder parent folder files filename of array if filenames
function filterAddFiles(folder, files) { this.Folder = folder; if (files instanceof Array) this.Files = this.Files.concat(files); else this.Files.push(files); return this; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "fillParents () {\n this.files.forEach((demoFile: DemoFile) => {\n demoFile.folder = this\n })\n this.folders.forEach((demoFolder: DemoFolder) => {\n demoFolder.parentFolder = this\n demoFolder.fillParents()\n })\n }", "addData(filename) {\n let tempArray = []; tempArray.push(fi...
[ "0.6162632", "0.6069537", "0.6007634", "0.59652025", "0.5933693", "0.5883479", "0.5873101", "0.58069754", "0.57122505", "0.5710662", "0.5657091", "0.5650082", "0.5635718", "0.55643004", "0.5558826", "0.5558245", "0.55543107", "0.55214316", "0.5520037", "0.551269", "0.5496411"...
0.55753934
13
add to object files from filder and all subfolders excluding exclFolders and exclFiles folder start folder exclFolder regular expression which defines the folders to exclude exclFiles regular expression which defines the files to exclude
function filterAddFilesByMask(folder, exclFolders, exclFiles) { this.Folder = folder; this.exclFolders = exclFolders; this.exclFiles = exclFiles; return this; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function filterFiles(files, pathObj, matcher) {\n\n //lets sort the files first, we want files that start with - to take\n //precedence, then files that start with _ and then unicode sequenced\n pathObj.files.sort(sortFiles);\n\n pathObj.files.forEach(function forEachFile(file) {\n var fileObj = n...
[ "0.59163195", "0.56009656", "0.5503242", "0.55005646", "0.5440359", "0.5297358", "0.516028", "0.51168066", "0.50841635", "0.5017734", "0.5015834", "0.49431214", "0.49135405", "0.48887202", "0.4870725", "0.4844103", "0.48440313", "0.4775961", "0.4768508", "0.47481948", "0.4746...
0.6540305
0
add file to VCFilter object filter VCFilter object filename filename to add filetype type of file (one of eFileTypexxx) exclude if true then file will be excluded from build
function AddFilterFile(filter, filename, filetype, exclude) { var VCFile = filter.AddFile(filename); if (null != filetype && typeof(VCFile.FileType) != "undefined") VCFile.FileType = filetype; var customFileDef = null; if (exclude) { var cfgs = VCFile.FileConfigurations; for (var i = 1; i <= cfgs.Count; ++i) { var cfg = cfgs.Item(i); if (typeof(cfg.Tool.ToolKind) != "undefined") { if (cfg.Tool.ToolKind != "VCCLCompilerTool") exclude = false; } else if (cfg.Tool.ToolName != "C/C++ Compiler Tool") exclude = false; cfg.ExcludedFromBuild = exclude; } } else if (".asm" == VCFile.Extension) InitAsmTool(VCFile); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function filterCreateVCFilter(parent)\r\n{\r\n var VCFilter;\r\n if (null == this.Name)\r\n VCFilter = parent;\r\n else\r\n {\r\n VCFilter = parent.AddFilter(this.Name);\r\n if (null != this.Id)\r\n VCFilter.UniqueIdentifier = this.Id;\r\n if (null != this.Filter)...
[ "0.66218656", "0.5804125", "0.5716339", "0.566151", "0.55632144", "0.5541064", "0.5528256", "0.5524406", "0.5493981", "0.5439422", "0.5381027", "0.5320261", "0.52996725", "0.5252509", "0.5211838", "0.51948696", "0.5185912", "0.5180396", "0.51615876", "0.5160147", "0.5142139",...
0.80895925
0
create VCFilter object from the FilterDef definition and add to parent
function filterCreateVCFilter(parent) { var VCFilter; if (null == this.Name) VCFilter = parent; else { VCFilter = parent.AddFilter(this.Name); if (null != this.Id) VCFilter.UniqueIdentifier = this.Id; if (null != this.Filter) VCFilter.Filter = this.Filter; } if (null != this.Folder) this.Folder = ReplaceMacros(this.Folder, cmnMacros); if (0 < this.Files.length) { // add specified files for (var i = 0; i < this.Files.length; ++i) { var filename = this.Files[i]; if (null != this.Folder && this.Folder.length > 0) filename = this.Folder + "\\" + filename; try { fso.GetFile(filename); } catch (e) { WScript.Echo("File " + filename + " does not exist"); WScript.Quit(3); } AddFilterFile(VCFilter, filename, this.Type, this.Exclude); } } else { // add files from folder // create regexp from extensions var extArray = this.Filter.replace(/\./g, "\\.").split(";"); var rxText = "^"; if (extArray.length != 0) { rxText += "(?:" + extArray[0]; for (i = 1; i < extArray.length; ++i) rxText += "|" + extArray[i]; rxText += ")"; } rxText += "$"; var rxExts = new RegExp(rxText, "i"); var folder; try { folder = fso.GetFolder(this.Folder); } catch (e) { WScript.Echo("Folder " + this.Folder + " does not exist"); WScript.Quit(3); } // add subfolders as own filters var enumSubFolders = new Enumerator(folder.SubFolders); for (; !enumSubFolders.atEnd(); enumSubFolders.moveNext()) { var subFolder = enumSubFolders.item(); if (null == this.exclFolders || !this.exclFolders.test(subFolder.Name)) { var filterDef = new FilterDef(subFolder.Name, this.Id, this.Filter, this.Type, this.Exclude); filterDef.Folder = subFolder.Path; filterDef.exclFolders = this.exclFolders; filterDef.exclFiles = this.exclFiles; filterDef.createVCFilter(VCFilter); } } // add files var nfiles = 0; var enumFiles = new Enumerator(folder.Files); for (; !enumFiles.atEnd(); enumFiles.moveNext()) { var file = enumFiles.item(); var fileext = getExtension(file.Name); if (rxExts.test(fileext) && (null == this.exclFiles || !this.exclFiles.test(file.Name))) { ++nfiles; AddFilterFile(VCFilter, file.Path, this.Type, this.Exclude); } } // remove filter if it is empty if (0 == nfiles) parent.RemoveFilter(VCFilter); } for (var i = 0; i < this.FilterDefs.length; ++i) this.FilterDefs[i].createVCFilter(VCFilter); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function filterAddFilter(filter)\r\n{\r\n this.FilterDefs.push(filter);\r\n return this;\r\n}", "function Filter(whichFilter) {\n console.log(\"Filter\");\n this.name = whichFilter;\n }", "function FilterDef(name, id, filter, type, exclude)\r\n{\r\n this.Name = name;\r\n this.Id = ...
[ "0.65283203", "0.64035165", "0.6305128", "0.62389654", "0.6165176", "0.5901936", "0.58510965", "0.5841315", "0.5818336", "0.57384384", "0.5712048", "0.561314", "0.56001145", "0.55726075", "0.5548683", "0.55398726", "0.55089235", "0.55066496", "0.55018514", "0.5496555", "0.547...
0.6689034
0
get issue types and sub types
async function getIssueTypes(input) { const headers = config.issuev1.httpHeaders(input.credentials.access_token) const endpoint = config.issuev1.getIssueType(input.containerId) const options = { method: 'GET', headers: headers || {} }; const response = await fetch(endpoint, options); if (response.status == 200 ) { const json = await response.json(); return json.results } else { const message = await response.text(); console.log('get getIssueTypes failed' + message) return null } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getAnomalyTypes() {\n return new Promise(function (resolve) {\n fetch(host + '/anomaly_types', getSpecs).then(function (resp) {\n resolve(resp);\n }).catch(function (error) {\n return resolve(Response.error(error));\n });\n });\n}", "summarizeIssue(issue) {\n const summary = ...
[ "0.5514989", "0.5211364", "0.5204251", "0.5167871", "0.5152026", "0.51326865", "0.5097082", "0.5085893", "0.5083028", "0.5073279", "0.503514", "0.50157344", "0.5007582", "0.4989689", "0.49791455", "0.4972157", "0.4959664", "0.49447826", "0.49435884", "0.49375188", "0.49117398...
0.61703956
0
get root causes list of field issue
async function getRootCause(input) { const headers = config.issuev1.httpHeaders(input.credentials.access_token) const endpoint = config.issuev1.getRootCause(input.containerId) const options = { method: 'GET', headers: headers || {} }; const response = await fetch(endpoint, options); if (response.status == 200 ) { const json = await response.json(); return json.data } else { const message = await response.text(); console.log('get getRootCause failed' + message) return null } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "getTree() {\n\n return ['string', this.value];\n }", "get root() { return getRoot() }", "get fields() {\n return this.getNodeByVariableCollectionId('fields').variableCollection;\n }", "getChildren () {\n const doc = this.getDocument()\n const id = this.id\n const schema = this.getSchem...
[ "0.60497564", "0.60195357", "0.58858216", "0.58789533", "0.5862485", "0.5823059", "0.57835776", "0.5685606", "0.56469226", "0.559713", "0.5584236", "0.5564179", "0.5544287", "0.55343527", "0.5504241", "0.5504241", "0.54735124", "0.5453324", "0.545191", "0.54497445", "0.544535...
0.0
-1
Setting comp choices to be random
function getCompChoice() { const choices = ["r", "p", "s"]; const randomNumber = Math.floor(Math.random() * 3); return choices[randomNumber]; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function makeCompChoice() {\n return choices[Math.floor(Math.random() * choices.length)];\n }", "function comp_choice() {\n const choices_array = [\"r\", \"p\", \"s\"];\n return (choices_array [Math.floor(Math.random()*3)]);\n}", "function resetCompChoice() {\n compGuess = compChoices[Math.floor...
[ "0.79668397", "0.75526017", "0.75268227", "0.7275957", "0.7233437", "0.7189743", "0.712176", "0.71111494", "0.7099737", "0.70319057", "0.6935403", "0.6863956", "0.67855346", "0.67495984", "0.6713656", "0.66995156", "0.6593919", "0.658661", "0.6531186", "0.6527112", "0.6514334...
0.71922076
5
Setting what happens deppend on getCompChoice
function compMove(computerChoice) { if (computerChoice === "r") { resetCompRPS(); showCompRock_div.style.display = "block"; } else if (computerChoice === "p") { resetCompRPS(); showCompPaper_div.style.display = "block"; } else { resetCompRPS(); showCompScissors_div.style.display = "block"; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function makeCompChoice() {\n return choices[Math.floor(Math.random() * choices.length)];\n }", "function resetCompChoice() {\n compGuess = compChoices[Math.floor(Math.random() * compChoices.length)];\n}", "resetChoices() {\n // We are always going to go first for now -- left turn in for future...
[ "0.5847476", "0.583687", "0.5527652", "0.5493256", "0.5493256", "0.5458657", "0.54196036", "0.5287648", "0.5287648", "0.52848876", "0.52647865", "0.5253967", "0.52380675", "0.5188442", "0.51731116", "0.51375544", "0.513292", "0.5123249", "0.51204854", "0.51204854", "0.5093711...
0.0
-1
Converting letters to word for win,lose, draws functions
function convertToWord(letter) { if (letter === "r") return "Rock"; if (letter === "p") return "Paper"; if (letter === "s") return "Scissors"; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function convertToWord(letter)\n{\n if (letter===\"r\") return \"Rock\";\n if (letter===\"p\") return \"Paper\";\n return \"Scissor\";\n\n\n}", "function convertToWord(letter){\n if(letter === \"r\")\n return \"Rock\";\n else if(letter === \"p\")\n return \"Paper\";\n else \n ...
[ "0.7444648", "0.7422416", "0.74029356", "0.7299573", "0.7236549", "0.71780455", "0.691791", "0.6730369", "0.6652612", "0.66421807", "0.6607969", "0.64524376", "0.6405789", "0.6397617", "0.63832253", "0.6347359", "0.6337549", "0.6299388", "0.62608695", "0.6250959", "0.62462777...
0.7268594
4
Setting win function and what happens if we win
function win(userChoice, computerChoice) { userScore++; const userChoice_div = document.getElementById(userChoice); userScore_span.innerHTML = userScore; compScore_span.innerHTML = compScore; result_p.innerHTML = `${convertToWord(userChoice)}${smallWordUser} wins over ${convertToWord(computerChoice)}${smallWordComp}. You win!`; userChoice_div.classList.add('green-glow'); setTimeout(() => userChoice_div.classList.remove('green-glow'), 400); compMove(computerChoice); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function win() { \r\n\r\n}", "function checkWin() {\n\n}", "function setWin(_win) {\n\t\t\twin = _win;\n\t\t}", "function win () {\n\tconsole.log( 'You win!' );\n}", "function winGame() {\n\tflashColor();\n\tturnCounter.innerHTML = \"WIN!\";\n\ton = false;\n\twin = true;\n}", "onWin(callback) {\n ...
[ "0.79314435", "0.7381011", "0.6981106", "0.6975275", "0.68010056", "0.6774585", "0.6758207", "0.6724249", "0.6607468", "0.66053146", "0.6591144", "0.6589989", "0.65856", "0.6573607", "0.6502426", "0.6451075", "0.6421372", "0.64155173", "0.6412545", "0.6383524", "0.63214415", ...
0.0
-1
Setting lose function and what happens if we lose
function lose(userChoice, computerChoice) { compScore++; const userChoice_div = document.getElementById(userChoice); userScore_span.innerHTML = userScore; compScore_span.innerHTML = compScore; result_p.innerHTML = `${convertToWord(userChoice)}${smallWordUser} loses over ${convertToWord(computerChoice)}${smallWordComp}. You lose!`; userChoice_div.classList.add('red-glow'); setTimeout(() => userChoice_div.classList.remove('red-glow'), 400); compMove(computerChoice); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function lose() {\n\ttime.Stop();\n\talive = false;\n\t\n\tstatistics.addGame(difficulty, statistics.state.lose);\n\tstatistics.addSeconds(difficulty, statistics.state.lose, seconds);\n\tstatistics.addDiscovered(difficulty, statistics.state.lose, calculateDiscoveredPercent());\n\t\n\t// Die statistics speichern\n\...
[ "0.731508", "0.70271003", "0.701266", "0.701266", "0.69700235", "0.69373053", "0.684488", "0.6675734", "0.66145754", "0.65597486", "0.6547416", "0.65083295", "0.6458732", "0.6438737", "0.641812", "0.636244", "0.6339041", "0.6315627", "0.6299145", "0.62626433", "0.6187455", ...
0.0
-1
Setting draw function and what happens if we have draw
function draw(userChoice, computerChoice) { const userChoice_div = document.getElementById(userChoice); userScore_span.innerHTML = userScore; compScore_span.innerHTML = compScore; result_p.innerHTML = `${convertToWord(userChoice)}${smallWordUser} is equal to ${convertToWord(computerChoice)}${smallWordComp}. It's draw!`; userChoice_div.classList.add('grey-glow'); setTimeout(() => userChoice_div.classList.remove('grey-glow'), 400); compMove(computerChoice); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function draw() {}", "function draw() {}", "function draw(){\n\t\t// Needed to comply with Tool Delegate design pattern\n\t}", "draw() {}", "draw() {}", "draw() {}", "draw() {}", "_draw() {\n\n }", "draw() { }", "draw() { }", "draw() { }", "function draw() {\n}", "function draw() {\n}", ...
[ "0.8326662", "0.8326662", "0.81820166", "0.7707931", "0.7707931", "0.7707931", "0.7707931", "0.76768094", "0.7674274", "0.7674274", "0.7674274", "0.7635243", "0.7635243", "0.7635243", "0.7635243", "0.7635243", "0.76021457", "0.7576073", "0.7538482", "0.7527197", "0.7524073", ...
0.0
-1
Setting game where we use win, lose or draw functions, also we get comp choice with random getCompChoice function
function game(userChoice) { const computerChoice = getCompChoice(); switch (userChoice + computerChoice) { case "rs": case "pr": case "sp": win(userChoice, computerChoice); break; case "sr": case "rp": case "ps": lose(userChoice, computerChoice); break; case "rr": case "pp": case "ss": draw(userChoice, computerChoice); break; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function game (userSelection){\r\n // message to display user choice\r\n userOption.innerHTML = \"Your selection is: \" + userSelection \r\n // getting computer choice \r\n let computerSelection = getcomputerSelection();\r\n // display computer choice\r\n compOption.innerH...
[ "0.7141385", "0.69619846", "0.69050884", "0.68751264", "0.67910975", "0.67751676", "0.67602456", "0.67549735", "0.6739126", "0.67336", "0.66713965", "0.6666221", "0.66438395", "0.6636184", "0.6630517", "0.66021", "0.65864825", "0.6580282", "0.6563945", "0.6563874", "0.6552554...
0.6748219
8
Reseting score for checkWhoWon function
function resetScore() { setTimeout(() => { userScore = 0; compScore = 0; userScore_span.innerHTML = userScore; compScore_span.innerHTML = compScore; result_p.innerHTML = "Feel free to start another game."; }, 300); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function resetScore() {\n if (lethal) {\n score = 0;\n lives = 2;\n }\n else {\n return;\n }\n}", "gameWon(){\n this.addToScore(this.SCORE);\n this.resetCards();\n this.next();\n }", "function checkScore(){\n\t\t\tif (totalScore === randNum){\n\t\t\twins++;\n\t\t\tres...
[ "0.69730496", "0.6918396", "0.68934137", "0.6839525", "0.6796899", "0.67644113", "0.6704764", "0.6695747", "0.6681689", "0.6676229", "0.66712666", "0.6648461", "0.6641588", "0.66248673", "0.66091317", "0.66034704", "0.659406", "0.65645605", "0.6554522", "0.6553315", "0.654172...
0.0
-1
Checking if game is over
function checkWhoWon() { setTimeout(() => { // setTimeout is there because we need to print score before alerting if (userScore === 5) { scoreBoard_div.classList.add("green-glow"); setTimeout(() => scoreBoard_div.classList.remove('green-glow'), 800); setTimeout(() => alert("Congrats! You won!"), 200); resetScore(); } if (compScore === 5) { scoreBoard_div.classList.add("red-glow"); setTimeout(() => scoreBoard_div.classList.remove('red-glow'), 800); setTimeout(() => alert("Sorry, you lost!"), 200); resetScore(); } }, 100) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "checkIfGameOver() {\n if (this.character.dead || this.endBoss.dead) {\n this.gameOver.gameFinished = true;\n this.gameOver.lostGame = this.character.dead && !this.endBoss.dead ? true : false;\n this.gameOver.showEndscreen();\n this.AUDIO_BACKGROUND.pause();\n ...
[ "0.82508165", "0.81681615", "0.81187147", "0.8111974", "0.80893236", "0.80593145", "0.80464226", "0.801168", "0.79936445", "0.79843855", "0.7980856", "0.7975794", "0.7959225", "0.7954016", "0.79249245", "0.79130167", "0.7867855", "0.78613156", "0.7850695", "0.7829241", "0.782...
0.0
-1
Reseting user choices when we click on another one
function resetUserRPS() { showUserRock_div.style.display = "none"; showUserPaper_div.style.display = "none"; showUserScissors_div.style.display = "none"; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function resetChoice() {\n\n var choice = \"\";\n var update_p1_Choice = database.ref('players/1/choice');\n var update_p2_Choice = database.ref('players/2/choice');\n update_p1_Choice.set(choice);\n update_p2_Choice.set(choice);\n }", "resetChoices() {\n // We are al...
[ "0.7387649", "0.734916", "0.6935567", "0.6760769", "0.66519827", "0.66262037", "0.6599179", "0.6572491", "0.651998", "0.64292127", "0.63269305", "0.63110995", "0.6291814", "0.6275466", "0.6222746", "0.6173599", "0.6153661", "0.61253697", "0.6102697", "0.610115", "0.6074394", ...
0.0
-1
Main function for eventListeners
function main() { rock_div.addEventListener("click", () => { game("r"); resetUserRPS(); showUserRock_div.style.display = "block"; checkWhoWon(); }); paper_div.addEventListener("click", () => { game("p"); resetUserRPS(); showUserPaper_div.style.display = "block"; checkWhoWon(); }); scissors_div.addEventListener("click", () => { game("s"); resetUserRPS(); showUserScissors_div.style.display = "block"; checkWhoWon(); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function main() {\n addEventListeners();\n}", "function main() {\n addEventListeners();\n addAdvancedEventListeners();\n}", "function main() {\n register_listeners();\n}", "function main() {\n hamburgerLanguageButton_div.addEventListener(\"click\", languageChange);\n hamburgerInactive_div.addEven...
[ "0.8283783", "0.82405424", "0.7589247", "0.7071869", "0.7003831", "0.7003831", "0.7003831", "0.7003831", "0.7003831", "0.7003831", "0.7003831", "0.7003831", "0.7003831", "0.7003831", "0.7003831", "0.7003831", "0.7003831", "0.7003831", "0.7003831", "0.7003831", "0.7003831", ...
0.0
-1
Wrapper for the original QR code generator.
function createQRCode(text, level, version, quiet) { var qr = {}; var vqr = vendor_qrcode(version, level); vqr.addData(text); vqr.make(); quiet = quiet || 0; var qrModuleCount = vqr.getModuleCount(); var quietModuleCount = vqr.getModuleCount() + 2 * quiet; function isDark(row, col) { row -= quiet; col -= quiet; if (row < 0 || row >= qrModuleCount || col < 0 || col >= qrModuleCount) { return false; } return vqr.isDark(row, col); } function addBlank(l, t, r, b) { var prevIsDark = qr.isDark; var moduleSize = 1 / quietModuleCount; qr.isDark = function (row, col) { var ml = col * moduleSize; var mt = row * moduleSize; var mr = ml + moduleSize; var mb = mt + moduleSize; return prevIsDark(row, col) && (l > mr || ml > r || t > mb || mt > b); }; } qr.text = text; qr.level = level; qr.version = version; qr.moduleCount = quietModuleCount; qr.isDark = isDark; qr.addBlank = addBlank; return qr; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function QRCode() {\n\n var undefined$1;\n /** Node.js global 检测. */\n\n var freeGlobal = (typeof global === \"undefined\" ? \"undefined\" : _typeof(global)) == 'object' && global && global.Object === Object && global;\n /** `self` 变量检测. */\n\n var freeSelf = (typeof self === \"undefined\" ? \"und...
[ "0.73518693", "0.68677163", "0.68408304", "0.671673", "0.6669476", "0.6581289", "0.63664085", "0.63502973", "0.6343354", "0.63114464", "0.62971365", "0.6264429", "0.6231682", "0.6182599", "0.61708295", "0.61583835", "0.6072448", "0.60479206", "0.6040605", "0.6040605", "0.6002...
0.57168186
34
Returns a minimal QR code for the given text starting with version `minVersion`. Returns `undefined` if `text` is too long to be encoded in `maxVersion`.
function createMinQRCode(text, level, minVersion, maxVersion, quiet) { minVersion = Math.max(1, minVersion || 1); maxVersion = Math.min(40, maxVersion || 40); for (var version = minVersion; version <= maxVersion; version += 1) { try { return createQRCode(text, level, version, quiet); } catch (err) {/* empty */} } return undefined; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "static _minVersion (range) {\n let s = range.split(' ')[0]\n while (s) {\n if (semver.valid(s)) {\n break\n }\n s = s.substring(1)\n }\n return s || undefined\n }", "function sv(str, minVersion, maxVersion)\n{ if ( ((sv.arguments.length < 3) || (is.major <= maxVersion)) \n ...
[ "0.5585061", "0.5411627", "0.52411795", "0.49984828", "0.49480188", "0.48571634", "0.48316678", "0.48043016", "0.47520474", "0.47336906", "0.47222534", "0.46630508", "0.46498713", "0.45821908", "0.4580631", "0.4499303", "0.44972944", "0.44694412", "0.44410014", "0.44299656", ...
0.7572261
0
Draws QR code to the given `canvas` and returns it.
function drawOnCanvas(canvas, settings) { var qr = createMinQRCode(settings.text, settings.ecLevel, settings.minVersion, settings.maxVersion, settings.quiet); if (!qr) { return null; } var $canvas = jq(canvas).data('qrcode', qr); var context = $canvas[0].getContext('2d'); drawBackground(qr, context, settings); drawModules(qr, context, settings); return $canvas; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@api\n redraw() {\n if (this.value) {\n const qrCodeGenerated = new qrcodeGeneration(\n 0,\n this._errorCorrection\n );\n\n qrCodeGenerated.addData(this.value, this._encoding);\n qrCodeGenerated.make();\n\n let svgCode =...
[ "0.60523456", "0.59711325", "0.589345", "0.56918144", "0.55602473", "0.5554381", "0.5468692", "0.5214101", "0.5208547", "0.5148443", "0.5109897", "0.510857", "0.5081925", "0.50689006", "0.505175", "0.50397104", "0.5026192", "0.501151", "0.49599937", "0.49262762", "0.49190986"...
0.7790648
0
Returns a `canvas` element representing the QR code for the given settings.
function createCanvas(settings) { var $canvas = jq('<canvas/>').attr('width', settings.size).attr('height', settings.size); return drawOnCanvas($canvas, settings); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function drawOnCanvas(canvas, settings) {\n var qr = createMinQRCode(settings.text, settings.ecLevel, settings.minVersion, settings.maxVersion, settings.quiet);\n if (!qr) {\n return null;\n }\n\n var $canvas = jq(canvas).data('qrcode', qr);\n var context = $canvas[0]....
[ "0.761237", "0.6912934", "0.6411634", "0.6269316", "0.6025549", "0.593511", "0.58275676", "0.57338804", "0.57232183", "0.57220894", "0.56892306", "0.56840193", "0.5610977", "0.56085354", "0.55400497", "0.5433563", "0.53741723", "0.53733826", "0.5340677", "0.5335207", "0.52623...
0.69664794
1
Returns an `image` element representing the QR code for the given settings.
function createImage(settings) { return jq('<img/>').attr('src', createCanvas(settings)[0].toDataURL('image/png')); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function createDiv(settings) {\n var qr = createMinQRCode(settings.text, settings.ecLevel, settings.minVersion, settings.maxVersion, settings.quiet);\n if (!qr) {\n return null;\n }\n\n // some shortcuts to improve compression\n var settings_size = settings.size;\n ...
[ "0.6551269", "0.6300483", "0.5939693", "0.59094363", "0.5895037", "0.58454007", "0.5672177", "0.5595341", "0.5583767", "0.55277264", "0.5521292", "0.54785675", "0.5455297", "0.5408633", "0.53184825", "0.52423596", "0.521436", "0.5204009", "0.5174044", "0.5148366", "0.51191676...
0.67723143
0
Returns a `div` element representing the QR code for the given settings.
function createDiv(settings) { var qr = createMinQRCode(settings.text, settings.ecLevel, settings.minVersion, settings.maxVersion, settings.quiet); if (!qr) { return null; } // some shortcuts to improve compression var settings_size = settings.size; var settings_bgColor = settings.background; var math_floor = Math.floor; var moduleCount = qr.moduleCount; var moduleSize = math_floor(settings_size / moduleCount); var offset = math_floor(0.5 * (settings_size - moduleSize * moduleCount)); var row; var col; var containerCSS = { position: 'relative', left: 0, top: 0, padding: 0, margin: 0, width: settings_size, height: settings_size }; var darkCSS = { position: 'absolute', padding: 0, margin: 0, width: moduleSize, height: moduleSize, 'background-color': settings.fill }; var $div = jq('<div/>').data('qrcode', qr).css(containerCSS); if (settings_bgColor) { $div.css('background-color', settings_bgColor); } for (row = 0; row < moduleCount; row += 1) { for (col = 0; col < moduleCount; col += 1) { if (qr.isDark(row, col)) { jq('<div/>') .css(darkCSS) .css({ left: offset + col * moduleSize, top: offset + row * moduleSize }) .appendTo($div); } } } return $div; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function showQr() {\n new QRCode(qr,{\n text: `${name.value.toUpperCase()}\nNUMBER PLATE: ${plate.value.toUpperCase()}\nCHASSIS: ${chassis.value.toUpperCase()}\nhttp://www.npf.gov.ng/tinted/permit/index.index.php?abuja=${id.value}`,\n width: 300,\n height: 300,\n })\n...
[ "0.6437941", "0.62831396", "0.61078393", "0.6077871", "0.60644764", "0.60304385", "0.60088664", "0.59863466", "0.59365666", "0.5904476", "0.585612", "0.5693855", "0.56244576", "0.5564403", "0.55440634", "0.5506828", "0.54966986", "0.54965603", "0.5479519", "0.53611845", "0.53...
0.7864426
0
Run code goes here
run (message) { // separting the message into cmd & args const messageArry = message.content.split(' ') const messageLength = messageArry.length - 1 // `.ticket create issue #1` is turned into // cmd = `.ticket`, option = `create`, issue = `issue #1` const option = messageArry[1] const issue = messageArry.slice(2, messageLength) const errorEmbed = new Discord.RichEmbed() .setTitle('Incorrect Usage!') .addField('Please use as:', `\`${this.client.commandPrefix}ticket [create/new] [Your Issue]\``) .setFooter('Made by - nukestye™', `${this.client.user.avatarURL}`) const permEmbed = new Discord.RichEmbed() .setTitle(message.author.tag) .setDescription('You do not have perms to close ticket, ask staff to do so.') .setFooter('Made by - nukestye™', `${this.client.user.avatarURL}`) if (option === 'create' || option === 'new') { const name = `Ticket-${message.author.discriminator}` if (issue.length < 1) return message.channel.send(errorEmbed) message.guild.createChannel(name, 'text').then(c => { const role = message.guild.roles.find('name', 'Staff') const role2 = message.guild.roles.find('name', '@everyone') c.overwritePermissions(role, { SEND_MESSAGES: true, READ_MESSAGES: true }) c.overwritePermissions(role2, { SEND_MESSAGES: false, READ_MESSAGES: false }) c.overwritePermissions(message.author, { SEND_MESSAGES: true, READ_MESSAGES: true }) const category = message.guild.channels.find(c => c.name === 'Support' && c.type === 'category') if (category) { c.setParent(category.id) } else { if (!category) { message.guild.createChannel('Support', 'category').then(Category => { c.setParent(Category.id) }) } else { console.error(`Category channel is missing:\nCategory: ${!!category}`) return message.channel.send(`Category channel is missing:\nCategory: ${!!category}`) } } message.channel.send(`:white_check_mark: Your ticket has been created, #${c.name}.`) const embed = new Discord.RichEmbed() .setColor(0xCF40FA) .addField(`Hey ${message.author.username}!`, `Please try explain why you opened this ticket with as much detail as possible. Our **Support Team** will be here soon to help.\n**Your Issue**\n ${issue.join(' ')}`) .setTimestamp() c.send({ embed: embed }) }).catch(console.error) } else if (option === 'close') { if (message.member.roles.some(role => role.name === 'Staff')) { if (!message.channel.name.startsWith('ticket-')) return message.channel.send('You can\'t use the close command outside of a ticket channel.') message.channel.send(`Are you sure? Once confirmed, you cannot reverse this action!\nTo confirm, type \`${this.client.commandPrefix}confirm\`. This will time out in 10 seconds and be cancelled.`) .then((m) => { message.channel.awaitMessages(response => response.content === `${this.client.commandPrefix}confirm`, { max: 1, time: 10000, errors: ['time'] }) .then((collected) => { message.channel.delete() }) .catch(() => { m.edit('Timed out, the ticket will not closed.') .then(m2 => { m2.delete() }, 3000) }) }) } else { message.channel.send({ embed: permEmbed }) } } else { message.channel.send(errorEmbed) } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function run() {}", "function run() {\n\n }", "Run() {\n\n }", "function run() {\n }", "run () {\n }", "function run() {\n\n}", "function runCode() {\n\t\tset_code(data);\n\t}", "function run () {\n load_userinfo();\n if (url.includes(\"discuss\")) {\n l...
[ "0.76041883", "0.7578692", "0.7529287", "0.7500702", "0.7062101", "0.69552034", "0.69324756", "0.66878647", "0.6676726", "0.6666443", "0.6654643", "0.6549697", "0.6471058", "0.64703476", "0.6401637", "0.63749194", "0.63530254", "0.6347068", "0.63296306", "0.63176477", "0.6311...
0.0
-1
EVENTS //////////////// window.addEventListener("mousemove", app.events.mousePosOnCanvas); window.addEventListener("mouseup", app.events.mouseUp); window.addEventListener("mousedown", app.events.mouseDown);
function onDocumentMouseMove( event ) { mouseX = ( event.clientX - app.width/2 ); mouseY = ( event.clientY/2 - app.height/2 ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function addMouseListeners() {\r\n gElCanvas.addEventListener('mousemove', onMove)\r\n gElCanvas.addEventListener('mousedown', onDown)\r\n gElCanvas.addEventListener('mouseup', onUp)\r\n}", "onActivate() {\r\n this.canvas.addEventListener('mousedown', this.mouseDownEventHandler);\r\n this....
[ "0.7366813", "0.73295873", "0.73041815", "0.7235083", "0.72139746", "0.71048754", "0.7102138", "0.70412", "0.695106", "0.6943553", "0.6925063", "0.6920607", "0.6910119", "0.6907832", "0.6898426", "0.68519586", "0.6813125", "0.6767761", "0.6757176", "0.6723509", "0.6699014", ...
0.6664109
24
Rendering //////////////// rendering function called in loop
function render() { stats.begin(); //camera positionning camera.position.x = ( mouseX - camera.position.x ) * 0.1; camera.position.y = ( - mouseY - camera.position.y ) * 0.1; camera.lookAt( scene.position ); requestAnimationFrame(render); renderer.render( scene, camera ); stats.end(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function render() {\n\t\t\t}", "function render() {\n\n\t\t\t}", "function render() {\n\t\t\n\t}", "render() {\n\t\tthis.a1.render(this.context);\n\t\tthis.b1.render(this.context);\n\t\tthis.c1.render(this.context);\n\t\tthis.c2.render(this.context);\n\t\tthis.d1.render(this.context);\n\t\tthis.e1.render(thi...
[ "0.7784709", "0.77556694", "0.77344805", "0.7714688", "0.7612673", "0.74172056", "0.74172056", "0.73875433", "0.7356476", "0.73120743", "0.73120743", "0.72808415", "0.7269201", "0.7269201", "0.7269201", "0.7243627", "0.72199804", "0.71689314", "0.7168611", "0.71615386", "0.71...
0.0
-1
Load a document from an URI, absolute or relative to the current sitemap
function loadDocument(uri) { var resolver = cocoon.getComponent( "org.apache.excalibur.source.SourceResolver"); var source = resolver.resolveURI(uri); try { var document = Packages.org.apache.cocoon.components.source.SourceUtil.toDOM(source); } finally { resolver.release(source); cocoon.releaseComponent(resolver); } return document; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function loadDocument(uri) {\n var parser = null;\n var source = null;\n var resolver = null;\n try {\n parser = cocoon.getComponent(Packages.org.apache.excalibur.xml.dom.DOMParser.ROLE);\n resolver = cocoon.getComponent(Packages.org.apache.cocoon.environment.SourceResolver.ROLE);\n source = res...
[ "0.6705444", "0.6191085", "0.6053718", "0.5688697", "0.5686216", "0.5626906", "0.5625001", "0.535249", "0.53453344", "0.53453344", "0.53369254", "0.5305177", "0.52327436", "0.52327436", "0.5205816", "0.51918375", "0.5174269", "0.5116176", "0.50922656", "0.50710285", "0.505037...
0.6733862
0
Creates an instance of FeedReader.
constructor(options) { Object.assign(this, options); if (!this.articlesOutStream) { throw new Error("Missing articlesOutStream"); } if (!this.feedInStream) { throw new Error("Missing feedInStream"); } if (!this.concurrency) { this.concurrency = 10; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function ReaderFactory() {}", "newEntryReader(options: EntryReaderOptions): EntryReader {\n return new EntryReader(this, options);\n }", "function FeedViewer() {\n this._init.apply(this, arguments);\n}", "function FeedParser () {\n var self = this;\n self.saxStream = require('sax').createStream(fals...
[ "0.65226114", "0.5848688", "0.5815979", "0.5692269", "0.5535047", "0.5490539", "0.5488296", "0.54827124", "0.54440176", "0.5429117", "0.54007316", "0.5336327", "0.53336227", "0.53336227", "0.53336227", "0.53336227", "0.53336227", "0.53336227", "0.53336227", "0.53336227", "0.5...
0.0
-1
Run feedreader, it will read feeds from feedInStream and write found articles in articlesOutStream It end when feedInStream emit an end event
run() { const self = this; return new Promise((resolve, reject) => { const pipelineArgs = [ self.feedInStream, new LoggerStream({ message: "feedReader.run feedInStream>" }), parallel.transform( (feed, encoding, callback) => { self .process(feed.url) .then(() => { callback(null, feed); return feed; }) .catch(error => { callback(error); }); }, { objectMode: true, concurrency: self.concurrency }), new LoggerStream({ message: "feedReader.run parallel.transform>" }), ]; if (self.feedOutStream) { pipelineArgs.push( new LoggerStream({ message: "feedReader.run >feedOutStream" }), self.feedOutStream ); } // Pipeline final argument is a callback pipelineArgs.push((error) => { if (error) { return reject(error); } resolve(); }); pipeline.apply(null, pipelineArgs); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function processFeed(feed, isotope_page, callback){\r\n feed = feed.responseData.feed;\r\n var entries = feed.entries;\r\n var articles = new Array();\r\n if(sideburnTemplate === null){\r\n sideburnTemplate = new Template(\"/templates/article\", null, null, null, function(tem...
[ "0.56259936", "0.550869", "0.54431546", "0.5352508", "0.5351009", "0.53310937", "0.5245857", "0.5245142", "0.5209201", "0.5186798", "0.5143602", "0.50737923", "0.50263464", "0.50198114", "0.50184125", "0.5016335", "0.50098634", "0.490734", "0.48946", "0.48849547", "0.4865928"...
0.6321037
0
Create a new game.
function newGame(n, target) { let data = generateData(face_genders, female_names, male_names, n); filenames = data[0]; names = data[1]; setUpRender(filenames, names); // Clear existing timers. try { window.clearTimeout(timer); window.clearInterval(result_timer); window.clearInterval(tick_timer); } catch(err) { // Don't care. } // Initialize timers. result_timer = setInterval(flashResults, S_TO_MS); tick_timer = setInterval(timerTick, S_TO_MS); setTimer(MEMORIZE_SEC); window.clearTimeout(timer); timer = buildRecallTimer(); current_mode = "memorize"; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function createGame () {}", "async create(game)\n {\n this.log.info('creating new game %s %s', game.id, game.name);\n\n const host = new GameHost(game, this.net);\n await host.startInstance();\n this.hosts.push(host);\n\n this.log.info('game instance for %s started!', game.id);\n\n // inform s...
[ "0.83364946", "0.7656899", "0.7533235", "0.74491125", "0.7440732", "0.73449725", "0.73274964", "0.7259151", "0.72167563", "0.7214506", "0.72058076", "0.71815515", "0.71612275", "0.7136137", "0.7133798", "0.71296805", "0.7093024", "0.70663273", "0.7066135", "0.7038021", "0.701...
0.64233243
63
Switch to recall mode.
function switchRecall() { switchRecallRender(); setTimer(RECALL_SEC); window.clearTimeout(timer); timer = buildResultTimer(); current_mode = "recall"; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function buildRecallTimer() {\n return setTimeout(switchRecall, MEMORIZE_SEC * S_TO_MS);\n}", "recall( n = -1 ) {\n \n const history = this.history;\n\n if( n < 0 ) return this[history[history.length + n].method].apply(this, history[history.length + n].args);\n\n else return this[histo...
[ "0.5355681", "0.5324435", "0.524964", "0.5104267", "0.50686044", "0.50407004", "0.4965592", "0.4962244", "0.49480948", "0.49161887", "0.4894717", "0.48926458", "0.4882578", "0.4857256", "0.48537043", "0.48312736", "0.4779663", "0.47782016", "0.47654167", "0.4762068", "0.47315...
0.7996275
0
Switch to result mode.
function switchResult() { switchResultRender(); renderScore(scoreGame()); current_mode = "result"; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function useResult() {\n updateFormula(function() {\n return resultDisplay.text();\n }, true);\n }", "switchResult(on) {\n this.resultClass = on\n ? 'slds-form-element slds-lookup slds-is-open'\n : 'slds-form-element slds-lookup slds-is-clo...
[ "0.61713105", "0.6115478", "0.5899522", "0.5662158", "0.55803835", "0.54039997", "0.53749377", "0.5248141", "0.51498914", "0.51295656", "0.512867", "0.5122722", "0.5113336", "0.5100053", "0.5069485", "0.50657773", "0.5055737", "0.5055091", "0.50493425", "0.504693", "0.5045417...
0.7718923
0
Maneja los filtros de proyecto
handleProjectChange(event) { const { name, value } = event.target; this.setState({ project: { ...this.state.project, [name]: value, }, }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function filtro() {\n let selectorSexo = document.getElementById(\"selectorSexo\");\n let inputNombre = document.getElementById(\"inombre\");\n\n const sexo = selectorSexo.value;\n const nombre = inputNombre.value.trim().toLowerCase();\n\n console.trace(`filtro sexo=${sexo} nombre=${nombre}`);\n console.debu...
[ "0.71433747", "0.70650107", "0.69662505", "0.6941914", "0.6831761", "0.6793147", "0.6782998", "0.6747394", "0.67448604", "0.6702384", "0.66809905", "0.6677676", "0.66232544", "0.6557244", "0.6548158", "0.6482813", "0.64621294", "0.64162475", "0.6414619", "0.64138645", "0.6405...
0.0
-1
Maneja los filtros de actividad
handleActivityChange(event) { const { name, value } = event.target; this.setState({ activity: { ...this.state.activity, [name]: value, }, }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function setFilter() {\n switch (target.value) {\n case 'person':\n addFilters('all', 'id', 'phone', 'email', 'hobby');\n toggelAdvancedbtn(\"person\");\n break;\n case 'company':\n addFilters('all', 'cvr', 'name', 'phone', 'email');\n toggelA...
[ "0.7246091", "0.68613255", "0.6826052", "0.6799616", "0.6799616", "0.6799616", "0.6799616", "0.6799616", "0.6799616", "0.6799616", "0.6799616", "0.6799616", "0.6762021", "0.67474407", "0.67051584", "0.67051584", "0.67051584", "0.67051584", "0.67051584", "0.67051584", "0.67051...
0.0
-1
Manejan los filtros de persona
handlePersonChange(event) { this.setState({ show: { ...this.state.show, filterResults: false, }, }); const { name, value } = event.target; this.setState({ person: { ...this.state.person, [name]: value, }, }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function filtro() {\n let selectorSexo = document.getElementById(\"selectorSexo\");\n let inputNombre = document.getElementById(\"inombre\");\n\n const sexo = selectorSexo.value;\n const nombre = inputNombre.value.trim().toLowerCase();\n\n console.trace(`filtro sexo=${sexo} nombre=${nombre}`);\n console.debu...
[ "0.7780834", "0.6956932", "0.6877953", "0.6782082", "0.6664981", "0.64841926", "0.64691067", "0.64451045", "0.643292", "0.64247316", "0.6397689", "0.63964623", "0.6272743", "0.6271314", "0.62698907", "0.6249764", "0.62336296", "0.62230116", "0.6221797", "0.6187848", "0.614627...
0.0
-1
Maneja los filtros de partida
async handleBudgetChange(event) { const { name, value } = event.target; this.setState({ budget: { ...this.state.budget, [name]: value, }, }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function filter() {\n let preFilter = [];\n let gender = selectG.value;\n let stat = selectS.value;\n let filteredChar = [];\n\n if (gender != \"Gender\") {\n filteredChar.push(\"gender\");\n if (filteredChar.length == 1) {\n limpiartodo();\n preFilter = filterGender(preFilter, gender, true);\...
[ "0.67793185", "0.6738174", "0.6621623", "0.6601521", "0.6549656", "0.6477179", "0.6474099", "0.6407554", "0.64065534", "0.63992125", "0.6362318", "0.63203955", "0.6298616", "0.62927854", "0.6257946", "0.6256378", "0.62140375", "0.6212352", "0.6199437", "0.6195098", "0.6195098...
0.0
-1
return the contact by the contact id
GetItem() { return { method: 'GET', path: '/contact/{id}', config: { description: 'Get contact', notes: 'Returns the contact which matches the id received', tags: ['api'], /*pre: [{ method: BaseController.Authorize(['general']) }],*/ handler: (request, reply) => { return this.BaseGetItemHandler(this.GetCollectionName(), request.params.id) .then((item) => { reply(item); }) .catch((err) => { reply(Boom.wrap(err, 400)); }) }, validate: { params: { id: joi.string().hex().required().description("Filter contact by id "), } } } }; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getContact(id) {\n return contacts[id];\n }", "function getContactByContactId(contactId) {\n\n var deferred = new $.Deferred();\n \n var contactList = window.Compass.Helm.LoanContacts;\n var contact = null;\n\n for (var i = 0; i < contactList.lengt...
[ "0.89063615", "0.7764037", "0.7729102", "0.7523333", "0.7162289", "0.69711095", "0.69600105", "0.68860304", "0.68695515", "0.6750106", "0.6560774", "0.6546844", "0.64388114", "0.643127", "0.6427946", "0.63910633", "0.6383369", "0.63510484", "0.62962437", "0.6286873", "0.62868...
0.58413255
51
return the contact by the contact id
GetItemAutocomplete() { return { method: 'GET', path: '/contact/autocomplete/{string}', config: { description: 'Get contact by some sub string of the name', notes: 'Returns the contacts which match the name of the substring passed', tags: ['api'], /*pre: [{ method: BaseController.Authorize(['general']) }],*/ handler: (request, reply) => { return this.BaseGetItemsAutocompleteHandler(this.GetCollectionName(), request.params.string) .then((item) => { reply(item); }) .catch((err) => { reply(Boom.wrap(err, 400)); }) }, validate: { params: { string: joi.string().required().description("Filter contact by substring of the name "), } } } }; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getContact(id) {\n return contacts[id];\n }", "function getContactByContactId(contactId) {\n\n var deferred = new $.Deferred();\n \n var contactList = window.Compass.Helm.LoanContacts;\n var contact = null;\n\n for (var i = 0; i < contactList.lengt...
[ "0.8906038", "0.7764337", "0.7729413", "0.75240546", "0.71636385", "0.69714236", "0.69604135", "0.68862826", "0.6870753", "0.6751003", "0.65622294", "0.6547027", "0.643891", "0.64306474", "0.64277595", "0.6392311", "0.6382997", "0.6350271", "0.62967753", "0.6287876", "0.62878...
0.0
-1
Returns the Contacts meeting the provided parameters. In case there are no search parameters, all Contacts will be returned
Get() { return { method: 'GET', path: '/contact', config: { description: 'Get contacts', notes: 'Returns the Contacts meeting the provided parameters. In case there are no search parameters, all Contacts will be returned', tags: ['api'], handler: (request, reply) => { return this.BaseGetHandler(this.GetCollectionName(), request.query) .then((item) => { reply(item); }) .catch((err) => { reply(Boom.wrap(err, 400)); }) }, validate: { query: { id: joi.string().hex().description("Filter contact by id (same as use path/{id})"), name: joi.string().description("Filter by contact's name"), email: joi.string().email().description("Filter contact by email"), phonenumber: joi.phone.e164().description("Filter by contact's phone number"), address: joi.string().description("Filter by the contact's address"), birthday: joi.date().iso().max('now').description("Filter by the contact's birthday") } } } }; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getPhoneContacts(){\r\n\tvar options = new ContactFindOptions();\r\n\toptions.filter=\"\"; // empty search string returns all contacts\r\n\toptions.multiple=true; // return multiple results\r\n\tfilter = [\"displayName\", \"name\", \"phoneNumbers\",\"photos\",\"emails\"];\r\n\t// find contac...
[ "0.7319802", "0.7145983", "0.7087223", "0.6928248", "0.6885723", "0.6787454", "0.6735602", "0.6689131", "0.66770387", "0.6475375", "0.6454935", "0.64398205", "0.63594544", "0.6298301", "0.6289553", "0.62210697", "0.618763", "0.6119327", "0.61055213", "0.6099368", "0.59511876"...
0.5407476
47
Create a new contact in the database by a POST request
Post() { return { method: 'POST', path: '/contact', config: { description: 'Create a contact ', notes: 'Create a new contact and returns it.', tags: ['api'], handler: (request, reply) => { return this.BasePostHandler(this.GetCollectionName(), request.payload) .then((item) => { reply(item); }) .catch((err) => { reply(Boom.wrap(err, 400)); }) }, validate: { payload: { name: joi.string().required().description("Name of the contact person"), phonenumber: joi.phone.e164().optional().allow('').description("The contact's phone number"), email: joi.string().email().optional().allow('').description("The contact's email"), address: joi.string().optional().allow('').description("The contact's address"), birthday: joi.date().iso().optional().max('now').allow('').description("The contact's birthday"), picture: joi.string().optional().allow('').description("The contact's picture"), } } } }; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function addContact(name, email, contactNumber) {\r\n if(checkEmptyField(name, email, contactNumber)) return;\r\n let dataObject = { 'name': name, 'email': email, 'contactNumber': contactNumber };\r\n $.ajax({\r\n url: \"http://localhost:8080/api/contact/create\",\r\n type: 'PUT',\r\n ...
[ "0.7475307", "0.73504", "0.72105575", "0.7180738", "0.70261", "0.6909752", "0.67889595", "0.67804885", "0.6780175", "0.6774251", "0.67663896", "0.6762721", "0.6751013", "0.6738387", "0.6705101", "0.6700908", "0.66736877", "0.66123706", "0.6596147", "0.65826136", "0.65344", ...
0.6087979
56
Updates the contact item that has the id provided. If the update is sucessful then the notification item data will be returned
Patch() { return { method: 'PATCH', path: '/contact/{id}', config: { description: 'Patch contact item', notes: 'Updates the contact item that has the id provided. If the update is sucessful then the contact item data will be returned', tags: ['api'], handler: (request, reply) => { return this.BasePatchHandler(this.GetCollectionName(), request.params.id, request.payload) .then((item) => { reply(item); }) .catch((err) => { reply(Boom.wrap(err, 400)); }) }, validate: { params: { id: joi.string().hex().required().description("Filter contact by id "), }, payload: { name: joi.string().optional().description("Name of the contact person"), phonenumber: joi.phone.e164().optional().description("The contact's phone number"), email: joi.string().email().optional().description("The contact's email"), address: joi.string().optional().description("The contact's address"), birthday: joi.date().iso().max('now').optional().description("The contact's birthday"), picture: joi.string().optional().allow('').description("The contact's picture") } } } }; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "updateContactById(id, updateContact){\n let index = this.contacts.findIndex(contact => contact.id === id)\n\n this.contacts[index].name = updateContact.name || this.contacts[index].name\n this.contacts[index].phone = updateContact.phone || this.contacts[index].phone\n this.contacts[inde...
[ "0.64917535", "0.63016456", "0.6238141", "0.6176348", "0.6118999", "0.61174566", "0.6044565", "0.5891191", "0.5853809", "0.57492703", "0.5747341", "0.5741424", "0.5739734", "0.5709403", "0.5691592", "0.5688212", "0.5657111", "0.5642245", "0.5636127", "0.561214", "0.5608138", ...
0.5208198
74
Put an element on the database
Put() { return { method: 'PUT', path: '/contact/{id}', config: { description: 'Put contact item in the database', notes: 'Updates the contact item that has the id provided. If the update is sucessful then the contact item data will be returned', tags: ['api'], handler: (request, reply) => { return this.BasePutHandler(this.GetCollectionName(), request.params.id, request.payload) .then((item) => { reply(item); }) .catch((err) => { reply(Boom.wrap(err, 400)); }) }, validate: { params: { id: joi.string().hex().required().description("Filter contact by id "), }, payload: { name: joi.string().optional().description("Name of the contact person"), phonenumber: joi.phone.e164().optional().description("The contact's phone number"), email: joi.string().email().optional().description("The contact's email"), address: joi.string().optional().description("The contact's address"), birthday: joi.date().iso().max('now').optional().description("The contact's birthday"), picture: joi.string().optional().allow('').description("The contact's picture"), } } } }; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function putEntry(data) {\n db.get(\"data_entries_point\").push(data).write();\n}", "function putIndexedDB(objectStore, item, key) {\r\n let openDB = openIndexedDB();\r\n\r\n openDB.onsuccess = function() {\r\n let db = getStoreIndexedDB(openDB, objectStore);\r\n let putRequest = db.store.put(item, key)...
[ "0.65548223", "0.6506666", "0.62615055", "0.62069494", "0.61782223", "0.615755", "0.6146406", "0.6103219", "0.6094421", "0.6009078", "0.5916059", "0.5915694", "0.5873743", "0.5873743", "0.5872145", "0.587142", "0.58656937", "0.5863343", "0.5858354", "0.5854905", "0.5845222", ...
0.0
-1
Deletes the contact item that has the id provided.
Delete() { return { method: 'DELETE', path: '/contact/{id}', config: { description: 'delete contact item', notes: 'Deletes the contact item that has the id provided.', tags: ['api'], handler: (request, reply) => { return this.BaseDeleteHandler(this.GetCollectionName(), request.params.id) .then(() => { reply(); }) .catch((err) => { reply(Boom.wrap(err, 400)); }) }, validate: { params: { id: joi.string().hex().required().description("Delete contact by id "), } } } }; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function deleteContact(id) {\n var _iterator2 = _createForOfIteratorHelper(contacts),\n _step2;\n\n try {\n for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {\n var contact = _step2.value;\n if (parseFloat(contact.id) === parseFloat(id)) contacts.splice(contacts.indexOf(contact), 1);\n ...
[ "0.7713994", "0.72795886", "0.71683216", "0.7150037", "0.7029298", "0.68940634", "0.68587315", "0.6819253", "0.67626476", "0.67335063", "0.6730563", "0.6712919", "0.66996247", "0.666174", "0.66616255", "0.6613412", "0.65489817", "0.6505478", "0.64980733", "0.6483289", "0.6393...
0.5947663
47
Returns the size of the file in bytes
function getFileSizeInBytes(filename) { var stats = fs.statSync(filename) var fileSizeInBytes = stats["size"] return fileSizeInBytes }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getFilesizeInBytes(filename) {\n var stats = fs.statSync(filename)\n var fileSizeInBytes = stats[\"size\"]\n return fileSizeInBytes\n}", "function getFilesize(fileName) {\n stats = fs.statSync(fileName);\n fileSizeBytes = stats.size;\n console.log('Bytes written so far: %d', (fileSizeBytes));\n retu...
[ "0.80828553", "0.7936286", "0.7839017", "0.7674886", "0.7642025", "0.76014084", "0.7544102", "0.7508911", "0.7246401", "0.71224624", "0.70971704", "0.7081837", "0.6952788", "0.68984693", "0.68890476", "0.6856516", "0.68351054", "0.6793753", "0.6772049", "0.67276806", "0.66493...
0.78090906
3
Serves a video either as a range of bytes or the entire video
function serveVideo(filename,req,res) { fs.stat(filename, function(err, stats) { if (err) { if (err.code === 'ENOENT') { res.writeHead(404); res.end(); return; } } var start; var end; var total = 0; var contentRange = false; // True if sending partial data var contentLength = 0; var range = req.headers.range; // If a range is specified in the header, parse it if (range) { var positions = range.replace(/bytes=/, "").split("-"); start = parseInt(positions[0], 10); total = stats.size; // If no end specified, serve rest of the file end = positions[1] ? parseInt(positions[1], 10) : total - 1; var chunksize = (end - start) + 1; contentRange = true; contentLength = chunksize; } // Otherwise serve the entire file else { start = 0; end = stats.size; contentLength = stats.size } if (start <= end) { var responseCode = 200; var responseHeader = { "Accept-Ranges": "bytes", "Content-Length": contentLength, "Content-Type": "video/mp4" }; // If sending partial data, specify the range in the header if (contentRange) { responseCode = 206; responseHeader["Content-Range"] = "bytes " + start + "-" + end + "/" + total; } res.writeHead(responseCode, responseHeader); var stream = fs.createReadStream(filename, { start: start, end: end}).on("readable", function() { var chunk; while (null !== (chunk = stream.read(1024))) { res.write(chunk); } }).on("error", function(err) { res.end(err); }).on("end", function(err) { res.end(); }); } else { // HTTP 403: Forbidden res.writeHead(403); res.end(); } }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "_sendVideo(options, data, start, end, done) {\n\t\tlet temp;\n\t\tlet callback = done;\n\n\t\tif (start < data.length) {\n\t\t\ttemp = data.slice(start, end);\n\t\t\t\n\t\t\toptions.body = temp;\n\t\t\toptions.headers['Content-Length'] = options.body.length;\n\t\t\toptions.headers['Content-Range'] = ('bytes ' + st...
[ "0.7015453", "0.60163087", "0.5945797", "0.5912173", "0.567372", "0.56511074", "0.56459594", "0.56053984", "0.5589894", "0.55373526", "0.55174065", "0.55138123", "0.5513522", "0.5498778", "0.5498455", "0.5491237", "0.5489832", "0.5461205", "0.5409612", "0.54021746", "0.540149...
0.7634724
0
get duration & currentTime for Time of song
function DurTime(e) { const { duration, currentTime } = e.target; var sec; var sec_d; // define minutes currentTime let min = currentTime == null ? 0 : Math.floor(currentTime / 60); min = min < 10 ? "0" + min : min; // define seconds currentTime function get_sec(x) { if (Math.floor(x) >= 60) { for (var i = 1; i <= 60; i++) { if (Math.floor(x) >= 60 * i && Math.floor(x) < 60 * (i + 1)) { sec = Math.floor(x) - 60 * i; sec = sec < 10 ? "0" + sec : sec; } } } else { sec = Math.floor(x); sec = sec < 10 ? "0" + sec : sec; } } get_sec(currentTime, sec); // change currentTime DOM currTime.innerHTML = min + ":" + sec; // define minutes duration let min_d = isNaN(duration) === true ? "0" : Math.floor(duration / 60); min_d = min_d < 10 ? "0" + min_d : min_d; function get_sec_d(x) { if (Math.floor(x) >= 60) { for (var i = 1; i <= 60; i++) { if (Math.floor(x) >= 60 * i && Math.floor(x) < 60 * (i + 1)) { sec_d = Math.floor(x) - 60 * i; sec_d = sec_d < 10 ? "0" + sec_d : sec_d; } } } else { sec_d = isNaN(duration) === true ? "0" : Math.floor(x); sec_d = sec_d < 10 ? "0" + sec_d : sec_d; } } // define seconds duration get_sec_d(duration); // change duration DOM durTime.innerHTML = min_d + ":" + sec_d; updateProgress(e); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function updateCurrentTime() {\n\n var song = document.querySelector('audio');\n var currentTime = Math.floor(song.currentTime); //it sends the value to the from currenttime to 'time' and after that get value from ret to CurrentTime\n currentTime = fancyTimeFormat(currentTime);\n\n var duration = Math....
[ "0.7753682", "0.7537345", "0.7371441", "0.7238096", "0.7136981", "0.7101667", "0.701997", "0.6791171", "0.67178553", "0.6697977", "0.6646058", "0.66356784", "0.6635637", "0.66061044", "0.6590448", "0.65829897", "0.6510258", "0.6494143", "0.6475755", "0.6467237", "0.64218545",...
0.0
-1
generates a random number
function setRandom(){ correctAns=Math.floor(1000+Math.random()*9000) +""; // console.log("Generated no is"+correctAns); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function randomNumberGenerator() {\n\treturn (Math.floor(((Math.random() * 9) + 1)));\n}", "function generateNum() {\n\treturn Math.floor(Math.random()*100)\n}", "function generateNumber() {\n return Math.floor(Math.random() * 256);\n }", "function getRandomNumber () {}", "function randomNumGen()...
[ "0.848984", "0.84228784", "0.84039485", "0.8367604", "0.8353997", "0.8340606", "0.83235204", "0.8302201", "0.8283621", "0.82590187", "0.82247794", "0.8202984", "0.82021326", "0.8200444", "0.81930053", "0.81544304", "0.8150633", "0.81491065", "0.81446457", "0.8135838", "0.8126...
0.0
-1
used to show the latest result to the user
function setMessage(msg) { document.getElementById("message").innerHTML = msg; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function loadLastResult() {\n \n request(\"http://introtoapps.com/datastore.php?action=load&appid=215242834&objectid=result-\" + username, \"GET\", \"json\", \"#quiz-list_error\", function(data) {\n \n selectObject(data, data[\"quiz-id\"], quizList);\n \n });\n}", "function lastquery(){\n\tGestion.me...
[ "0.6547963", "0.63167936", "0.629992", "0.6172905", "0.60999495", "0.6093985", "0.6033953", "0.59934783", "0.5959632", "0.5904703", "0.5868042", "0.5861459", "0.5856779", "0.5800227", "0.5784271", "0.57524323", "0.5744363", "0.57429147", "0.56859964", "0.5684139", "0.5682973"...
0.0
-1
Lets accept 4 digits from the user only
function validateInput(input) { if(input.length != 4) { setMessage("You must enter <b class='text-info'>4</b> Digits"); return false; } return true; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function allowFourDigits() {\n if (this.value.length > 4) {\n this.value = this.value.slice(0, 3);\n }\n}", "function checkLength() {\n\tif (document.getElementById( 'number-input' ).value.length >= 4) {\n\t\t/* If more than 4 digits input, limit it to 4, and update last\n\t\t * digit to most recent...
[ "0.85337985", "0.7645992", "0.7328031", "0.72972393", "0.7084881", "0.70655316", "0.70542157", "0.69823414", "0.6826992", "0.68156344", "0.6795089", "0.67548347", "0.67293453", "0.66403407", "0.66005224", "0.65908045", "0.652949", "0.6517928", "0.65128034", "0.6511644", "0.64...
0.76279426
2
Shows final result to the user
function showAnswer(success) { let code = document.getElementById("code"); if(success) { code.className += " success"; } else { code.className += " failure"; } code.innerHTML = correctAns; document.getElementById("inputdiv").style.display = "none"; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function showResult(event) {\n event.preventDefault();\n const fullName = getFullName();\n const email = getEmail();\n const house = getHouse();\n const family = getFamily();\n const content = getContent();\n const rate = getRate();\n const comment = getComment();\n deleteFormContent();\n const form = do...
[ "0.7438866", "0.7419805", "0.73148334", "0.72728866", "0.72176284", "0.71366143", "0.7123219", "0.6960669", "0.6879059", "0.68190396", "0.68171346", "0.67927897", "0.67893237", "0.6780861", "0.67626756", "0.67517585", "0.6751191", "0.67460275", "0.67445296", "0.673781", "0.67...
0.0
-1
days are 1indexed starting at Monday. return object keyed by menu category (e.g. Soup)
function menuFor(day, sheets) { return new Promise((resolve, reject) => { sheets.spreadsheets.values.get({ spreadsheetId: '1uzlk8dpvDeHOe6cAdBnAq8W62WHjPSq-2MC5q82TKKQ', range: 'weekly menu!A5:F12' }, (err, res) => { if (err) return reject(err) const menu = {} res.data.values.forEach(function(row) { const category = row[0].trim() const today = (row[day] || "").trim() menu[category] = today || 'I do not know' }) resolve(menu) }) }) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function Days () {\n var days = {};\n var x = $('.schedule-shifts').length + 1;\n for (var i = 1; i < 8; i++) {\n var name;\n var fri = '';\n switch (i) {\n case 1:\n name = 'Mon';\n break;\n case 2:\n name = 'Tues';\n break;\n case 3...
[ "0.6308546", "0.6039212", "0.596901", "0.58704484", "0.57662505", "0.5742889", "0.574002", "0.5720018", "0.5684095", "0.56522125", "0.5626026", "0.561609", "0.5614953", "0.5614953", "0.5614953", "0.5614953", "0.5614953", "0.5614953", "0.5613618", "0.5607251", "0.5605808", "...
0.59858036
2
Returns input value length
function inputLength() { return input.value.length; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getLength(input){\n return input.length;\n}", "function lengthInput()\r\n{\r\n return inputLength;\r\n}", "_getValLength( value ){\n\t\tif (isString( value )) {\n\t\t\t// if the value is a String get the real length\n\t\t\treturn value.length;\n\t\t} else if (this.options.forceString) {\n\t\t\t// ...
[ "0.8437408", "0.8205176", "0.8013935", "0.8008406", "0.80033803", "0.7998696", "0.793729", "0.793729", "0.793729", "0.793729", "0.793729", "0.793729", "0.793729", "0.793729", "0.793729", "0.79004985", "0.7851865", "0.7851865", "0.7851865", "0.7791825", "0.7625923", "0.76226...
0.7718497
21
Returns length of item
function listLength() { return item.length; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "get length() {\n\t\treturn this.items.length;\n\t}", "function listLength(){\n\treturn item.length;\n}", "get length() {\n return this.items.size;\n }", "function getLength(item) {\r\n if (!IsUndefinedNullOrEmpty(item))\r\n return item.length;\r\n else\r\n return 0;\r\n}", "si...
[ "0.8305929", "0.8245196", "0.8202372", "0.8077543", "0.79096407", "0.7861992", "0.77792495", "0.77544594", "0.77259296", "0.7640301", "0.7633196", "0.7551714", "0.75303245", "0.75282073", "0.75059915", "0.74931014", "0.7489663", "0.74610686", "0.74268097", "0.7415553", "0.736...
0.8250586
1
Resets text input field Start Cross Out Only added for new items
function crossOut() { li.classList.toggle('done'); // Toggles class 'done' for elements }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function resetInput(){\n $(\"#quantity-counter\").text(1);\n $(\"#item-name\").val('');\n}", "function resetInput(inputField) {\n inputField.val('');\n }", "function resetInput() {\n $(\"#date\").combodate('setValue', null);\n $(\"#start\").val(\"\");\n $(\"#interval\").combod...
[ "0.6982337", "0.69225955", "0.68648005", "0.6801933", "0.6797745", "0.6700779", "0.662633", "0.6606399", "0.66054535", "0.6550615", "0.65375996", "0.653634", "0.6517053", "0.6517053", "0.6517053", "0.6517053", "0.6514239", "0.6492806", "0.6484902", "0.6484612", "0.6474366", ...
0.0
-1
add listener for click
function deleteListItem() { li.classList.add('delete'); // Add class 'delete' to element }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function addClickListeners() {\n\t$('#start').click(triviaGame);\n}", "function _click(d){\n \n }", "function click(el){\n \n \n}", "function addclickEvents(){\n document.getElementById(\"flask\").addEventListener(\"click\", function() {\n callFlask();\n }, false);\n document.getEleme...
[ "0.71490234", "0.7021041", "0.6819902", "0.6804138", "0.6800726", "0.67953825", "0.67923087", "0.6774997", "0.672597", "0.6651014", "0.66508424", "0.66497445", "0.66072536", "0.66013783", "0.65868527", "0.6574869", "0.6567238", "0.6564006", "0.65561014", "0.6546318", "0.65363...
0.0
-1
register a seekBar directive / For directives, the callback function (seekBar) is a factory function. It returns an object that / describes the directive's behavior to Angular's HTML compiler. We've named the directive seekBar, which means Angular / will look for seekbar in the HTML and call this directive when it finds that markup.
function seekBar($document) { /* must inject $document as a dependency */ var calculatePercent = function(seekBar, event) { /* Calculates the horizontal percent along the seek bar */ /* where the event (passed in from the view as $event) occurred. */ var offsetX = event.pageX - seekBar.offset().left; var seekBarWidth = seekBar.width(); var offsetXPercent = offsetX / seekBarWidth; offsetXPercent = Math.max(0, offsetXPercent); offsetXPercent = Math.min(1, offsetXPercent); return offsetXPercent; }; return { templateUrl: '/templates/directives/seek_bar.html', /* specifies a URL from which the directive will load a template */ /* The templateUrl option specifies the path to the HTML template that the directive will use. */ replace: true, /* Specifies what the template should replace. If true, the template replaces the directive's */ /* If false, the template replaces the contents of the directive's element. */ /* replace: true instructs Angular to completely replace the <seek-bar> element with the directive's */ /* HTML template rather than insert the HTML between the <seek-bar></seek-bar> tags. */ restrict: 'E', /* Restricts the directive to a specific declaration style: element E, attribute A, class C, and */ /* comment M. If omitted, the defaults (E and A) are used. */ /* restrict: 'E' instructs Angular to treat this directive as an element. For example, Angular will run */ /* the code if it finds <seek-bar> in the HTML, but not if it finds <div seek-bar>. */ /* The & in the isolate scope object is a type of directive scope binding. The three types of directive */ /* scope bindings – @, =, and & – allow us to treat the value of the given attribute differently. */ /* The & binding type provides a way to execute an expression in the context of the parent scope. */ scope: { /* specifies that a new scope be created for the directive, Declaring an empty scope property ensures */ onChange: '&' /* that a new scope will exist solely for the directive (referred to as isolate-scope). An isolate-scope */ }, /* allows us to bind functions from the directive's view to its scope. Scoping the attribute allows us the / /* flexibility to specify how we want to handle the value passed to the on-change attribute: */ link: function(scope, element, attributes) { /* Responsible for registering DOM listeners and updating the DOM. */ /* This is where we put most of the directive logic. The link function is automatically generated and */ /* scoped to the element defining the directive. Think of it as a function that executes when the directive */ /* is instantiated in the view. This is where all logic related to DOM manipulation will go. */ scope.value = 0; /* seekBar's HTML template can access the attributes & methods of the directive's scope object */ /* Holds the value of the seek bar, such as the currently playing song time or the current volume. */ /* Default value is 0. */ scope.max = 100; /* Holds the maximum value of the song and volume seek bars. Default value is 100. */ var seekBar = $(element); /* Holds the element that matches the directive (<seek-bar>) as a jQuery object */ /* so we can call jQuery methods on it. */ attributes.$observe('value', function(newValue) { /* We can notify the directive of all changes to attribute values */ /* by using the $observe method on the Angular attributes object */ scope.value = newValue; }); attributes.$observe('max', function(newValue) { /* We can notify the directive of all changes to attribute values */ /* by using the $observe method on the Angular attributes object */ scope.max = newValue; }); var percentString = function () { /* A function that calculates a percent based on the value and maximum value */ /* of a seek bar. */ var value = scope.value; var max = scope.max; var percent = value / max * 100; return percent + "%"; }; scope.fillStyle = function() { /* Returns the width of the seek bar fill element based on the calculated percent. */ return {width: percentString()}; }; scope.thumbStyle = function() { /* updates the position of the seek bar thumb */ return {left: percentString()}; }; scope.onClickSeekBar = function(event) { /* Updates the seek bar value based on the seek bar's width and */ /* the location of the user's click on the seek bar. */ var percent = calculatePercent(seekBar, event); scope.value = percent * scope.max; notifyOnChange(scope.value); /* send the updated scope.value to the function evaluated by onChange */ }; scope.trackThumb = function() { /* Similar to scope.onClickSeekBar, but uses $apply to constantly apply */ /* the change in value of scope.value as the user drags the seek bar thumb. */ $document.bind('mousemove.thumb', function(event) { /* We use $document as we did in the Foundation, but with */ /* Angular, $document must be injected as a dependency to use it. */ var percent = calculatePercent(seekBar, event); scope.$apply(function() { scope.value = percent * scope.max; notifyOnChange(scope.value); /* send the updated scope.value to the function evaluated by onChange */ }); }); $document.bind('mouseup.thumb', function() { $document.unbind('mousemove.thumb'); $document.unbind('mouseup.thumb'); }); }; /* We name the function notifyOnChange because its purpose is to notify onChange that scope.value has changed. */ var notifyOnChange = function(newValue) { if (typeof scope.onChange === 'function') { scope.onChange({value: newValue}); } }; } }; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "_setSeekBarPos()\n {\n // Insert the seek bar into the correct container.\n let top = ppixiv.mobile || !helpers.isFullscreen();\n this.seekBar.root.remove();\n let seekBarContainer = top? \".seek-bar-container-top\":\".seek-bar-container-bottom\";\n this.root.querySelector(see...
[ "0.5653584", "0.5216995", "0.5038641", "0.50141996", "0.4822654", "0.48223767", "0.47898915", "0.477737", "0.47578552", "0.47152972", "0.47029215", "0.46562803", "0.46404034", "0.46251947", "0.4616447", "0.4614327", "0.46088067", "0.46088067", "0.46088067", "0.46088067", "0.4...
0.7844802
0
Params: baseURI path: If this is set, this path will be normalized. Otherwise the request path will be normalized.
function GetNormalizedPath() { }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function normalizeBase(base) {\n if (!base) {\n if (isBrowser) {\n // respect <base> tag\n const baseEl = document.querySelector('base');\n base = (baseEl && baseEl.getAttribute('href')) || '/';\n // strip full URL origin\n base = base.replace(/^\\w+...
[ "0.60815495", "0.6062212", "0.6062212", "0.60281986", "0.5965333", "0.5923114", "0.585962", "0.58404535", "0.5830885", "0.5809322", "0.57905954", "0.5726863", "0.5665024", "0.5653778", "0.56004506", "0.5598368", "0.5589009", "0.5589009", "0.5518051", "0.5509463", "0.55062234"...
0.61865586
0
don't throw any errors, just report them and end the cleanup
function invokeCleanup() { var Topic = Console.topic('TestRunner').topic('runCleanup'); var cleanup = 'cleanup'; var result = validate(cleanup, {mustExist: false}); if ( result.ok && result.exists === false ) { return; } cleanup = item.cleanup; runner.methodStart(cleanup.name); runner.currentMethod = cleanup.name; try { cleanup(); } catch (e) { /// FIXME: Qt5, remove this as e.stack *can be* enabled by default e.__addStack(1); Topic.debug('Exception in cleanup: ', e); var error = { message: e.message, stack: e.stack, formatted: e.formatted, meta: e.meta }; runner.logEvent('WARNING', error); } finally { Topic.debug('run finally - finishing method : cleanup '); runner.methodEnd(cleanup.name); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "cleanup() {}", "cleanup() {}", "cleanup() {\n\n\t}", "internalCleanup() {\n\n }", "function callback(err, results) {\n try { dev.close() }\n catch(_) { /* Well, we tried... */ }\n cb(null, clean(dev));\n }", "async cleanup() {\n\n }", "function somethingBad() {\n nock.cleanAll()\n ...
[ "0.7710211", "0.7710211", "0.736632", "0.708011", "0.6882819", "0.6832897", "0.6762577", "0.6710967", "0.65977323", "0.65977323", "0.6536951", "0.6522848", "0.6522848", "0.6522848", "0.64740455", "0.64740455", "0.64740455", "0.64608884", "0.6453599", "0.64054626", "0.64054626...
0.65734434
10
audio average volume / GLOBAL INITIALIZATION AND AUDIO IMPORT
function InitPage() {//page initialization //PREPARE SAVE DefaultSave(); //FPS PREPARATION stop_animating = false; frame_count = 0; fps_array = []; fps = 60; animating = false; setInterval(UpdateFPSDisplay, 1000); //UI INITIALIZATION InitUI(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function volumeUpMusic() {\n if( audio.volume <= .9 ) {\n audio.volume += .12\n } else {\n audio.volume = 1\n }\n console.log(audio.volume)\n imageVolume()\n}", "function getVolume()\n {\n return audio.volume;\n }", "function addMix () {\n\tlet slider = document.getEle...
[ "0.686863", "0.68256", "0.6820203", "0.6796098", "0.6693362", "0.6674192", "0.66299355", "0.66263515", "0.6569682", "0.6567203", "0.6519878", "0.6515844", "0.6513527", "0.6493304", "0.6453861", "0.64403963", "0.6397636", "0.6388051", "0.6384308", "0.6383977", "0.6380435", "...
0.0
-1
the animation loop calculates time elapsed since the last loop and only draws if the specified fps interval is achieved
function Animate() { //stop animating if requested if (stop_animating) return; // request another frame requestAnimationFrame(Animate); // calc elapsed time since last loop time.now = performance.now(); time.elapsed = time.now - time.then; // if enough time has elapsed and all objects finished rendering, draw the next frame if ( (time.elapsed > fps_interval) && (UpdateFinished()) ) { //add this frame duration to the frame array fps_array.push( parseInt(1000/ (time.now - time.then) ) ); // Get ready for next frame by setting then=now, but also adjust for your // specified fps_interval not being a multiple of user screen RAF's interval //(16.7ms for 60fps for example). time.then = time.now - (time.elapsed % fps_interval); //Draw the frame UpdateTimeDisplay(); DrawFrame(); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "loop() {\n if (document.hidden) { this.running = false }\n\n let now = Date.now(),\n delta = now - (this.lastRender || now)\n this.lastRender = now;\n\n if (this.running) {\n this.draw(delta)\n this.frames++\n }\n\n requestAnimationFrame(()...
[ "0.75321823", "0.75300694", "0.7507789", "0.7382644", "0.7360565", "0.73501056", "0.73303586", "0.72467214", "0.7191583", "0.71559143", "0.71529967", "0.7097042", "0.70888734", "0.7088589", "0.7055679", "0.7037421", "0.7023097", "0.7000001", "0.6989694", "0.6982969", "0.69761...
0.7669371
0
holds the bounds of the created markers on the map / Init Map Function
function initMap() { // defines map location coorodinates var hamilton = { lat: 43.2557, lng: -79.8711 }; // creates the map centered on Hamilton, ON, Canada map = new google.maps.Map(document.getElementById('map'), { zoom : 13, center: hamilton, mapTypeControl: true, fullscreenControl: false, mapTypeControlOptions: false }); infoWindow = new google.maps.InfoWindow(); bounds = new google.maps.LatLngBounds(); ko.applyBindings(new ViewModel()); // initiates KnockoutJS for the ViewModel }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function initMap() {\n map = new google.maps.Map(document.getElementById(\"map\"), {\n center: {\n lat: 26.137184,\n lng: 91.784439\n },\n zoom: 13,\n mapTypeId: 'roadmap'\n });\n\n infoWindow = new google.maps.InfoWindow();\n\n var bounds = new google.maps.LatLngBounds();\n\n for (var i...
[ "0.7789447", "0.7772621", "0.77123815", "0.7567443", "0.7560191", "0.73964477", "0.73603404", "0.7337995", "0.7265786", "0.7258263", "0.72444457", "0.72400385", "0.72090656", "0.7202341", "0.72015476", "0.7200101", "0.7166649", "0.71412194", "0.7137028", "0.711764", "0.707143...
0.0
-1
Adds location details to the infowindow
function populateInfoWindow(marker, street, city, infowindow) { if (infowindow.marker != marker) { infowindow.setContent(''); infowindow.marker = marker; // closes the info-window when close is clicked infowindow.addListener('closeclick', function() { infowindow.marker = null; }); // creates a streetview object in the info-window var streetViewService = new google.maps.StreetViewService(); var radius = 50; // formatting the content in the window var windowContent = '<h3>' + marker.title + '</h3>' + '<p>' + street + '<br>' + city + '</p>'; // gets the sreet view if it exists. Adds panorama options var getStreetView = function (data, status) { // if the map street-view is found if (status == google.maps.StreetViewStatus.OK) { var nearStreetViewLocation = data.location.latLng; // gets a point close to the location in question var heading = google.maps.geometry.spherical.computeHeading(nearStreetViewLocation, marker.position); // compute headings for the panorama infowindow.setContent(windowContent + '<div id="pano"></div>'); // adds the street-view to the location info // define pano options var panoramaOptions = { position: nearStreetViewLocation, pov: { heading: heading, pitch: 0 } }; var panorama = new google.maps.StreetViewPanorama(document.getElementById('pano'), panoramaOptions); // } else { // display a message if street view is unavailable infowindow.setContent(windowContent + '<div>Street-view not available</div>'); } }; streetViewService.getPanoramaByLocation(marker.position, radius, getStreetView); // gets the panorama infowindow.open(map, marker); // opens the info-window on the map } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function placeInfoWindow(map, location) {\n let url = \"/getAddress?lat=\" + location.lat() + \"&lng=\" + location.lng();\n fetch(url)\n .then(res => res.json())\n .then(data => {\n // CHANGE INFOWINDOW CONTENT (LIKE A DOM)\n infowindow.setContent(\n '<img style=\"width:50px;...
[ "0.7436014", "0.731414", "0.7259854", "0.717327", "0.7128863", "0.7114174", "0.7079046", "0.70766956", "0.7071199", "0.70028085", "0.69992846", "0.69525903", "0.6952005", "0.69448775", "0.69153106", "0.6883224", "0.6863514", "0.6863074", "0.68555236", "0.68530524", "0.6826425...
0.6662997
39
Sets the animation for the markers
function toggleBounce(marker) { if (marker.getAnimation() !== null) { marker.setAnimation(null); } else { marker.setAnimation(google.maps.Animation.BOUNCE); setTimeout(function() { marker.setAnimation(null); }, 1400); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "setMarkerAnimation(marker) {\n\t\tthis.currentMarker = marker;\n\t\tthis.MAPMarker.SetAnimation(this.currentMarker);\n\t}", "function curentAnimation(mark) {\r\n mark.setIcon('http://maps.gstatic.com/mapfiles/ms2/micons/bar.png');\r\n mark.setAnimation(google.maps.Animation.BOUNCE);\r\n}", "function setA...
[ "0.75592804", "0.73248523", "0.70531875", "0.68347627", "0.66927296", "0.6501476", "0.64897925", "0.6430377", "0.6424922", "0.6404179", "0.63518494", "0.6337229", "0.6315497", "0.6308818", "0.6307379", "0.628968", "0.62712854", "0.6262106", "0.6235512", "0.62330484", "0.62186...
0.0
-1
Creates the marker images
function makeIcon() { var image = { url: 'http://chart.googleapis.com/chart?chst=d_map_spin&chld=1.15|0|D65555|40|_|%E2%80%A2', size: new google.maps.Size(21, 34), origin: new google.maps.Point(0, 0), anchor: new google.maps.Point(10, 34), scaledSize: new google.maps.Size(21, 34) }; return image; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function createMarkerIcons() {\n\t\t\tvar markerIconDot = {\n\t\t\t\turl: '/assets/images/1x1-pixel.png',\n\t\t\t\tsize: new google.maps.Size(1, 1),\n\t\t\t\torigin: new google.maps.Point(0, 0),\n\t\t\t\tanchor: new google.maps.Point(4, 4),\n\t\t\t\tscaledSize: null\n\t\t\t};\n\n\t\t\tvar markerIconSmallRed = {\n\...
[ "0.75684524", "0.7266626", "0.69883007", "0.6955126", "0.67849994", "0.6772415", "0.6772359", "0.6738935", "0.67100847", "0.6698893", "0.6641551", "0.66375196", "0.65683526", "0.65680283", "0.6546938", "0.65462816", "0.6541257", "0.65356994", "0.6526513", "0.6473536", "0.6454...
0.6181356
48
Loads local storage browser dictionary
loadPageDictionary() { const url = document.location.href; const dictionaryKey = `${url}.dictionary`; browser.storage.local.get(dictionaryKey).then(dictionary => { if (!dictionary[dictionaryKey] || dictionary[dictionaryKey].length === undefined) { this.log(`Dictionary not found`); return; } this.dictionary = dictionary[dictionaryKey]; this.log(`Dictionary loaded (${this.dictionary.length} words)`); this.textManager.highlightWords(this.dictionary); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function loadLocalStore(key) {\n var localString = localStorage.getItem(key);\n // catch undefined case\n localString = (localString) ? localString : \"{}\";\n return JSON.parse(localString);\n}", "static load() { return JSON.parse(window.localStorage.getItem('settings')) || {}; }", "load () {\n ...
[ "0.71726865", "0.7034572", "0.6958511", "0.6889129", "0.6814943", "0.6755905", "0.6750934", "0.66875315", "0.6671974", "0.6592297", "0.65694493", "0.65090626", "0.64958125", "0.64861286", "0.6485279", "0.647068", "0.64696217", "0.6467934", "0.6458961", "0.64547366", "0.645135...
0.6608683
9
Set up double click handlers
addHandlers() { this.onDoubleClick = this.onDoubleClick.bind(this); document.addEventListener("dblclick", this.onDoubleClick); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "onDoubleClick(e) {}", "doubleClick(x, y, _isLeftButton) {}", "function doubleClickEvent() {\n const buttons = document.querySelectorAll('.btn');\n buttons.forEach( buttons => buttons.addEventListener(\"dblclick\", (e) => {\n\n e.stopPropagation();\n window.alert(\"Thank you for signing up!\");\n })\n...
[ "0.7529161", "0.712862", "0.7024478", "0.6929979", "0.6725676", "0.6701528", "0.6694666", "0.6680143", "0.6628555", "0.6559908", "0.65421295", "0.65382326", "0.64999294", "0.64996105", "0.64285976", "0.6395143", "0.6395143", "0.63784575", "0.6371411", "0.6353512", "0.63334477...
0.7493516
1
Check if user already studying this word
isNewWord(word) { for (let wordObj of this.dictionary) { if (wordObj.text === word) { return false; } } return true; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function checkWord() {\r\n let userWord = document.getElementById(\"user-word\").value;\r\n userWord = userWord.toLowerCase();\r\n if (userWord == \"\") {\r\n $(\"#result\").text(\"Please insert a word.\");\r\n }\r\n else if (userWord == gameWor...
[ "0.6511954", "0.64940584", "0.6376401", "0.630853", "0.6291748", "0.61324656", "0.6061613", "0.60495365", "0.6042218", "0.59113234", "0.5907135", "0.5903558", "0.58555245", "0.5841895", "0.5823087", "0.5819563", "0.58156794", "0.5803104", "0.5780141", "0.5769507", "0.5743696"...
0.6743824
0
Add new word to the dictionary
async handleNewWord(word) { var saved = () => { const url = document.location.href; const dictionaryKey = `${url}.dictionary`; this.log(`Dictionary updated. Dictionary length = ${this.dictionary.length}`); let sendMessage = browser.runtime.sendMessage({command: "updateWordList", dictionaryKey: dictionaryKey}); sendMessage.then(responce => { this.textManager.highlightWords(this.dictionary); }, error => {this.error(error)}); }; var fail = (error) => { this.error(`Failed to update dictionary: ${error}`); }; let translated = "-"; try { translated = await this.translator.translate(word, this.pageLanguage, this.browserLanguage); } catch(e) { this.error(this.error); return; } this.dictionary.push({ text: word, translated: translated, language: this.pageLanguage, id: this.dictionary.length }); this.saveDictionary().then(saved, fail); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function addWordToDict(word){\n\tif (!wordDictionary.hasOwnProperty(word)){\n\t\twordDictionary[word] = 1;\n\t} else {\n\t\twordDictionary[word] += 1;\n\t}\n}", "'word.add'(val) {\n Vocabruary.insert(val);\n }", "function addWord() {\n if (currentWordLen > 0) {\n const word = str\n ...
[ "0.7757826", "0.75724936", "0.73463887", "0.73349947", "0.7318806", "0.7210921", "0.7157901", "0.6948513", "0.6900994", "0.6848607", "0.6830777", "0.67351305", "0.6718017", "0.67118776", "0.6699703", "0.669641", "0.6686929", "0.6592408", "0.6587741", "0.6573133", "0.65441626"...
0.72768074
5
To find Fibonacci series
function FibonacciSeries() { var n= document.getElementById("fibvalue").value; try { if(n == "") throw "empty"; if(isNaN(n)) throw "not a number"; n = Number(n); if(n < 10) throw "too low"; if(n > 100) throw "too high"; } catch(err) { alert("Input is " + err); } alert("check output in console-log"); if(n>10 && n<100) { var a=0 var b=1 var i=0 for(i=3;i<=n;i++) { c=a+b; console.log("fibonacci at "+ i +" ="+ c); a=b; b=c; } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function fibonacci(number) { // Ingresa un numero entero positivo \n let a = 0, b = 1, nextTerm; // Se declaran los terminos 0 y 1 para poder comenzar la cadena de fibonacci\n\n if (number < 2) { // Si se ingresa el valor 0 se imprime un teorico 0 que seria el valor 0 de fibonacci, pero hice un cambio para q...
[ "0.8146763", "0.8106741", "0.8098867", "0.8085705", "0.8078963", "0.8058612", "0.7969107", "0.79395425", "0.79188144", "0.79107225", "0.79025924", "0.78962874", "0.787984", "0.78622", "0.78516483", "0.7843105", "0.7842905", "0.78387654", "0.78298295", "0.78130996", "0.7808994...
0.0
-1
Takes a series of intervals, for each root, and returns array of notes 1 = half step, 2 = whole step, 3 = 1.5 step, 4 = 2 step...
function getNotes(root, intervals){ var diatonic = new Diatonic(root); var noteArray = new Array(); noteArray[0] = root; if(intervals !== '&nbsp;'){ for(var i = 0; i < intervals.length; i++){ noteArray[i + 1] = diatonic.getNextNote(intervals[i]); } } return noteArray; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getNotes(root, intervals) { \n\t//initialise the arrays (intervals array passed as param)\n\tvar chromaticScale = [\t'E','F','F#','G','G#','A','A#','B','C','C#','D','D#', \n\t\t\t\t\t\t\t'E','F','F#','G','G#','A','A#','B','C','C#','D','D#', \n\t\t\t\t\t\t\t'E','F','F#','G','G#','A','A#','B','C','C#','D','...
[ "0.7338023", "0.61412305", "0.5839376", "0.57847846", "0.5761309", "0.56359607", "0.563478", "0.56325835", "0.55946845", "0.5504364", "0.5385264", "0.53742343", "0.535268", "0.53338474", "0.5329229", "0.53243303", "0.53034514", "0.52937454", "0.5275325", "0.5261365", "0.52377...
0.71143544
1
Interval reference Perfect unison = 0 Minor second = 1 Major second = 2 Minor third = 3 Major third = 4 Perfect fourth = 5 Aug fourth/Dim fifth = 6 Perfect fifth = 7 Minor sixth = 8 Major sixth = 9 Minor seventh = 10 Major seventh = 11 This works by adding to last note, not root, ex. 343 for minor seventh chord
function setChordPanel(chords){ var chordPanelString = '<table id="chordTable">'; chordPanelString += ' <tr>'; var i = 0; var curGroup = chords[0].group; chordPanelString += '<td><ul>'; while(i < chords.length){ if(chords[i].group !== curGroup){//Moved to next group curGroup = chords[i].group; chordPanelString += '</ul></td><td><ul>'; } chordPanelString += '<li><a name="' + chords[i].intervals + '" class="pointer hoverable" onclick="setChord(this);">' + chords[i].name + '</a></li>'; i++; } chordPanelString += '</ul></td>'; chordPanelString += ' </tr>'; chordPanelString += '</table>'; document.getElementById('note_slideDownMenu').innerHTML = chordPanelString; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getNotes(root, intervals) { \n\t//initialise the arrays (intervals array passed as param)\n\tvar chromaticScale = [\t'E','F','F#','G','G#','A','A#','B','C','C#','D','D#', \n\t\t\t\t\t\t\t'E','F','F#','G','G#','A','A#','B','C','C#','D','D#', \n\t\t\t\t\t\t\t'E','F','F#','G','G#','A','A#','B','C','C#','D','...
[ "0.61779994", "0.58340096", "0.5831581", "0.57032424", "0.55585027", "0.5534436", "0.550731", "0.53461987", "0.5250006", "0.52077806", "0.51856154", "0.51798964", "0.51367337", "0.51232463", "0.51148474", "0.51019406", "0.50924265", "0.5061068", "0.5046155", "0.50374645", "0....
0.0
-1
remove the overlay, if we're in a correct state make an ajax call // to change the main page content
function removeNode(){ fadeOut(); if (state === true) { makeRequest(); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function removeOverlay() {\n if (!getCurrentOpen()) {\n removeClass(overlay, fadeClass);\n overlay.remove();\n resetScrollbar();\n }\n}", "function removeOverlay( e ) {\n //console.debug( \"removing overlay\" );\n $(\"overlay\").hide();\n}", "removeLoadingOverlay() {\n\t\tif (this.is_showing_loadi...
[ "0.72035897", "0.7141497", "0.69827616", "0.68784565", "0.6827612", "0.67486525", "0.6711216", "0.667748", "0.66401076", "0.66348755", "0.6623944", "0.66179276", "0.65494305", "0.6522709", "0.6473656", "0.6462017", "0.64332515", "0.6428138", "0.6418839", "0.63981545", "0.6369...
0.0
-1
create an overlay to run when an answer was chosen
function createOverlay(){ // change message and page state if (this.className == "correct") { messageHTML = "You are correct!"; state = true; }else{ messageHTML = "You are wrong, please try again."; } // create and add the overlay overlay = document.createElement("div"); overlay.setAttribute("id", "overlay"); document.body.appendChild(overlay); fadeIn(overlay, 0.7); // create the text area... overText = document.createElement("div"); overText.setAttribute("id", "overText"); overText.innerHTML= messageHTML; document.body.appendChild(overText); fadeIn(overText, 1); // bind a click to remove it. overlay.addEventListener('click', removeNode); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function onChoice(event) {\n clearTimeout(hideResponseTimeout);\n hideResponse();\n var element = event.target;\n\n if (element.matches(\"li\")) {\n var createDiv = document.createElement(\"div\");\n createDiv.setAttribute(\"id\", \"createDiv\");\n\n if (element.textContent == ques...
[ "0.65589815", "0.652645", "0.6444585", "0.63820034", "0.6341064", "0.63241124", "0.63130087", "0.6312983", "0.63067", "0.62981427", "0.62907696", "0.62838507", "0.6281402", "0.62799627", "0.62647563", "0.6258571", "0.62500453", "0.6243351", "0.62430555", "0.62430555", "0.6237...
0.58839273
93
Ajax Call, using regular javascript, does not currently support older versions of IE;
function makeRequest(){ var httpRequest = new XMLHttpRequest(); httpRequest.onreadystatechange = function(){ var response = ''; if (httpRequest.readyState === 4) { if (httpRequest.status === 200) { response = httpRequest.responseText; state = false; }else{ response = "there was a server error, please reload the page"; } document.getElementById('main').innerHTML = response; bindAnswers(); } } httpRequest.open('GET', 'ajax.php', true); httpRequest.send(null); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function fncallxmlAjaxFunction()\r\n{\r\n var senddata = mstrInformationTargetID;\r\n\t\tvar url = \"/loadData?senddata=\"+senddata;\r\n \r\n // To remove firefox bug :\r\n if (navigator.appName ==\"Netscape\")\r\n\t\t{\r\n\t\t\t http_request.open(\"GET\", url, true);\r\n\t\t}\r\n else\r...
[ "0.6972461", "0.6882267", "0.6826113", "0.6824396", "0.67674494", "0.6655262", "0.66210353", "0.661113", "0.65936166", "0.6587835", "0.6581856", "0.65644246", "0.6558989", "0.65517557", "0.6510495", "0.6481371", "0.64812195", "0.6480776", "0.64789397", "0.6474595", "0.6472081...
0.0
-1
loop through the answers nodeList using array's foreach method and assign the createOverlay function as a click event for every answer. // get the child nodes of definitionTest
function bindAnswers(){ answers = document.getElementById('definitionTest').childNodes; Array.prototype.forEach.call(answers, function(answer){ answer.addEventListener('click', createOverlay); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function buildQuiz() {\n questionsEl.textContent = questions[questionIndex].question;\n\n choicesEl.innerHTML = \"\";\n resultsEl.innerHTML = \"\";\n\n //for loop method\n for (var i = 0; i < questions[questionIndex].choices.length; i++) {\n var questionChoicesItem = document.createElement(\"...
[ "0.6416151", "0.63368076", "0.632616", "0.6320811", "0.62644696", "0.6236028", "0.6102381", "0.6100545", "0.6065886", "0.60637844", "0.6041361", "0.60112345", "0.597657", "0.5973307", "0.5965755", "0.5956576", "0.59469944", "0.5923427", "0.5891638", "0.58852446", "0.5866809",...
0.8461279
0
CR: awesome! great logic
function generateCherry() { var optionalCells = getFreeCells() var rndIdx = getRandomIntInclusive(0, optionalCells.length - 1) var rndCell = optionalCells[rndIdx] if (!rndCell) return; gBoard[rndCell.i][rndCell.j] = CHERRY renderCell(rndCell, CHERRY) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function main()\r\n\t{\r\n\t\tif ($(\"font[color*='#007700']\").length>0)\r\n\t\t{\r\n\t\t\tvar captchars = $(\"img[src*='cap_']\");\r\n\t\t\tvar capText='';\r\n\t\t\t$(\"img[src*='slow_1']\").each(function(){capText+= GetCapchar(captchars[GetImgNumber(this.src)-1].src);});\r\n\t\t\t$(\"[onpaste*='return false;']\...
[ "0.5652597", "0.53394675", "0.5331994", "0.53311825", "0.5321784", "0.53030586", "0.5267678", "0.52211803", "0.51814127", "0.51814127", "0.51814127", "0.51814127", "0.51736367", "0.51449144", "0.5133377", "0.512617", "0.51257914", "0.51257914", "0.51201296", "0.5109429", "0.5...
0.0
-1
CR: good generic function!
function showModal(modalForWin) { var elModal = document.querySelector(".modal"); elModal.style.display = 'block' var resString = (modalForWin) ? `Well Done ` : 'Try again..' elModal.innerHTML = `${resString} <button onclick="init()">Play again</button>` }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private public function m246() {}", "protected internal function m252() {}", "private internal function m248() {}", "function i(e,t){return t}", "transient private protected internal function m182() {}", "transient protected internal function m189() {}", "transient private internal function m185() {}",...
[ "0.60308033", "0.5968969", "0.59162694", "0.5814583", "0.5787574", "0.5785248", "0.5727697", "0.5716829", "0.57038563", "0.57038563", "0.5703032", "0.56441915", "0.5608296", "0.5596092", "0.55203867", "0.55203867", "0.5475126", "0.5465306", "0.5464281", "0.54478884", "0.54331...
0.0
-1
Writes the configuration back to the server
function saveConfig() { var data = JSON.stringify(editor.getValue()); $.ajax({ url: serverURL + "config", method: 'POST', contentType: "application/json; charset=utf-8", dataType: 'json', xhrFields: { withCredentials: true }, data: data, success: function () { $("#successDialog").dialog({ modal: true, draggable: false, buttons: { ok: function () { $(this).dialog("close"); } } }); } }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function writeConfig() {\r\n /** output `config.json` file */\r\n let fd = fs.openSync(\"config.json\", \"w\");\r\n /** Config object to be serialized into JSON */\r\n let config_obj = {\r\n last_scan_time: last_scan_time\r\n };\r\n /** JSON-serialized configuration data */\r\n let data = JSON.stringify(...
[ "0.701695", "0.6773093", "0.66760445", "0.6577536", "0.6524788", "0.6493316", "0.6476665", "0.64307696", "0.63637924", "0.6347492", "0.6183048", "0.6179185", "0.6158627", "0.61504805", "0.61412233", "0.61352533", "0.61351496", "0.6120497", "0.61193144", "0.6044201", "0.599114...
0.528772
58
It loads the Backend Servers configuration.
function loadConfig() { $.ajax({ url: serverURL + "config", dataType: "json", xhrFields: { withCredentials: true }, success: function (data) { editor.setValue(data); closeWaitAnimation(); } }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "loadCustomConfig() {\n try {\n const config = require(`${process.cwd()}/config/server.js`) || {};\n\n this._config = merge.all([this._config, config]);\n } catch (err) {\n if (!err.code || err.code !== 'MODULE_NOT_FOUND') {\n throw err;\n }\n }\n }", "loadConfig() {\n ...
[ "0.6531531", "0.6402371", "0.619233", "0.6047952", "0.60060704", "0.5834497", "0.5833129", "0.5829139", "0.57843745", "0.5782568", "0.5760901", "0.57535315", "0.57371694", "0.56810915", "0.5663318", "0.5625764", "0.5613896", "0.5588025", "0.55462575", "0.5526386", "0.55237764...
0.0
-1
Update config based on canvas
updateConfig(canvas) { this.size = canvas.size; this.updateCache(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "static get pluginConfig() {\n return {\n after: ['render', 'updateCanvasSize']\n };\n }", "static get pluginConfig() {\n return {\n after: ['render', 'updateCanvasSize']\n };\n }", "updateConfigs(){\n this.level = this.scene.level;\n this.mode = parseFloat(this.scene.mode)...
[ "0.6448887", "0.6448887", "0.6443755", "0.64228344", "0.64228344", "0.64186394", "0.6269881", "0.61787075", "0.6170971", "0.6133932", "0.6133932", "0.6114062", "0.61110485", "0.6003738", "0.597601", "0.59590846", "0.5939103", "0.59277135", "0.5916628", "0.5915131", "0.5909322...
0.81131566
0
Update the image cache src to match config
updateCache() { this.imageCache.src = this.config.src; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function swapSrc(img, src) {\n $(img).attr('src', src);\n }", "updateImagesWithSameSrc(response, image){\n CAEditor.allMatchedElements('uploadable').forEach(item => {\n if ( item.getPointerSetting('defaultUrl', 'uploadable') == image.getPointerSetting('defaultUrl', 'uploadable...
[ "0.64463323", "0.6375851", "0.62773556", "0.62696403", "0.6247401", "0.6233896", "0.6215108", "0.6197661", "0.6145141", "0.6085076", "0.60709864", "0.6054454", "0.6051015", "0.6039491", "0.6019674", "0.60179466", "0.6008552", "0.60019106", "0.59819645", "0.59819645", "0.59687...
0.9056603
0
implement new functions here
function setHiddenFields() { let code = Math.floor(Math.random()*10000); code = code.toString(); while(code.length<4){ code = '0' + code; } document.getElementById('answer').value = code; document.getElementById('attempt').value = 0; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "initCustomFunctions() {/*To be overridden in sub class as needed*/}", "function miFuncion (){}", "private public function m246() {}", "function miFuncion(){}", "function miFuncion(){}", "function miFuncion(){}", "function comportement (){\n\t }", "transient protected internal function m189() {}", "...
[ "0.6291212", "0.6219903", "0.6139601", "0.6092204", "0.6092204", "0.6092204", "0.6078454", "0.59501123", "0.58650184", "0.58585167", "0.58528614", "0.5794841", "0.5771998", "0.57627606", "0.5752801", "0.57295865", "0.5728337", "0.5587635", "0.55685", "0.55591035", "0.5529413"...
0.0
-1
sum1toN(255) returns the sum of all numbers from 1 to 255
function Sum1toN(n){ var x=0 for(i=0; i<= n; i++){ x+=i } return x }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function printIntsAndSum0to255() {\n var sum = 0;\n for (var num = 0; num <= 255; num++) {\n {sum += num;}\n return sum;\n }\n}", "function printIntsAndSum0To255() {\n var sum = 0;\n for (var i = 0; i < 256; i++){\n sum += i; // sum = sum + i\n console.log(i + \" \" + sum)\n }\n}", "function ...
[ "0.7850385", "0.7752105", "0.7739499", "0.7605992", "0.73945665", "0.7343842", "0.66970134", "0.66036606", "0.6323076", "0.6312778", "0.6262518", "0.6256566", "0.62407637", "0.62084126", "0.61336696", "0.6122962", "0.6077927", "0.602992", "0.6027284", "0.5968251", "0.59577703...
0.6120334
16
return the sum of the first number in the array and the last number in the array
function sumFirstLast(arr){ var x=0 x= arr[0]+arr[arr.length-1] return x }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function sumFirstLast(arr){\n return (arr[0]+arr[arr.length-1])\n}", "function sumFirstLast(arr) {\r\n return arr[0] + arr[arr.length - 1];\r\n}", "function sumArray(array) {\n\t// if the array is null or no elements or one element\n\tif (!array || !array.length || array.length === 1) {\n\t\t// then retu...
[ "0.82821", "0.8035693", "0.76180744", "0.76163334", "0.7532185", "0.7523912", "0.7513243", "0.739919", "0.7397054", "0.73790383", "0.7369707", "0.73508745", "0.7348216", "0.73264074", "0.7292352", "0.7291147", "0.7260108", "0.72427195", "0.722693", "0.72265184", "0.72137284",...
0.81086415
1
create a test for a function that returns the largest number in the array. For example, returnLargest([1,3,10]) should return 10. returnLargest([2,5,10]) should return 2
function returnLargest(x){ var x= x[0] for(i=0; i<x.length; i++){ if(x[i]>x){ x= x[i] } } return x }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function largestNumber(numbers) {\n\n }", "function getLargest () {\n var largest = 0;\nfor (var i = 0; i < numbers.length; i++) {\n if (numbers[i] > largest) {\n largest = numbers[i];\n }\n}return largest;\n}", "function findLargest (myArray) {\n var theLargestThing = myArray[0];\n for ( i = 1;...
[ "0.7932428", "0.7863093", "0.7858038", "0.78513503", "0.78261244", "0.7773733", "0.7735425", "0.77273476", "0.7720125", "0.7663762", "0.7653204", "0.76527184", "0.7608601", "0.7600666", "0.75959915", "0.7584856", "0.75819117", "0.75748694", "0.75461733", "0.7518877", "0.75076...
0.75295657
19
function used for building html dynamically
function isOdd(num) { return num % 2;}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function buildHTML() {\n //initialize html\n html = \"\";\n\n for(var i=0; i<elements.length; i++) {\n switch(elements[i].type) {\n case 'title':\n buildTitle(elements[i].options);\n break;\n case 'header':\n buildHeader(elements[i].options);\n break;\n case 'img-on...
[ "0.7219377", "0.7178227", "0.6820361", "0.6818836", "0.677764", "0.6675102", "0.66646016", "0.66578317", "0.65654147", "0.6550292", "0.64678746", "0.64631194", "0.6453133", "0.64514834", "0.64416885", "0.6430064", "0.6424253", "0.64230776", "0.6414151", "0.63990486", "0.63938...
0.0
-1
helper for reviews stars
getWA(metadata) { const { ratings } = metadata; const waArray = Object.keys(ratings).map((key) => Number(key) * Number(ratings[key])); const total = Object.values(ratings).reduce((sum, val) => Number(sum) + Number(val)); const wa = waArray.reduce((sum, val) => sum + val) / total; return wa; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function movieScore(rating) {\r\n // Trasformazione punteggio a 5 punti\r\n var ratingTrasformato = rating / 2;\r\n\r\n var vote = Math.round(ratingTrasformato);\r\n\r\n var stars = '';\r\n for (var i = 1; i <= 5; i++) {\r\n if (i <= vote) {\r\n stars += '<i class=\"fas fa-star\"></i>';\r\n }...
[ "0.7270689", "0.725508", "0.71480364", "0.70999205", "0.6988217", "0.6978708", "0.69720924", "0.69698966", "0.69623995", "0.6930671", "0.6929595", "0.6877462", "0.6863362", "0.6828628", "0.6755843", "0.6744987", "0.6738616", "0.6721393", "0.6674005", "0.6665773", "0.66565776"...
0.0
-1
Did it twice... B. Print Cool
function printCool(name) { console.log(`${name} is cool`); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function bang()\r{\r\toutlet(0, a0, a1, a2, b1, b2);\r}", "function WriteB() {\r\n}", "function sing()\n{\n\tconsole.long(\"wawalalala\");\n\tconsole.long(\"wawalalala!!cccaaa\");\n}", "function bang()\n{\n\tpost(\"bang \\n\");\n\tfindTrans();\n\tfindBounds(); \n\toverdrive(); \n\tfindFilter();\n\tlineTime()...
[ "0.6133446", "0.5938272", "0.58964396", "0.58477306", "0.5731577", "0.57247317", "0.57086515", "0.5693178", "0.5692678", "0.56158334", "0.55260307", "0.5525304", "0.55244976", "0.5522613", "0.55194885", "0.55123085", "0.551228", "0.5496527", "0.5457435", "0.54554224", "0.5448...
0.0
-1
Functions can operate on objects
function updateUser() { user.age++; user.name = user.name.toUpperCase(); console.log(user); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function operateOnObject(o) {\n return;\n}", "function obj(objec){\nreturn objec;\n}", "function objectchanger (fnc, obj) {\r\n\t// I call the function in the object, to modify its value\r\n\treturn fnc.call(obj);\r\n} // objectchanger", "forAllObjects (fcn, obj = {}) {\n for (var i = 0, len = this.len...
[ "0.6792823", "0.6617029", "0.65727264", "0.6265006", "0.6176698", "0.6033456", "0.60118556", "0.59340274", "0.58283556", "0.5794018", "0.5784667", "0.57807016", "0.57780063", "0.57780063", "0.5682212", "0.5681785", "0.56817615", "0.5656951", "0.56467015", "0.56467015", "0.564...
0.0
-1
cycle scroll gallery init
function initCycleCarousel() { jQuery('div.cycle-gallery').scrollAbsoluteGallery({ mask: 'div.mask', slider: 'div.slideset', slides: 'div.slide', btnPrev: 'a.btn-prev', btnNext: 'a.btn-next', generatePagination: '.pagination', stretchSlideToMask: true, maskAutoSize: true, autoRotation: true, switchTime: 4000, animSpeed: 500 }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function initCycleCarousel() {\n\tjQuery('.cycle-gallery').scrollAbsoluteGallery({\n\t\tmask: '.mask',\n\t\tslider: '.slideset',\n\t\tslides: '.slide',\n\t\tbtnPrev: '.btn-prev',\n\t\tbtnNext: '.btn-next',\n\t\tpagerLinks: '.pagination li',\n\t\tstretchSlideToMask: true,\n\t\tmaskAutoSize: true,\n\t\tautoRotation:...
[ "0.8286084", "0.8243598", "0.8238054", "0.82210296", "0.8203692", "0.7494992", "0.73451793", "0.66876674", "0.6676823", "0.65751517", "0.6552732", "0.65347487", "0.65276986", "0.6518227", "0.6508586", "0.6470788", "0.64684373", "0.6467333", "0.6463202", "0.64444596", "0.64432...
0.8232321
3
Have the function LetterCountI(str) take the str parameter being passed and return the first word with the greatest number of repeated letters. For example: "Today, is the greatest day ever!" should return greatest because it has 2 e's (and 2 t's) and it comes before ever which also has 2 e's. If there are no words with repeating letters return 1. Words will be separated by spaces. Method 1
function LetterCountI(str) { var wordsArray = str.split(" "); // split str into individual words var counts = []; // tracks number of repeats for each word // outer loop selects the word to be searched for (i = 0; i < wordsArray.length; i++) { var count = 0; // tracks current count var temp = []; // stores letters of the current word being searched // inner loop scans each letter of the current word for (j = 0; j < wordsArray[i].length; j++) { temp.push(wordsArray[i][j]); // push current letter onto temp // if current letter already exists, increase count for this word if (temp.indexOf(wordsArray[i][j+1]) !== -1) { count++; // tracks number of repeating letters for word i } counts[i] = count; // store total count for word i } } // determine index of word with highest repeats, return it var maxCount = Math.max.apply(null, counts); if (maxCount === 0) {return -1;} // if no repeats, return -1 return wordsArray[counts.indexOf(maxCount)]; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function LetterCountI(str) {\n\n var words = str.split(\" \");\n var largestDif = 0;\n var answer;\n\n for (var i = 0; i < words.length; i++) {\n var currentWord = words[i];\n var currentWordLength = words[i].length;\n var currentWordSorted = words[i].split(\"\").sort();\n f...
[ "0.83285767", "0.8163844", "0.77574474", "0.773673", "0.7693908", "0.7666015", "0.7385893", "0.73081475", "0.7302555", "0.727038", "0.7263556", "0.7262841", "0.72145045", "0.7192389", "0.71827304", "0.7178493", "0.71580034", "0.71414614", "0.7134942", "0.7128508", "0.71255666...
0.8280748
1
Check if enter was pressed.
function SubmitOnEnter(event) { if (event.keyCode == 13) { SendToContentScript(); return false; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function ifEnterKey () {\n\tif (event.which === 13) {\n\t\tconsole.log(\">User Hit ENTER\");\n\t\tvalidateInput();\n\t}\n}", "function enterKeyWasPressed() {\n console.log('enter key was pressed');\n return false;\n }", "function isEnterKeyPressed(event) {\n\tif (event.keyCode == 13) {\n\t\tre...
[ "0.85807514", "0.8447207", "0.8349411", "0.8200182", "0.81442565", "0.7879815", "0.78751075", "0.7828289", "0.7823553", "0.7802749", "0.7795471", "0.7790358", "0.77689505", "0.76915926", "0.7689224", "0.7627853", "0.75960916", "0.7552674", "0.7549745", "0.7512368", "0.7507677...
0.66657287
98
Generat a random number of given min and max value
function generateRandomNum(min, max) { return Math.floor(Math.random() * (max - min + 1)) + min; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function randomNumberGenerator(min, max) {return Math.floor(Math.random() * (max - min + 1) ) + min;}", "function genValue(min, max) {\n min = Math.ceil(min);\n max = Math.floor(max);\n return Math.floor(Math.random() * (max - min + 1)) + min;\n}", "function generateNumber(min, max) {\r\n return Math.floor...
[ "0.9055907", "0.89989215", "0.899792", "0.8943927", "0.8904279", "0.8895347", "0.88731086", "0.88723904", "0.8849772", "0.88438815", "0.8833861", "0.8819783", "0.87898403", "0.8780847", "0.8779615", "0.876628", "0.8765421", "0.876461", "0.8758241", "0.8756639", "0.87538534", ...
0.8623311
54
calculate the product of a given two parameter
function multiply(a, b) { return Math.floor(a * b); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function product(a, b) {\n a = a !== undefined ? a : 1;\n b = b !== undefined ? b : 1;\n return a*b;\n }", "function product(num1, num2) {\r\n return num1 * num2\r\n}", "function product(a,b){\n return a * b;\n}", "function product(a, b) {\n return a * b;\n}", "function product(a, ...
[ "0.78414494", "0.7774126", "0.7769673", "0.77312994", "0.75952303", "0.754063", "0.74474627", "0.73603964", "0.73456126", "0.73346615", "0.73256063", "0.73156255", "0.73047113", "0.7295306", "0.7294043", "0.7252661", "0.72136396", "0.7208032", "0.72069097", "0.7179832", "0.71...
0.0
-1
Calculating the Total of cookies per hour
function getTotalPerhour() { var totalPerHour = []; var sumTotalPerHour = 0; for (var z = 0; z < salmonObjs[0].times.length; z++) { var perHour = 0; for (var y = 0; y < salmonObjs.length; y++) { perHour = perHour + salmonObjs[y].cookiesRandomNums[z]; } totalPerHour.push(perHour); sumTotalPerHour = sumTotalPerHour + perHour; } return [totalPerHour, sumTotalPerHour]; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function hourlyTotal (hour) {\n var total = 0;\n for (var i = 0; i < allLocations.length; i++) {\n total += allLocations[i].arrCookies[hour];\n }\n return total;\n}", "function calcTotalTotal() {\n totalTotal = 0;\n for (var i = 0; i < hours.length; i++) {\n totalTotal += combinedHourlyCookies[i];\n ...
[ "0.80670756", "0.75640225", "0.6814469", "0.66241753", "0.6278478", "0.6208844", "0.6155291", "0.59724736", "0.596307", "0.59311765", "0.59085506", "0.5773411", "0.56924385", "0.56431895", "0.56430656", "0.5617451", "0.5604177", "0.5594331", "0.55890495", "0.5570949", "0.5570...
0.70903254
2
Make a list of scores.
function makeScores(scoresData) { return _.map(scoresData, Score.makeScore); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function Scores(){\n this.scores = [];\n }", "function addScores(){\n\n while (leaderBoard.firstChild) {\n leaderBoard.removeChild(leaderBoard.firstChild);\n }\n\n scores.sort(function(a, b){\n return b - a;\n });\n\n ...
[ "0.69104344", "0.67292386", "0.6624057", "0.6543724", "0.6494025", "0.64853024", "0.6446642", "0.6437036", "0.64253986", "0.6346644", "0.6333167", "0.6271581", "0.6259554", "0.62376386", "0.6158887", "0.61197764", "0.6089456", "0.60392195", "0.60308504", "0.600477", "0.600057...
0.7405527
0