query stringlengths 9 14.6k | document stringlengths 8 5.39M | metadata dict | negatives listlengths 0 30 | negative_scores listlengths 0 30 | document_score stringlengths 5 10 | document_rank stringclasses 2
values |
|---|---|---|---|---|---|---|
Transform a key hash map to a sorted shortcut string | function keyarray_to_shortcut(keyarray){
if(typeof keyarray === 'undefined' || keyarray.length === 0){
return;
}
return keyarray.sort(sort_which).join('_');
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function replacePlaceholders(fmt, map, sortedMapKeys) {\n var from = fmt, to = \"\";\n while (from.length > 0) {\n var found = false;\n \n for (var i=0; i<sortedMapKeys.length; i++) {\n var key = sortedMapKeys[i];\n var val = map[key];\n if (from.substring(0, key.length) =... | [
"0.61036897",
"0.5812917",
"0.570823",
"0.56559706",
"0.5625213",
"0.5578003",
"0.556536",
"0.55110025",
"0.5506466",
"0.5486622",
"0.5486006",
"0.54578334",
"0.5380088",
"0.5360842",
"0.53461605",
"0.5328661",
"0.5328313",
"0.5328313",
"0.5327226",
"0.5322771",
"0.53098404",... | 0.6465178 | 0 |
Given a shortcut string, return a shortcut array | function shortcut_to_keyarray(shortcut){
rdb.extensions.log(shortcut);
return shortcut.split('_').map(function(elem){
return String(elem);
}).sort(sort_which);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function shortcut(string) {\n\t// code here\n}",
"function getShortcuts() {\n const searchAgainKey = L10N.getStr(\"sourceSearch.search.again.key2\");\n const searchAgainPrevKey = L10N.getStr(\"sourceSearch.search.againPrev.key2\");\n const searchKey = L10N.getStr(\"sourceSearch.search.key2\");\n\n return {\n... | [
"0.59297067",
"0.5901731",
"0.57187146",
"0.56941485",
"0.56866753",
"0.5634359",
"0.56158775",
"0.5392708",
"0.52587765",
"0.5209805",
"0.5168825",
"0.5154465",
"0.5134335",
"0.5120145",
"0.5072163",
"0.50272",
"0.5022406",
"0.49812067",
"0.49812067",
"0.49686766",
"0.496753... | 0.7548537 | 0 |
Determine if a key event should be considered valid | function validate_event(event){
var which = String(event.which);
if (
( // Keydown events from firefox are used to capture modifier
// keys.
!browser_is_webkit &&
event.type === 'keydown' &&
is_modifier(which)
) |... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function validateKey(evt, validKeys){\n\tvar charCode;\n\tif(evt.charCode){\n\t\tcharCode=evt.charCode;\n\t\tif(!(validKeys.indexOf(String.fromCharCode(charCode)) >= 0)){\n\t\t evt.preventDefault();\n\t }\n\t}else{\n\t\tcharCode=event.keyCode;\n\t\tevt.returnValue=validKeys.indexOf(String.fromCharCode(charCo... | [
"0.7192793",
"0.70966625",
"0.6874167",
"0.6874167",
"0.6874167",
"0.6865449",
"0.685599",
"0.68264997",
"0.6812455",
"0.68052644",
"0.675894",
"0.67290425",
"0.67042017",
"0.67006254",
"0.67006254",
"0.6698966",
"0.66896456",
"0.66852486",
"0.6683981",
"0.6640269",
"0.662247... | 0.7804062 | 0 |
Invoked by Kuzzle when a connection leaves a channel | leaveChannel (channel, connectionId) {
// ...
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"leave(channel) {\n this.connector.leave(channel);\n }",
"leave(channel) {\n this.connector.leave(channel);\n }",
"leaveChannel(name) {\n //\n }",
"leaveChannel(name) {\n //\n }",
"leaveChannel(channel) {\n this.connector.leaveChannel(channel);\n }",
"leav... | [
"0.7753545",
"0.7753545",
"0.75028265",
"0.75028265",
"0.7386165",
"0.7386165",
"0.73752993",
"0.70636195",
"0.70298326",
"0.6982198",
"0.6906968",
"0.6815829",
"0.6771802",
"0.6742978",
"0.6742978",
"0.6742978",
"0.6742978",
"0.6665997",
"0.6601781",
"0.65771234",
"0.6551421... | 0.8126954 | 0 |
setupPreprocessorRegistry is called before included see as a workaround we ignore that hook and call this method from included | setupPreprocessorRegistryAfterConfiguration(type, registry) {
if (this.fontawesomeConfig.enableExperimentalBuildTimeTransform) {
this.ui
.writeWarnLine(`The "enableExperimentalBuildTimeTransform" option may be removed soon.
Please see https://github.com/FortAwesome/ember-fontawesome/issues/117 f... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"_do_setup() {\n this._script.imports = this.imports;\n\n /*\n * //This custom bind function copies other values along with the bound function\n * this._script.define = bind( this.define, this );\n * */\n\n //this.define is already just a closure and doesn't need to be b... | [
"0.5707062",
"0.5239469",
"0.51129764",
"0.5083589",
"0.50203174",
"0.49448675",
"0.49251512",
"0.49237645",
"0.4923567",
"0.49038503",
"0.48755923",
"0.48188964",
"0.48188964",
"0.48167083",
"0.48106754",
"0.48067814",
"0.47940633",
"0.47859403",
"0.47650826",
"0.47638726",
... | 0.57413304 | 0 |
Properly formatting this joke! | function formatJoke(joke) {
return [
'Knock, knock.',
'Who’s there?',
joke.name + '.',
joke.name + ' who?',
joke.name + ' ' + joke.answer
].join('\n')
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function\n oddlyFormatted() {}",
"function getFormattedPizza()\n{\n var text = win.crust + ' pizza with:\\n';\n if (win.toppings.length == 0)\n {\n text += '• Plain (cheese pizza)\\n';\n }\n else\n {\n for (var i = 0; i < win.toppings.length; i++)\n {\n ... | [
"0.60467905",
"0.586865",
"0.58657926",
"0.5843596",
"0.5805266",
"0.5705625",
"0.5647068",
"0.56350225",
"0.5599292",
"0.55806214",
"0.54572433",
"0.5428465",
"0.5391733",
"0.53704643",
"0.5350765",
"0.53432244",
"0.53168046",
"0.52505827",
"0.52236336",
"0.52082294",
"0.520... | 0.7392803 | 0 |
constructor arguments: numberScreen the number of screens to be handled (Default: 1) activeScreen the screen that shall be active at first (Default: 0) container a DOM object that defines the screens (one single parent DOM object needed for all screens) | constructor(numberScreens , activeScreen, container) {
this.countScreens = ( numberScreens === undefined ) ? 0 : numberScreens;
if ( activeScreen > this.countScreens ) { activeScreen == this.countScreens };
this.activeScreen = ( activeScreen === undefined ) ? 0 : activeScreen;
this.width = container.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function ScreenMain() {\n this.next_screen = null;\n this.option = 0;\n}",
"initializeScreenElements() {\n this.screenElements.overlay = document.getElementById(\"overlay\");\n this.screenElements.skipButton = document.getElementById(\"skip\");\n this.screenElements.nextStepButton = do... | [
"0.6466074",
"0.622446",
"0.6203214",
"0.60943186",
"0.6026235",
"0.6019065",
"0.5945334",
"0.59233344",
"0.59067696",
"0.58801126",
"0.58459276",
"0.5797008",
"0.579052",
"0.5784739",
"0.5778833",
"0.57430303",
"0.57145166",
"0.57102716",
"0.568281",
"0.5681464",
"0.56748086... | 0.7395191 | 0 |
Converts the lines of the input into objects representing the first index, second index, letter, and password contents of each line. | function clean(data) {
return data.map(e => {
const pattern = /^(\d*)-(\d*) ([a-z]*): ([a-z]*)$/;
const [_, index1, index2, letter, password] = e.match(pattern);
return {index1: index1, index2, letter, password};
})
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function readAndTokenizeInput(file) {\n return fs.readFileSync(file, \"utf8\").split(\"\\r\\n\").map(x => {\n const regex = /(\\d+)-(\\d+)\\s(\\S):\\s(\\S+)/gm;\n var m = regex.exec(x);\n return { \"min\": m[1], \"max\": m[2], \"char\": m[3], \"passwd\": m[4] };\n });\n}",
"function ge... | [
"0.5106195",
"0.5033172",
"0.50167906",
"0.498347",
"0.49758044",
"0.497334",
"0.4894454",
"0.47898224",
"0.47523206",
"0.47513467",
"0.47219083",
"0.4696291",
"0.46902663",
"0.4686904",
"0.46500337",
"0.4604244",
"0.46027792",
"0.4599432",
"0.45538405",
"0.45218796",
"0.4512... | 0.5826623 | 0 |
Iterates through the array of objects, computes a sum of the number of password values where the characters at index1 or index2 (but not both) are equal to letter. Returns the sum. | function count(data) {
return data.map(d => {
const match1 = d.password[d.index1 - 1] === d.letter;
const match2 = d.password[d.index2 - 1] === d.letter;
const valid = match1 || match2;
const invalid = match1 && match2;
return (valid && !invalid) ? 1 : 0;
}).reduce((a,b) => a + b);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function part2(input) {\n let count = 0;\n\n input.forEach((pass) => {\n if (pass.word[pass.min-1] === pass.letter ^ pass.word[pass.max-1] === pass.letter) count++;\n });\n\n console.log(count);\n}",
"function countChars() {\n let twoCount = 0;\n let threeCount = 0;\n\n for (let i = 0; i < ... | [
"0.5937151",
"0.5820497",
"0.58013463",
"0.57375485",
"0.56915694",
"0.55869776",
"0.5541169",
"0.54617417",
"0.5450949",
"0.5449248",
"0.54472685",
"0.5428838",
"0.5408601",
"0.53990746",
"0.5377497",
"0.53702325",
"0.53612643",
"0.53383714",
"0.53342223",
"0.53206706",
"0.5... | 0.7269606 | 0 |
Loads all areas and sets them to areas | function loadAreas() {
API.getAreas()
.then((res) => setAreas(res.data))
.catch((err) => console.log(err));
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function all() {\n return areas\n}",
"clearAreas() {\n\t\tthis.areas = [];\n\t}",
"function getAreas(areas, cb) {\n areas = areas.concat([{\n name: 'News Header',\n template: 'news.tpl',\n location: 'header'\n }, {\n name: 'News Sidebar',\n template: 'news.tpl',\n location: 'sidebar'\n },... | [
"0.67744935",
"0.65375584",
"0.6459913",
"0.6279612",
"0.6238168",
"0.6088659",
"0.59630865",
"0.5947401",
"0.5826051",
"0.58216095",
"0.58199847",
"0.5773177",
"0.5705232",
"0.56988525",
"0.5684018",
"0.5682295",
"0.5670653",
"0.5669792",
"0.5634287",
"0.5625215",
"0.5591765... | 0.77886313 | 0 |
init wires up watchers on selections and fetches new data | function init(){
var countrySel = $('#sel-country');
var categorySel = $('#sel-category');
var genderSel = $('#sel-gender');
function updateSelections() {
var params = window.winners.params || {};
params.country = countrySel.val();
params.category = categorySel.val();
pa... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function init()\n{\n extractCodedData();\n\n createCountrySelector();\n createStateSelector();\n createCentreSelector();\n createTeamSelector();\n}",
"function init() {\n tableData = data;\n selectedTableData = [];\n\n // set the filter values to dummy values during initialization.\n // Onl... | [
"0.68936604",
"0.66921985",
"0.66170657",
"0.66124785",
"0.6587488",
"0.6585722",
"0.65750635",
"0.6570018",
"0.65451247",
"0.6464809",
"0.643706",
"0.64293367",
"0.6419791",
"0.64132434",
"0.6410763",
"0.6372559",
"0.6361364",
"0.63577473",
"0.6328924",
"0.6328393",
"0.63280... | 0.6901098 | 0 |
It will log debugging because the function logger has access to the outer variables. | function debugIt() {
var status = 'debugging';
function logger() {
console.log(status);
}
logger();
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"debug() {}",
"function debug() {\n if (attrs.isDebug) {\n //stringify func\n var stringified = scope + \"\";\n \n // parse variable names\n var groupVariables = stringified\n //match var x-xx= {};\n .match(/var\\s+([\\w])+\\s*=\\s*{\... | [
"0.6895272",
"0.6875424",
"0.6861408",
"0.6775147",
"0.6767143",
"0.6710553",
"0.66643006",
"0.6643889",
"0.6620235",
"0.65737414",
"0.6487826",
"0.6460496",
"0.64593893",
"0.64502126",
"0.64502126",
"0.644008",
"0.64218915",
"0.6407191",
"0.6398945",
"0.6369845",
"0.63515234... | 0.7334829 | 0 |
reload the product tree | function ReloadProductTree01() {
matchString = "";
$("#matchtextbox").val("");
$("#tree div").html("");
$("#productsNameList span").html("");
o.data = [{
"id": "All",
"Text": "All",
"Value": "All",
"showcheck": false,
complete: false,
"isexpand": false... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function reloadTreeWithData(jsonData){\n $('#jsTree').tree('loadData', []);\n $('#jsTree').tree('loadData',jsonData);\n}",
"function rebuildTree() {\n // Remove the old tree\n $('#tree').jstree('destroy').empty();\n buildTree();\n }",
"function reloadTree(){\n\n $('#jsTree').tree('loadData',... | [
"0.67052406",
"0.660413",
"0.6530081",
"0.642355",
"0.6422955",
"0.6338818",
"0.6332293",
"0.6289723",
"0.6054769",
"0.596908",
"0.59269994",
"0.589753",
"0.5873877",
"0.58571887",
"0.58524597",
"0.5830354",
"0.58174986",
"0.57885695",
"0.578845",
"0.5785993",
"0.577277",
"... | 0.73852134 | 0 |
Function for drawNetworking the network | function drawNetwork({nodes: nodesDataset, edges: edgesDataset}) {
network = new vis.Network(container, {nodes: nodesDataset, edges: edgesDataset} , options);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function draw() {\n // create an array with nodes\n nodes = new vis.DataSet();\n // Reads the JSON from the pre-formatted nodes field.\n nodes.on('*', function () {\n document.getElementById('nodes').innerHTML = JSON.stringify(nodes.get(), undefined, 4);\n... | [
"0.70995045",
"0.6974686",
"0.6852065",
"0.6655075",
"0.65815353",
"0.654745",
"0.6248469",
"0.6246652",
"0.616659",
"0.6117223",
"0.6033612",
"0.5988872",
"0.593215",
"0.58959293",
"0.58260953",
"0.58248097",
"0.57797277",
"0.5778281",
"0.57645136",
"0.5727574",
"0.5704766",... | 0.7172633 | 0 |
This is a ActivityDefinitionDynamicValue resource | static get __resourceType() {
return 'ActivityDefinitionDynamicValue';
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"get dynamicValue () {\n\t\treturn this._dynamicValue;\n\t}",
"get dynamicValue() {\n\t\treturn this.__dynamicValue;\n\t}",
"static get properties() {\n return {activities: {type: Array}};\n }",
"toDynamicValue(factoryFn) {\r\n // TODO(bajtos) allow factoryFn with @inject arguments\r\n this.getV... | [
"0.5346381",
"0.50874496",
"0.49801075",
"0.48305902",
"0.47589982",
"0.47299296",
"0.46985522",
"0.46078447",
"0.45789284",
"0.45113122",
"0.4490604",
"0.4463654",
"0.4454165",
"0.44328904",
"0.44088238",
"0.44057003",
"0.43871632",
"0.43830988",
"0.43603837",
"0.43468022",
... | 0.7153214 | 0 |
Create a sumArray function that takes an array of numbers1 as a parameter, and calculate the sum of all its numbers Use reduce method of array Use the above sum and calculate the average. | function sumArray()
{
return numbers1.reduce((acc, elem)=> {
acc += elem;
return acc;
}, 0);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function sumNumbers(array) {\n function getSum(total, num) {\n var total = 0\n var num = 0\n var sum = total + num\n return sum\n }\n return array.reduce(getSum)\n}",
"function addNumbers(array) {\n //your code here!\n function sum (a, b) {\n return a + b;\n }\n\n retu... | [
"0.80707335",
"0.77917755",
"0.772758",
"0.7688441",
"0.7672328",
"0.7620311",
"0.7577574",
"0.75468045",
"0.75139093",
"0.75129235",
"0.74533844",
"0.74167264",
"0.7415025",
"0.7412118",
"0.7402649",
"0.7390466",
"0.7381006",
"0.73746204",
"0.7368851",
"0.73398083",
"0.73306... | 0.80329096 | 1 |
Write a function averageWordLength that receives an array of words2 and calculate the average length of the words. | function averageWordLength()
{
return words2.reduce((acc, elem, index)=> {
var sum = acc*(index);
sum += elem.length;
acc = sum/(index+1);
return acc;
}, 0);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function averageWordLength(){\n var stringLength = words2.map(x => x.length);\n var sum = 0;\n for (i = 0; i < stringLength.length; i++){\n sum = sum + stringLength[i];\n } \n}",
"function averageWordLength(array) {\n if (array.length > 0) {\n let sumLetters = array.join('').length\n\n return sumLe... | [
"0.809822",
"0.77027935",
"0.7684783",
"0.7327055",
"0.70932364",
"0.7033039",
"0.7008172",
"0.6835575",
"0.66597533",
"0.647251",
"0.6354721",
"0.6267643",
"0.6165151",
"0.6130679",
"0.6018716",
"0.59676373",
"0.5895091",
"0.58482796",
"0.5803042",
"0.5797051",
"0.575679",
... | 0.82924646 | 0 |
fetch single video or series of images for carousel also set height of .modalbody accordingly | function getHtmlImg(title) {
var tot = "";
if (library[title].video != "") {
tot += (library[title].video + "</div>");
$(".modal-body").css("height", "auto");
} else {
$(".modal-body").css("height", "70%");
for (i = 0; i < library[title].img.length; i++) {
if (i =... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function fInitialModalLoad () {\n console.log (\"fInitialModalLoad |-------------\");\n\n //fResizeModalCarouselWindow ();\n\n // Returns height of browser viewport\n //var winHeight = $ (window).height ();\n\n imgClass = $ (\".imgClass\");\n /*????*/\n imgClassHeight = imgClass.height ();\n ... | [
"0.6478258",
"0.6452626",
"0.6272053",
"0.6216209",
"0.62136436",
"0.6011314",
"0.5961664",
"0.59544957",
"0.59176606",
"0.5905508",
"0.58941644",
"0.5876636",
"0.58342165",
"0.57919574",
"0.57408905",
"0.5734721",
"0.57256204",
"0.57156116",
"0.5699536",
"0.5692599",
"0.5688... | 0.6490828 | 0 |
This observable is for notifying the ClrOption to update its selection by comparing the value | get selectionChanged() {
return this._selectionChanged.asObservable();
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"get _shouldUpdateSelection() {\n return this.selected != null;\n }",
"change(value) {\n const selectedItem = this.options.find($ => $.value === value)\n this.$emit('input', value, selectedItem)\n }",
"get _shouldUpdateSelection() {\n return this.selected != null ||\n (this.selectedVa... | [
"0.59321797",
"0.57985806",
"0.5765049",
"0.56530756",
"0.5643303",
"0.5643303",
"0.5643303",
"0.5643303",
"0.5643303",
"0.5643303",
"0.56314063",
"0.5589398",
"0.55639595",
"0.5563301",
"0.5518939",
"0.5509687",
"0.54967046",
"0.54808444",
"0.5475967",
"0.5461281",
"0.545753... | 0.62957525 | 1 |
Complete the getMoneySpent function in the editor below. getMoneySpent has the following parameter(s): int keyboards[n]: the keyboard prices int drives[m]: the drive prices int b: the budget Returns int: the maximum that can be spent, or 1 if it is not possible to buy both items | function getMoneySpent(keyboards, drives, b) {
let combinations = [];
keyboards.map((keyboard) => {
drives.map((drive) => {
combinations.push(drive + keyboard);
});
});
let underBudget = combinations.filter((combo) => combo <= b);
return underBudget.length != 0 ? Math.max(...underBudget) : -1;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function getMoneySpent(keyboards, drives, b) {\n // var that holds all the potential prices\n let allPrices = []\n // double for loop to push the sum of all potential prices to arr\n for(let i = 0; i < keyboards.length; i++){\n for(let j = 0; j < drives.length; j++){\n let totalPrice = keyb... | [
"0.8302756",
"0.7964524",
"0.796091",
"0.78679097",
"0.7855114",
"0.7845483",
"0.75072575",
"0.7451019",
"0.6384826",
"0.62969136",
"0.62939394",
"0.6241993",
"0.6240642",
"0.6219291",
"0.6206707",
"0.6194657",
"0.61377776",
"0.6104486",
"0.60187185",
"0.6005565",
"0.5993844"... | 0.84906447 | 0 |
search by a given condition but if nothing is given show all the list and markers. | function search() {
var foundStores = [];
var searchQue = document.getElementById('zip-code-input').value; //get value from zip-code-input class
if(searchQue) {
stores.forEach(function(store){
var city = store.city;
var zipcod... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function search() {\n\tshowAllLocations();\n}",
"generateVisibleList(){\n\n const nameReg=new RegExp(this.search.name,\"i\");\n const surnameReg=new RegExp(this.search.surname,\"i\");\n\n // LIST FILTERING\n this.clients=this.allclients.filter((client)=>{\n\n return nameReg.test(clien... | [
"0.661342",
"0.62650865",
"0.6258393",
"0.6214702",
"0.62009466",
"0.6136783",
"0.61307055",
"0.6090693",
"0.6044425",
"0.6027956",
"0.6019866",
"0.60086673",
"0.6001916",
"0.5999376",
"0.59631884",
"0.5957965",
"0.5952688",
"0.593547",
"0.5932549",
"0.59123546",
"0.58717763"... | 0.65859216 | 1 |
Checking form labels sibling status to append 'active' ============================================================ | checkSiblingValue(element) {
const elementForVal = element.id;
const labelQuery = document.querySelector(`label[for=${elementForVal}]`);
if (labelQuery) {
if((element.nodeName === 'SELECT' && element.firstElementChild.innerText !== '') || element.value !== '') {
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function active_field(){\n var field = $(this).closest('.field');\n cleanup(field);\n if(field_is_empty(field)){ \n field.addClass('active_visible_label'); \n }\n else {\n field.addClass('active_hidden_label');\n }\n }",
"function setupLabel() {\r\n\t\tif ($('.labe... | [
"0.6584918",
"0.6238685",
"0.61092114",
"0.6074479",
"0.59393024",
"0.588016",
"0.5879001",
"0.58538014",
"0.58413255",
"0.58076644",
"0.57702774",
"0.57304573",
"0.57027304",
"0.5674748",
"0.5651775",
"0.5637685",
"0.5620993",
"0.55842584",
"0.5562996",
"0.5559643",
"0.55509... | 0.6345376 | 1 |
generates a list of ddl 320 | function generateDropDownList() {
var numbers = [3,4,5,10,20];
var generateOptions = "";
for(let i = 0; i < numbers.length; i++) {
generateOptions += "<option>" + numbers[i] + "</option>";
}
return generateOptions;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function getDrop2(){\n var fromtag = document.getElementsByTagName(\"body\"),\n getLi = gi('conDown'),\n makeSelect = document.createElement('select');\n makeSelect.setAttribute(\"id\", \"con\");\n for(var i=0, j=consoleList.length; i<j; i++){\n \tvar makeOption = document... | [
"0.61890906",
"0.6142756",
"0.6079982",
"0.60696036",
"0.60194594",
"0.60087013",
"0.5993262",
"0.5972849",
"0.5969644",
"0.5955184",
"0.59323823",
"0.58901036",
"0.58724296",
"0.58572996",
"0.58290094",
"0.5791186",
"0.5761275",
"0.57377785",
"0.57186884",
"0.5695171",
"0.56... | 0.62078667 | 0 |
cache current slide and image | function storeCurrentImage(){
//prevent continious image storring
var currentTime = jQuery.now();
var diff = currentTime - g_temp.storeImageLastTime;
if(diff < 20)
return(false);
var slides = g_parent.getSlidesReference();
g_temp.objSlide = slides.objCurrentSlide;
g_temp.objImage = slides.ob... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function getCurrentSlide(){\n\t\treturn currentSlide;\n\t}",
"function getCurrent() {\n return getSlide($index);\n }",
"get currentSlide() { return currentSlide; }",
"get currentSlide() {\n return this._slides[this._currentIndex];\n }",
"function getCurrentImageKey() {\n i = ... | [
"0.6984865",
"0.6721392",
"0.6473652",
"0.64000255",
"0.63758457",
"0.6369252",
"0.63612956",
"0.63445544",
"0.6322992",
"0.6272478",
"0.6172121",
"0.616153",
"0.61594784",
"0.614554",
"0.61383134",
"0.6090809",
"0.60841143",
"0.6062715",
"0.60585964",
"0.6054441",
"0.6038626... | 0.70423347 | 1 |
zoom current image mode: in, out, back | function zoomCurrentImage(mode, mousePos){
var slides = g_parent.getSlidesReference();
var objImage = slides.objCurrentSlide.find("img");
var scaleMode = getFitScaleMode();
g_objParent.trigger(g_parent.events.ZOOM_START);
//flag if the images zoomed
var isZoomed = true;
var objPadding = g_pare... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"zoomIn() {\n this.__img.zoomIn();\n }",
"function zoomInBtn(){\n currentScale += 0.1;\n pinta();\n imageDataPixels = ctx.getImageData(0,0,canvas.width,canvas.height);\n}",
"function resetZoom () {\r\n if (!zoomKeyPressed) {\r\n return;\r\n }\r\n \r\n if (mouseOverOriginalImageWind... | [
"0.74278873",
"0.71992683",
"0.70180583",
"0.70047516",
"0.69715947",
"0.6938763",
"0.68722266",
"0.6829545",
"0.68122846",
"0.6792341",
"0.6791974",
"0.6780611",
"0.6757009",
"0.66912097",
"0.668183",
"0.66717386",
"0.6646612",
"0.66297066",
"0.6628931",
"0.66249573",
"0.661... | 0.7844533 | 1 |
check if pan is posible for the current image check if the image is bigger then the parent | function isPanPosible(objImage, event, stictTouchesCheck){
//check num touches, strict means that even if 0 - pan not posible
var arrTouches = g_functions.getArrTouches(event);
if(stictTouchesCheck === true){
if(arrTouches.length != 1)
return(false);
}else{
if(arrTouches.length > 1)
r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function checkReturnAfterPan(){\n\t\t\t\t\n\t\tvar isReturnX = false, isReturnY = false, newX = 0, newY = 0;\n\t\tvar objSize = g_functions.getElementSize(g_temp.objImage);\n\t\tvar objImagePadding = g_parent.getObjImagePadding();\n\t\t\t\t\n\t\tvar objCenterPos = g_functions.getElementCenterPosition(g_temp.objIma... | [
"0.67946863",
"0.67946863",
"0.64307404",
"0.63874197",
"0.62359387",
"0.62268823",
"0.6018276",
"0.5972149",
"0.5957921",
"0.59571195",
"0.59360874",
"0.58767366",
"0.58767366",
"0.5867348",
"0.5808308",
"0.580638",
"0.57993734",
"0.5752642",
"0.57195234",
"0.5710248",
"0.57... | 0.7323479 | 1 |
check if the image animating or not | function isImageAnimating(){
if(g_temp.objImage && g_temp.objImage.is(":animated"))
return(true);
return(false);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"isAnimated()\n {\n if(this.animationFunc != null)\n {\n return true\n }\n return false\n }",
"isAnimating() {\n return !!this.animation;\n }",
"isAnimating() {\n return this.animations.length > 0;\n }",
"isAnimating() {\n return ... | [
"0.7858962",
"0.7799282",
"0.76435184",
"0.7168025",
"0.69949585",
"0.68712544",
"0.68589365",
"0.6806076",
"0.6744428",
"0.6706302",
"0.668684",
"0.6683159",
"0.6647032",
"0.66080755",
"0.65761876",
"0.6547551",
"0.6521798",
"0.64934367",
"0.6444745",
"0.6442154",
"0.6419809... | 0.8788101 | 1 |
check num touches, if not 2 end zoom | function checkTouchZoomEnd(event){
if(g_temp.isZoomActive == false)
return(false);
var arrTouches = g_functions.getArrTouches(event);
if(arrTouches.length != 2){ //end touch zoom
g_temp.isZoomActive = false;
//trigger end zoom event
g_objParent.trigger(g_parent.events.ZOOM_END); ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function checkTouchZoomStart(event){\n\t\t\t\t\n\t\tif(g_temp.isZoomActive == true)\n\t\t\treturn(true);\n\n\n\t\tvar arrTouches = g_functions.getArrTouches(event);\n\t\t\t\t\n\t\tif(arrTouches.length != 2)\n\t\t\treturn(true);\n\t\t\t\t\t\n\t\tstartTouchZoom(arrTouches);\t\t\n\t}",
"function checkTouchZoomStart... | [
"0.713175",
"0.713175",
"0.6477265",
"0.64055455",
"0.6273114",
"0.6248163",
"0.6146304",
"0.60514796",
"0.6046788",
"0.6046788",
"0.6046788",
"0.6046788",
"0.6028115",
"0.60274935",
"0.60012674",
"0.5918717",
"0.5918717",
"0.5918162",
"0.5910304",
"0.5880153",
"0.58728397",
... | 0.7177672 | 1 |
check start touch zoom | function checkTouchZoomStart(event){
if(g_temp.isZoomActive == true)
return(true);
var arrTouches = g_functions.getArrTouches(event);
if(arrTouches.length != 2)
return(true);
startTouchZoom(arrTouches);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function onTouchStart(event){\n\t\t\n\t\t//if no image type, exit\n\t\tif(g_parent.isCurrentSlideType(\"image\") == false)\n\t\t\treturn(true);\n\t\t\n\t\tvar isStored = storeCurrentImage();\n\t\t\n\t\tif(g_temp.objImage == undefined || g_temp.objImage.length == 0)\n\t\t\treturn(true);\n\t\t\n\t\tevent.preventDefa... | [
"0.70800287",
"0.70800287",
"0.70454305",
"0.6988788",
"0.68997496",
"0.68997496",
"0.68523765",
"0.6673486",
"0.6673486",
"0.66686434",
"0.6656646",
"0.6656646",
"0.6638276",
"0.66282284",
"0.6623353",
"0.66076595",
"0.6581937",
"0.6573209",
"0.6521527",
"0.6504023",
"0.6492... | 0.85286903 | 1 |
check return the image from zoom | function checkReturnFromZoom(){
if(g_temp.objImage == undefined || g_temp.objImage.length == 0)
return(true);
var objSize = g_functions.getElementSize(g_temp.objImage);
if(objSize.width < g_temp.objFitImageSize.imageWidth){
g_temp.objImage.css({
position:"absolute",
margin:"none"
}... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"zoomIn() {\n this.__img.zoomIn();\n }",
"function checkTile(){\n\tif(bingMap==false)\n\t\t\tbingMap = new BingMap();\n\t\t\t\n\t var czoom =bingMap.map.getZoom();\n\t $(\"#mapDiv img\").each(function() { var url=this.src.split(\"/\");\n\t\tif(url[url.length-1]=='notile.png'){\n\t\t\tbingMap.map.setView({zoom... | [
"0.67425984",
"0.6699652",
"0.66205764",
"0.6606985",
"0.6577738",
"0.6566826",
"0.64889705",
"0.6339028",
"0.6311586",
"0.6311586",
"0.62926733",
"0.62769765",
"0.625226",
"0.62008035",
"0.6191054",
"0.6167992",
"0.61632866",
"0.6129789",
"0.6129789",
"0.6117219",
"0.6117219... | 0.7473091 | 1 |
Change case of every character, ie. lower case to upper case, upper case to lower case. Reverse the order of words from the input. For example: stringTransformer('Example Input')/string_transformer("Example Input") (depending on the language you are completing the Kata in) should return 'iNPUT eXAMPLE' You may assume t... | function stringTransformer(str) {
// Your code here
var a=str.split(' ')
var b=[]
for(var i=0;i<a.length;i++){
var str=''
a[i].split('').forEach((x)=>{
if(x==x.toUpperCase()){
str=str+x.toLowerCase()
} else if(x==x.toLowerCase()){
str=str+x.toUpperCase()
}
});
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function stringTransformer(str) {\n let letArr = str.split('');\n for(let i = 0; i < letArr.length; i++){\n if(letArr[i] == letArr[i].toUpperCase()){\n letArr[i] = letArr[i].toLowerCase();\n continue;\n }\n if(letArr[i] == letArr[i].toLowerCase()){\n letArr[i] = letArr[i].... | [
"0.76333076",
"0.7632653",
"0.7416751",
"0.70284104",
"0.6920794",
"0.67094934",
"0.667546",
"0.65995514",
"0.6584155",
"0.6561075",
"0.64945817",
"0.6483116",
"0.64065886",
"0.6401571",
"0.639918",
"0.6379226",
"0.63469714",
"0.6317634",
"0.63160586",
"0.63122714",
"0.629995... | 0.7851337 | 0 |
Functions Generate scale based on root note and mode. | function genScale(_root, mode){
var scale;
var majorSteps = [0,2,4,5,7,9,11,12];
var minorSteps = [0,2,3,5,7,8,10,12];
var steps;
if (mode == "maj"){
steps = majorSteps;
}
else if (mode == "min"){
steps = minorSteps;
}
else{
steps = majorSteps;
}
_root = _root + "4";
scale = Tone.Frequency(_root... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function setTonality(scale,root){\n var newScale = new Set();\n for(let i of scale){\n i = i + root;\n if(i<0){newNote = i+12;}\n if (i>=12) {i= i-12}\n newScale.add(i);\n }\n return newScale;\n}",
"function initScale() {\n\n\tvar key = program.key\n\tif (key =... | [
"0.6657176",
"0.65914685",
"0.6517721",
"0.64777726",
"0.6347767",
"0.61969674",
"0.6087725",
"0.6078825",
"0.6069807",
"0.6047497",
"0.60150594",
"0.59562445",
"0.5931238",
"0.5917621",
"0.5879933",
"0.5873837",
"0.5873837",
"0.5836395",
"0.5820695",
"0.58006245",
"0.5799201... | 0.8218769 | 0 |
Creates a chord triad based on root note and mode. | function genChordTriad(scale){
var triad;
triad = [scale[0],scale[2],scale[4]];
return triad;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"setCurrentChord(root, chord) {\n this.currentChord = root + chord[0];\n this.currentDescription = root + ' ' + chord[1];\n }",
"function createChordArray(length) {\n\tconsole.log(length);\n var chords = new Array(length || 0),\n i = length;\n\n if (arguments.length > 1) {\n var args = ... | [
"0.5429544",
"0.54180455",
"0.5375944",
"0.53585774",
"0.53369355",
"0.52679765",
"0.52390385",
"0.5208406",
"0.5188949",
"0.51796305",
"0.5079766",
"0.50118876",
"0.49865976",
"0.49819943",
"0.49398664",
"0.49023524",
"0.48437348",
"0.48137435",
"0.47863942",
"0.4779726",
"0... | 0.61277807 | 0 |
Generates a 7 chord based on root note and mode. | function genChord7(scale){
var chord;
chord = [scale[0],scale[2],scale[4], scale[6]];
return chord;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function playChord( mode ) {\n if ( mode > 6 ) {\n return;\n }\n\n let first = document.getElementsByClassName( numerals[ ( 0 + mode ) % 7 ] );\n let third = document.getElementsByClassName( numerals[ ( 2 + mode ) % 7 ] );\n let fifth = document.getElementsByClassName( numerals[ ( 4 + mode ) % 7 ] );\n le... | [
"0.69561774",
"0.6144402",
"0.6141733",
"0.6048987",
"0.58213454",
"0.58118284",
"0.58100635",
"0.5788861",
"0.57577705",
"0.57042426",
"0.56466156",
"0.5636745",
"0.55289215",
"0.5510337",
"0.5501039",
"0.54216325",
"0.5418771",
"0.5388514",
"0.5373762",
"0.5371784",
"0.5362... | 0.6765873 | 1 |
Fonction de creation de l'alien | function createAlien(scene){
BABYLON.SceneLoader.ImportMesh("", "models/Alien/", "Alien.gltf", scene, function (meshes) {
let alien = meshes[0];
alien.position.y = 120;
alien.position.z = 600;
alien.scaling = new BABYLON.Vector3(200, 200, 200);
alien.name = "alienMast... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function makeAlien(){\n //cria um valor aleatorio emtre 0 e 7 => largura do canvas / largura alien \n //divide o canvas em 6 colunas com aliens\n var alienPosition = (Math.floor(Math.random() * 6)) * 50;\n\n var alien = new Alien(30, 0, 50, 50, alienPosition, -50);\n alien.vy = 1... | [
"0.7026611",
"0.6963091",
"0.66787136",
"0.6497713",
"0.6383838",
"0.62665033",
"0.6239722",
"0.6199126",
"0.61740947",
"0.6149703",
"0.61445177",
"0.61052376",
"0.61052376",
"0.60866463",
"0.6053443",
"0.60094416",
"0.60020614",
"0.59996647",
"0.5976906",
"0.59721273",
"0.59... | 0.7349702 | 0 |
Fonction de creation des boules d'energie presente autour de l'alien | function createEnergyBall(scene){
//Boule jaune
BABYLON.SceneLoader.ImportMesh("", "models/TrailMeshSpell/", "yellowEnergyBall.glb", scene, function (meshes) {
let ballE = meshes[0];
ballE.scaling = new BABYLON.Vector3(2, 2, 2);
ballE.name= "ballEY";
ballE.position.x = -1... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function gener()\n\t{\n\t\tperiodes=new Array();periodes.push(new Periode(0,new Date(Date.UTC(2015,gen,01)),new Date(Date.UTC(2015,feb,01))))\n\t\ttax_alq = 59.72\t\n\t\tenergy=[\n\t\t\t148,\n\t\t\t144,\n\t\t\t140,\n\t\t\t144,\n\t\t\t144,\n\t\t\t140,\n\t\t\t136,\n\t\t\t140,\n\t\t\t140,\n\t\t\t124,\n\t\t\t132,\n\t\... | [
"0.6079104",
"0.5969777",
"0.5959226",
"0.595014",
"0.5901574",
"0.5843604",
"0.57671154",
"0.569454",
"0.5684394",
"0.56097287",
"0.55813015",
"0.5576791",
"0.5571844",
"0.5549923",
"0.5545052",
"0.5534036",
"0.5527361",
"0.5507657",
"0.5465893",
"0.54646325",
"0.54452926",
... | 0.61610866 | 0 |
Function to resize the sidebar if the footer covers it | function resizeScrollbar() {
//Set the max heigh as either the content max height or the css max-height property
var contentHeight = 0;
if ($(".nav-sidebartoc").height() < parseInt($("#sidebar").css('max-height'))) {
contentHeight = $(".nav-sidebartoc").height();
}else {
contentHeight = $("#sidebar").cs... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function resizeSidebar(event) {\n if (self.resizing()) {\n layout.sidebarSize(event.pageX + (self.resizerWidth() - offset));\n }\n }",
"function resizeSidebars(){\n var height = $(\".content\").css(\"height\");\n $(\".sidebar\").css({\"height\": height});\n}",
... | [
"0.7361814",
"0.69679296",
"0.6965149",
"0.666073",
"0.6617686",
"0.6607012",
"0.6541002",
"0.653124",
"0.65064985",
"0.6471579",
"0.6450414",
"0.64285725",
"0.6411646",
"0.6317477",
"0.63164264",
"0.63019097",
"0.6292959",
"0.6270426",
"0.62450767",
"0.6232037",
"0.61426",
... | 0.7294524 | 1 |
Checks if resize TOC should be called when page is resized | function WidthChange(mq) {
if (!mq.matches) {
console.log("im resizing the TOC");
resizeScrollbar();
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function doResponsiveLogic () {\n\t\tvar func = ResponsiveBootstrapToolkit.changed(function () {\n\t\t\tvar currentSize = ResponsiveBootstrapToolkit.current();\n\t\t\tif (currentSize != lastSize) {\n\t\t\t\tvar desired = $(\"#toc-toggler\").hasClass(\"initial-open\");\n\t\t\t\tif (!desired)\n\t\t\t\t\tdesired = $(... | [
"0.66043156",
"0.656118",
"0.64614296",
"0.64470124",
"0.6427369",
"0.63612366",
"0.6355268",
"0.6339879",
"0.6333294",
"0.6324192",
"0.6313791",
"0.6290721",
"0.62292457",
"0.615825",
"0.6141768",
"0.6140685",
"0.6122354",
"0.60693306",
"0.60606617",
"0.6051836",
"0.6042103"... | 0.6780883 | 0 |
The basic view bindActions: fn() model: the model ctrl: the controller options: options hash | function View(bindActions, model, ctrl, options) {
options = options || {};
this.mode = "normal";
this.selection = null;
this.sel_inverted = false;
this.active = null;
this.o = util.extend(
{
Node: DefaultNode,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function bindUIActions () {\n\n }",
"attachButtonHandlers() {\n this.View.container.onclick \n = this.Controller.viewClickHandler.bind(this);\n }",
"attachButtonHandlers() {\r\n this.View.container.onclick = this.Controller.viewClickHandler.bind(this);\r\n }",
"function Controlle... | [
"0.6530217",
"0.599654",
"0.5816351",
"0.579358",
"0.550391",
"0.550391",
"0.5499775",
"0.5431407",
"0.5430114",
"0.5415082",
"0.54141426",
"0.5382758",
"0.5372324",
"0.53542167",
"0.5333867",
"0.5332065",
"0.52907395",
"0.5277916",
"0.5218816",
"0.51909906",
"0.5166421",
"... | 0.64326704 | 1 |
Setter for fighter last name | set lastName(value) {
this._lastName = value;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"get lastName() {\n return this._lastName;\n }",
"get lastName(){\n\t\treturn this.user.last_name;\n\t}",
"function handleChangeOfLastName(e) {\n setLAST_NAME(e.target.value)\n\n }",
"set fullName(name) {\n const nameParts = name.split(\" \");\n this.firstName = nameParts[0];\n th... | [
"0.68812096",
"0.684365",
"0.6719565",
"0.6677422",
"0.6668891",
"0.6588724",
"0.6575964",
"0.65535825",
"0.65210944",
"0.651708",
"0.6483823",
"0.6447126",
"0.63984805",
"0.6388982",
"0.6361454",
"0.6327017",
"0.6284068",
"0.6284068",
"0.62683666",
"0.6224374",
"0.61892074",... | 0.7552807 | 0 |
Setter for fighter nick name | set nickName(value) {
this._nickName = value;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"set nickName(val) {\n this.name = val;\n }",
"get nickName() {\n return this.name;\n }",
"function setNickname(nation){\n\treturn nation + ' ' + animals();\n}",
"function setNickname(str) {\n amplify.store(\"nickname\", str);\n setSettingsBarState(\"close\");\n}",
"function updatePlay... | [
"0.8205494",
"0.72505146",
"0.7172744",
"0.6837798",
"0.6741642",
"0.6463852",
"0.6441063",
"0.6436523",
"0.63854206",
"0.63146347",
"0.6302862",
"0.62623924",
"0.6259439",
"0.625495",
"0.6242912",
"0.62085074",
"0.6143935",
"0.61220115",
"0.60806847",
"0.605486",
"0.60299945... | 0.8414682 | 0 |
////////////////////// CPU static info //////////////////////////////////////////// | function systeminfo(callback){
const filepath = '/proc/cpuinfo';
fs.readFile(filepath, (err, data)=>{
if(err){
callback(err);
return;
}
try{
let items = data.toString('utf8').split('\n');
let cpu_model = "";
let number_cpu = 0;
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function GetCpuInfo()\n{\n\treturn execFileAsync( \"cat\", [\"/proc/cpuinfo\"] )\n\t.then( function( data ) \n\t{\n\t\tvar result = {};\n\t\t\n\t\t// Loop through each line in the output\n\t\tdata.stdout.toString().split('\\n').forEach(function (line) \n\t\t{\n\t\t\t// Remove tabs from line\n\t\t\tline = line.repl... | [
"0.69563466",
"0.6625092",
"0.6506247",
"0.6455103",
"0.6455103",
"0.64526635",
"0.63976365",
"0.6382543",
"0.6353",
"0.63386106",
"0.6332356",
"0.6204854",
"0.6200283",
"0.6151026",
"0.6149201",
"0.61401135",
"0.6120594",
"0.6098745",
"0.60948604",
"0.595169",
"0.5948051",
... | 0.66621786 | 1 |
Set dict to contain only words from the specified scene | function changeDict(dict, full_dict, scene) {
for (var key of Object.keys(dict)) {
delete dict[key];
}
Object.keys(full_dict).forEach((word) => {
if (full_dict[word][1] === scene || scene === 'all') {
dict[word] = full_dict[word];
}
});
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function wordStats(lines) {\n\t\tlet words = {};\n\n\t\tif (!lines) {\n\t\t\tlines = savedLines;\n\t\t}\n\n\t\tfor (let item of lines) {\n\t\t\tlet line;\n\n\t\t\t// Use .displayText or .text\n\t\t\tif (item.displayText) {\n\t\t\t\tline = item.displayText.toLowerCase();\n\t\t\t }\n\t\t\t else {\n\t\t\t \tline = it... | [
"0.56247526",
"0.5623723",
"0.55020106",
"0.54914016",
"0.5482993",
"0.54323936",
"0.5386401",
"0.5354153",
"0.5352215",
"0.53374004",
"0.53035045",
"0.5290018",
"0.5228238",
"0.52199125",
"0.5204667",
"0.51977444",
"0.51933587",
"0.5187945",
"0.51830107",
"0.516807",
"0.5161... | 0.6606553 | 0 |
gerarNumerosEntre(1, 5, [1, 2, 4]) .then(console.log) .catch(console.log) | async function gerarMegaSena(qtdeNumeros, tentativas = 1){
const numeros = []
try{
for(let _ of Array(qtdeNumeros).fill()){
numeros.push(await gerarNumerosEntre(1, 60, numeros ))
}
return numeros
} catch(e) {
if(tentativas > 100) {
throw "Perdeu Play Boy"
} else {
return gerarM... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function sum2() {\n sumOfThreeElements(2, 9, 8)\n .then(result => console.log(result))\n .catch(error => console.log(error));\n}",
"function elevaNumero(numero) {\n return new Promise((resolve, reject) => {\n if(isNaN(numero)) {\n reject('Não é um número')\n } else {\n resolve(Math.pow(nu... | [
"0.6401876",
"0.62785244",
"0.6128003",
"0.6120497",
"0.57770693",
"0.5719821",
"0.56930304",
"0.5673231",
"0.5669981",
"0.5664512",
"0.5622177",
"0.560256",
"0.5550162",
"0.55199015",
"0.5461464",
"0.545514",
"0.5421339",
"0.54105085",
"0.5395921",
"0.5373385",
"0.53718776",... | 0.65982956 | 0 |
2. function that returns the squares of numbers 1 100 | function numberSquares() {
for (let i = 1; i < 101; i++) {
console.log(Math.pow(i,2));
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function square(n)\n{\nreturn n^2;\n}",
"function square(n){\n return Math.pow(n, 2);\n}",
"function squareNum(x) { return x*x }",
"function square(n) {\n return n ** 2;\n}",
"function squareOfSums(number) {\n var sum = number * (number + 1) / 2;\n return sum * sum;\n }",
"function... | [
"0.739123",
"0.7350492",
"0.7322954",
"0.73072946",
"0.7281275",
"0.7237249",
"0.72327095",
"0.72090155",
"0.7195827",
"0.7188875",
"0.71712077",
"0.7155865",
"0.7142717",
"0.7114397",
"0.7110585",
"0.7104504",
"0.70828277",
"0.7073556",
"0.70697826",
"0.7061105",
"0.7050886"... | 0.7769757 | 0 |
3. function that flips between heads and tails until you get tails | function headsOrTails(){
let heads = 0;
let tails = 1;
let flip = Math.floor(Math.random() * 2);
if(flip != tails){
console.log(flip + " Keep flipping until you get to tails.");
headsOrTails();
} else {
console.log(flip + " It's tails. You win!");
}
// return flip;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function coinFlip() {\n if (Math.floor(Math.random() * 2) === 0) {\n return \"heads\"\n }\n return \"tails\"\n}",
"function coinFlip() {\r\n return ( Math.random() > 0.5 ? \"heads\" : \"tails\" );\r\n}",
"flipCoin(input){\n var tail=0, head=0, tailper, headper, n = input;\n for (var i = ... | [
"0.6686459",
"0.64645237",
"0.6125851",
"0.60458326",
"0.6024392",
"0.600918",
"0.59396696",
"0.5847403",
"0.5841288",
"0.5788386",
"0.56189185",
"0.55183816",
"0.542189",
"0.54184276",
"0.5413434",
"0.53780013",
"0.5353843",
"0.5346802",
"0.53285295",
"0.532746",
"0.5324124"... | 0.73131275 | 0 |
Gets an instance of groups service, trying to reuse the same one, if possible. | async function getGroupsService() {
const m2mToken = await api.getTcM2mToken();
const cached = getGroupsService.cachedService;
if (cached && m2mToken === cached.getTokenV3()) return cached;
const res = groups.getService(m2mToken);
getGroupsService.cachedService = res;
return res;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"createGroup(groupName) {\n if (this.groups.hasOwnProperty(groupName))\n console.error(`Pulse Collection: Group ${groupName} already exists`);\n let group = new group_1.default(() => this);\n group.name = groupName;\n this.groups[groupName] = group;\n return group;\n ... | [
"0.620983",
"0.60502356",
"0.58682734",
"0.5728946",
"0.5724704",
"0.56671494",
"0.5645336",
"0.5634157",
"0.5590502",
"0.5569491",
"0.54918385",
"0.5470061",
"0.5413602",
"0.5405984",
"0.5401784",
"0.54016125",
"0.53846776",
"0.5384019",
"0.533636",
"0.5335799",
"0.5304757",... | 0.74859685 | 0 |
Socket events Define/execute a function to get the username from the server so that it can be broadcast on connection | function getUserName() {
socket.emit("register-user", username.value)
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function updateUsername(){\n\t\t//send username to sockets to update username\n\t\tusername = $scope.username;\n\t\tsocket.emit('user_to_server', username);\n\t\t//end socket emit\n\t}",
"function check_username(username){\n socket.emit('check_username', { 'username': username });\n\n }",
"function e... | [
"0.7245492",
"0.72261554",
"0.70359266",
"0.6906982",
"0.6856892",
"0.6768714",
"0.6726387",
"0.6637081",
"0.6636805",
"0.65068436",
"0.64875513",
"0.6461018",
"0.6424703",
"0.6409854",
"0.6381614",
"0.6359545",
"0.6358701",
"0.6322282",
"0.62713015",
"0.6271112",
"0.624477",... | 0.7528653 | 0 |
The paddle was made in blender and autoconverted to JSX by | function Paddle() {
// Load the gltf file
const { nodes, materials } = useLoader(GLTFLoader, "/pingpong.glb")
// Fetch some reactive state
const { pong } = useStore((state) => state.api)
const welcome = useStore((state) => state.welcome)
const count = useStore((state) => state.count)
const model = useRef(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"renderLeftPaddle() {\r\n ctx.fillStyle = 'white';\r\n ctx.fillRect(this.paddle_x, this.paddle_y, this.paddle_width, this.paddle_hight);\r\n }",
"function displayPaddle(paddle) {\n // Draw the paddles\n fill(paddle.paddleColor);\n rect(paddle.x, paddle.y, paddle.w, paddle.h);\n}",
"function ... | [
"0.6548157",
"0.6360453",
"0.6288837",
"0.6281613",
"0.6270663",
"0.6246863",
"0.62311214",
"0.6099728",
"0.6092988",
"0.60605794",
"0.60494345",
"0.6042137",
"0.6041325",
"0.60355175",
"0.60233665",
"0.60232806",
"0.6015071",
"0.6014767",
"0.6014255",
"0.60039145",
"0.600121... | 0.6491548 | 1 |
Create a service agreement with sane testing defaults | function serviceAgreement(overrides) {
const agreement = {
payment: helpers_1.bigNum('1000000000000000000'),
expiration: helpers_1.bigNum(300),
endAt: helpers_1.sixMonthsFromNow(),
oracles: [],
requestDigest: '0xbadc0de5badc0de5badc0de5badc0de5badc0de5badc0de5badc0de5badc0de5... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function assertServiceAgreementEmpty(sa) {\n matchers.bigNum(sa.payment, helpers_1.bigNum(0), 'service agreement is not absent');\n matchers.bigNum(sa.expiration, helpers_1.bigNum(0), 'service agreement is not absent');\n matchers.bigNum(sa.endAt, helpers_1.bigNum(0), 'service agreement is not absent');\n... | [
"0.57897514",
"0.57749164",
"0.5533435",
"0.55051315",
"0.54414076",
"0.5368609",
"0.53410286",
"0.5268463",
"0.52456915",
"0.5242131",
"0.52168024",
"0.51898855",
"0.51691437",
"0.5150922",
"0.51408094",
"0.51163477",
"0.5088412",
"0.508019",
"0.5076059",
"0.50312847",
"0.49... | 0.70506775 | 0 |
Check that all values for the struct at this SAID have default values. For example, when an invalid service agreement initialization request is made to a `Coordinator`, we want to make sure that it did not initialize its service agreement struct to any value, hence checking for it being empty. | function assertServiceAgreementEmpty(sa) {
matchers.bigNum(sa.payment, helpers_1.bigNum(0), 'service agreement is not absent');
matchers.bigNum(sa.expiration, helpers_1.bigNum(0), 'service agreement is not absent');
matchers.bigNum(sa.endAt, helpers_1.bigNum(0), 'service agreement is not absent');
chai_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function isAllStandardFieldsEmpty(entry) {\n return (entry.userName.length == 0) && \n (entry.password.length == 0) && \n (entry.url.length == 0) && \n (entry.notes.length == 0); \n}",
"get has_default_params() {\n throw new Error(\"has_default_params is a private attr... | [
"0.6176302",
"0.5760112",
"0.57454103",
"0.571051",
"0.5658458",
"0.5646124",
"0.5646124",
"0.55489796",
"0.5535087",
"0.55005795",
"0.5474135",
"0.539567",
"0.53779745",
"0.5355542",
"0.53242517",
"0.5321922",
"0.5305382",
"0.52801764",
"0.52648354",
"0.5260422",
"0.5257434"... | 0.6108147 | 1 |
Create parameters needed for the ```solidity function initiateServiceAgreement( bytes memory _serviceAgreementData, bytes memory _oracleSignaturesData ) ``` method of the `Coordinator.sol` contract | async function initiateSAParams(overrides) {
const sa = serviceAgreement(overrides);
const signatures = await generateOracleSignatures(sa);
return [encodeServiceAgreement(sa), encodeOracleSignatures(signatures)];
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function serviceAgreement(overrides) {\n const agreement = {\n payment: helpers_1.bigNum('1000000000000000000'),\n expiration: helpers_1.bigNum(300),\n endAt: helpers_1.sixMonthsFromNow(),\n oracles: [],\n requestDigest: '0xbadc0de5badc0de5badc0de5badc0de5badc0de5badc0de5badc0... | [
"0.64041525",
"0.568735",
"0.56333226",
"0.5507744",
"0.51842064",
"0.511459",
"0.5019269",
"0.49738938",
"0.49426565",
"0.49046832",
"0.4872582",
"0.4864651",
"0.48236454",
"0.48236454",
"0.47958517",
"0.47820207",
"0.47661954",
"0.4762708",
"0.474847",
"0.4737499",
"0.47207... | 0.64749163 | 0 |
ABI encode a service agreement object | function encodeServiceAgreement(sa) {
return ethers_1.ethers.utils.defaultAbiCoder.encode(SERVICE_AGREEMENT_TYPES, serviceAgreementValues(sa));
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function serviceAgreement(overrides) {\n const agreement = {\n payment: helpers_1.bigNum('1000000000000000000'),\n expiration: helpers_1.bigNum(300),\n endAt: helpers_1.sixMonthsFromNow(),\n oracles: [],\n requestDigest: '0xbadc0de5badc0de5badc0de5badc0de5badc0de5badc0de5badc0... | [
"0.55282766",
"0.54792523",
"0.5462073",
"0.5462073",
"0.5462073",
"0.5462073",
"0.5462073",
"0.5462073",
"0.5462073",
"0.5361081",
"0.53438264",
"0.5336749",
"0.5149123",
"0.51392543",
"0.51346445",
"0.51168436",
"0.5105328",
"0.5085461",
"0.5082781",
"0.50690824",
"0.506908... | 0.7239528 | 0 |
Generate the unique identifier of a service agreement by computing its digest. | function generateSAID(sa) {
return ethers_1.ethers.utils.solidityKeccak256(SERVICE_AGREEMENT_TYPES, serviceAgreementValues(sa));
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"static generateSha() {\n let sha = new Date().getTime();\n return sha;\n }",
"function _getNewID(){\n \n // Rendiamo il nostro id univoco\n var now = new Date().getTime();\n \n return signature + now;\n \n }",
"makeGUID() {\n const s4 = () => {\n... | [
"0.61105496",
"0.59043175",
"0.57499117",
"0.57197535",
"0.5714435",
"0.5707649",
"0.5707384",
"0.5689819",
"0.5663108",
"0.5661005",
"0.56393147",
"0.56360114",
"0.56350404",
"0.5630622",
"0.5630622",
"0.5606445",
"0.5597319",
"0.5597278",
"0.5593136",
"0.55899346",
"0.55889... | 0.61282265 | 0 |
Abi encode the oracleRequest() method for `Coordinator.sol` ```solidity function oracleRequest( address _sender, uint256 _amount, bytes32 _sAId, address _callbackAddress, bytes4 _callbackFunctionId, uint256 _nonce, uint256 _dataVersion, bytes calldata _data ) ``` | function encodeOracleRequest(specId, to, fHash, nonce, dataBytes) {
const oracleRequestSighash = '0x40429946';
const oracleRequestInputs = [
{ name: '_sender', type: 'address' },
{ name: '_amount', type: 'uint256' },
{ name: '_sAId', type: 'bytes32' },
{ name: '_callbackAddress',... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function encodeOracleRequest(specId, callbackAddr, callbackFunctionId, nonce, data) {\n const oracleRequestSighash = '0x40429946';\n const oracleRequestInputs = [\n { name: '_sender', type: 'address' },\n { name: '_payment', type: 'uint256' },\n { name: '_specId', type: 'bytes32' },\n ... | [
"0.7156876",
"0.61916983",
"0.5428801",
"0.5271255",
"0.52340883",
"0.5183039",
"0.5011805",
"0.5004504",
"0.49396664",
"0.49396378",
"0.49152863",
"0.48834854",
"0.48660105",
"0.48654854",
"0.48602244",
"0.48438525",
"0.47731152",
"0.4758058",
"0.47530842",
"0.47363696",
"0.... | 0.6822851 | 1 |
Generates the oracle signatures on a ServiceAgreement | async function generateOracleSignatures(serviceAgreement) {
const sAID = generateSAID(serviceAgreement);
const signatures = [];
for (let i = 0; i < serviceAgreement.oracles.length; i++) {
const oracle = serviceAgreement.oracles[i];
if (!(oracle instanceof ethers_1.ethers.Wallet)) {
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function serviceAgreement(overrides) {\n const agreement = {\n payment: helpers_1.bigNum('1000000000000000000'),\n expiration: helpers_1.bigNum(300),\n endAt: helpers_1.sixMonthsFromNow(),\n oracles: [],\n requestDigest: '0xbadc0de5badc0de5badc0de5badc0de5badc0de5badc0de5badc0... | [
"0.61694694",
"0.6118807",
"0.57380044",
"0.55154854",
"0.5494163",
"0.5432775",
"0.5387856",
"0.5358595",
"0.5338572",
"0.5338572",
"0.5338572",
"0.5338572",
"0.53227824",
"0.5254178",
"0.51849204",
"0.51718336",
"0.5164441",
"0.5127292",
"0.5127075",
"0.51130533",
"0.507916... | 0.8315842 | 0 |
Combine v, r, and s params of multiple signatures into format expected by contracts | function combineOracleSignatures(signatures) {
return signatures.reduce((prev, { v, r, s }) => {
prev.vs.push(v);
prev.rs.push(r);
prev.ss.push(s);
return prev;
}, { vs: [], rs: [], ss: [] });
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"signatureExport (obj, sig) {\n const sigR = sig.subarray(0, 32)\n const sigS = sig.subarray(32, 64)\n if (new BN(sigR).cmp(ecparams.n) >= 0) return 1\n if (new BN(sigS).cmp(ecparams.n) >= 0) return 1\n\n const { output } = obj\n\n // Prepare R\n let r = output.subarray(4, 4 + 33)\n r[0] = 0... | [
"0.5527054",
"0.5527054",
"0.5527054",
"0.5527054",
"0.5520501",
"0.52912235",
"0.51467663",
"0.5131755",
"0.5094602",
"0.5080123",
"0.5060278",
"0.50281864",
"0.50262904",
"0.4996045",
"0.4996045",
"0.4996045",
"0.4996045",
"0.49862057",
"0.49797684",
"0.49797684",
"0.497976... | 0.6178767 | 0 |
(x, y) refers to pointer_x and pointer_y, the coordinates of the mouse dragging; this method will be called as show(mouseX, mouseY) | show(x, y) {
fill(100, 20)
stroke(255)
// have I been clicked? /scared
if (this.dragging) {
// we need an offset so we can display where we
// really were earlier and where the mouse really is. So, we
// can't absolutely set this.x to x, we have to ha... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function showCoords(evt){\n document.getElementById(\"mousecoor\").innerHTML = (\n \"X : \" + evt.clientX + \"\\n\" +\n \"Y : \" + evt.clientY + \"\\n\"\n );\n}",
"function mouseDragged() {}",
"function showMouse(state) { }",
"function mouseReleased() {\n print(mouseX + \", \" + mouseY);\n}",
"func... | [
"0.6770649",
"0.67533535",
"0.66808265",
"0.66225106",
"0.6549448",
"0.64894736",
"0.64502037",
"0.6443321",
"0.64240867",
"0.6399168",
"0.6396004",
"0.6308341",
"0.6238511",
"0.62160736",
"0.6212205",
"0.62029886",
"0.6201679",
"0.6194531",
"0.6188227",
"0.61713266",
"0.6145... | 0.72834826 | 0 |
Given a node in a partition layout, return an array of all of its ancestor nodes, highest first, but excluding the root. | _getAncestors(node) {
const path = [];
let current = node;
while (current.parent) {
path.unshift(current);
current = current.parent;
}
return path;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function getAncestors(node) {\n let path = [];\n let current = node;\n while (current.parent) {\n path.unshift(current);\n current = current.parent;\n }\n return path;\n }",
"function getAncestors(node) {\n var path = [];\n var current = node;\n while (current.p... | [
"0.6918536",
"0.68882644",
"0.68882644",
"0.68642163",
"0.68501633",
"0.68501633",
"0.68501633",
"0.68444574",
"0.68268126",
"0.6820855",
"0.6818828",
"0.6818828",
"0.64508206",
"0.6309352",
"0.6309352",
"0.6118323",
"0.60752004",
"0.60190445",
"0.6011709",
"0.58762103",
"0.5... | 0.6915202 | 1 |
Generate a string that describes the points of a breadcrumb polygon. | _breadcrumbPoints(d, i) {
const points = [];
points.push('0,0');
points.push(`${b.w},0`);
points.push(`${b.w + b.t},${b.h / 2}`);
points.push(`${b.w},${b.h}`);
points.push(`0,${b.h}`);
if (i > 0) {
// Leftmost breadcrumb; don't include 6th vertex.
points.push(`$... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function breadcrumbPoints(d, i) {\r\n\r\n // Sequences dimensions: width, height, spacing, width of tip/tail.\r\n var b = {\r\n w: 75,\r\n h: 30,\r\n s: 3,\r\n t: 10\r\n };\r\n var points = [];\r\n points.push(\"0,0\");\r\n points.push(b.w + \",0\");\r\n points.push... | [
"0.7619685",
"0.73364294",
"0.72655684",
"0.7232941",
"0.72284234",
"0.720995",
"0.7202926",
"0.7145182",
"0.7133041",
"0.7119084",
"0.7119084",
"0.71093285",
"0.710516",
"0.710516",
"0.710516",
"0.71048313",
"0.71048313",
"0.70348895",
"0.69735146",
"0.6070634",
"0.6027312",... | 0.74070007 | 1 |
This is basically the same idea as was used in Palindrome I (Exercise 15). It uses the same framework, but adds a few extra conditions in the first forloop Bascially, the ifstatement w/in the 1st for loop is filtering out all spaces and punctuation marks. So only letters are added to the results string. The resultsstri... | function PalindromeTwo(str) {
var parts = str.toLowerCase().split('');
var results = '';
for (var i = 0; i < parts.length; i++){
if (parts[i] != ' ' && parts[i] >= 'a' && parts[i] <= 'z'){
results += parts[i];
}
}
var reverse = '';
for (var j = 0; j < results.length; j++){
reverse += resul... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function isPalindrome(theString) { \n let words = [];\n words = theString.match(/\\S+/g);\n let result= \"\";\n for (let i = 0; i < words.length; i++) {\n return result += words[i].split('').reverse().join('');\n} \nif ( result === theString) { \n return \"true\";\n}\n\n}",
"function palindrome (string) {\n ... | [
"0.74170315",
"0.7382544",
"0.7293323",
"0.72566223",
"0.7255558",
"0.72007996",
"0.7156467",
"0.71365726",
"0.70569146",
"0.7018394",
"0.7016914",
"0.70102286",
"0.7000424",
"0.6979079",
"0.69784343",
"0.6972345",
"0.69573736",
"0.69544065",
"0.6948327",
"0.6940514",
"0.6922... | 0.7690653 | 0 |
import BookForm from './01components/BookFormWithReducer' | function App() {
return (
<div className="App">
<BookContextProvider>
<Navbar />
<BookList />
<BookForm />
</BookContextProvider>
</div>
);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function mapStateToProps(state) {\n return {\n ...state.redux_form\n // nameError: state.nameError,\n // descriptionError: state.descriptionError,\n // docTypeError: state.docTypeError,\n // docListError: state.docListError,\n // renderApp1: state.renderApp1\n };\n}",
"function mapStateToProp... | [
"0.5698579",
"0.5693082",
"0.56293595",
"0.560583",
"0.56003207",
"0.55827034",
"0.5582208",
"0.5582208",
"0.55618376",
"0.55589116",
"0.55364597",
"0.55154645",
"0.5485737",
"0.54766417",
"0.5473302",
"0.5450074",
"0.54469925",
"0.5444049",
"0.5427524",
"0.5419945",
"0.54186... | 0.5768171 | 0 |
Empties the storage object. | clear() {
this.store = {};
this._updateStorage();
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"clear() {\n this.storage.clear();\n }",
"function clearData() {\n if (storage) {\n return storage.clear();\n }\n }",
"clear() {\n AsyncStorage.clear('app-data', console.log);\n this.obj = {};\n }",
"clear () {\n this.data = []\n this.syncToDisk()\n }",
"c... | [
"0.8118265",
"0.7465801",
"0.7450216",
"0.73471",
"0.7262815",
"0.71889794",
"0.7167492",
"0.7126509",
"0.71030414",
"0.70828325",
"0.70603997",
"0.705923",
"0.7016421",
"0.69676816",
"0.69262546",
"0.6894789",
"0.683308",
"0.6750402",
"0.67371374",
"0.6708593",
"0.6700884",
... | 0.7890659 | 1 |
Show ranking of players | function showRanking() {
if (usersList.length != 0) {
var html = `
<table class="table">
<thead class="table__head">
<tr class="table__row">
<th class="table__header">Name</th>
<th class="table__header">Time</th>
<th class="table__header">Attempts</th>
</tr>... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function displayRankings() {\n\trank();\n\t//show rankings\n\tvar i, l;\n\tfor (i=0, l=rankings.length; i < l; i +=1) {\n\t\tdocument.getElementById(\"r\" + i).innerHTML = rankings[i].lastName;\n\t\tdocument.getElementById(\"pts\" + i).innerHTML = rankings[i].points;\n\t}\n\t//show when last updated\n\tvar stamp =... | [
"0.74083894",
"0.7136899",
"0.69781786",
"0.6901951",
"0.67785144",
"0.67710996",
"0.6717239",
"0.66662365",
"0.6602457",
"0.6572284",
"0.6524758",
"0.6511606",
"0.6481755",
"0.6471103",
"0.64173645",
"0.6368981",
"0.6340068",
"0.63333654",
"0.63270634",
"0.63269776",
"0.6309... | 0.7229582 | 1 |
Write a function called averagePair. Given a sorted array of integers and a target average, determine if there is a pair of values in the array where the average of the pair equals the target average. There may be more than one pair that matches the average target. Bonus Constraints: Time: O(N) Space: O(1) | function averagePair(arr, target) {
let first = 0;
let second = arr.length - 1;
while (first < second) {
let ave = (arr[first] + arr[second]) / 2;
if (ave === target) {
return true;
}
if (ave < target) {
first++;
}
if (ave > target) {
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function averagePair(array, targetAvg){\n let start = 0;\n let end = array.length - 1;\n \n while (start < end){\n const num1 = array[start];\n const num2 = array[end];\n let pairAvg = (num1 + num2) / 2;\n if(pairAvg === targetAvg){\n return true\n } else i... | [
"0.86737305",
"0.86245793",
"0.8555811",
"0.8375971",
"0.82294136",
"0.78843945",
"0.7697702",
"0.76886827",
"0.7669883",
"0.76607853",
"0.765332",
"0.7558792",
"0.69971704",
"0.69347847",
"0.6343782",
"0.6323826",
"0.6315619",
"0.6305926",
"0.62383574",
"0.6122322",
"0.60866... | 0.863122 | 1 |
Reload the previously loaded graph. loadName is either the contents of a locally loaded file or the filename of a server object. fromServer will be true if it is a server object and false if it was a locally loaded file. If it's 1 no graph has been loaded yet. | function reloadGraph() {
if(fromServer == -1) return;
if (fromServer) loadFromFile(loadName);
else loadFile(loadName);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"reload() {\n this._callWrapper( this._do_load ).then( () => {\n this.emit( 'change', 'change', this.filename );\n } );\n }",
"async function reloadFile(){\n file = document.getElementById(\"graph\").files[0];\n if(file == null) return;\n\n try { await readFile();}\n catch (e) {\n ... | [
"0.6034298",
"0.5892899",
"0.54766876",
"0.5387524",
"0.53432536",
"0.52992374",
"0.52071464",
"0.5196678",
"0.51680136",
"0.5147193",
"0.5145821",
"0.50525314",
"0.49960747",
"0.4964391",
"0.49489218",
"0.49433246",
"0.4942352",
"0.49417874",
"0.4938274",
"0.49132374",
"0.49... | 0.8106849 | 0 |
function to toggle HMDD MiRNAAssociated Diseases Table (Harini) | function togglehmdd() {
toggleElement("mirnafilter", "hmddbutton");
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function togglehmdd2() {\n toggleElement(\"diseasefilter\", \"hmddbutton2\");\n}",
"function toggleAnswerTable() {\n var tbl = document.getElementById(\"answerTable\");\n if (tbl.style.display === \"none\") {\n tbl.style.display = \"block\";\n\n } else {\n tbl.style.display = \"none\";\n ... | [
"0.6638469",
"0.5961531",
"0.58591217",
"0.57572263",
"0.5745813",
"0.5645043",
"0.5629955",
"0.556801",
"0.55246305",
"0.5519277",
"0.54817945",
"0.5454384",
"0.54470915",
"0.54135853",
"0.54135853",
"0.54135853",
"0.5402818",
"0.53936076",
"0.53468615",
"0.534677",
"0.53321... | 0.7114055 | 0 |
function to toggle HMDD DiseaseAssociated MiRNAS Table (Harini) | function togglehmdd2() {
toggleElement("diseasefilter", "hmddbutton2");
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function togglehmdd() {\n toggleElement(\"mirnafilter\", \"hmddbutton\");\n}",
"function ToggleAttributeTablesCallbackFunction() { \r\n \r\n var id = $(this).attr('id');\r\n \r\n if ( id == \"CountableTable\" ) { \r\n ... | [
"0.7095617",
"0.56220394",
"0.5532202",
"0.55180055",
"0.5460212",
"0.5440631",
"0.5438879",
"0.5412987",
"0.53619593",
"0.53600633",
"0.53556186",
"0.53228664",
"0.5318629",
"0.5277823",
"0.52519405",
"0.52370614",
"0.52342016",
"0.52342016",
"0.52342016",
"0.52241445",
"0.5... | 0.63944227 | 1 |
fade in newly loaded panorama. | function fadeIn() {
new TWEEN.Tween(pano.material)
.to({opacity: 1}, 1000)
.onComplete(fadeInOverlay)
.start();
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function fadeIn()\n{\n\t_galleryPictureViewer.removeEventListener('transitionend', fadeIn);\n\n\t// Remember to only commence with the animations once the new image is fully loaded\n\t_galleryPicture.addEventListener('load', finishFadeIn);\n\n\t_galleryLoadingIcon.classList.remove(HIDE_CLASS);\n\t_galleryPicture.s... | [
"0.6452678",
"0.64176315",
"0.6318433",
"0.63113654",
"0.6070422",
"0.60696214",
"0.60616416",
"0.6037346",
"0.60235906",
"0.60183907",
"0.5902165",
"0.5870167",
"0.5869789",
"0.5869471",
"0.5848863",
"0.58434176",
"0.58330625",
"0.5824902",
"0.5787745",
"0.5782611",
"0.57592... | 0.707359 | 0 |
Adds an empty object as the value for a key if the object does not contain the key yet | function addKey(object, key) {
if (object[key] === undefined) {
object[key] = {};
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function updateObject(object, key, value) {\n if(!object[key]){\n object[key] = value;\n } else {\n object[key] = value;\n }\n return object;\n}",
"function returnOrCreateObject(baseObject, key) {\n if (key in baseObject) return baseObject[key];\n else return (baseO... | [
"0.6104593",
"0.599503",
"0.5798409",
"0.5797618",
"0.57857746",
"0.5763657",
"0.5758091",
"0.5749371",
"0.5747771",
"0.5732119",
"0.5700541",
"0.56867373",
"0.5630846",
"0.5630622",
"0.56273973",
"0.5618851",
"0.5551692",
"0.55468357",
"0.55078256",
"0.5505052",
"0.5500311",... | 0.7376171 | 0 |
Helper function that subscribes to a channel in node | function subscribeNode (client, subscriptions, channel, callback, done_callback) {
if (subscriptions[channel]===undefined) {
subscriptions[channel] = [callback];
client.subscribe(channel, {qos: 0}, function() {
// If there is a done_callback defined, execute it
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function chatSubscribe(channel) {\n\tconn.send(JSON.stringify({command: \"subscribe\", channel: channel}));\n}",
"subscribe(channels) {\n try {\n this.log(\"Subscribing to channels.\");\n this.redisClient.subscribe(channels);\n } catch (e) {\n this.log(\"Exception subscribing to channels. \"... | [
"0.74937457",
"0.71739256",
"0.71526796",
"0.70608675",
"0.7052403",
"0.6993933",
"0.69062436",
"0.6856127",
"0.6825486",
"0.67897135",
"0.67890316",
"0.677751",
"0.677751",
"0.67251986",
"0.67129135",
"0.6705096",
"0.6668722",
"0.6635059",
"0.657562",
"0.6561868",
"0.6496187... | 0.7549706 | 0 |
Helper function that subscribes to a channel in the browser | function subscribeBrowser (client, subscriptions, backlog, channel, callback, done_callback) {
if ( addToBacklog(client, backlog, subscribeBrowser, [client, subscriptions, backlog, channel, callback, done_callback]) ) return;
if (subscriptions[channel]===undefined) {
subscriptions[channel] = [call... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function gameChannelSubscribe() {\n\tvar scope = angular.element(document.getElementById(\"content_wrap\")).scope();\n\tscope.subscribeChannle(scope.game.cid, 1);\t\t// force subscribed state\n}",
"function chatSubscribe(channel) {\n\tconn.send(JSON.stringify({command: \"subscribe\", channel: channel}));\n}",
... | [
"0.7035052",
"0.6999339",
"0.68553185",
"0.6839361",
"0.6734209",
"0.6721367",
"0.6686635",
"0.6653601",
"0.6552969",
"0.6552969",
"0.65362006",
"0.6511062",
"0.64831185",
"0.64771295",
"0.64366233",
"0.64313257",
"0.64313257",
"0.64026535",
"0.6398381",
"0.6319445",
"0.63149... | 0.75197864 | 0 |
Helper functions Helper function that generates a random client ID | function generateRandomClientId () {
var length = 22;
var chars = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
var result = '';
for (var i = length; i > 0; --i) {
result += chars[Math.round(Math.random() * (chars.length - 1))];
}
return re... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function generateClientID() {\n return _prefix + _clientID++;\n}",
"function generateClientID() {\n\t return _prefix + _clientID++;\n\t}",
"randomId() {\n return Date.now().toString(36).substr(2) + Math.random().toString(36).substr(2);\n }",
"function getRandId() {\n return Math.random().toS... | [
"0.8385694",
"0.8248188",
"0.7991094",
"0.7978154",
"0.7901852",
"0.7855734",
"0.78539324",
"0.7853854",
"0.7796925",
"0.77941364",
"0.7765616",
"0.77561074",
"0.77407634",
"0.7734627",
"0.7717579",
"0.7700424",
"0.7687779",
"0.7686652",
"0.76865894",
"0.76833385",
"0.7679985... | 0.86034393 | 0 |
Helper function that tries to match a channel with each subscription it returns undefined if no match is found | function matchesWildcard (subscriptions, channel) {
var i;
var subs = Object.keys(subscriptions);
for (i=0; i < subs.length; i++) {
if (matchesFilter(subs[i], channel)) {
return subs[i];
}
}
return undefined;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function findCallbacks (subscriptions, channel) {\n // First try to see if a callback for the exact channel exists\n if(Object.keys(subscriptions).indexOf(channel)!==-1)\n return subscriptions[channel];\n // If it doesn't then let's try to see if the channel matches a wildcard callb... | [
"0.69816333",
"0.62062705",
"0.61973506",
"0.6081594",
"0.5993563",
"0.5848132",
"0.584274",
"0.5839992",
"0.5811177",
"0.5804415",
"0.5785261",
"0.5702175",
"0.5701332",
"0.5690988",
"0.5660334",
"0.5604431",
"0.55726534",
"0.5564509",
"0.5526829",
"0.54907036",
"0.54841655"... | 0.71151066 | 0 |
Helper function that checks a certain channel and see if it matches a wildcard pattern Returns true if the channel matches a pattern (including the exact pattern) | function matchesFilter (pattern, channel) {
// If multi-level wildcard is the only character in pattern, then any string will match
if (pattern==="#") {
return true;
}
// Handle all other multi-level wildcards
// FROM SPEC: The number sign (‘#’ U+0023) is a wildcard c... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function matchesWildcard (subscriptions, channel) {\n var i;\n var subs = Object.keys(subscriptions);\n for (i=0; i < subs.length; i++) {\n if (matchesFilter(subs[i], channel)) {\n return subs[i];\n }\n }\n return undefined;\n }",
"functi... | [
"0.7092201",
"0.68681216",
"0.6717932",
"0.664152",
"0.6292744",
"0.6237502",
"0.60791564",
"0.60553914",
"0.6052953",
"0.60515034",
"0.5919058",
"0.59120727",
"0.59120727",
"0.5893713",
"0.5866912",
"0.5866232",
"0.58503765",
"0.5796084",
"0.57891864",
"0.57891864",
"0.57851... | 0.78564554 | 0 |
Replace 'VisualizationObjectName' with the proper object name for your visualization. | function VisualizationObjectName(){
/*
Define the ID of your visualization. This is used to apply
visualizations to songs, playlists, and default. It is a JSON
key so make sure you use `_`
*/
this.id = 'visualization_id';
/*
Define a clean name for your visualization.
*/
this.name = 'Visualization Name';... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function updateVisualization( returnedObject ) {\n\tvar node = verifyJSONForVisjsNodes( returnedObject );\n\tvar edge = verifyJSONForVisjsEdges( returnedObject );\n\n\t// create a graph\n\tvar container = document.getElementById('mygraph');\n\n\tnodes = new vis.DataSet();\n\tnodes.add(node);\n\tedges = new vis.Dat... | [
"0.5742928",
"0.5561899",
"0.5475146",
"0.54259104",
"0.526258",
"0.51882875",
"0.51093066",
"0.5107605",
"0.50832546",
"0.5079307",
"0.5077075",
"0.50346595",
"0.502642",
"0.50054246",
"0.5002236",
"0.497699",
"0.4974766",
"0.49722686",
"0.49606568",
"0.49514008",
"0.4950225... | 0.71250194 | 0 |
Checks if response type is a Response Object or not and converts it to a response object if it isn't | function formatResponse(requestType, response) {
let init = {
status: 200,
statusText: "OK",
headers: {'Content-Type': 'text/plain'}
};
if (response.constructor == Response ) {
console.debug('formatResponse: object is response object', response);
return response;
}
console.debug(response.text, typeof r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function isResponse(obj) {\n\t\treturn typeof obj.setHeader == \"function\" ? obj: null;\n\t}",
"_normalizeResponse(res){\n let ct = res.headers.get('Content-Type');\n if( ct != 'application/json' ){\n return res.text().then( txt => {\n res.error = {error: `unexpected response type ${ct}`, body... | [
"0.63487536",
"0.611361",
"0.60867155",
"0.60319674",
"0.59050417",
"0.59015715",
"0.59015715",
"0.59015715",
"0.59015715",
"0.59015715",
"0.5845757",
"0.5841183",
"0.5828236",
"0.57617205",
"0.5721332",
"0.56850857",
"0.56850857",
"0.56850857",
"0.56850857",
"0.56850857",
"0... | 0.6464071 | 0 |
Returns the SSO cookie content or null | ssoCookie(cookies = {}) {
return cookies[cookieName];
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function getSSOToken () {\n let tokenJWT = document.cookie;\n let base64Url = tokenJWT.split('.')[1];\n let base64 = base64Url.replace('-', '+').replace('_', '/');\n let payload = JSON.parse(window.atob(base64));\n let ssoToken = payload.forgerock.ssotoken\n return ssoToken\n}",
"function getCo... | [
"0.67957413",
"0.65456057",
"0.64884126",
"0.62280834",
"0.62113976",
"0.6194646",
"0.6166985",
"0.6164132",
"0.6152548",
"0.61259794",
"0.6117648",
"0.60681015",
"0.60557574",
"0.60401046",
"0.60226595",
"0.6011335",
"0.5993708",
"0.59925383",
"0.5980302",
"0.5971999",
"0.59... | 0.6546877 | 1 |
fill up both float and 8bit texture data with light properties | addLightData(light, lightIndex, gammaCorrection) {
const isSpot = light._type === LIGHTTYPE_SPOT;
const pos = light._node.getPosition();
// data always stored in 8bit texture
const data8 = this.lights8;
let data8Index = lightIndex * this.lightsTexture8.width * 4;
// li... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"set linearTexture(value) {}",
"function LightDatas(){\n Chunk.call( this, true, true );\n\n this.type = 0;\n this.lights = [];\n this.shadowIndices = [];\n this.preCodeTemplate = null;\n}",
"constructor() {\n /**\n * Base color texture\n */\n this.color0 = new Texture();\n /**\n * Tex... | [
"0.647524",
"0.62745523",
"0.620682",
"0.6204797",
"0.60756516",
"0.6064856",
"0.6059544",
"0.6019963",
"0.6008334",
"0.599891",
"0.59562767",
"0.59539366",
"0.5953675",
"0.59520346",
"0.5915649",
"0.5892796",
"0.5885878",
"0.5885153",
"0.5881064",
"0.5832726",
"0.5827839",
... | 0.66513777 | 0 |
evaluates min and max coordinates of AABB of the light in the cell space | evalLightCellMinMax(clusteredLight, min, max) {
// min point of AABB in cell space
min.copy(clusteredLight.min);
min.sub(this.boundsMin);
min.div(this.boundsDelta);
min.mul2(min, this.cells);
min.floor();
// max point of AABB in cell space
max.copy(clust... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"evaluateBounds() {\n\n const usedLights = this._usedLights;\n\n // bounds of the area the lights cover\n const min = this.boundsMin;\n const max = this.boundsMax;\n\n // if at least one light (index 0 is null, so ignore that one)\n if (usedLights.length > 1) {\n\n ... | [
"0.72965753",
"0.7008233",
"0.64125174",
"0.63468754",
"0.613978",
"0.61372936",
"0.6113157",
"0.60012585",
"0.5958666",
"0.59451365",
"0.58726174",
"0.5866395",
"0.5859436",
"0.58273464",
"0.5821928",
"0.58165485",
"0.5807888",
"0.5772649",
"0.57713395",
"0.5768032",
"0.5755... | 0.7209273 | 1 |
evaluate the area all lights cover | evaluateBounds() {
const usedLights = this._usedLights;
// bounds of the area the lights cover
const min = this.boundsMin;
const max = this.boundsMax;
// if at least one light (index 0 is null, so ignore that one)
if (usedLights.length > 1) {
// AABB of th... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function checkAreas() \r\n{\r\n\tfor (var b = 0; b < buttons.length; b++)\r\n\t{\r\n\t\t// get the pixels in a note area from the blended image\r\n\t\tvar blendedData = blendContext.getImageData( buttons[b].x, buttons[b].y, buttons[b].w, buttons[b].h );\r\n\t\t\t\r\n\t\t// calculate the average lightness of the bl... | [
"0.70492613",
"0.6762474",
"0.65126723",
"0.63072824",
"0.61877954",
"0.6063671",
"0.5893137",
"0.5766055",
"0.57114",
"0.56633115",
"0.56543994",
"0.5632461",
"0.56206",
"0.5611938",
"0.5610279",
"0.5609265",
"0.5569214",
"0.55676454",
"0.5567609",
"0.55600667",
"0.5556858",... | 0.7108657 | 0 |
called on already updated clusters, activates for rendering by setting up uniforms / textures on the device | activate() {
this.updateUniforms();
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"update_GPU( g_state, model_transform, material, gpu = this.g_addrs, gl = this.gl )\r\n { // First, send the matrices to the GPU, additionally cache-ing some products of them we know we'll need:\r\n this.update_matrices( g_state, model_transform, gpu, gl );\r\n gl.uniform1f... | [
"0.6301244",
"0.62930006",
"0.6213533",
"0.6206946",
"0.6103002",
"0.6094484",
"0.6062405",
"0.6009608",
"0.5986634",
"0.59772193",
"0.5974431",
"0.5939879",
"0.5917444",
"0.59138846",
"0.59098375",
"0.58992445",
"0.589438",
"0.5892955",
"0.58759135",
"0.5870558",
"0.5855635"... | 0.6572151 | 0 |
Will accept an array of Card objects as props | function CardList({ cards}) {
// cards => props object
// { cards } => props.cards
return (
<div className="card-list">
<h2 className="component-name">CardList Component</h2>
<br />
{/* Avoid direct state mutation using spread operator */}
{[...cards... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function List(props) {\n const cardsList = props.cards.map(cardObject => {\n return (\n <Card \n title={cardObject.title} \n content={cardObject.content}\n key = {cardObject.id}\n id = {cardObject.id}\n index = {props.i... | [
"0.67839724",
"0.6749131",
"0.6735676",
"0.6668723",
"0.66297597",
"0.6422406",
"0.64166254",
"0.6403317",
"0.6402372",
"0.6401581",
"0.6396012",
"0.638256",
"0.6377296",
"0.63652295",
"0.6316289",
"0.6315445",
"0.630482",
"0.6293405",
"0.62842226",
"0.62755",
"0.6259028",
... | 0.7104437 | 0 |
init runs at startup to configure options and connect to consul | function init(ctx, showHelp) {
var args=ctx.args;
if (showHelp || ctx.argv.length>0 || !args.host || !args.tag) {
console.error("usage: -host=HOSTNAME [-port=PORT] -tag=TAGNAME");
console.error();
console.error(" -host Consul host");
console.error(" -port Consul port, default 8500");
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function init() {\n params = app.params;\n util = app.util;\n app.Log.initStaticFields();\n log = new app.Log('index');\n\n app.server.address = extractHostNameFromUrl(app.server.address);\n log.d('init', 'server=' + app.server.address + ':' + app.server.port);\n\n util.init();\n\n util.lis... | [
"0.65451914",
"0.6403175",
"0.6329634",
"0.62986594",
"0.62749094",
"0.6271055",
"0.626251",
"0.62419444",
"0.6235552",
"0.61854875",
"0.6173177",
"0.61271405",
"0.6124412",
"0.61162573",
"0.6115593",
"0.6089056",
"0.60805094",
"0.6065874",
"0.60632473",
"0.60432607",
"0.6025... | 0.66249305 | 0 |
expandFileReferences This function is used to expand file references that are encountered in the suite data. | function expandFileReferences(data, basePath) {
var targetPath
, stats;
// iterate through the keys in the data
_.each(data, function(value, key) {
// if the key is in any of the ignore keys, then skip this check
if (ignoreKeys.indexOf(key) >= 0) return;
// if the value is a string, then we are ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"initiateReferenceTree() {\n this.referenceTree = new ReferenceTree_1.ReferenceTree();\n Object.keys(this.sourceFilesManager.toJSON()).forEach((filePath) => {\n const sourceFile = this.program.getSourceFile(filePath);\n if (!sourceFile) {\n return;\n }\n... | [
"0.5743458",
"0.53929806",
"0.51805305",
"0.49856955",
"0.47070363",
"0.46812043",
"0.46150595",
"0.4610528",
"0.46090966",
"0.45784247",
"0.45618525",
"0.456151",
"0.45610246",
"0.45503375",
"0.45434335",
"0.45289233",
"0.44760755",
"0.44588235",
"0.44563273",
"0.4440935",
"... | 0.61926746 | 0 |
loadSuite This function is used to load a test suite from a specified definition file. | function loadSuite(definitionFile, opts) {
var ext = path.extname(definitionFile)
, suite = require(definitionFile);
// TODO: attempt to load a parser first, and if not available
// fall back to requiring the file
// if test data is an array, then create a top level testdata object
// and insert the ite... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"fetchSuite(suiteId) {\n AppDispatcher.handleSuiteAction({\n actionType: ActionConstants.SUITE_REQUEST_DATA,\n data: suiteId\n });\n SuiteApi.initSuiteDataBySuiteId(suiteId);\n }",
"function load()\n{\n dashcode.setupParts();\n detailTest();\n setupLogic();\n... | [
"0.57370967",
"0.56915706",
"0.54424566",
"0.54102796",
"0.53131",
"0.5268443",
"0.5253979",
"0.5237065",
"0.51642984",
"0.50709146",
"0.50476366",
"0.50142473",
"0.49736267",
"0.49479377",
"0.49222925",
"0.48373106",
"0.48361117",
"0.481597",
"0.47924703",
"0.47024038",
"0.4... | 0.756967 | 0 |
wrapTasks This is a private helper function that ensures that functions will fire a callback even if they are designed to work in that way | function wrapTasks(fns) {
return fns.map(function(fn, index) {
if (typeof fn == 'function' && fn.length === 0) {
return function(cb) {
fn();
cb();
};
}
return fn;
});
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function executor(tasks){\n \n if(tasks.length ==0){\n console.log(\"empty task list, can't run executor\");\n return;\n }\n let task = tasks.shift();\n let callback = function(err, data){\n if(err!==null){\n console.log(\"some error, stopping now\", err);\n return; \n }\n c... | [
"0.62607133",
"0.6216421",
"0.605181",
"0.6027825",
"0.5943212",
"0.58681554",
"0.5832828",
"0.5827064",
"0.5813667",
"0.57701445",
"0.5744822",
"0.57122713",
"0.5681707",
"0.5658797",
"0.56546086",
"0.5638608",
"0.55788964",
"0.5578576",
"0.5559661",
"0.5552483",
"0.5552483"... | 0.7877028 | 0 |
decreases the number of items which may be added to the cart | function decreaseItems() {
let element = document.querySelector('#items-to-add')
let itemsTotal = parseInt(element.innerHTML)
if (itemsTotal !==0) {
itemsTotal--
element.innerHTML = itemsTotal
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"remove(item) {\n let new_arr = this.get('items')\n let elementIndex = new_arr.findIndex(obj => {\n return obj.id === item.id\n })\n\n if (\n elementIndex !== -1 &&\n new_arr[elementIndex].ordered_quantity !== 0\n ) {\n {\n ... | [
"0.7203347",
"0.7145727",
"0.7095918",
"0.69486505",
"0.68943924",
"0.6890387",
"0.68643713",
"0.68255454",
"0.6795437",
"0.67394394",
"0.6674612",
"0.6508833",
"0.64914566",
"0.6483178",
"0.64391273",
"0.643561",
"0.6428672",
"0.6408295",
"0.63868636",
"0.6349891",
"0.634254... | 0.7364788 | 0 |
Determins whether the cart has items or not | function calculateCart() {
let element = document.querySelector('#items-count')
let itemsTotal = parseInt(element.innerHTML)
if (itemsTotal===0) {
noItems()
return false
}
updateItems(itemsTotal)
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function checkItemsInMiniCart() { \n\n\t\tif($('#cart-info .mini-products-list').children().length > 0) {\n\n\t\t\t$('#cart-info').addClass('hasItem'); \n\t\t} else{\n\t\t\t$('#cart-info').removeClass('hasItem'); \n\t\t}\n\t}",
"async isCartEmpty() {\n const isCartEmpty = await this.getCart();\n ... | [
"0.76931065",
"0.70503485",
"0.6877692",
"0.6857757",
"0.6700503",
"0.66668874",
"0.66092396",
"0.6601019",
"0.65996516",
"0.65907574",
"0.6586302",
"0.65854293",
"0.6581872",
"0.65563387",
"0.65558857",
"0.65558857",
"0.65527",
"0.65317655",
"0.6523901",
"0.65116143",
"0.650... | 0.7418598 | 1 |
scraper the retailer's page | function scrape(retailer_url) {
casper.log('Scraping ' + retailer_url, 'info');
var retailer = {};
var retailer_id = retailers[retailer_url].retailer_id;
// open retailer's page
casper.thenOpen(retailer_url, function() {
// parse the page
var parsed_data = this.evaluate(parse_page, XPATH);
var retailer_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function scrapURL(body) {\n\n var $ = cheerio.load(body);\n\n $(\"a[href*='shirt']\",\"#content\").each(function() {\n var link = $(this);\n var href = link.attr(\"href\");\n var productLinks = url.resolve(productpageURL,\"/\" + href);\n //console.log(productLinks... | [
"0.68140674",
"0.6758607",
"0.6662734",
"0.66027474",
"0.65432286",
"0.6412251",
"0.6245944",
"0.6219176",
"0.6197042",
"0.6169351",
"0.61324745",
"0.61308986",
"0.6055645",
"0.5965707",
"0.5957538",
"0.5946665",
"0.5917319",
"0.59055066",
"0.5882515",
"0.5882012",
"0.5872246... | 0.7223446 | 0 |
TODO: move all image and texture loading into new class. | imgLoader() {
gl.bindTexture(gl.TEXTURE_2D, this.texture);
gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA,gl.UNSIGNED_BYTE, this.image);
gl.generateMipmap(gl.TEXTURE_2D);
console.log(`${this.image.src} loaded!`);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function SimpleTextureLoader () {\n}",
"initTexture(path){\n //var index = this.texture.length;\n this.texture = this.gl.createTexture();\n this.texture.image = new Image();\n var self = this;\n this.texture.image.onload = function(){\n self.handleLoadedTexture(self.... | [
"0.7825388",
"0.7469914",
"0.7469914",
"0.7429241",
"0.74123985",
"0.7409153",
"0.7385497",
"0.7118812",
"0.7113327",
"0.71098846",
"0.7106061",
"0.70893085",
"0.70817757",
"0.70732355",
"0.7035236",
"0.7000042",
"0.6997908",
"0.6992616",
"0.6976087",
"0.69691855",
"0.6960786... | 0.76799 | 1 |
Generates a blank vote as a string using the binary encoding scheme | function genBlankVote() {
var vote = "";
for(var i = 0; i < OPTION_COUNT; i++) {
vote += "0";
if (i !== (OPTION_COUNT - 1)) {
vote += ",";
}
}
return vote;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function BinaryNumberString()\n\t{\n\t\tthis.string = stringGenerator();\n\t\tvar dim = sizeGenerator();\n\t\tthis.font = dim + \"% verdana\";\n\t\tthis.dim = dim;\n\t\tthis.transparency = 0.8 * Math.random() + 0.2;\n\t\tvar coor = coordinateGenerator();\n\t\tthis.x = coor.x;\n\t\tthis.y = -650;\n\t\tthis.speed =... | [
"0.5909859",
"0.5666715",
"0.56424683",
"0.56424683",
"0.55908436",
"0.54932505",
"0.5466492",
"0.5441151",
"0.54053223",
"0.53967184",
"0.53870046",
"0.5378167",
"0.53698295",
"0.53619754",
"0.5346502",
"0.5336",
"0.5334798",
"0.53095424",
"0.5283576",
"0.52618885",
"0.52457... | 0.6236494 | 0 |
Notice that I have 2 line break tag after the images for under featured work if the images are on top of each other like then I need those line breaks to come to life if the images aren't laid out like that then i need those line breaks to be hidden | function hideLineBreaksForFeaturedWork() {
each(document.getElementsByClassName("line-break-for-images"), function(lb) {
$(lb).hide();
})
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function removeblank() {\n $(\".post-photo .actions.raw, .post-photoset .actions.raw\").each(function() {\n if (!$(this).siblings(\".caption\").length && !$(this).siblings(\".tags\").is(\":visible\")) {\n $(this).css(\"margin-top\", \"-16px\").children(\"hr\").css(\"visibility\", \... | [
"0.62070733",
"0.58507013",
"0.5766553",
"0.57580817",
"0.5693414",
"0.5588825",
"0.55799294",
"0.55768114",
"0.555849",
"0.5483135",
"0.54526013",
"0.5405674",
"0.5342708",
"0.53424436",
"0.5340343",
"0.53315455",
"0.5300152",
"0.5294315",
"0.5284612",
"0.5273886",
"0.527078... | 0.73808575 | 0 |
playerOne = new Human(); make determination playerTwo = New Human or new AI | choosePlayers(){
let choice = prompt("Enter 1 to play with a friend or 2 to play against the computer ")
switch(choice){
case '1':
this.player2 = new Human();
break;
case '2':
this.player2 = new AI();
break;
default: ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function createPlayer (isHuman) {\n let type = true;\n // x goes first, so human goes first to have a chance at a tie\n let sign = 'X'; \n\n if (!isHuman) {\n type = false;\n sign = 'O'; \n }\n\n return {sign, type};\n }",
"createPlayer() {\n\t\t... | [
"0.65518314",
"0.64778054",
"0.6450058",
"0.63763416",
"0.63574696",
"0.6302527",
"0.6266267",
"0.612813",
"0.6086955",
"0.6048698",
"0.60198057",
"0.59662944",
"0.5955613",
"0.59524924",
"0.5950693",
"0.59364295",
"0.5929362",
"0.5890372",
"0.5885366",
"0.58612704",
"0.58564... | 0.7612377 | 0 |
check for duplicate todo | function isExistingTodo(content, todo) {
removeProp(todo);
if (!content.length) return false;
for (const item of content) {
if (_.isEqual(todo, item)) return true;
}
return false;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"onFormSubmit(evt) {\n evt.preventDefault(); \n const todo = this.state.input\n let error\n if (todo) {\n if (this.props.todos.find((item) => item.text === todo) > -1) {\n console.log('duplicate')\n error = 'Error: Duplicate todo.'\n } else {\n this.props.addTodo(todo)\n ... | [
"0.690023",
"0.6634523",
"0.661464",
"0.6567777",
"0.63466245",
"0.6271694",
"0.6242825",
"0.6191204",
"0.6170351",
"0.6170351",
"0.614071",
"0.6120753",
"0.6107502",
"0.6104637",
"0.6013454",
"0.596997",
"0.5948398",
"0.592556",
"0.59050566",
"0.5870582",
"0.5870582",
"0.5... | 0.6778511 | 1 |
STEP 3 / Parse Cymru response | function parseAsData(cymruResponse,tabID,ip) {
try {
var splitHTML = cymruResponse.split('<PRE>');
var requestResult = splitHTML[1].split('</PRE>');
requestResult = requestResult[0];
// Cutting unnecessary parts.
var split1 = requestResult.split("AS Name");
var split... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"parse(resp) {\n return resp;\n }",
"function parseResponse(res, log) {\n const text = res.text\n if(log) {\n console.log('\\n\\n========',log,'==========')\n csgrant.dump()\n }\n let result\n try {\n result = JSON.parse(text)\n }\n catch (e) {\n console.log(text)\n }\n if(log){\n cons... | [
"0.62343156",
"0.5949815",
"0.5940661",
"0.5836629",
"0.57378966",
"0.57273734",
"0.57098335",
"0.5681362",
"0.5568482",
"0.55108285",
"0.5473341",
"0.5447101",
"0.54434705",
"0.5401044",
"0.5381278",
"0.53637564",
"0.5353237",
"0.53387445",
"0.53092664",
"0.53052807",
"0.528... | 0.63551384 | 0 |
Gets the routine list from storage | async function getRoutine() {
routineList = (await browser.storage.local.get()).pages;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function getRoutineItems(tx)\r\n{\r\n tx.executeSql('SELECT * FROM `ROUTINELIST` WHERE `rtnID` = '+rtnID, [], getRoutineItemsArray, errorInsert);\r\n}",
"function get(){\n chrome.storage.local.get(['~'], function(result){\n let words = result['~'];\n if(words !== undefined){\n list... | [
"0.6031906",
"0.59672177",
"0.5821806",
"0.5782855",
"0.5731241",
"0.5665002",
"0.5659019",
"0.56540984",
"0.5632905",
"0.55671716",
"0.5538595",
"0.5535911",
"0.5525209",
"0.54965746",
"0.54894805",
"0.5467544",
"0.5464732",
"0.54578006",
"0.54510903",
"0.54300755",
"0.54128... | 0.6951606 | 0 |
Each letter of a word scores points according to it's position in the alphabet: a = 1, b = 2, c = 3 etc. You need to return the highest scoring word as a string. If two words score the same, return the word that appears earliest in the original string. All letters will be lowercase and all inputs will be valid. | function high(x){
if (!isNaN(x)){
return ''
}
var alpha = "abcdefghijklmnopqrstuvwxyz".split('')
var highword = []
var scores = [0]
x = x.split(' ')
x.forEach(function(word) {
var letters = word.split('')
var score = 0
letters.forEach(function(letter){
score += alpha.indexOf(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function most_common_letter(string) {}",
"function getBestLetter(wordLength){\n \n var bestLetter = 1;\n \n switch (wordLength) {\n case 1:\n bestLetter = 1; // first\n break;\n case 2:\n case 3:\n case 4:\n case 5:\n bestLetter = 2... | [
"0.7396853",
"0.7368957",
"0.7141246",
"0.69858503",
"0.6967097",
"0.6966638",
"0.6934",
"0.6878958",
"0.6878958",
"0.678266",
"0.67449975",
"0.6742421",
"0.66923875",
"0.6667837",
"0.6667818",
"0.666503",
"0.6630323",
"0.66201234",
"0.6582589",
"0.65782267",
"0.654028",
"0... | 0.75007045 | 0 |
Replaces TED's flash player by our own player. | function replace_flash_player(src)
{
player.innerHTML = "";
video = document.createElement("embed");
video.setAttribute("type", "video/flv");
video.setAttribute("src", src);
video.setAttribute("width", PLAYER_WIDTH);
video.setAttribute("height", PLAYER_HEIGHT);
video.setAttribute("autoplay",... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function _initFlashPlayer() {\n if (Drupal.microsite.installed != true) {\n setTimeout(function(){\n _initFlashPlayer();\n }, 500);\n } else {\n Drupal.microsite.initFlashPlayer();\n }\n }",
"function replace_flash_instances() {\n ... | [
"0.6373728",
"0.634856",
"0.6026853",
"0.5961353",
"0.58584297",
"0.5815417",
"0.5803571",
"0.57868797",
"0.57866657",
"0.5781756",
"0.57750034",
"0.57673323",
"0.57266855",
"0.5711442",
"0.5703232",
"0.5702107",
"0.5677378",
"0.5665111",
"0.56449914",
"0.56260574",
"0.560027... | 0.7077845 | 0 |
saves current edit progress to storage | saveCurrentEntries()
{
if (this.saveConfirm)
{
this.pushtoHdb();
this.saveConfirm=0;
this.setState({buttonState:this.normalMenu});
return;
}
chrome.storage.local.set({currentTabs:this.getOutput()});
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function saveAction() {\n var activeTab = eval(\"editorsArr.\" + $(\"#tabs .ui-tabs-panel:visible\").attr(\"id\"));\n var content = activeTab[1].getSession().getValue();\n var location = activeTab[0];\n \n saveFile(location, content);\n }",
"save() {\n if (this.isClosed) ... | [
"0.6376333",
"0.63259745",
"0.61760163",
"0.61651254",
"0.61647207",
"0.6149387",
"0.6148634",
"0.61468756",
"0.61364233",
"0.61049575",
"0.610269",
"0.610213",
"0.6090895",
"0.6076796",
"0.6075112",
"0.6074878",
"0.60708195",
"0.6033291",
"0.5970667",
"0.59686095",
"0.596860... | 0.6348408 | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.