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 |
|---|---|---|---|---|---|---|
overwrite paragraph_open and close rule to inject line number | function withLineNumbers(renderer) {
renderer.renderer.rules.paragraph_open
= renderer.renderer.rules.heading_open
= renderer.renderer.rules.ordered_list_open
= renderer.renderer.rules.bullet_list_open
= renderer.renderer.rules.blockquote_open
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function injectLineNumbers(tokens, idx, options, env, slf) {\n var line;\n if (tokens[idx].map && tokens[idx].level === 0) {\n line = tokens[idx].map[0];\n tokens[idx].attrJoin('class', 'line');\n tokens[idx].attrSet('data-line', String(line));\n }\n return slf.renderToken(tokens, idx, o... | [
"0.60298777",
"0.60298777",
"0.57767123",
"0.57236016",
"0.56779027",
"0.56779027",
"0.55777",
"0.5437449",
"0.5432099",
"0.5424962",
"0.54110885",
"0.5383547",
"0.5383547",
"0.5380584",
"0.5380584",
"0.5380584",
"0.5380584",
"0.5380584",
"0.5380584",
"0.5380584",
"0.5380584"... | 0.6144453 | 0 |
Format a subPath, return its plain form if it is a literal string or number. Otherwise prepend the dynamic indicator (). | function formatSubPath(path) {
var trimmed = path.trim();
// invalid leading 0
if (path.charAt(0) === '0' && isNaN(path)) {return false;}
return isLiteral(trimmed) ? stripQuotes(trimmed) : '*' + trimmed;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function formatSubPath (path) {\n var trimmed = path.trim();\n // invalid leading 0\n if (path.charAt(0) === '0' && isNaN(path)) { return false }\n\n return isLiteral(trimmed) ? stripQuotes(trimmed) : '*' + trimmed\n}",
"function formatSubPath (path) {\n var trimmed = path.trim();\n // invalid leading 0\n ... | [
"0.7751597",
"0.7751597",
"0.7751597",
"0.7751597",
"0.7751597",
"0.7751597",
"0.7751597",
"0.7751597",
"0.7751597",
"0.7751597",
"0.7751597",
"0.7751597",
"0.7751597",
"0.7751597",
"0.77374643",
"0.7526618",
"0.5522109",
"0.5449936",
"0.5359377",
"0.5324072",
"0.5295831",
... | 0.7757124 | 0 |
Call this to get a new SSWeave connection. The parent is the parent SyncString. The other parameters are the same as in Weave. | function SSWeave(parent, pubsub, uuid, username) {
var weave = new Weave(pubsub, uuid, username);
weave.insert_received = function(msg) {
if (msg[1][3] != parent.yarn) {
parent.apply_patch(msg, true);
parent.change_callback();
}
}
weave.delete_received = function(msg) {
if (msg[1][3] != p... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function getNewWs () {\n return new WebSocket(`${ (location.protocol === \"https:\" ? \"wss:\" : \"ws:\")\n }//${ location.hostname }:${ location.port ||\n (location.protocol === \"https:\" ? \"443\" : \"80\")\n }/terminalsocket/${ encodeURIComponent(CACHE_CLASS_NAME) }`);\n}",
"connect()... | [
"0.51098406",
"0.50894636",
"0.48828012",
"0.4817366",
"0.4813275",
"0.47626722",
"0.47595868",
"0.4733176",
"0.47217986",
"0.47196317",
"0.47129574",
"0.46959245",
"0.46806306",
"0.46762952",
"0.46003568",
"0.45680475",
"0.45136726",
"0.44888145",
"0.4476448",
"0.44715118",
... | 0.5387441 | 0 |
Note: this is a class constructor. Call with new keyword. A synchronized string, with the given UUID or a randomlygenerated one, a given username, a given pubsub connection object, an optional change callback, and an optional callback function to be called with the syncstring as an argument when self.text3 is ready to ... | function SyncString(uuid, username, pubsub, change_callback, ready_callback) {
var self = this;
self.uuid = uuid || randomUUID();
console.log('uuid:', self.uuid);
self.change_callback = change_callback || (function() {});
self.weave = SSWeave(this, pubsub, self.uuid, username);
// Check if... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"constructor(kind, text, guid1, guid2) {\n this.kind = kind;\n this.text = text;\n this.guid1 = guid1;\n this.guid2 = guid2;\n this.timestamp = new Date();\n }",
"constructor (user, room, text) {\n super(user, room);\n this.text = text;\n }",
"function initializeChat() {\n var pubnubCh... | [
"0.5508902",
"0.5264564",
"0.49859086",
"0.49288946",
"0.48866153",
"0.48740053",
"0.48076117",
"0.47759193",
"0.4762214",
"0.47287035",
"0.47276747",
"0.47226205",
"0.46869785",
"0.46699435",
"0.46433398",
"0.46430117",
"0.46428227",
"0.46223378",
"0.46209893",
"0.4614104",
... | 0.70297104 | 0 |
Depend on table's id and checkbox's name to Delete checked Rows / Create By zhangjiang 20041029 | function delRow(tableID,checkBoxName)
{
var objBox = document.all(checkBoxName) ;
if(objBox != null)
{
if(objBox.length != null)
{
for(var i=0;i<objBox.length;i++)
{
if(objBox[i].checked == true)
{
if( i == 0)
{
alert("The First Row Must Be Keep !") ;
break ;
}
else
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function CHMdeleteRow(oTableBody,formName,checkBoxName,cntOfCells)\r\n{\r\n // Loop through rows\r\n var i = 0;\r\n \r\n for( i=0; oTableBody.rows.length >= 1 && i<eval('document.'+formName+'.'+checkBoxName).length;i++)\r\n {\r\n if(eval('document.'+formName+'.'+checkBoxName)[i].checked)\r\n { \r\n ... | [
"0.7541184",
"0.7297277",
"0.69953585",
"0.6994853",
"0.6977765",
"0.6956382",
"0.69391567",
"0.6516567",
"0.64872354",
"0.6449783",
"0.6416656",
"0.6395706",
"0.6380782",
"0.6335812",
"0.6321802",
"0.6298669",
"0.6273575",
"0.62718654",
"0.6265768",
"0.62344897",
"0.6230778"... | 0.7592491 | 0 |
filters model based on matches found | function filter_model(sub) {
find_matches(sub);
return tabs.filter(isMatched);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"_filter(value) {\n //convert text to lower case\n const filterValue = value.toLowerCase();\n //get matching products\n return this.products.filter(option => option.toLowerCase().includes(filterValue));\n }",
"on(model) {\n\t\treturn this.filter.reduce( (acc, m, key) => {\n\t\t\t\tf... | [
"0.63490385",
"0.6283388",
"0.6000551",
"0.59585744",
"0.5916492",
"0.5862114",
"0.58354026",
"0.5827213",
"0.58244985",
"0.5776128",
"0.57409817",
"0.5647171",
"0.5643602",
"0.5625067",
"0.56077653",
"0.5603893",
"0.56015724",
"0.5601097",
"0.55649644",
"0.5564499",
"0.55568... | 0.6912728 | 0 |
Renders the answer and drops the pin on the map | function setAnswer (answer) {
$('#question').fadeOut(250, function() {
$('#answer').fadeIn(250);
});
$("#answer h1").html(answer)
map.createMarker(latitude, longitude)
map.setLocation(latitude, longitude, config.finalZoom);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function displayPin(){\n\n if (predictions.length > 0){\n let hand = predictions[0];\n let index = hand.annotations.indexFinger;\n let tip = index[3];\n let base = index[0];\n let tipX = tip[0];\n let tipY = tip[1];\n let baseX = base[0];\n let baseY = base[1];\n\n // wh... | [
"0.6325469",
"0.59542525",
"0.5923742",
"0.5856072",
"0.5851754",
"0.57913274",
"0.57887834",
"0.5750996",
"0.57032067",
"0.56729096",
"0.56680113",
"0.56487817",
"0.56430334",
"0.55914384",
"0.55911577",
"0.55695724",
"0.5564893",
"0.55523235",
"0.5549356",
"0.55476725",
"0.... | 0.6702271 | 0 |
Displays an answer that specifies that the location is within the limits | function onWithinLimits () {
setAnswer("Yes");
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function onOutsideLimits () {\n setAnswer(\"No\");\n}",
"function DoAutoBounds(object) {\n // Get the lat/long bounds of the map's viewport\n var bounds = object.getBounds();\n // Get the northeast and southwest lat/long objects.\n var ne = bounds.getNorthEast();\n var sw = bounds.getSouthWest();... | [
"0.65100133",
"0.59305704",
"0.58326536",
"0.57846415",
"0.57798046",
"0.57427716",
"0.56882095",
"0.5652398",
"0.561512",
"0.5569235",
"0.55618244",
"0.5552276",
"0.5550405",
"0.5523462",
"0.5500124",
"0.5478286",
"0.54768044",
"0.54295576",
"0.54269516",
"0.54220974",
"0.54... | 0.6757839 | 0 |
Displays an answer that specifies that the location is not within the limits | function onOutsideLimits () {
setAnswer("No");
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function locationDenied() {\n // we have a few random question, so we get some question...\n var numberOfQuestions = config.enableGeolocationQuestion.length;\n var i = Math.floor((Math.random() * numberOfQuestions));\n // ...and show this question to user\n warningGeolocation.inn... | [
"0.6552357",
"0.6170282",
"0.59873164",
"0.5927395",
"0.5789985",
"0.5780002",
"0.57500845",
"0.5708181",
"0.570438",
"0.5689229",
"0.56865865",
"0.5628984",
"0.5594315",
"0.55894136",
"0.5576367",
"0.5518107",
"0.5500463",
"0.54827994",
"0.5466474",
"0.5460038",
"0.5395354",... | 0.68611366 | 0 |
Submits the form, geocodes the address, and checks whether it is within the limits | function onSubmit (e) {
e.preventDefault();
var $input = $("#input-location"), address = $input.val();
geocodeByAddress(address);
return false;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function handleSubmitAddress() {\n $(\".select-address\").submit((event) => {\n event.preventDefault();\n\n // Get the selected coordinates\n const coordinates = $('.select-address input[name=\"address\"]:checked')\n .val();\n console.log(`Selected ... | [
"0.7207855",
"0.68446386",
"0.67946684",
"0.66042835",
"0.65933514",
"0.6318291",
"0.63125104",
"0.6293651",
"0.62876266",
"0.6287256",
"0.6248172",
"0.6243702",
"0.62121516",
"0.6196864",
"0.6183961",
"0.6157459",
"0.61177874",
"0.6091906",
"0.60875994",
"0.6077578",
"0.6077... | 0.6907293 | 1 |
Return the child element of type name, at index index; or undefined | getElement(name, index = 0) {
return (this._elements[name] || this._makeElements(name))[index];
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function child(parent, index){\n var i = 0,\n n = parent.firstChild;\n while(n){\n if(n.nodeType == 1){\n if(++i == index){\n return n;\n }\n }\n n = n.nextSibling;\n }\n return null;\n }",
"s... | [
"0.6869438",
"0.65482897",
"0.6514236",
"0.6476618",
"0.64044863",
"0.6380693",
"0.6299078",
"0.6299078",
"0.6293822",
"0.62862",
"0.62751335",
"0.6165572",
"0.6093755",
"0.60818696",
"0.6045772",
"0.6030711",
"0.59712446",
"0.5953078",
"0.59405047",
"0.5891203",
"0.58725315"... | 0.7074676 | 0 |
Create an array of child elements and cache it | _makeElements(name) {
let res = [];
if (this._source != null) res = this._source(name) || [];
this._elements[name] = res;
return res;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"getChildren(): Array<Element>{\n return this._elements;\n }",
"update () {\n if (!this.hasChanged) return\n for (const child of this.childNodes) {\n this.cache[child.uuid] = child\n if (child.childCache) {\n Object.assign(this.cache, child.childCache.getCache())\n }\n }\n th... | [
"0.6575961",
"0.6551582",
"0.6516932",
"0.64280295",
"0.6349868",
"0.62967414",
"0.62967414",
"0.6292662",
"0.62593853",
"0.6202453",
"0.6202453",
"0.6188413",
"0.6188413",
"0.6188413",
"0.6188413",
"0.6188413",
"0.6188413",
"0.618226",
"0.6180959",
"0.6180959",
"0.6180959",
... | 0.66706765 | 0 |
The publication date of the item, as a RFC 2822 date | get pubDate() {
return this.getText('pubDate');
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function getDate(pubDate) {\n var date = new Date(pubDate);\n var months = Array(\"January\", \"February\", \"March\", \"April\", \"May\", \"June\", \"July\", \"August\", \"September\", \"October\", \"November\", \"December\");\n var dateString = date.getDate() + \" \" + months[date.getMonth()... | [
"0.66843134",
"0.6294021",
"0.6283646",
"0.6237402",
"0.6163667",
"0.601155",
"0.58812845",
"0.5841887",
"0.5814949",
"0.5707379",
"0.56069654",
"0.551943",
"0.55009687",
"0.544802",
"0.54476863",
"0.54420805",
"0.5434749",
"0.54313916",
"0.5324007",
"0.5312126",
"0.5304202",... | 0.6843522 | 0 |
sends message to renderer process to check mouse position | function checkMousePosition() {
mainWindow.webContents.send('check-mouse-pos');
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function mouseMoveHandler(e) {\r\n\tif (!e) {\r\n\t\te = event;\r\n\t}\r\n\tif (e.clientX) {\r\n\t //if there is an x pos property\r\n\t //GET MOUSE LOCATION\r\n\t\tv_xcoordinate = mouseX(e);\r\n\t\tv_ycoordinate = mouseY(e);\t\r\n\t\tv_havemouse = 1;\r\n\t}\r\n\tif (v_visible == 1) { \r\n\t\tpositionLayer();\t\r\... | [
"0.6662651",
"0.6636114",
"0.6627663",
"0.65927094",
"0.65687585",
"0.6390587",
"0.6325358",
"0.630966",
"0.6294082",
"0.6271527",
"0.62451994",
"0.6228587",
"0.621369",
"0.61840147",
"0.61830366",
"0.6176825",
"0.6168602",
"0.6164343",
"0.6156208",
"0.61533046",
"0.6146356",... | 0.74668777 | 0 |
button press handler. when pressed, we want to display the current form being conjugated. Also update the placeholderText to indicate to the user that they should select the input box. | _handlePress(form) {
this.setState({
currentForm: form,
placeholderText: 'Type here to conjugate...',
});
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function putQuestion() {\r\n inputLabel.innerHTML = questions[position].question\r\n inputField.value = ''\r\n\tdocument.getElementById('inputField').placeholder = placeholders[position].place\r\n inputField.type = questions[position].type || 'text' \r\n inputField.focus()\r\n showCurrent()\r\n }"... | [
"0.63842493",
"0.60747546",
"0.60492057",
"0.58678705",
"0.5864986",
"0.58432215",
"0.5741356",
"0.57158303",
"0.5680556",
"0.56767035",
"0.56661433",
"0.5662439",
"0.56514305",
"0.56301457",
"0.56226164",
"0.5619359",
"0.56080747",
"0.56034803",
"0.55960387",
"0.559429",
"0.... | 0.65811133 | 0 |
Shops list Functionality name[string] name of shops list, shopStorage[array] storage of shops, map[object] ymaps.Map object | function shopsList(name, shopStorage, map) {
//get DOM elements
var shopTypeName = document.getElementById('shopTypeName');
var container = document.querySelector('#shopsContainer');
var dialog = document.getElementById('addShopDialog');
var showDialogButton = document.getElementById('showAddS... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function updateShopList(){\r\n container.innerHTML = '';\r\n shopStorage.forEach(function(shop) {\r\n container.append(shopElement(shop));\r\n });\r\n addBtnListener(productsBtnclassName, function(index){\r\n productsList(shopStorage[index], map);\r\n });\r\... | [
"0.7100052",
"0.6613169",
"0.64090973",
"0.6215149",
"0.6199633",
"0.5929612",
"0.5883565",
"0.5674249",
"0.55425215",
"0.55239207",
"0.5496356",
"0.5490451",
"0.5450084",
"0.544021",
"0.5421057",
"0.54081887",
"0.53934705",
"0.5391215",
"0.5383925",
"0.53673303",
"0.536724",... | 0.7023285 | 1 |
add shop to shopStorage name[string] name of shop, address[string] address of shop, wHours[string] working hours of shop, coords[array] coordiantes for mark on the map | function addShop (name, address, wHours, coords){
shopStorage.push(new Shop({
name: name,
address: address,
wHours: wHours,
number: shopStorage.length + 1,
coords: coordsFromStr(coords)
}));
updateShopList();
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function updateShop (name, address, wHours, coords, index){\r\n shopStorage[index].name = name;\r\n shopStorage[index].address = address;\r\n shopStorage[index].wHours = wHours;\r\n shopStorage[index].coords = coordsFromStr(coords);\r\n\r\n dialogNameField.value = '';\r\n ... | [
"0.6749814",
"0.65904367",
"0.6491565",
"0.6478571",
"0.6212379",
"0.6013487",
"0.595616",
"0.5773426",
"0.56322896",
"0.5523419",
"0.5504943",
"0.5440978",
"0.5414347",
"0.5394344",
"0.5380788",
"0.5375669",
"0.5344815",
"0.5272671",
"0.5261201",
"0.52449477",
"0.52411014",
... | 0.8404007 | 0 |
update shop in shopStorage name[string] name of shop, address[string] address of shop, wHours[string] working hours of shop, coords[array] coordiantes for mark on the map index[number] position of shop in the shopStorage | function updateShop (name, address, wHours, coords, index){
shopStorage[index].name = name;
shopStorage[index].address = address;
shopStorage[index].wHours = wHours;
shopStorage[index].coords = coordsFromStr(coords);
dialogNameField.value = '';
dialogAddressField.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function addShop (name, address, wHours, coords){\r\n shopStorage.push(new Shop({\r\n name: name,\r\n address: address,\r\n wHours: wHours,\r\n number: shopStorage.length + 1,\r\n coords: coordsFromStr(coords)\r\n }));\r\n updateShopList()... | [
"0.6617538",
"0.6200899",
"0.5823386",
"0.5777921",
"0.5756209",
"0.5751357",
"0.5686293",
"0.56205666",
"0.55806345",
"0.5577412",
"0.5528265",
"0.5468734",
"0.5462224",
"0.5429826",
"0.5333778",
"0.5292758",
"0.52142835",
"0.51887864",
"0.5130989",
"0.5120034",
"0.5118952",... | 0.76142025 | 0 |
open modal and fill fields to edit shop in the shopStorage index[number] position of shop in the shopStorage | function editShop(index) {
addShopBtn.value = index;
dialogNameField.value = shopStorage[index].name;
dialogAddressField.value = shopStorage[index].address;
dialogHoursField.value = shopStorage[index].wHours;
dialogCoordsField.value = shopStorage[index].coords;
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function edit(idx) {\n let fl = fullList[idx];\n document.querySelector(\".item2\").value = fl.item;\n document.querySelector(\".textarea2\").value = fl.info;\n document.querySelector(\".form2\").style.display = \"flex\";\n modal.classList.add(\"open\");\n position = idx;\n}",
"function updateS... | [
"0.72693455",
"0.6652279",
"0.6639865",
"0.66375375",
"0.6607615",
"0.65827644",
"0.6507244",
"0.6483408",
"0.64575684",
"0.6421963",
"0.6399454",
"0.63456655",
"0.6198701",
"0.61713123",
"0.61166763",
"0.61161107",
"0.61064774",
"0.61012477",
"0.61010486",
"0.6094996",
"0.60... | 0.8203605 | 0 |
update list of shops and set listeners for buttons | function updateShopList(){
container.innerHTML = '';
shopStorage.forEach(function(shop) {
container.append(shopElement(shop));
});
addBtnListener(productsBtnclassName, function(index){
productsList(shopStorage[index], map);
});
addBtnListen... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function updateShops() {\n // update the request:\n url = \"https://api.foursquare.com/v2/venues/search\\?\" +\n \"client_id=\" + client_id +\n \"&client_secret=\" + client_secret +\n \"&v=20170406\" +\n \"&ll=\" + map.getCenter().lat().toString() + \",\" + map.getCenter().lng().toString() +\n \"&... | [
"0.64021385",
"0.616386",
"0.61547226",
"0.6141915",
"0.5946019",
"0.5919627",
"0.58520955",
"0.57872576",
"0.565915",
"0.5522604",
"0.551815",
"0.5487023",
"0.54629993",
"0.5462425",
"0.54616755",
"0.54466224",
"0.54354084",
"0.54180574",
"0.5412847",
"0.5412395",
"0.5405412... | 0.6808275 | 0 |
create shop markup shop[object] shop object return[object] html element of shop | function shopElement(shop){
var item = document.createElement('div');
item.classList.add('mdl-list__item');
item.innerHTML =
'<span>' + shop.number + '.</span>'+
'<span>'+ shop.name +'</span>'+
'<span>' + shop.wHours... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function buildShopItem(data) {\n \n if (product === null || product === undefined) return;\n\n var productItem = document.createElement('div');\n\n var html =\n '<h3>' + data.title + '</h3>' +\n '<ul class=\"c-rating\"></ul>' +\n '</div>';\n\n pro... | [
"0.69934845",
"0.670465",
"0.6596055",
"0.652389",
"0.64584506",
"0.635465",
"0.6341052",
"0.63401157",
"0.627051",
"0.6139825",
"0.61083263",
"0.6090271",
"0.6017427",
"0.60020006",
"0.60005313",
"0.59977",
"0.599247",
"0.5957447",
"0.5936666",
"0.59330815",
"0.59299946",
... | 0.7353326 | 0 |
sort shop list on the page currentIndex[number] current index in the shop list, oldIndex[number] old index in the shop list | function sortShops(currentIndex, oldIndex){
var buffer = shopStorage[oldIndex];
if (currentIndex < oldIndex){
for(var i = oldIndex; i > currentIndex; i--){
shopStorage[i] = shopStorage[i-1];
}
shopStorage[currentIndex] = buffer;
}else if... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function sortActive(item, index) {\n //console.log(\"im sort\" + item);\n putAtPosition(item, index);\n changeColorofBar(item + 1, true);\n key2++;\n}",
"function sortingChanged(event) {\r\n var input = event.target\r\n\r\n var produs = document.getElementsByClassName('product')\r\n var shop... | [
"0.6133073",
"0.595188",
"0.58169",
"0.5810331",
"0.57791746",
"0.5778466",
"0.57684034",
"0.57595915",
"0.5711861",
"0.5687269",
"0.56622815",
"0.56545585",
"0.56540275",
"0.56321293",
"0.563171",
"0.5592578",
"0.55893576",
"0.54987186",
"0.54837674",
"0.54594386",
"0.543258... | 0.78851783 | 0 |
set right numbers for shops in the shopStorage | function sortShopNumbers(){
for(var i = 0; i < shopStorage.length; i++){
shopStorage[i].number = i+1;
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function cartNumbers(drinks){\n let itemNumbers = localStorage.getItem('cartNumbers');\n \n itemNumbers= parseInt(itemNumbers);\n\n if (itemNumbers){\n localStorage.setItem('cartNumbers', itemNumbers + 1);\n document.querySelector('.cart span').textContent = itemNumbers + 1;\n }\n e... | [
"0.60176474",
"0.5997476",
"0.5986463",
"0.59690815",
"0.5880193",
"0.5846493",
"0.57527447",
"0.571856",
"0.56785846",
"0.5652664",
"0.5629866",
"0.5579714",
"0.55575144",
"0.5555188",
"0.55463487",
"0.5538009",
"0.5530745",
"0.5527554",
"0.552644",
"0.55061364",
"0.5506023"... | 0.6659367 | 0 |
products list Functionality shop[object] active shop objet, map[object] ymaps.Map object | function productsList(shop, map){
//get DOM elements
var addProductBtn = document.getElementById('addProduct');
var container = document.querySelector('#productsContainer');
var dialog = document.getElementById('addProductDialog');
var showDialogButton = document.getElementById('showAddProductD... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function updateShopList(){\r\n container.innerHTML = '';\r\n shopStorage.forEach(function(shop) {\r\n container.append(shopElement(shop));\r\n });\r\n addBtnListener(productsBtnclassName, function(index){\r\n productsList(shopStorage[index], map);\r\n });\r\... | [
"0.6729469",
"0.6371386",
"0.62693816",
"0.6200137",
"0.6113206",
"0.59426236",
"0.59341574",
"0.59255356",
"0.58972216",
"0.58739245",
"0.5871723",
"0.58498746",
"0.583374",
"0.5825721",
"0.58164185",
"0.5775527",
"0.5767603",
"0.57675093",
"0.57340866",
"0.57284564",
"0.572... | 0.73002446 | 0 |
add new product to shop.products name[string] name of product, price[number] price of product | function addProduct(name, price){
var number = 1;
if(shop.products){
number = shop.products.length + 1;
}
shop.addProduct(new Product({
name: name,
price: price,
number: number
}));
updateProductList(); ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function addNewProduct(cart, name, price) {\n let product = new Product(name, price, id++);\n cart.push(product);\n paintNewRow(product);\n}",
"addProduct (product) {\n\n }",
"function addProduct () {\n\n\t}",
"addProduct(data) {\n\t\tlet product = {\n\t\t\tid: '',\n\t\t\tprice: '',\n\t\t\tnumber: 0,\n\t... | [
"0.7754012",
"0.7712608",
"0.75957024",
"0.75911593",
"0.742858",
"0.7407244",
"0.71680874",
"0.71545064",
"0.71542746",
"0.71517074",
"0.71236366",
"0.7104697",
"0.707794",
"0.7059112",
"0.7033722",
"0.70217437",
"0.700624",
"0.69707173",
"0.6965926",
"0.6924744",
"0.6917515... | 0.8150555 | 0 |
update product in shop.products name[string] name of product, price[number] price of product id[number] id of product | function updateProduct(name, price, id){
var index = getIndexById(id);
shop.products[index].name = name;
shop.products[index].price = price;
dialogNameField.value = '';
dialogPriceField.value = '';
addProductBtn.value = '';
updateProductList(); ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async update ({ params, request, response }) {\n const product = await Product.find(params.id)\n const data = request.only([\n \"name\", \n \"description\", \n \"price\"\n ])\n product.merge(data)\n if (product) {\n response.status(200).json({\n success: 'Product Upd... | [
"0.7447032",
"0.7348232",
"0.7266028",
"0.71745735",
"0.71447533",
"0.7140678",
"0.71212804",
"0.71147907",
"0.7061893",
"0.69739693",
"0.6972167",
"0.6949726",
"0.6949431",
"0.69459695",
"0.69417775",
"0.6902247",
"0.6871896",
"0.6870242",
"0.68530715",
"0.68441767",
"0.6835... | 0.7670355 | 0 |
edit product in shop.products id[number] id of product | function editProduct(id) {
addProductBtn.value = id;
var index = getIndexById(id);
dialogNameField.value = shop.products[index].name ;
dialogPriceField.value = shop.products[index].price;
dialog.showModal();
var event = new Event("input");
dialogP... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"setEditingProduct(state, payload) {\n state.editingProductIndex = payload.index;\n state.products[payload.index] = payload.product;\n }",
"function handleProductEdit() {\n var currentProduct = $(this)\n .parent()\n .parent()\n .data(\"product\");\n window.location.href... | [
"0.7464735",
"0.74299306",
"0.73406863",
"0.72722834",
"0.7191418",
"0.7154034",
"0.70640004",
"0.70454544",
"0.6936721",
"0.6790258",
"0.6753957",
"0.6723206",
"0.6649505",
"0.6615643",
"0.65894413",
"0.65805686",
"0.656679",
"0.6542147",
"0.6533673",
"0.6470725",
"0.6435982... | 0.7511125 | 0 |
update list of products and set listeners for buttons | function updateProductList(){
if(shop.products){
container.innerHTML = '';
for(var i = 0; i < shop.products.length; i++){
container.append(productElement(shop.products[i]));
}
addBtnListener(editBtnclassName, function(index, id){
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function listenForProductAddition(products){\n for(let product of products){//On boucle sur le produit pour écouter avec plus- chaque product.id & product.varnish\n document.getElementById('plus-' + product.id + '-' + product.varnish).addEventListener('click', function(){//On écoute product.id et product.varni... | [
"0.7123041",
"0.7082354",
"0.6993194",
"0.6892474",
"0.67038345",
"0.6674857",
"0.6633423",
"0.65549034",
"0.645306",
"0.642443",
"0.64013374",
"0.63869095",
"0.63570607",
"0.63516057",
"0.63505393",
"0.63367945",
"0.63366634",
"0.63164824",
"0.6307492",
"0.6296009",
"0.62799... | 0.8354286 | 0 |
return coordinates from string str[string] string of coordinates return[array] array of coordinates | function coordsFromStr(str){
var coordsArr = str.split(',');
coordsArr[0] = Number(coordsArr[0].trim());
coordsArr[1] = Number(coordsArr[1].trim());
return [coordsArr[0], coordsArr[1]];
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"static toCoords(string) {\n return [parseFloat(string.split(',')[0]), parseFloat(string.split(',')[1])];\n }",
"function coordinates() {\n// If the coordinates were originally written with colons, insure that the whole numbers\n// have preceding zeros to make them be 2-digit values: \n// NOTE: we do not filt... | [
"0.8069098",
"0.70493037",
"0.7019725",
"0.6943295",
"0.6934612",
"0.693393",
"0.6921228",
"0.69113314",
"0.682729",
"0.682729",
"0.68140215",
"0.6798701",
"0.6709272",
"0.6633467",
"0.6595545",
"0.65609896",
"0.6540807",
"0.6540024",
"0.6538758",
"0.6503415",
"0.6407598",
... | 0.772524 | 1 |
add listeners for buttons btnclassName[string] class name for buttons cb[function] callback | function addBtnListener(btnclassName, cb){
var editBtns = document.getElementsByClassName(btnclassName);
for(var i = 0; i < editBtns.length; i++){
(function(index) {
editBtns[i].onclick = function(){
cb(index, this.value);
};
})(i);
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function add_button_listeners() {\n\tadd_listener_to_book_buttons();\n\tadd_listener_to_confirm_buttons();\n\tchange_buttons();\n}",
"listenForButtons() {\n this._qsAll(\".button-link\").forEach((item) => {\n item.addEventListener(\"click\", () => {\n item.classList.remove(\"primary-button\");\n ... | [
"0.7108522",
"0.6864359",
"0.6729014",
"0.6676004",
"0.6599257",
"0.65830016",
"0.6580913",
"0.6564563",
"0.64848244",
"0.6465436",
"0.6429576",
"0.641886",
"0.6394721",
"0.6337584",
"0.6304241",
"0.6293211",
"0.62666464",
"0.62138456",
"0.62138456",
"0.61895907",
"0.6081695"... | 0.73392963 | 0 |
Add the current page path + timestamp to the pageviews entry in local storage | function addPageView() {
/**
* In order to add a page view,
* we have to first check if there are any page views set
* and if not, then we need to create the array first
* afterward, or if the array already existed, we want to append to the array
*/
let pageViews = localStorage.getItem(pageViewsKeyNa... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function loadTimeStampPage(){\n Form.hideForm();\n handleAddButton();\n globalTimeStamp.getTimeStamps(function(timeStamps){\n Render.loadManageTimeStampPage(timeStamps);\n page = \"timeStamp\";\n localStorage.setItem(\"page\", page);\n })\n //TODO only load TimeStamps\n}",
"fu... | [
"0.6234118",
"0.6064426",
"0.6046336",
"0.5956502",
"0.59313935",
"0.5916915",
"0.58873594",
"0.58539325",
"0.58390677",
"0.5829814",
"0.5825347",
"0.58243126",
"0.5822079",
"0.5778616",
"0.5778488",
"0.57454526",
"0.5727307",
"0.570807",
"0.5698775",
"0.56890494",
"0.5687231... | 0.6982556 | 0 |
wordcount.jar cp=transform.jar:someother.jar org.myorg.WordCount wordcount/input wordcount/output % curl s d user.name=ctdean \ d jar=wordcount.jar \ d class=org.myorg.WordCount \ d libjars=transform.jar \ d arg=wordcount/input \ d arg=wordcount/output \ ' | function jar(jarname, libjars, classname, options,callback) {
var options = options || {};
console.log("check the args: " + options);
var version = options.version || "v1";
url = this.knoxUrl + '/' + this.cluster + '/templeton/' + version + '/mapreduce/jar';
var body = "jar=" + jarname + "&class=" + classname... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function passIntoJar(res) {\r\n child = exec('java -jar '+userPath+'/leaf-analysis/bin/Blooming.jar ',\r\n function (error, stdout, stderr){\r\n if(error !== null){\r\n console.log('exec error: ' + error);\r\n }\r\n else{\r\n //Analysis retur... | [
"0.5298867",
"0.49407074",
"0.44133922",
"0.42397505",
"0.4230568",
"0.42130068",
"0.41958806",
"0.41614142",
"0.41339472",
"0.4075089",
"0.4064643",
"0.4000312",
"0.39959112",
"0.39945084",
"0.39836296",
"0.39830923",
"0.3972406",
"0.39320898",
"0.39312652",
"0.39161763",
"0... | 0.5364763 | 0 |
Restores liveHeart icons to scoreboard ready for new game | resetHearts() {
const lostHearts = document.querySelectorAll('[alt="Lost Heart Icon"]');
lostHearts.forEach(heart => {
heart.setAttribute('alt', 'Heart Icon');
heart.setAttribute('src', 'images/liveHeart.png');
});
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"removeLife() {\r\n const lifeIcon = document.querySelector('[alt=\"Heart Icon\"]'); // returns first one it finds\r\n \r\n /* Apply heart icon css animation */\r\n lifeIcon.className = 'spin-heart';\r\n \r\n /* Allow animation to complete before changing to lost heart icon */\r\n window.setTim... | [
"0.6769308",
"0.64909375",
"0.6420047",
"0.6415183",
"0.6369894",
"0.6347421",
"0.62803555",
"0.62481546",
"0.6237192",
"0.62320596",
"0.6228569",
"0.621393",
"0.62113595",
"0.6202225",
"0.62014246",
"0.61671174",
"0.61529076",
"0.61486584",
"0.61408263",
"0.6116803",
"0.6106... | 0.66365147 | 1 |
Remove phrase from game board | removePhraseFromDisplay() {
const container = document.getElementById('phrase').firstElementChild;
container.innerHTML = null;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function removeWord() {\n // Generate random number between the length of the title and 1\n var rand;\n do {\n rand = Math.round(Math.random() * 10);\n } while (rand > titlelength || rand === 0);\n wordPosition = rand - 1; // Array start at 0\n answer = titlewords[wordPosition];\n answer ... | [
"0.6573891",
"0.6483753",
"0.64153206",
"0.6358934",
"0.6340214",
"0.6283991",
"0.6249723",
"0.62473327",
"0.6243549",
"0.6215296",
"0.6092287",
"0.60771334",
"0.6038077",
"0.60147077",
"0.6006287",
"0.59948325",
"0.597678",
"0.59726924",
"0.5967588",
"0.5916715",
"0.59150267... | 0.6721488 | 0 |
Check if card value equals any of the values in a suit's run | function runCheck (run_values_by_suit, card) {
for (var suit in run_values_by_suit) {
return (run_values_by_suit[suit].indexOf(+card.value) !== -1 && suit === card.suit);
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"checkIfExists(array, suit, value) {\n var result = false;\n\n array.map((card) => {\n // If the card is in this arary return true\n if (card.suit === suit && card.value === value) {\n return result = true;\n }\n\n return false;\n });\n... | [
"0.70697105",
"0.69406897",
"0.671162",
"0.6608418",
"0.63781863",
"0.635393",
"0.634484",
"0.63130003",
"0.630371",
"0.6298059",
"0.6274967",
"0.6272984",
"0.6217101",
"0.6211354",
"0.61903787",
"0.6157175",
"0.6155434",
"0.61369735",
"0.61332583",
"0.6118842",
"0.61054033",... | 0.86356187 | 0 |
Transmit tick function. Called whenever the endpoint sends TS (TRANSMIT_SUCCESS) and whenever write() is called | txTick() {
var t = this;
if (!t.lastTxSuccess) {
if (t.lastCmdSendMs == null) { // If command has already been received
if (t.nextTxAttMs != null) {
if (Date.now() > t.nextTxAttMs && t.port.canWrite()) {
t.nextTxAttMs = null;
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"staTick() {\n var t = this;\n t.txTick(); // Handle outstanding TX before updating status\n if (!t.port.isConnected()) {\n if (t.port.isPairing())\n t.readyState = 0;\n else\n t.readyState = 2;\n } else {\n t.readyState = 1;... | [
"0.6235044",
"0.60493493",
"0.5981117",
"0.56075245",
"0.5554116",
"0.551576",
"0.5502215",
"0.5494444",
"0.5493332",
"0.54825526",
"0.5433207",
"0.5429628",
"0.54221916",
"0.5417462",
"0.54006046",
"0.5378185",
"0.53488356",
"0.53368765",
"0.5329093",
"0.53252774",
"0.532406... | 0.7277471 | 0 |
Create the write buffer from an element in the write queue, applying shift encoding (see lofiFramingProtocol.txt) and adding an End of Frame opcode at the end. The returned data is guaranteed to be free of null and newline characters but may contain spaces | createWriteBuffer(data) {
var rtn = "";
for (var x = 0; x < data.length; x++) {
var c = data.charCodeAt(x);
if(c <= 8){
rtn += String.fromCharCode(c + 1); // 0-8 => 1-9
}
else if (c <= 252) { // 9-252 => 11-254
rtn += String... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function write() {\n\t// Bail if the write queue is invalid\n\tif (!check_queue_write()) return;\n\n\t// Create message from buffer\n\tlet buffer = proto.proto.create(intf.intf.queue_write[intf.intf.queue_write.length - 1]);\n\n\tif (typeof buffer === 'undefined' || buffer === null || buffer === '') return;\n\n\ti... | [
"0.5936087",
"0.55997723",
"0.54887223",
"0.5168598",
"0.5149136",
"0.5112806",
"0.5101402",
"0.5090525",
"0.5070747",
"0.5047859",
"0.5003922",
"0.49624628",
"0.49405587",
"0.49312893",
"0.4903186",
"0.48811665",
"0.48655835",
"0.48583132",
"0.4858083",
"0.4858083",
"0.48580... | 0.59149396 | 1 |
Called when connection status widget is clicked Used to execute privileged functionality | onConnClick() {
if (!this.port.isConnected() && !this.port.isPairing())
this.port.connect();
else
this.port.disconnect();
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function connectionStatusListener(event) {\n trace(event.status);\n if (event.status == ConnectionStatus.Established) {\n trace('Connection has been established. You can start a new call.');\n $(\"#connectBtn\").text(\"Disconnect\").prop('disabled',false);\n $(\"#publishBtn\").prop('disa... | [
"0.65159255",
"0.62360317",
"0.6192793",
"0.6188846",
"0.6104937",
"0.60474735",
"0.6042457",
"0.597921",
"0.5928035",
"0.591409",
"0.58964574",
"0.58593774",
"0.58370066",
"0.58344984",
"0.5815181",
"0.57847047",
"0.5773095",
"0.576343",
"0.57572323",
"0.57138777",
"0.567057... | 0.6259335 | 1 |
Store the given questions array in localStorage. Arguments: questions the questions array to store in localStorage | function storeQuestions(questions) {
localStorage.questions = JSON.stringify(questions);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function storeQuestions(questions) {\n if(questions.subject=='' && questions.question=='') return;\n localStorage.questions = JSON.stringify(questions);\n }",
"function storeQuizArrayToLocalStorage(){\n\t\t//var db = window.localStorage.getItem(localQuizArrayName);\n\t\t//if(db == null || db == ... | [
"0.83574116",
"0.77297163",
"0.75212115",
"0.74764216",
"0.72942644",
"0.7257938",
"0.7112044",
"0.70827174",
"0.7040257",
"0.7004178",
"0.70022076",
"0.6952187",
"0.6952187",
"0.6930356",
"0.69261247",
"0.6843944",
"0.6835036",
"0.68188816",
"0.6788042",
"0.67627484",
"0.674... | 0.8829319 | 0 |
this function will append a question to local storage | function appendQuestionToLocalStorage(newQuestion) {
var newQuestions = getStoredQuestions();
newQuestions.push(newQuestion);
storeQuestions(newQuestions);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function storeQuestions(questions) {\n localStorage.questions = JSON.stringify(questions);\n }",
"function storeQuestions(questions) {\n localStorage.questions = JSON.stringify(questions);\n }",
"function storeQuestions(questions) {\n localStorage.questions = JSON.stringify(questions... | [
"0.7697831",
"0.7697831",
"0.7697831",
"0.75711095",
"0.7570495",
"0.74810785",
"0.72913796",
"0.7250274",
"0.7243147",
"0.7197488",
"0.71819067",
"0.702324",
"0.69850105",
"0.69234556",
"0.69082594",
"0.68283975",
"0.6814255",
"0.6779632",
"0.6773953",
"0.67678225",
"0.67459... | 0.83579856 | 0 |
this function will append a question the left pane | function appendQuestionToLeftPane(newQuestion) {
var li = document.createElement('li');
li.innerHTML = templates.renderQuestions({questions: [newQuestion]});
leftPane.appendChild(li);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function addTemporaryQuestion() {\n\tvar li = document.createElement('li');\n\tli.innerHTML = templates.renderQuestions({questions: null});\n\tleftPane.appendChild(li);\n }",
"function addQuestions(questionList) {\n questionList.forEach(function(question) {\n \tvar li = document.createElement('l... | [
"0.71227586",
"0.6830744",
"0.6747929",
"0.6747929",
"0.662237",
"0.6522908",
"0.6512596",
"0.6380497",
"0.6375375",
"0.6365793",
"0.63593376",
"0.6349492",
"0.633765",
"0.6313481",
"0.6279989",
"0.6277436",
"0.62661266",
"0.6215987",
"0.62088674",
"0.6204034",
"0.62038386",
... | 0.7824447 | 0 |
if there is a placeholder, meaning a list object displaying that there are no questions, then remove it to add question | function removePlaceholder() {
var possiblePlaceholder = leftPane.querySelector('div[class="list-question"]');
if(possiblePlaceholder !== null && possiblePlaceholder.children.length < 2) {
var li = possiblePlaceholder.parentNode;
li.parentNode.removeChild(li);
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function addTemporaryQuestion() {\n\tvar li = document.createElement('li');\n\tli.innerHTML = templates.renderQuestions({questions: null});\n\tleftPane.appendChild(li);\n }",
"function removeAllQuestion(){\n\t\t$scope.newExam.questions = [];\n\t\t$scope.newExam.numberQuestion = 0;\n\t}",
"function deleteUse... | [
"0.68857455",
"0.659462",
"0.63722026",
"0.6308426",
"0.63038695",
"0.6201112",
"0.6154347",
"0.61127496",
"0.59993666",
"0.59948736",
"0.59900314",
"0.5971628",
"0.59696",
"0.59681946",
"0.59679157",
"0.59602934",
"0.5959731",
"0.5940819",
"0.5895417",
"0.5887916",
"0.586535... | 0.7127956 | 0 |
this function will expand the question into the pane on the right and update event listeners. | function expandQuestion() {
rightPane.innerHTML = templates.renderExpandedQuestion(expandedQuestion);
addEventListenerToResponseSubmit();
addEventListenerToResolveButton();
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function addListeners(){\n var allQuestions = document.getElementsByClassName(\"question-info\");\n var lastQuestion = allQuestions[allQuestions.length - 1];\n lastQuestion.addEventListener('click', function(event){\n var target = event.target;\n var subject = lastQuestio... | [
"0.6568578",
"0.6319374",
"0.6212151",
"0.6097003",
"0.6094323",
"0.5971697",
"0.5963355",
"0.5942912",
"0.58794457",
"0.5832208",
"0.5802824",
"0.5801202",
"0.57970136",
"0.5792971",
"0.5790492",
"0.578313",
"0.5781168",
"0.57622415",
"0.5737195",
"0.57117534",
"0.5710513",
... | 0.80473125 | 0 |
this function will update the responses if there is a name and value in the response list. | function updateResponses() {
var responseForm = rightPane.querySelector('form[id="response-form"]');
var name = responseForm.querySelector('input[type="text"]');
var response = responseForm.querySelector('textarea[type="text"]');
if(name.value && response.value) {
appendResponseToResponseList(name.value, response... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function appendResponseToResponseList(newname, newresponse) {\n\tvar questions = getStoredQuestions();\n\tvar index = questions.indexOf(expandedQuestion);\n\texpandedQuestion.responses.push({name: newname, response: newresponse});\n\tquestions[getIndex(questions, expandedQuestion.id, \"id\")] = expandedQuestion;\n... | [
"0.6566457",
"0.6364721",
"0.61278874",
"0.5902362",
"0.5849969",
"0.58269495",
"0.5815864",
"0.5677031",
"0.5657952",
"0.5649165",
"0.56461483",
"0.5627717",
"0.55926317",
"0.55714226",
"0.5518509",
"0.5515157",
"0.5482811",
"0.5482557",
"0.54602444",
"0.5407468",
"0.5406825... | 0.69529575 | 0 |
TASK 5 this function will add an event listener to the resolve button. when clicked it will remove the question | function addEventListenerToResolveButton() {
var resolveButton = rightPane.querySelector('a[class="resolve btn"]');
resolveButton.addEventListener("click", function(event) {
event.preventDefault();
removeQuestionFromLocalStorage();
removeQuestionFromSidebar();
updateWindowAfterResolve();
});
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function clickNext(){\r\n\r\n\t\r\n\tnext.addEventListener(\"click\",reset);\r\n\tnext.addEventListener(\"click\",newQuestion);\r\n}",
"function clickNext(){\r\n\t\r\n\tnext.addEventListener(\"click\",reset);\r\n\tnext.addEventListener(\"click\",newQuestion);\r\n}",
"function submit_answer(answer) {\n hilig... | [
"0.6228689",
"0.619184",
"0.6124602",
"0.6074258",
"0.60040736",
"0.59625775",
"0.59012455",
"0.58960336",
"0.5878034",
"0.5865928",
"0.58639205",
"0.5861255",
"0.58467543",
"0.5845612",
"0.58350265",
"0.58308977",
"0.5826825",
"0.58225965",
"0.58147746",
"0.5806785",
"0.5798... | 0.7578444 | 0 |
this function will remove the question from local storage | function removeQuestionFromLocalStorage() {
var questions = getStoredQuestions();
var pos = getIndex(questions, expandedQuestion.id, "id");
questions.splice(pos, 1);
storeQuestions(questions);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function resetQuestion(){\n localStorage.clear() \n question = question2\n }",
"unfavoriteLocalStorage() {\n let favorites = localStorage.getItem(\"favorites\");\n //console.log(localStorage);\n let favoritesJSON = {\n questions: []\n };\n if (favori... | [
"0.81064945",
"0.74122286",
"0.7410633",
"0.72428745",
"0.7223887",
"0.70770115",
"0.70386636",
"0.7027558",
"0.6953029",
"0.6864508",
"0.68474734",
"0.68403614",
"0.6808236",
"0.6766224",
"0.6764916",
"0.67596847",
"0.67543507",
"0.6727295",
"0.6708408",
"0.6684688",
"0.6673... | 0.85879105 | 0 |
this function will remove the question from the sidebar | function removeQuestionFromSidebar() {
var id = expandedQuestion.id.toString();
var questionItem = leftPane.querySelector('div[id="' + id + '"]');
var li = questionItem.parentNode;
li.parentNode.removeChild(li);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function deleteQ(){\n var pageElement = document.querySelector(\".sub-question-area\");\n pageElement.remove();\n }",
"function onClickRemoveQuestion(){\n let question = $(this).parent().parent();\n let index = $(\".question\").index(question);\n question.remove();\n surveyChanged[\"questions\... | [
"0.7656624",
"0.7197146",
"0.7146235",
"0.70917207",
"0.69687337",
"0.685009",
"0.66365397",
"0.653179",
"0.6530995",
"0.6510759",
"0.648954",
"0.6480175",
"0.6474513",
"0.645473",
"0.6451536",
"0.6442761",
"0.64283836",
"0.64174694",
"0.6385189",
"0.637648",
"0.63759243",
... | 0.850609 | 0 |
this function will add the question form back to the right pane and possibly add the temporary question. | function updateWindowAfterResolve() {
rightPane.innerHTML = templates.renderQuestionForm();
if(getStoredQuestions().length < 1) addTemporaryQuestion();
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function addTemporaryQuestion() {\n\tvar li = document.createElement('li');\n\tli.innerHTML = templates.renderQuestions({questions: null});\n\tleftPane.appendChild(li);\n }",
"function appendQuestionToLeftPane(newQuestion) {\n\tvar li = document.createElement('li');\n\tli.innerHTML = templates.renderQuestions... | [
"0.7164284",
"0.6853606",
"0.6675765",
"0.6674263",
"0.65750766",
"0.6491318",
"0.63562894",
"0.63190055",
"0.6308304",
"0.62975156",
"0.6237459",
"0.62274456",
"0.6223088",
"0.61746377",
"0.61508685",
"0.61302924",
"0.6119921",
"0.61090016",
"0.6099595",
"0.6084393",
"0.6056... | 0.6902748 | 1 |
this function will remove the expanded question if it is not in the remaining questions | function removeExpandedQuestion(remainingQuestions) {
if(expandedQuestion !== undefined && getIndex(remainingQuestions, expandedQuestion.id, "id") === -1) {
rightPane.innerHTML = templates.renderQuestionForm();
return false;
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function removeQuestionFromSidebar() {\n\tvar id = expandedQuestion.id.toString();\n\tvar questionItem = leftPane.querySelector('div[id=\"' + id + '\"]');\n\tvar li = questionItem.parentNode;\n\tli.parentNode.removeChild(li);\n }",
"function removeQuestionFromLocalStorage() {\n\tvar questions = getStoredQuest... | [
"0.7154827",
"0.704625",
"0.6675637",
"0.6663286",
"0.66413003",
"0.6625727",
"0.65859395",
"0.64053583",
"0.6349891",
"0.6340225",
"0.63258445",
"0.6200854",
"0.6163025",
"0.6041598",
"0.60091484",
"0.5991494",
"0.598825",
"0.59850645",
"0.5980091",
"0.5966425",
"0.5959775",... | 0.8244558 | 0 |
this function adds a temporary question to the event list | function addTemporaryQuestion() {
var li = document.createElement('li');
li.innerHTML = templates.renderQuestions({questions: null});
leftPane.appendChild(li);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function addQuizQuestionForm(event) {\n var jListItem = GeoMarkup.QuizMarkup.GetQuestionsListItem();\n\n var id = quiz.GetNextAvailableQuestionId();\n quiz.AddQuestion(new Question(\"\", id));\n\n //set the id of the created question to the list item\n jListItem.attr(\"data-id\",... | [
"0.6837976",
"0.677527",
"0.6770815",
"0.67434984",
"0.66913885",
"0.6644318",
"0.647353",
"0.643733",
"0.63995856",
"0.637189",
"0.6297571",
"0.6295585",
"0.6293092",
"0.62901574",
"0.6287219",
"0.6269161",
"0.6265531",
"0.62500936",
"0.6219602",
"0.62171215",
"0.6212995",
... | 0.70940787 | 0 |
Sets handlers to allow certain survey fields to be duplicated from last current survey to new survey used for email address and primary recorder name | initialiseSurveyFieldsMirror() {
this.addListener(App.EVENT_NEW_SURVEY, () => {
console.log('Try to initialise core fields of new survey.');
if (this._coreSurveyFieldCache) {
console.log({'Using cached survey values' : this._coreSurveyFieldCache});
for (le... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function saveCondInviteSetup(survey_id,event_id,form) {\r\n\t// Set survey_id-event_id pair\r\n\tvar se_id = survey_id+'-'+event_id;\r\n\t// Set initial values\r\n\t$('#sscondlogic-'+se_id).val( trim($('#sscondlogic-'+se_id).val()) );\r\n\t$('#sssubj-'+se_id).val( trim($('#sssubj-'+se_id).val()) );\r\n\t$('#ssemai... | [
"0.56240773",
"0.54547215",
"0.5391528",
"0.5387237",
"0.53272617",
"0.53198767",
"0.5315727",
"0.53125834",
"0.5277317",
"0.5264918",
"0.52608263",
"0.5255739",
"0.52465737",
"0.52352035",
"0.52046573",
"0.51909995",
"0.51546156",
"0.5130448",
"0.5122463",
"0.5100491",
"0.50... | 0.6164079 | 0 |
Simple function to highlight the given track | function highlightTrack(track) {
track = document.querySelector("li[trackNumber='" + track + "']");
cleanHighlights();
if (!track) return;
track.classList.add('playing');
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"highlight(on) { }",
"function highlightCurrentTrack(element){\n $(element).addClass(current_playing_track_class);\n }",
"function highlight(beatNum) {\n let prevBeat = (beatNum - 1) < 0 ? 7 : (beatNum - 1);\n // Clear previous beat\n document.getElementById(prevBeat + \"\").style.background = \"#2... | [
"0.7207704",
"0.6721293",
"0.6712069",
"0.6520607",
"0.6387784",
"0.6312974",
"0.6251855",
"0.61949956",
"0.61539435",
"0.6114476",
"0.6086804",
"0.60649496",
"0.6049351",
"0.60384005",
"0.6035576",
"0.6020213",
"0.6015787",
"0.60119396",
"0.60089266",
"0.5959278",
"0.5946650... | 0.7478704 | 0 |
Compares the books in the user's bookshelf with the books in the search results and gives each search result book a shelf accordingly. Maintains state for each book and which shelf it belongs in. | setShelf() {
// TODO: optimize this loop. Perhaps memoize or use a for loop.
this.state.searchResults.map(resultBook => {
// merge searched book with user's books
const matchedSearchBook = this.props.bookshelf.find(
bookshelfBook => resultBook.id === bookshelfBook.id,
);
if (matc... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"searchBooks() {\n\t\tif (this.state.query === '' || this.state.query === undefined) {\n\t\t\treturn this.setState({ searchResults: [] })\n\t\t}\n\t\tBooksAPI.search(this.state.query.trim()).then(matches => {\n\t\t\tif (matches.error) {\n\t\t\t\treturn this.setState({ searchResults: [] })\n\t\t\t} else {\n\t\t\t\t/... | [
"0.7568447",
"0.7141453",
"0.7093684",
"0.69713885",
"0.6956901",
"0.6762639",
"0.67552584",
"0.6700618",
"0.66934717",
"0.66801995",
"0.6636849",
"0.6609396",
"0.660563",
"0.6573379",
"0.6440775",
"0.6423257",
"0.63217217",
"0.60602355",
"0.60064656",
"0.60064405",
"0.599609... | 0.8069066 | 0 |
send QuickSearch expression whenever quickSearch is changed. | function updateFieldQuickSearch(value) {
// Unsubscribe from fieldQuickSearch to avoid calling updateFieldQuickSearch:
subscription.fieldQuickSearch.dispose();
// Update external observable:
fieldFilter.quickSearch(has(value)
? { op: quickOp, values: [val... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function searchUpdated(term) {\n setsearch(term);\n }",
"onSearchTermChange() {\n this.search();\n Metrics.getInstance().updateMetric(Filters.SEARCH, 1);\n }",
"_deferredInvocUpdateSearch() {\n QuickFilterBarMuxer.updateSearch();\n }",
"function searchTextChange(text) {\n // console... | [
"0.66136926",
"0.6576186",
"0.65216583",
"0.6291163",
"0.62766343",
"0.6213",
"0.62127054",
"0.6163856",
"0.61515725",
"0.6145607",
"0.61389095",
"0.61001617",
"0.6085874",
"0.6085874",
"0.6027647",
"0.60233134",
"0.601809",
"0.6003533",
"0.5995312",
"0.5990816",
"0.5970397",... | 0.71304536 | 0 |
flip is boolean; sets 'flipped' observable in order to show the correct ui if filter is flipped (left/right) also returns the offset which needs to be applied to the popup if it is flipped | function flipFilter(flip) {
flipped(flip);
if (flip) {
return $filter.offset().left - $popup.width() - column.width + 10;
}
return $filter.offset().left + 20;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"_flipCard () {\r\n // Don't flip if tile is hidden or inactive.\r\n if (this.hasAttribute('inactive') || this.hasAttribute('hidden')) {\r\n return\r\n }\r\n\r\n // Toggle the flip attribute.\r\n if (this.hasAttribute('flip')) {\r\n this.removeAttribute('flip')\r\n this... | [
"0.57381076",
"0.55578005",
"0.5496731",
"0.54761034",
"0.53248817",
"0.5302202",
"0.52070254",
"0.5196445",
"0.5183438",
"0.5166614",
"0.513413",
"0.5124171",
"0.5104575",
"0.51016396",
"0.50977206",
"0.50269216",
"0.50204766",
"0.49967417",
"0.49896607",
"0.49888298",
"0.49... | 0.7892534 | 0 |
removed filter.loading stage and filter.ready stage because quick search now is updated continuously when quick filter changes moved subs to list and value outside of the hidden substate in the logical states because now we must react to changes when its closed due to saving | function createStatechart() {
return statechart(
parallel('filter',
onEntry(function () {
send = this.send;
this.initial = true;
}),
state('filter.view',
state('filter.hidden',
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"handleChange(vis, element) {\n // if born in NV is checked, disable non-USA\n if (element.id === \"checkbox-NV\") {\n $(\"#checkbox-non-USA\").prop(\"checked\", false);\n }\n if (element.id === \"checkbox-non-USA\") {\n $(\"#checkbox-NV\").prop(\"checked\", false);... | [
"0.66749793",
"0.665035",
"0.6608417",
"0.6593995",
"0.65752196",
"0.6559843",
"0.65161824",
"0.64324313",
"0.6430278",
"0.64217675",
"0.6407794",
"0.63875353",
"0.63870287",
"0.6386742",
"0.6365036",
"0.63416797",
"0.6328443",
"0.6320432",
"0.63161004",
"0.62878287",
"0.6268... | 0.6989912 | 0 |
when default filtering/sorting/vitualization is enabled, we need to create our own items source | function createInternalItemsSource() {
internalItemsSource = options.itemsSource;
internalItemsSource = setupSorting(internalItemsSource);
internalItemsSource = setupFilters(internalItemsSource);
internalItemsSource = setupIndex(internalItemsSource);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"constructor(id, source, name, items) {\n super({\n id,\n source,\n name,\n items\n });\n }",
"_prepareItems(data) {\n\n // Categorize Items as Features and Spells\n const features = {\n weapons: { label: game.i18n.localize(\"DND5E.AttackPl\"), items: [] , hasActions: true, d... | [
"0.63863534",
"0.60310656",
"0.6001949",
"0.5580707",
"0.5527218",
"0.5523469",
"0.5513918",
"0.5490231",
"0.5462793",
"0.5462793",
"0.5462059",
"0.5451476",
"0.54389477",
"0.5427004",
"0.54148746",
"0.5396637",
"0.5391618",
"0.53910077",
"0.53757966",
"0.5372574",
"0.5372574... | 0.77018046 | 0 |
Returns weeks start and end dates | function getWeeksDates(start, end) {
var sDate;
var eDate;
var dateArr = [];
var daysHash = {};
var daysArr = [];
while (start <= end) {
daysHash[getTimestamp(start, 'yyyymmdd')] = dateArr.length
daysArr.push(getTimestamp(new Date(start.getTime())))
if (start.getDay() == 1 || ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function findStartAndEndDate() {\n return [dayOfLastWeek(1), dayOfLastWeek(0)];\n}",
"_weeks() {\n const { day } = this.props;\n const weeks = [];\n\n let endOfMonth = Utils.endOfMonth(day);\n let startOfMonth = Utils.beginningOfMonth(day);\n let fistDayOfMonth = (new Date(day.getFullYear(), da... | [
"0.7444718",
"0.7085755",
"0.662579",
"0.6582741",
"0.65101445",
"0.65053976",
"0.64572954",
"0.6450284",
"0.64341104",
"0.6404881",
"0.63490105",
"0.6338028",
"0.6329664",
"0.6324201",
"0.6323447",
"0.6323447",
"0.6323447",
"0.6322284",
"0.6304421",
"0.62881964",
"0.6245478"... | 0.7983604 | 0 |
Adds one day to the given date and returns a new date | function addDay(date) {
//TODO: refactor
var date = [date.substring(0, 4), date.substring(4, 6), date.substring(6, 8)].join('-')
date = (date) ? new Date(date + "T23:59:59-0000") : new Date()
return getTimestamp(new Date(date.setDate(date.getDate() + 1)), 'yyyymmdd')
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function moveOneDay(date) {date.setTime((date.getTime() + 24 * 60 * 60 * 1000)); }",
"function nextDay(date) {\n return new Date(date.getFullYear(), date.getMonth(), date.getDate() + 1)\n }",
"function addDaysToDate(date, days){\n let res = new Date(date);\n res.setDate(res.getDate() + days);\n re... | [
"0.7459156",
"0.7316399",
"0.72544",
"0.72068304",
"0.7144066",
"0.70218056",
"0.69902056",
"0.6975037",
"0.69557923",
"0.6952606",
"0.6930013",
"0.69191307",
"0.6915927",
"0.6911802",
"0.69005924",
"0.6881055",
"0.6856881",
"0.6848078",
"0.6796444",
"0.6794563",
"0.67940396"... | 0.80884147 | 0 |
Initializes Plotly Box plot | function initBoxPlot(vizData, lookups) {
var chaptersData = vizData["chaptersData"]
var chaptersNames = lookups["chaptersNames"]
var users = lookups["users"]
var usersEmailHash = lookups["usersEmailHash"]
var weeksData = vizData["weeksData"]
var weeksNames = lookups["weeksNames"]
var numOfWe... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function setBox(){\n model.box = {\n x: 0,\n y: 0,\n // Use `clientWidth` and `clientHeight` to\n // access the actual size of the dashboard div.\n width: container.clientWidth,\n height: container.clientHeight\n };\n }",
"function boxplotV... | [
"0.65711224",
"0.64447683",
"0.6135744",
"0.612142",
"0.5945332",
"0.5933275",
"0.59279567",
"0.5892571",
"0.5889963",
"0.5864273",
"0.58605677",
"0.58603114",
"0.5833921",
"0.5833921",
"0.5833921",
"0.5833921",
"0.57964736",
"0.57634336",
"0.5718227",
"0.56866217",
"0.566233... | 0.6853911 | 0 |
Gets code points from a string. | function getCodePointsFromString(str) {
return _toConsumableArray(str).map(function (each) {
return each.codePointAt(0);
});
} // Gets the next emoji (from the start of a string) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function stringToPoints(s)\n{\n return s.split(\"\").map(function(b) { return b.charCodeAt(0); });\n}",
"static getCodePoint(str) {\n\t\tvar l = str.length;\n\t\tvar result = \"\";\n\t\tfor (var index = 0; index < l; index++) {\n\t\t\tresult += '&#' + str.codePointAt(index) + \";\";\n\t\t}\n\t\treturn result;\n... | [
"0.62162876",
"0.5865393",
"0.5850615",
"0.56958836",
"0.5597476",
"0.5574774",
"0.549774",
"0.5453305",
"0.5453305",
"0.5453305",
"0.5453305",
"0.5445322",
"0.53799564",
"0.53773993",
"0.5360949",
"0.53302354",
"0.5314203",
"0.5311074",
"0.53076214",
"0.5267038",
"0.5228365"... | 0.72321075 | 0 |
Search in Rust files for C.class_name. | function getUsedCssClassesInRust() {
const usedCssClasses = new Set;
// search in Rust files
const files = findFiles.fileSync(/\.rs$/, './crate/src');
files.forEach(filePath => {
const fileContent = fs.readFileSync(filePath, 'utf8')
// example of a used class in Rust code is `C.mb_16`
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"getClassFileLink(className, containingNamespace) {\n const lowerClassName = className === null || className === void 0 ? void 0 : className.toLowerCase();\n const classMap = this.getClassMap();\n let cls = classMap.get(util_1.util.getFullyQualifiedClassName(lowerClassName, containingNamespace ... | [
"0.5934338",
"0.59135026",
"0.5856212",
"0.58131427",
"0.5785248",
"0.5748123",
"0.5710669",
"0.5705279",
"0.5630714",
"0.5625114",
"0.562488",
"0.55865777",
"0.55724335",
"0.55724335",
"0.5531237",
"0.5531237",
"0.5531237",
"0.5531237",
"0.5531237",
"0.5531237",
"0.5531237",... | 0.62753016 | 0 |
Search in Handlebar templates for CSS classes. | function getUsedCssClassesInHandlebars() {
const usedCssClasses = new Set;
// search in Handlebars templates
const files = findFiles.fileSync(/\.hbs$/, './entries');
files.forEach(filePath => {
const fileContent = fs.readFileSync(filePath, 'utf8')
// example of a used class in HTML code ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function getUsedCssClassesInRust() {\n const usedCssClasses = new Set;\n // search in Rust files\n const files = findFiles.fileSync(/\\.rs$/, './crate/src');\n files.forEach(filePath => {\n const fileContent = fs.readFileSync(filePath, 'utf8')\n // example of a used class in Rust code is ... | [
"0.54903275",
"0.5488424",
"0.5407934",
"0.5402619",
"0.53196216",
"0.53012663",
"0.5265705",
"0.52377295",
"0.5208319",
"0.5208319",
"0.5132023",
"0.51306224",
"0.51306224",
"0.51144975",
"0.5091042",
"0.5067473",
"0.5067473",
"0.5066819",
"0.5065251",
"0.5064879",
"0.506073... | 0.6459487 | 0 |
add the initial features on top of the map | function addMapFeatures(map, popup) {
map.dragRotate.disable(); // Disable map rotation using right click + drag.
map.touchZoomRotate.disableRotation(); // Disable map rotation using touch rotation gesture.
map.addControl(
new maplibregl.NavigationControl({
showCompass: false,
})
);
map.on("lo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function initLayerAllFeatures(points, mainMap) {\n var context = function(feature) {return feature;} // a magic line from somewhere..\n var myStyle = new OpenLayers.Style( {\n graphicName: \"circle\", fillOpacity: \"1\", fillColor: \"#378fe0\", strokeColor: \"blue\", pointRadius: 5,\n graphicTitle:... | [
"0.6745349",
"0.6649718",
"0.66453344",
"0.647166",
"0.63843745",
"0.6354424",
"0.6274162",
"0.6258143",
"0.6253195",
"0.6217728",
"0.6184991",
"0.61743647",
"0.61729735",
"0.61423576",
"0.61304873",
"0.61290616",
"0.60828656",
"0.6076998",
"0.6065158",
"0.60558",
"0.60355",
... | 0.6869022 | 0 |
removes special button and resets hit count | function removeSpecialButton() {
playerHitCounter = 0;
specialBar(playerSpecialBar, playerHitCounter);
if (buttonWrapper.contains(specialButton)) {
buttonWrapper.removeChild(specialButton);
} else {
return
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"resetButton(button) \n {\n button.body.hit = false;\n button.pressed = false;\n }",
"function resetButtons() {\n $(\".letter\").css({\"pointer-events\": \"auto\", \"background-color\": \"#666600\"});\n /*\n $(\".letter\").removeClass(\"used\");\n $(... | [
"0.74418694",
"0.67376006",
"0.67164433",
"0.6645595",
"0.6549548",
"0.64867324",
"0.6439846",
"0.6411243",
"0.64013314",
"0.639382",
"0.63786405",
"0.6341854",
"0.63397473",
"0.63326365",
"0.63289165",
"0.63147616",
"0.62971115",
"0.62919474",
"0.62674904",
"0.62664366",
"0.... | 0.7565791 | 0 |
sets special bar width, adds glow when full | function specialBar(bar, count) {
if (count === 1) {
bar.setAttribute("style", "width: 33%");
} else if (count === 2) {
bar.setAttribute("style", "width: 66%");
} else if (count === 3) {
bar.setAttribute("style", "width: 100%");
bar.className += " glow";
} else if (count === 0) {
bar.setAttr... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function adjustWidth() {\n width += 0.0166666666666667;\n bar.style.width = width + \"%\";\n bar.innerHTML = width.toFixed(1) + \"%\";\n\n // set width value to a var\n barWidth = width;\n }",
"function setBar (value) {\n return fill.style.width = `${(value/max)*100... | [
"0.75057477",
"0.7332387",
"0.7300094",
"0.7013837",
"0.6878339",
"0.6744488",
"0.66693616",
"0.6583304",
"0.65545183",
"0.6502482",
"0.6494032",
"0.64729434",
"0.6470702",
"0.64468545",
"0.64262545",
"0.6380428",
"0.6378764",
"0.63621795",
"0.63562703",
"0.6286404",
"0.62740... | 0.76912576 | 0 |
delays attack of cpu so that characters aren't attacking simultaneously | function cpuAttackDelay() {
setTimeout(function () {
playRandomSnippet();
specialBar(cpuSpecialBar, cpuHitCounter);
cpuImg.setAttribute('class', 'r-swing black-border-fifty');
determineHealthPercent(playerBattleH, playerH100, playerHBar);
remSwing(cpuImg);
}, 500);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async attack (action_) { _attack (action_); }",
"function cooldown() {\n setTimeout(function(){ \n isReadyToSpeedUp = true\n }, 10000);\n}",
"function ToggleAttack()\n{\n\tcanAttack = false;\n\tyield WaitForSeconds(0.5);\n\tcanAttack = true;\n}",
"function attack(){\n\t//generate sound effect\n\... | [
"0.71069956",
"0.6359532",
"0.62837017",
"0.61424875",
"0.6138166",
"0.61169606",
"0.610966",
"0.610966",
"0.610966",
"0.6094957",
"0.60940844",
"0.6059199",
"0.60410756",
"0.60410756",
"0.6036468",
"0.600728",
"0.6001887",
"0.599804",
"0.5980199",
"0.597409",
"0.5973656",
... | 0.75822157 | 0 |
delays the reset of the battlefield so that the win dance can happen | function delayReset() {
setTimeout(function () {
pauseSong(winSong)
pauseSong(loseSong);
buildBattle();
}, 5000);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function reset() {\n time = 120;\n gameRun = false;\n }",
"function reset() {\n\tupdateWins();\n\tremaining();\n\tanswer();\n}",
"ResetGame()\n { \n setTimeout(this.ResetGame, 10000);\n ReachThewater = false;\n this.x=250;\n this.y=500;\n }",
"functio... | [
"0.6629783",
"0.6546423",
"0.6516055",
"0.65115106",
"0.633626",
"0.6332862",
"0.63324",
"0.63221073",
"0.6306305",
"0.6302217",
"0.629915",
"0.6277682",
"0.6252218",
"0.6248493",
"0.62331176",
"0.6222671",
"0.62177885",
"0.61985815",
"0.61956936",
"0.6194209",
"0.61925703",
... | 0.7679484 | 0 |
If they have progress 100 for this survey, don't let them in. | function checkSurveyNotDone(loaded) {
const theyAlreadyDidIt = loaded.pdArr.find(
pd =>
pd.key === 'progress' &&
pd.survey_ordinal === loaded.session &&
parseInt(pd.value, 10) === 100,
);
if (theyAlreadyDidIt) {
return $q.reject(new ValidationError('survey... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function goalReached() {\r\n\tif(totalProgressPercent >= 100.00) {\r\n\t\talert(\"You did it!\");\r\n\t\tstop = true;\r\n\t\tbreak;\r\n\t}\r\n}",
"function have_pending() {\n\t\tvar all_done = true;\n\t\tfor (name in progress_bars) {\n\t\t\tvar progress_bar = progress_bars[name];\n\t\t\tif (progress_bar.value < ... | [
"0.60409206",
"0.5959871",
"0.56382227",
"0.5630603",
"0.560228",
"0.5595163",
"0.55881757",
"0.55876565",
"0.55233324",
"0.54863846",
"0.5463238",
"0.542828",
"0.5426748",
"0.54236025",
"0.5422108",
"0.5412443",
"0.5405852",
"0.5387862",
"0.53860384",
"0.53833973",
"0.531115... | 0.6672677 | 0 |
Validate inputs before confirming: picked qty must be equal or less than qty to pick if this is OI order, do not allow partial shipping if order requires mfg date, check for the data's emptiness | function isValidInputs() {
var totalQtyToShip = Number($("totalQty").innerHTML);
var totalAvailableQty = Number($("totalAvailableQty").innerHTML);
if (totalQtyToShip > Number($v("qtyToPick"))) {
alert(messagesData.shipMoreThanQtyToPick);
return false;
} else if ("Y" === $v("originInspectionRequired") && total... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function invalidFormInput() {\n return isNaN(modalInstance.form.purchaseCost) || (modalInstance.form.cusip === undefined);\n }",
"function validOrder (req, res, next) {\n const { data: { deliverTo, mobileNumber, dishes } = {} } = req.body;\n if ( deliverTo && mobileNumber && Array.isArray(dishes) &... | [
"0.67560136",
"0.6557411",
"0.64020294",
"0.6319471",
"0.6305876",
"0.6302166",
"0.6288219",
"0.6270513",
"0.6246082",
"0.6163903",
"0.61450726",
"0.61385006",
"0.6137235",
"0.6120141",
"0.61074233",
"0.60969603",
"0.60964054",
"0.6071365",
"0.6064887",
"0.60553604",
"0.60546... | 0.75079143 | 0 |
console.log(res); global = 10; // define in !global! scope var local = 20; // define in current scope scope? | function sum(){
// new scope
global = 10;
var local = 20;
console.log('in sum', local, global)
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function variables()\n{\n var local = 10;\n console.log(global + local);\n}",
"function changeLocal() {\n\n // global can be used here\n\n var a = 2; // local\n\n // local a now = 2\n\n return a;\n}",
"function local(t){\n\t// Here t is a local variable, can be passed with any type as a parameter\n\t... | [
"0.70127827",
"0.6877845",
"0.67863744",
"0.6782781",
"0.6755459",
"0.6520753",
"0.64723307",
"0.6472229",
"0.636805",
"0.6336073",
"0.6333709",
"0.6327548",
"0.63198423",
"0.6317967",
"0.6300005",
"0.62732065",
"0.62648",
"0.625875",
"0.6258413",
"0.62491393",
"0.6222384",
... | 0.74753493 | 0 |
check if a fuel tank or mine has been hit, if so add/subtract fuel, mark item as hit, and return index(es) | function itemCheck(robot) {
var dx, dy, distance, item = {};
for(var i = 0, len = copy.map.fuelTanks.length; i < len; i++) {
if(copy.map.fuelTanks[i].hit)
continue;
dx = copy.map.fuelTanks[i].x - robot.x;
dy = copy.map.fuelTanks[i].y - robot.y;
distance = Math.sqrt(dx * dx + dy * dy);
if(distance... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"hitsBrick(){\n var max_i = this.gameboard.bricks;\n var ret;\n for(var i=0;i<max_i;i++){\n ret = this.gameboard.bricksArray[i].isHit(this);\n if(ret!=0){\n\treturn ret;\n }\n }\n return 0;\n }",
"function addHitAndCheckWin() {\n numHits++;\n console.log(numHits);\n return numHit... | [
"0.5942436",
"0.59354645",
"0.5835391",
"0.581479",
"0.5783286",
"0.56395036",
"0.5562313",
"0.5526314",
"0.5501241",
"0.549613",
"0.5480427",
"0.54309076",
"0.54240346",
"0.5403055",
"0.53555435",
"0.5341518",
"0.5311123",
"0.53046304",
"0.5295324",
"0.5290086",
"0.52827513"... | 0.70660406 | 0 |
subtract fuel and update robot's position | function update(robot, move) {
var fuelUsed = (move.dx * move.dx) + (move.dy * move.dy) + rules.ante;
robot.fuel -= fuelUsed; // subtract fuel
if(robot.fuel < 0) // if fuel drops below 0 from the move, set fuel to 0 and do not move
robot.fuel = 0;
else { // move the robot according to output
robot.x += mo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"update(t) {\r\n this.vehicle.v = this.vehicleSpeed * this.speedFactor;\r\n this.vehicle.update(t, this.freezeVehiclePos);\r\n }",
"update() {\n\t\tthis.velocity.add(this.acceleration);\n\t\tthis.location.add(this.velocity);\n\t\tthis.acceleration.mult(0);\n\t}",
"update() {\n this.location.add(th... | [
"0.691715",
"0.685307",
"0.6759595",
"0.66734946",
"0.6614983",
"0.6563102",
"0.6459798",
"0.6458477",
"0.64363134",
"0.63965416",
"0.6336837",
"0.63190955",
"0.6312646",
"0.63080287",
"0.62752897",
"0.62661046",
"0.62596273",
"0.62427443",
"0.62411565",
"0.6240285",
"0.62356... | 0.7358098 | 0 |
validate ingest date, probably not necessary | function validateDate(data, x){
//validate the ingest date just to be sure
if(!data[x][15].match(/^\d{4}-\d{2}-\d{2}$/)){
return false;
} else{
return true;
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function dateValidation( date ) {\n\n\t\tvar pass = /^\\d{4}-\\d{2}-\\d{2}/.test( date );\n\t\treturn pass;\n\n\t}",
"static validateDate(input) {\r\n // Try to recognize the input as a date-time. This works for responses such as \"11/14/2018\", \"today at 9pm\", \"tomorrow\", \"Sunday at 5pm\", and so on... | [
"0.68730456",
"0.68251944",
"0.6820548",
"0.66354644",
"0.6502724",
"0.6447444",
"0.64246976",
"0.641059",
"0.6405455",
"0.6398612",
"0.6386051",
"0.6385121",
"0.6371501",
"0.6366005",
"0.63629436",
"0.63613665",
"0.6347828",
"0.6313898",
"0.6292902",
"0.62706643",
"0.6267359... | 0.8005707 | 0 |
add the noTransition class if dropdown menu is clickedfixedMenu class to the navbar when you reach its scroll position. | function scrollingMenu() {
if (window.pageYOffset >= fixedPosition && fixedMenu.className === "hideFixedMenu") {
fixedMenu.className = "noTransition";
} else if (window.pageYOffset >= fixedPosition && fixedMenu.className != "hideFixedMenu") {
fixedMenu.className = "fixedMenu";
} else {
fixedMenu.class... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function fixedNav () {\n\tif (document.body.scrollTop < 200) {\n\t\tfixNav.classList.add('hidingNav'); \n\t} \n\telse if (fixNav.classList.contains('hidingNav')) {\n\t\tfixNav.classList.remove('hidingNav');\n\t}\n}",
"function fixedMenu(scroll) {\n const headerScroll = document.querySelector(\".navigation-bar\"... | [
"0.7163341",
"0.69911873",
"0.6958435",
"0.6918547",
"0.6905268",
"0.68451965",
"0.6806771",
"0.6783933",
"0.67673457",
"0.67647964",
"0.67505634",
"0.67369",
"0.67227966",
"0.67018056",
"0.66906387",
"0.664646",
"0.6586796",
"0.6548586",
"0.6542325",
"0.6472482",
"0.64603513... | 0.7679048 | 0 |
ERROR VALIDATION BEGIN A section dedication to validation of the user input requiredAction(id,valid) Description: Takes the id and changes the object given its validity. Adds the check or x mark and turns text red on false, otherwise show some green id The id of the inputs error box ie. cityr valid Which validy to chan... | function requiredAction(input,valid,msg){
jQuery(input).closest('fieldset').find('.error').html(msg);
if(!valid){
jQuery(input).closest('fieldset').removeClass('success').addClass('error');
return false;
}
else{
jQuery(input).closest('fieldset').removeClass('error').addClass('success');
return true;... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function validateRequiredField(id_name,err_id)\n{\n\tvar x = document.getElementById(id_name).value;\n\tif(x == \"\")\n\t{\n\t\t//make the background color red\n\t\tdocument.getElementById(id_name).style.backgroundColor = '#F6D3D3';\n\t\t//showing the msg\n\t\tdocument.getElementById(err_id).innerHTML = '**Please ... | [
"0.69807327",
"0.6544803",
"0.6530617",
"0.64476633",
"0.643077",
"0.6385485",
"0.6365182",
"0.63587534",
"0.6330385",
"0.6324286",
"0.63106346",
"0.6292057",
"0.6215904",
"0.6161931",
"0.6153311",
"0.61462176",
"0.6110577",
"0.60941154",
"0.6078955",
"0.60576665",
"0.6050569... | 0.6585184 | 1 |
Validate tax id if it is checked | function validateTaxID(){
var input = jQuery("#tax_id").val();
if(validWord(input) == false){
requiredAction('#tax_id', false, 'You must enter a valid Tax ID.');
return false;
}else {
requiredAction('#tax_id', true);
return true;
}
var retval = jQuery('#distributor-signup').is(':checked');
var input = j... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"validateTax(val) {\n\t\tconst amount = _.trim(val);\n\t\tif (_.isEmpty(amount)) {\n\t\t\treturn new Error('Tax cannot be empty');\n\t\t}\n\n\t\t/* eslint-disable-next-line no-restricted-globals */\n\t\tif (isNaN(amount)) {\n\t\t\treturn new Error('Tax must be a valid number');\n\t\t}\n\n\t\tif (Number(amount) < 0 ... | [
"0.65686655",
"0.64894",
"0.64542985",
"0.63083166",
"0.61222005",
"0.6084338",
"0.60651493",
"0.58840024",
"0.5871883",
"0.566336",
"0.5625698",
"0.5570493",
"0.5557018",
"0.5556753",
"0.55346715",
"0.5524306",
"0.552004",
"0.55112904",
"0.5493734",
"0.5464582",
"0.5459696",... | 0.8061121 | 0 |
Validate credit card month | function validateCCMonth(){
var input = jQuery('#exp-month').val();
var retval = validMonth(input);
requiredAction('#exp-month',retval);
return retval;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function validateMonth(month)\n {\n var valid = true;\n if(isNaN(month))\n {\n valid = false;\n }\n else\n {\n var num = parseInt(month);\n if (num <1 || num >12)\n {\n valid = false;\n }\n }\n... | [
"0.7197747",
"0.7050997",
"0.6934618",
"0.6918779",
"0.6917093",
"0.690931",
"0.6899082",
"0.6867649",
"0.68626267",
"0.6851696",
"0.68501943",
"0.68501943",
"0.68501943",
"0.68501943",
"0.68501943",
"0.68501943",
"0.68501943",
"0.68501943",
"0.68501943",
"0.68501943",
"0.685... | 0.81251085 | 0 |
Validate credit card year | function validateCCYear(){
var input = jQuery('#exp-year').val();
var retval = validYear(input);
requiredAction('#exp-year',retval);
return retval;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function isLegalYear(year) {\n\treturn year.length == 2\n\t\n}",
"function isBirthYearValid(birthyear) {\n\t\"use strict\";\n\tvar date, currentYear, regExp;\n\tregExp = /^[0-9]*$/;\n\tif (!regExp.test(birthyear)) {\n\t\tdocument.getElementById('errorfieldforyear').innerHTML = \"invalid year\";\n\t\treturn false... | [
"0.73259383",
"0.73172945",
"0.7286435",
"0.7259902",
"0.6965353",
"0.6944718",
"0.694203",
"0.689646",
"0.68956804",
"0.68775237",
"0.6796466",
"0.6796466",
"0.6791971",
"0.67794895",
"0.67794895",
"0.67542106",
"0.6739855",
"0.67238337",
"0.6703935",
"0.67013186",
"0.665948... | 0.8125488 | 0 |
Validate CVV for credit card | function validateCVV(){
var input = jQuery('#cardverify').val();
var retval = validCVV(input);
if(!retval) msg = 'Card Verification must be 3 or 4 digits.';
else msg = '';
requiredAction('#cardverify',retval,msg);
return retval;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function validateCVV () {\n\n isValid(cvvInput);\n isCvvValid = true;\n \n if (paymentSelect.value === 'credit card') {\n if (!/^\\d{3}$/.test(cvvInput.value)){\n isInvalid(cvvInput);\n isCvvValid = false;\n }\n }\n}",
"function validateCVV(creditCard, c... | [
"0.89701396",
"0.84758145",
"0.81333256",
"0.80518895",
"0.78681517",
"0.7858993",
"0.7757135",
"0.77332574",
"0.7495076",
"0.7443381",
"0.73414004",
"0.7283704",
"0.7248063",
"0.70817417",
"0.7056084",
"0.701906",
"0.6986154",
"0.6910743",
"0.6866685",
"0.67375416",
"0.67277... | 0.8484805 | 1 |
The biscuit function checks the HTTP request's cookies against supplied credentials returning true or false. | function biscuit(request, response, username, password) {
var authenticated = false;
return authenticated;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function chkcookies(){\n\tvar NameOfCookie=\"userID\";\n\tvar c = document.cookie.indexOf(NameOfCookie+\"=\"); \n\tif (c != -1){\n\t\treturn(true);\n\t}\n\telse{\n\t\treturn (false);\n\t}\n}",
"function isCookie() {\r\n let CookiePlaced = getCookie(\"BrownieCookie\");\r\n if (CookiePlaced != url) {\r\n cons... | [
"0.62799066",
"0.6250346",
"0.6210982",
"0.6092477",
"0.6052967",
"0.60210925",
"0.598782",
"0.59799945",
"0.59590495",
"0.5935382",
"0.59338975",
"0.59302115",
"0.59272146",
"0.59024906",
"0.5901115",
"0.5885216",
"0.5873456",
"0.5868039",
"0.5853291",
"0.5853108",
"0.585195... | 0.6349166 | 0 |
A valid ticker symbol is defined by the regex: /^[AZ]+$/ This function sanitizes the ticker string so it validates for above regex. Will remove things like parenthesis, asterisks, and other human formatting helpers REQUIREMENT: Ticker string must start with true ticker string. Ie, only use custom suffixes and not prefi... | function sanitizeTickerStr(ticker) {
validation_re = /(^[A-Z]+)/;
if (validation_re.test(ticker)) {
return ticker.match(validation_re)[1];
} else {
throw Exception("Could not validate input ticker string as valid. Using regex: "+validation_re);
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function cleanSymbolFromDigits(sym) {\n var re = /^[A-Za-z]+$/;\n var newSym = sym;\n if (!re.test(sym)) {\n newSym = sym.substring(0, sym.length-1);\n }\n return newSym; \n}",
"function cleanAlpha(inputStr) {\n return inputStr.replace(/[^0-9a-zA-Z \\'()]/g, '')\n}",
"function clean_string_no_special(input_... | [
"0.5568044",
"0.5552444",
"0.54909897",
"0.54069895",
"0.53825045",
"0.53213364",
"0.5217471",
"0.5179851",
"0.51359785",
"0.51237416",
"0.5064312",
"0.50566673",
"0.50410736",
"0.50279856",
"0.5015876",
"0.49962595",
"0.498907",
"0.49886063",
"0.49886063",
"0.4963091",
"0.49... | 0.7490285 | 0 |
show highlight on a slot | function updateSelected(newSlot) {
if (selectedSlot >= 0) {
// remove the highlight class (see utilities.js)
removeClass(slots[selectedSlot], 'highlight');
}
if (newSlot >= 0) {
addClass(slots[newSlot], 'highlight');
}
selectedSlot = newSlot;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"highlight(on) { }",
"function highlight() {\r\n\tthis.style.backgroundColor = '#ff0';\r\n}",
"highlight(index) {\r\n if (this.state.active === index) {\r\n return \"#f5f5f5\";\r\n }\r\n return \"\";\r\n }",
"function highlight() {\n if (window.getSelection) {\n var selection = window... | [
"0.7073606",
"0.6641971",
"0.6494544",
"0.6371076",
"0.6213218",
"0.61805433",
"0.6125007",
"0.60996675",
"0.6094771",
"0.6031086",
"0.5996076",
"0.5976474",
"0.5972181",
"0.5968109",
"0.5966029",
"0.5936702",
"0.59140897",
"0.5909042",
"0.58897805",
"0.5888067",
"0.58533525"... | 0.6727769 | 1 |
Returns the absolute time represented as an offset of the current time. Throws a SeleniumException if timeout is invalid. | function getTimeoutTime(timeout) {
var now = new Date().getTime();
var timeoutLength = parseInt(timeout);
if (isNaN(timeoutLength)) {
throw new SeleniumError("Timeout is not a number: '" + timeout + "'");
}
return now + timeoutLength;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function calcTimeoutOffset() {\n var serverTime = getCookie(emxUIConstants.STR_AUTOLOGOUT_SERVERTIME);\n serverTime = serverTime==null ? null : Math.abs(serverTime);\n var clientTimeOffset = (new Date()).getTime() - serverTime;\n setCookie(emxUIConstants.STR_AUTOLOGOUT_CLIENTTIMEOFFSET, clientTimeOffse... | [
"0.5228059",
"0.52250564",
"0.5171219",
"0.5168975",
"0.5137416",
"0.49346843",
"0.49327648",
"0.491575",
"0.4869355",
"0.48675123",
"0.48675123",
"0.48568454",
"0.4839688",
"0.4817943",
"0.479203",
"0.47841775",
"0.47669274",
"0.47546116",
"0.47546116",
"0.47522542",
"0.4751... | 0.5815015 | 0 |
Returns true iff the current environment is the IDE, and is not the chrome runner launched by the IDE. | function is_IDE() {
var locstr = window.location.href;
if (locstr.indexOf('chrome://selenium-ide-testrunner') == 0) {
return false;
}
return (typeof(SeleniumIDE) != 'undefined');
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function browserContext() {\n if (typeof window === 'undefined') return false;\n return true;\n}",
"function isChromeApp() {\n\t return false;\n\t}",
"_isTestEnv() {\n const window = this._getWindow();\n return window && (window.__karma__ || window.jasmine);\n }",
"_isTestEnv() {\n ... | [
"0.65387386",
"0.63471204",
"0.6331762",
"0.6331762",
"0.6150784",
"0.61381894",
"0.61315775",
"0.61315775",
"0.61315775",
"0.61315775",
"0.61315775",
"0.61315775",
"0.61315775",
"0.61315775",
"0.61315775",
"0.61315775",
"0.61315775",
"0.61315775",
"0.61315775",
"0.61315775",
... | 0.79689837 | 0 |
Returns true iff the given element represents a link with a javascript href attribute, and does not have an onclick attribute defined. | function hasJavascriptHref(element) {
if (getTagName(element) != 'a') {
return false;
}
if (element.getAttribute('onclick')) {
return false;
}
if (! element.href) {
return false;
}
if (! /\s*javascript:/i.test(element.href)) {
return false;
}
return tr... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function clickable(elt) {\n\treturn elt.attr('href') !== '#';\n}",
"function clickable(elt) {\n\treturn elt.attr('href') !== '#';\n}",
"function isAnchorWithHref(element) {\n return isAnchorElement(element) && element.hasAttribute('href');\n}",
"function isAnchorWithHref(element) {\n return isAnchorEle... | [
"0.6993287",
"0.6993287",
"0.67841727",
"0.67841727",
"0.67841727",
"0.67841727",
"0.67375034",
"0.6389527",
"0.6217756",
"0.61840004",
"0.61492485",
"0.61298794",
"0.61298794",
"0.61298794",
"0.61298794",
"0.6129329",
"0.60635394",
"0.6063179",
"0.60615873",
"0.5916395",
"0.... | 0.8256956 | 0 |
Returns the given element, or its nearest ancestor, that satisfies hasJavascriptHref(). Returns null if none is found. | function getAncestorOrSelfWithJavascriptHref(element) {
if (hasJavascriptHref(element)) {
return element;
}
if (element.parentNode == null) {
return null;
}
return getAncestorOrSelfWithJavascriptHref(element.parentNode);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function polyfillClosest(element, selector) {\n let curr = element;\n while (curr != null && !(curr instanceof Element && matches(curr, selector))) {\n curr = curr.parentNode;\n }\n return (curr || null);\n}",
"function polyfillClosest(element, selector) {\n let curr = element;\n while (... | [
"0.6025343",
"0.6025343",
"0.6025343",
"0.5803224",
"0.5631439",
"0.560057",
"0.5561071",
"0.5539743",
"0.5391253",
"0.5387005",
"0.5367468",
"0.53348553",
"0.5291062",
"0.5291062",
"0.5291062",
"0.5291062",
"0.5291062",
"0.5291062",
"0.5290544",
"0.5284315",
"0.5271187",
"... | 0.838879 | 0 |
Locator evaluation support Parses a Selenium locator, returning its type and the unprefixed locator string as an object. | function parse_locator(locator)
{
var result = locator.match(/^([A-Za-z]+)=(.+)/);
if (result) {
return { type: result[1].toLowerCase(), string: result[2] };
}
return { type: 'implicit', string: locator };
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function eval_locator(locator, inDocument, opt_contextNode)\n{\n locator = parse_locator(locator);\n \n var pageBot;\n if (typeof(selenium) != 'undefined' && selenium != undefined) {\n if (typeof(editor) == 'undefined' || editor.state == 'playing') {\n safe_log('info', 'Trying [' + lo... | [
"0.70426995",
"0.63555515",
"0.57389414",
"0.5708964",
"0.5381311",
"0.5191062",
"0.506227",
"0.4903341",
"0.48642793",
"0.4779893",
"0.47780484",
"0.46757317",
"0.4643169",
"0.46123955",
"0.45489943",
"0.45320928",
"0.45270422",
"0.4508023",
"0.44805235",
"0.44805235",
"0.44... | 0.71644425 | 0 |
Evaluates an xpath on a document, and returns a list containing nodes in the resulting nodeset. The browserbot xpath methods are now backed by this function. A context node may optionally be provided, and the xpath will be evaluated from that context. | function eval_xpath(xpath, inDocument, opts)
{
if (!opts) {
var opts = {};
}
var contextNode = opts.contextNode
? opts.contextNode : inDocument;
var namespaceResolver = opts.namespaceResolver
? opts.namespaceResolver : null;
var xpathLibrary = opts.xpathLibrary
? opts... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function $X(xpath, contextNode) {\r\n var doc = selenium.browserbot.getDocument();\r\n var nodeSet = evaluateXpath(doc, xpath, contextNode, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE);\r\n var elements = [];\r\n for (var i = 0, n = nodeSet.snapshotItem(i); n; n = nodeSet.snapshotItem(++i))\r\n elements.push(unw... | [
"0.6669672",
"0.66486925",
"0.6558039",
"0.6558039",
"0.65406",
"0.65148664",
"0.6415576",
"0.641178",
"0.6370603",
"0.63602436",
"0.6347349",
"0.6288052",
"0.6205812",
"0.61330575",
"0.6099041",
"0.6099041",
"0.6099041",
"0.60665435",
"0.60274905",
"0.5994592",
"0.59849805",... | 0.68048346 | 0 |
This function duplicates part of BrowserBot.findElement() to open up locator evaluation on arbitrary documents. It returns a plain old array of located elements found by using a Selenium locator. Multiple results may be generated for xpath and CSS locators. Even though a list could potentially be generated for other lo... | function eval_locator(locator, inDocument, opt_contextNode)
{
locator = parse_locator(locator);
var pageBot;
if (typeof(selenium) != 'undefined' && selenium != undefined) {
if (typeof(editor) == 'undefined' || editor.state == 'playing') {
safe_log('info', 'Trying [' + locator.type +... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"findElements() {\r\n return __awaiter(this, void 0, void 0, function* () {\r\n const es = [];\r\n const ids = yield this.findElementIds();\r\n ids.forEach(id => {\r\n const e = new Element(this.http.newClient(''), id);\r\n es.push(e);\r\n ... | [
"0.66825277",
"0.6533312",
"0.62588525",
"0.62289166",
"0.59237987",
"0.58081245",
"0.58081245",
"0.57574314",
"0.5756705",
"0.56476",
"0.56144613",
"0.55380213",
"0.55255276",
"0.5521801",
"0.54960036",
"0.5479317",
"0.54657227",
"0.54383445",
"0.54381245",
"0.54211587",
"0.... | 0.6928929 | 0 |
Parses a pythonstyle keyword arguments string and returns the pairs in a new object. | function parse_kwargs(kwargs)
{
var args = new Object();
var pairs = kwargs.split(/,/);
for (var i = 0; i < pairs.length;) {
if (i > 0 && pairs[i].indexOf('=') == -1) {
// the value string contained a comma. Glue the parts back together.
pairs[i-1] += ',' + pairs.splice(i, 1)... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function parseArgs(tokenStream) {\n var options = { args: [] };\n var result, nextArg, nextStream;\n\n while (result = parseArg(tokenStream)) {\n\n // We want to support two different syntaxes, because the RPG Maker\n // community has ridiculous conventions:\n //\n // <currency value: 10, name: ... | [
"0.65311956",
"0.58044",
"0.5611079",
"0.5609337",
"0.5602556",
"0.5506947",
"0.5481064",
"0.5449419",
"0.54349256",
"0.5411947",
"0.53429204",
"0.5342667",
"0.5337843",
"0.5327273",
"0.5308686",
"0.53040504",
"0.5302726",
"0.5302726",
"0.5302726",
"0.5302726",
"0.5302726",
... | 0.69491607 | 0 |
Creates a pythonstyle keyword arguments string from an object. | function to_kwargs(args, sortedKeys)
{
var s = '';
if (!sortedKeys) {
var sortedKeys = keys(args).sort();
}
for (var i = 0; i < sortedKeys.length; ++i) {
var k = sortedKeys[i];
if (args[k] != undefined) {
if (s) {
s += ', ';
}
s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function sc_keyword2string(o) {\n return o.slice(1);\n}",
"argsToString() {\n if (!this.fieldOptions || !this.fieldOptions.args) {\n return '';\n }\n return Object.keys(this.fieldOptions.args).reduce((acc, key) => { var _d, _e; return `${acc}${key}: ${(_e = (_d = this.fieldOpti... | [
"0.5684254",
"0.54468715",
"0.5428052",
"0.5405972",
"0.5396852",
"0.5384543",
"0.5384543",
"0.5384543",
"0.53802246",
"0.53774285",
"0.53774285",
"0.53774285",
"0.53774285",
"0.53774285",
"0.53774285",
"0.53774285",
"0.53774285",
"0.53774285",
"0.53774285",
"0.53774285",
"0.... | 0.60973656 | 0 |
Returns true if a node is an ancestor node of a target node, and false otherwise. | function is_ancestor(node, target)
{
while (target.parentNode) {
target = target.parentNode;
if (node == target)
return true;
}
return false;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"'is_ancestor_of'(target) {\n\t\tvar t_target = tof(target);\n\t\t//console.log('t_target', t_target);\n\n\t\tvar el = this.dom.el;\n\n\t\tvar inner = function(target2) {\n\n\t\t\tif (target2 == el) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\tvar parent = target2.parentNode;\n\t\t\tif (!parent) {\n\t\t\t\treturn false;... | [
"0.7576277",
"0.69598174",
"0.658366",
"0.658366",
"0.658366",
"0.6569252",
"0.6569252",
"0.6569252",
"0.6569252",
"0.6569139",
"0.6569139",
"0.6569139",
"0.65677965",
"0.65630656",
"0.65630656",
"0.65630656",
"0.65630656",
"0.65630656",
"0.65630656",
"0.65630656",
"0.6560880... | 0.8203869 | 0 |
Parses a gct file into an object | function parseGCTFile(fileContents)
{
var data = {
sampleNames: [],
rowNames: [],
rowDescriptions: [],
matrix: [[]]
};
var lines = fileContents.split(/\r\n|\r|\n/); //fileContents.split(/\r|\n/);
if(lines.length >= 4 && lines[0].indexO... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function loadGCI() {\n return fs.readFileSync('gci.txt','utf8')\n }",
"function parseFile(fileUpload) {\n\n //Add error handling here.\n var status = 'good';\n \n \n //TODO: Insert parsing code here\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n ... | [
"0.5803573",
"0.56188184",
"0.5593506",
"0.5566042",
"0.5556582",
"0.5529015",
"0.55231935",
"0.5452024",
"0.54444855",
"0.54415417",
"0.54035807",
"0.539886",
"0.539886",
"0.539886",
"0.539886",
"0.5334934",
"0.53244305",
"0.5320651",
"0.53086936",
"0.53027993",
"0.5286114",... | 0.71387255 | 0 |
Logs an action the Broad Institute AppLogger REST Service | function logToAppLogger(application, action, entity, user, successCallBack, failCallBack) {
if (user == undefined || user.length == 0) {
user = "anonymous";
}
if (application == undefined || application.length == 0) {
w2alert("An application must be specified");
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function log() {\n logger.hit(`${this.req.url} ${this.statusCode} ${this.req.method} ${this.req.body.From} ${this.req.body.Body} ${this[action_symbol]}`, this)\n}",
"log() {\n\n this.respond(undefined, \"log\", undefined, undefined, arguments);\n\n }",
"function postLog() {\n api(\"POST\", \"/... | [
"0.71839267",
"0.6765262",
"0.65004545",
"0.64391816",
"0.6211776",
"0.60510087",
"0.6036537",
"0.6036537",
"0.60290843",
"0.59279823",
"0.59110886",
"0.5875024",
"0.58706087",
"0.5838497",
"0.5831938",
"0.5825486",
"0.5805632",
"0.57837594",
"0.5777451",
"0.57722557",
"0.576... | 0.69294024 | 1 |
Prepares a file upload fetcher. This works perfectly with thorinpluginupload SAME configuration | function createUploadFetcher(config) {
parseConfig(config);
if (!config.name) config.name = 'asset'; // the name of the file input
delete config.headers['Content-Type'];
var obj = {};
var name = 'upload' + nidx;
nidx++;
/*
* Creates an actual fetch request to be sent.
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function prepareUpload(event)\n {\n files = event.target.files;\n }",
"function prepareUpload(event)\n{\n files = event.target.files;\n}",
"function prepareUpload(event)\n{\n files = event.target.files;\n}",
"function upload() {\n if (resumable == null)\n resumable = resumableInit(file... | [
"0.6485699",
"0.6417856",
"0.6417856",
"0.64029205",
"0.63993496",
"0.6383361",
"0.6372295",
"0.6372295",
"0.6328863",
"0.6272418",
"0.6266754",
"0.62482285",
"0.6106427",
"0.6088884",
"0.6076385",
"0.6035596",
"0.60312015",
"0.60162145",
"0.599161",
"0.5960013",
"0.59538496"... | 0.67430013 | 0 |
Prepare hash with list of photos and list of stylesheets. | function prepareDataHash(params){
return new Promise((resolve, reject) => {
var result = $.extend({}, params);
$.get(params["urls"]["preview"])
.done((data) => {
var html = sanitizeHTML(data);
result["images"] = [];
$(html).find("img").each(
(ind, element) => { result[... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"setupStyles_() {\n if (this.styles_.length) {\n return;\n }\n\n for (let i = 0, size; size = this.sizes[i]; i++) {\n this.styles_.push({\n url: `${this.imagePath_ + (i + 1)}.${this.imageExtension_}`,\n height: size,\n width: size\n });\n }\n }",
"function preproce... | [
"0.5921414",
"0.54155415",
"0.536543",
"0.53259206",
"0.5297141",
"0.5297141",
"0.5297141",
"0.5297141",
"0.5297141",
"0.5297141",
"0.5297141",
"0.5297141",
"0.5297141",
"0.5297141",
"0.5297141",
"0.5297141",
"0.5297141",
"0.5297141",
"0.5297141",
"0.5297141",
"0.5297141",
... | 0.6108941 | 0 |
Sets the response context around a post and renders it with the current theme's post view. Used by post preview and single post methods. Returns a function that takes the post to be rendered. | function renderPost(req, res) {
debug('renderPost called');
return function renderPost(post) {
var view = templates.single(req.app.get('activeTheme'), post),
response = formatResponse.single(post);
setResponseContext(req, res, response);
debug('Rendering view: ' + view);
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function renderPost(post){ //here we pass an object with post parameters needed to render the post\n\n //creating new elements of the layout\n var postContainer = document.createElement('div'),\n postTitle = document.createElement('h1'),\n postPicture = document.createElement('i... | [
"0.6197038",
"0.6170971",
"0.6139602",
"0.59740853",
"0.5827948",
"0.5823034",
"0.5777874",
"0.5688788",
"0.55446327",
"0.55391544",
"0.5514466",
"0.5508072",
"0.5508019",
"0.5478764",
"0.5451127",
"0.5431307",
"0.54237145",
"0.54122823",
"0.54122823",
"0.5365258",
"0.5343221... | 0.7617003 | 0 |
return values of declared fields of an object o: object to extract parent: a boolean variable that indicates whether to extract parent fields of the object | function extractDeclaredFields(o) {
var currentClass = Java.cast(o.getClass(), JClass);
var sb = JStringBuilder.$new();
while (currentClass.__proto__.hasOwnProperty('getName')) {
sb.append(currentClass.getName()).append("=====");
currentClass.getDeclaredFields().forEach(function (field) {
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"parentField() {\n let parent = this.$parent;\n for (let i = 0; i < 3; i++) {\n if (parent && !parent.$data._isField) {\n parent = parent.$parent;\n }\n }\n return parent;\n }",
"function getField(o,keys) {\n var subObj = o;\n for(var i in keys) {\n if (s... | [
"0.59514207",
"0.5871772",
"0.583941",
"0.5698559",
"0.567328",
"0.5662756",
"0.5622625",
"0.55435705",
"0.5455948",
"0.54450375",
"0.53508526",
"0.5309837",
"0.5304017",
"0.5296749",
"0.52935916",
"0.5260637",
"0.52415276",
"0.5192458",
"0.5192458",
"0.51867455",
"0.5171067"... | 0.6448323 | 0 |
Once the service worker is registered set the initial state | function initialiseState(serviceWorkerRegistration) {
// Are Notifications supported in the service worker?
if (!(serviceWorkerRegistration.showNotification)) {
console.log('Notifications aren\'t supported on service workers.');
useNotifications = false;
} else {
useNotifications = true;
}
// Che... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function initialiseState() {\n\n if (!('showNotification' in ServiceWorkerRegistration.prototype)) {\n window.Demo.debug.log('Notifications aren\\'t supported.');\n return;\n }\n\n if (Notification.permission === 'denied') {\n window.Demo.debug.log('The user has blocked notifications.');\n return;\n... | [
"0.7114276",
"0.68187326",
"0.646819",
"0.64395547",
"0.64395547",
"0.6402629",
"0.6344202",
"0.6335006",
"0.633165",
"0.6234476",
"0.60901994",
"0.6087264",
"0.6069678",
"0.6050336",
"0.6027971",
"0.59843564",
"0.59418887",
"0.58913845",
"0.5848453",
"0.5842831",
"0.5839352"... | 0.6824227 | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.