query stringlengths 9 34k | document stringlengths 8 5.39M | negatives listlengths 19 20 | metadata dict |
|---|---|---|---|
Flowthrough of projects: By team > By Search > By Filter > Sorted | filterProjectsByTeam(projects, str=this.state.activeTeam) {
if (str === "") {
return projects;
} else if (str === "Team OSE") {
return this.pullOSEProjects(projects);
} else {
return projects.filter(p => {
return (
p["Team Submitted"] &&
p["Team Submitted"].incl... | [
"getProjects(filter, sort) { \n\t\treturn this.cloneFilterSort(this.json.projects.slice(), filter, sort);\n\t}",
"sortProjects(projects, sort){\n let sorted = projects;\n switch(sort.field){\n case 'name':\n sorted.sort((a,b)=>(a.name > b.name));\n break;\n case 'bookmarks':\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Populate the participant list | function fillParticipantList(list) {
var panel = $('#participant-list');
while (panel.hasChildNodes()) {
panel.removeChild(panel.lastChild);
}
list.forEach(function(entry) {
var div = document.createElement('div');
div.textContent = entry;
panel.appendChild(div);
})
} | [
"function updateParticipants() {\n var participantsDiv = document.getElementById('participants');\n var retVal = '<ul>';\n var participants = gapi.hangout.getParticipants();\n for (var index in participants) {\n var part = participants[index];\n if (part.person == null) {\n retVal += '<li>An unknown ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
[1][get text] uu.text(node) > text or [text, ...] [2][set text] uu.text(node, "text") > node uu.text node.text / node.innerText accessor | function uutext(node, // @param Node/String: node or text string
text) { // @param String(= void):
// @return Array/String/Node:
if (uuisstring(node)) {
return doc.createTextNode(node);
}
if (text === void 0) {
return node[uu.gecko ? "textCont... | [
"function uutext(node, // @param Node/String: node or text string\r\n text) { // @param String(= void):\r\n // @return Array/String/Node:\r\n if (uu.isString(node)) {\r\n return doc.createTextNode(node);\r\n }\r\n if (text === void 0) {\r\n return node[... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Schedules a new job to run periodically/once. name Job name, used for reporting / monitoring time Run time, see below job The job to run Job is called with a callback, may also return a promise, or generator. The scheduled time can be one of: Integer interval String interval takes the form of "1s", "5m", "6h", etc Date... | scheduleJob(name, time, job) {
this._scheduler.scheduleJob(name, time, job);
} | [
"scheduleJob(name, time, job) {\n assert(job instanceof Function, 'Third argument must be the job function');\n assert(!this._schedules[name], `Attempt to schedule multiple jobs with same name (${name})`);\n\n const newSchedule = new Schedule(this, name, time, job);\n this._schedules[name] = newSchedul... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
proxy needed for api calls from frontend Url for getting setlist of a band | function buildSetlistUrl(mbid){
return proxyUrl + 'https://api.setlist.fm/rest/1.0/artist/' + mbid + '/setlists';
} | [
"function getBands() {\n $.get(\"/api/bands\", renderBandList);\n }",
"getBannerList () {\n let _this = this;\n wx.$http({\n url: api.GetCBanner,\n }).then(res => {\n _this.setData({\n bannerList: res\n })\n })\n }",
"function getBands() {\n $.get(\"/api/bands\", functi... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Adds event listener to multiple checkboxes | function addCheckboxEventListeners(checkboxes) {
for (let i = 0; i < checkboxes.length; i++) {
checkboxes[i].addEventListener('change', checkboxEventListenerCallback);
}
} | [
"function addCheckboxEventListeners(checkboxes) {\n for (var i = 0; i < checkboxes.length; i++) {\n checkboxes[i].addEventListener('change', checkboxEventListenerCallback);\n }\n}",
"function addCheckboxListeners() {\n\t// Add your code here\n var checkArray = document.querySelectorAll(\"input[type=checkb... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Redirect client to home page when video ends | function receiveVideoEndMessage() {
window.location = '/';
} | [
"function onFinish() {\n console.log('finished playing');\n window.location = 'http://www.theplanaproj.com/';\n }",
"function goToVideo() {\n window.location = location.protocol + \"//\" + location.host +\"/\"+ room;\n}",
"handleDownloadVideo(){ \n\t\t//make request and download video here... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
SET first , second AND third WITH ANY NUMBER SET biggest, smallest WITH first SET input_arr WITH ARRAY [first, second, third] FOR EACH input OF input_arr IF biggest LESS THAN input SET biggest WITH input ENDIF IF smallest MORE THAN input SET smallest WITH input ENDIF ENDFOR SET i WITH (smallest + 1) FOR LOOP FROM i UNT... | function lostNumbers(first, second, third) {
var biggest = smallest = first;
var input_arr = [first, second, third];
for(var input of input_arr){
if(biggest < input){
biggest = input;
}
if(smallest > input){
smallest = input;
}
}
for(var i = smallest+1; i < biggest; i++){
if(input_arr.indexOf(i)=... | [
"function largestAndSmallestIterate(numbers) {\n if(numbers.length === 0) return []\n let small = numbers[0];\n let large = numbers[1];\n for( let i = 1 ; i < numbers.length ; i++){\n if(numbers[i] < small){\n small = numbers[i];\n }\n if(numbers[i] > large){\n large = num... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Saves grade values on change | function saveGrades() {
var grade_arr = new Array();
for (i = 0; i < grades.length; i++) {
grade_arr.push(grades[i].value);
}
rubric_obj.grades = grade_arr;
localStorage['grades'] = grade_arr;
} | [
"updateGrade(newGrade){\n this.averageGrade = newGrade;\n }",
"function onChangeGrade(e) {\n var id = this.getAttribute(\"data-id\");\n var camper = getCamperById(id);\n camper[\"grade_code\"] = this.value;//fix this\n saveCamper(camper, \"update\");\n}",
"function saveGrade() {\n\n\tvar M... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
MAKE TREE OBJECT FROM INPUTS | function makeTreeObject() {
treeObject.lines = document.getElementById("lines").value;
treeObject.character = document.getElementById("character").value;
} | [
"inputTree(name, ages, heights, fruits, health) {\n if (name == \"AppleTree\") {\n let appleTree = new AppleTree();\n appleTree.name = name;\n appleTree.ages = ages;\n appleTree.heights = heights;\n for (let i = 0; i < fruits; i++) {\n let apple = new Apple();\n apple.assig... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Opens a fancybox which shows a video stream or a static image of a vessel. | function showCamOrImage(vessel) {
;
if (useCam) {
$('#show-cam').trigger('click');
} else {
// preload image and show picBox
passatShip.image = $('<img />')
.attr('src', 'http://images.vesseltracker.com/images/vessels/hires/-' + vessel.vessel.pic + '.jpg')
.load(... | [
"function setAndShowFancyBox() {\n $(\"#fancyHolder\").html(\"<a class='fancybox'><h1 style='text-align:center'>Welcome to the API Tutorial</h1><p>This add-in helps you try out the selected API call against Excel Online in real time. To use it:</p><p> 1. Read the code and description for the API call you selecte... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
The exchange market interval endpoint returns a summary of information about all markets over a configurable time interval in their native values. | exchangeMarketInterval({ nomicsCurrencyID, exchange, startISOString, endISOString }) {
return this.getExchangeMarketIntervalV1({ nomicsCurrencyID, exchange, startISOString, endISOString })
.catch((err) => {
console.error("Error in 'exchangeMarketInterval' method of nomics module\n" + err... | [
"marketInterval({ nomicsCurrencyID, hours, startISOString, endISOString }) {\n return this.getMarketIntervalV1({ nomicsCurrencyID, hours, startISOString, endISOString })\n .catch((err) => {\n console.error(\"Error in 'marketInterval' method of nomics module\\n\" + err);\n thr... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
UNSAFE. Deserialize the provided calculation synchronously. This method requires specific setup to happen to work properly: all services that all Calculations rely on must be initialized, the base CalculationMap must be initialized, and any models (like QueryFilter) that require extra steps for synchronous deserializat... | static UNSAFE_deserialize(values: SerializedCalculation): Calculation {
switch (values.type) {
case 'AVG':
return AverageCalculation.UNSAFE_deserialize(values);
case 'COMPLEX':
return ComplexCalculation.UNSAFE_deserialize(values);
case 'COUNT':
return CountCalculation.UNSAF... | [
"reloadCalculations() {\n const calculationsInSession = Calculator._getSession(\"calculations\");\n if (calculationsInSession) {\n this.calculations = JSON.parse(calculationsInSession);\n } \n }",
"restoreCalc(data) {\n this.calculation = data;\n this.updateCalculat... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
sync up bottom checkbox with top | function syncBottomBox(){
var box = document.getElementById("topcheckbox").checked;
if(box == true)
{
document.getElementById("bottomcheckbox").checked = true;
}
else{
document.getElementById("bottomcheckbox").checked = false;
}
} | [
"function syncTopBox(){\n var box = document.getElementById(\"bottomcheckbox\").checked;\n if(box == true)\n {\n document.getElementById(\"topcheckbox\").checked = true;\n }\n else{\n document.getElementById(\"topcheckbox\").checked = false;\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Load a cubemap texture onto the GPU as defined by 6 images. The last argument is the texture number, defaulting to 0. | function loadCubemapTexture(xp, xn, yp, yn, zp, zn, index) {
// Default argument value
if (typeof index === 'undefined') { index = 0; }
let texture = gl.createTexture(); // create a texture resource on the GPU
gl.activeTexture(gl['TEXTURE'+index]); // set the current texture that all following com... | [
"function load_cubemap_texture(gl, xp, xn, yp, yn, zp, zn, idx, mag_filter) {\n\tif (typeof idx === \"undefined\") { idx = 0; }\n\tif (typeof mag_filter === \"undefined\") { mag_filter = gl.LINEAR; }\n\n\tlet texture = gl.createTexture(); // create a texture resource on the GPU\n\tgl.activeTexture(gl['TEXTURE'+idx]... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Write our own `newSource` to bypass the batching logic. | function newSource(source) {
return {
type: constants.ADD_SOURCE,
source: source
};
} | [
"function setSource(newSource) {\n\n source = newSource;\n\n // TODO: fix lazy loading!\n //if (isRendered) {\n // renderSource();\n //}\n renderSource();\n\n }",
"function setSource(newSource) {\r\n\t\t\t\t\tsource = newSource;\r\n\t\t\t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
PUT: Update Client using client_id | function updateClient(client_id, data, callback) {
doAjaxCall('PUT', '/api/v1/clients/' + client_id, data, function(jsonData) {
callback(jsonData);
});
} | [
"update() {\n console.log('updating client data');\n let { name, redirect, id, modalRef } = this.state;\n\n const formUpdate = {\n name: name,\n redirect: redirect,\n };\n\n this.persistClient(\n 'put', '/oauth/clients/' + id,\n formUpda... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Combines the object with the operand tree in the environment. | function lisp_combine(obj, otree, env) {
return lisp_class_of(obj).lisp_combine(obj, otree, env);
} | [
"function lisp_combine(obj, otree, env) {\n var saved_stack = lisp_stack;\n lisp_stack = lisp_make_stack_frame(lisp_stack, obj, otree, env);\n try {\n return lisp_class_of(obj).lisp_combine(obj, otree, env);\n } finally {\n lisp_stack = saved_stack;\n }\n}",
"function combine(peg_pars... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Check whether a rowIndex is within a zone or not rowIndex is index of row to check a_zone is an array of zones (zone = [min index, max index], itself an array) Returns Boolean: true = is within zone. | function isInZone (rowIndex, a_zone) {
let len = a_zone.length;
let is_inZone = false;
let zone;
for (let i=0; i<len ; i++) {
zone = a_zone[i];
if ((rowIndex >= zone[0]) && (rowIndex <= zone[1])) {
is_inZone = true;
break;
}
}
return (is_inZone);
} | [
"isInZone (index) {\r\n\tlet is_inZone = false;\r\n\tlet zone;\r\n\tfor (let i=0 ; i<this.zoneLen ; i++) {\r\n\t zone = this.a_zone[i];\r\n\t if (index < zone[0]) { // index is before start of current zone, none after that will match\r\n\t\tbreak;\r\n\t }\r\n\t if (index <= zone[1]) { // index is inside current... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Check support JavaScript BigInt to WebAssembly i64 integration (experimentalwasmbigint) | get bigInt() { return check(bigIntWasm, true); } | [
"toJSInteger() {\n const bigintVal = fromGfpMapping(fromMontgomery(this.val))\n\n if (\n bigintVal.geq(Number.MIN_SAFE_INTEGER) &&\n bigintVal.leq(Number.MAX_SAFE_INTEGER)\n ) {\n return bigintVal.toJSNumber()\n } else {\n throw new Error(\n `Overflow converting Gfp ${bigintVa... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
draw time axis, only for glancing referring | function drawTimeAxis(can)
{
ctx.fillStyle = 'black';
var dinf = getTimeAxisDispInfo(lv, tw);
var useUnit = dinf.useUnit;
var useStep = dinf.useStep;
var rw = getRefWidth(useUnit);
v... | [
"function timebar() {\n if (time >= 0) {\n var grad = context.createLinearGradient(350, 110, 100, 330); //(x0,y0) to (x1,y1)\n grad.addColorStop(0, '#614385');\n grad.addColorStop(1, '#513375');\n context.fillStyle = grad;\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
============================== Customer object ============================== All objects are optional, defaults to empty string | function Customer(name,street,city,state,zip) {
this.name = defaultValue(name,"");
this.street = defaultValue(street,"");
this.city = defaultValue(city,"");
this.state = defaultValue(state,"");
this.zip = defaultValue(zip,"");
this.taxRate=0.06;
} | [
"function customer(){\r\n //Creating the properties for the class customer\r\n this.name\r\n this.age\r\n this.gender\r\n this.location\r\n this.phoneNumber\r\n this.email\r\n this.product_bought\r\n this.sales\r\n this.service\r\n}",
"function Customer(_name) {\n // always initia... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Set the position of a light, in eye coordinates. | function setLightPosition( u_position_loc, modelview, lightPosition ) {
var transformedPosition = new Float32Array(4);
vec4.transformMat4(transformedPosition, lightPosition, modelview);
gl.uniform4fv(u_position_loc, transformedPosition);
} | [
"function set_eye_position (x, y, z) {\r\n eye_x = x;\r\n eye_y = y;\r\n eye_z = z;\r\n}",
"function set_eye_position (x, y, z) {\n //eyePosX = x;\n //eyePosY = y;\n //eyePosZ = z;\n eyePos = createVector(x, y, z);\n}",
"setLightPos(lightPos) {\n this.setUniform(\"uLightPos\" + this.id, lightPos);... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Update store to include the specified window, indexed by open window id or bookmark id Note that if an earlier snapshot of tabWindow is in the store, it will be replaced | registerTabWindow (tabWindow) {
const nextWindowIdMap =
(tabWindow.open) ? this.windowIdMap.set(tabWindow.openWindowId, tabWindow) : this.windowIdMap
const nextBookmarkIdMap =
(tabWindow.saved) ? this.bookmarkIdMap.set(tabWindow.savedFolderId, tabWindow) : this.bookmarkIdMap
return this.set('window... | [
"updateWindow(window) {\n let tab = window.gBrowser.selectedTab;\n this.updatePanel(window, this.tabContext.get(tab));\n }",
"addWindow(win, doUpdateActionHistory) {\n if(!win) {\n lively.notify(\"Unknown window\");\n return;\n } \n // Add window content\n var content = win.chi... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
grab a youtube id from a (clean, no querystring) url (thanks to | function youtubeid(url) {
var myregexp = /(?:youtube\.com\/(?:[^\/]+\/.+\/|(?:v|e(?:mbed)?)\/|.*[?&]v=)|youtu\.be\/)([^"&?\/ ]{11})/i;
var videoID = url.match(myregexp);
// var ytid = url.match("[\\?&]v=([^&#]*)");
videoID = videoID[1];
return videoID;
} | [
"function getYoutubeID(url) {\n var id = url.match(\"[\\\\?&]v=([^&#]*)\");\n id = id[1];\n return id;\n }",
"function youtubeid(url) {\n\t\t\t\tvar ytid = url.match('[\\\\?&]v=([^&#]*)');\n\t\t\t\t/*var ytid = url.match('/v/([^&#]*)');*/\n\t\t\t\tytid = ytid[1];\n\t\t\t\treturn ytid;\n\t\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Observable version of dragRectEvents: Constructs an observable stream for the rectangle that on mousedown creates a new stream to handle drags until mouseup O | map x/y offsets O | flatMap ++... O O | takeUntil mouseup | O O | map x/y + offsets | ++... O | move the rect | function dragRectObservable() {
var svg = document.getElementById("dragRect"), mousemove = Observable.fromEvent(svg, 'mousemove'), mouseup = Observable.fromEvent(svg, 'mouseup'), rect = new Elem(svg, 'rect')
.attr('x', 0).attr('y', 0)
.attr('width', 120).attr('height', 80)
.attr('fill', ... | [
"function dragRectObservable0() {\n const svg = document.getElementById(\"dragRect\"), mousemove = Observable.fromEvent(svg, 'mousemove'), mouseup = Observable.fromEvent(svg, 'mouseup'), rect = new Elem(svg, 'rect')\n .attr('x', 100).attr('y', 70) // initial rect's coordinate \n .attr('width', 120)... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Next, jekyll has behavior of renaming target files based on frontmatter and an algorithm Given a calculated slug, "apply" it in a consistent way to the file.path | function applySlug(inSlug){
var slug = inSlug;
var slugExt = path.extname(slug);
if(slugExt != ".html"){
if(slug.lastIndexOf("/") == slug.length - 1){
slug = slug + "index.html";
}
else {
slug = ... | [
"function slugFromFilename() {\n return function(files, metalsmith, done) {\n _.forEach(files, function(fileMeta, fileName) {\n let m;\n if (m = fileName.match(/\\d{4}-\\d{2}-\\d{2}-(.*)\\..*$/)) {\n fileMeta.slug = m[1];\n } else if (m = fileName.match(/(.*)[\\\\\\/]index\\..*$/)) {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
winner function determines money balance, big win, small win, or spin again | function winner() {
if ((showSlot1 === showSlot2) && (showSlot2 === showSlot3)) {
results.textContent = "Big Win!";
player.src = sounds.bgW;
player.play();
cash += points3x[showSlot1]
document.getElementById('balance').textContent = "Balance: $" + cash;
} else if ((showS... | [
"function checkwinner() {\r\n\r\n if (playerChoice == ComputerChoice) {\r\n\r\n updatescore(0)\r\n result.innerText = \"DRAW\"\r\n\r\n }\r\n if (playerChoice == 'paper' & ComputerChoice == 'rock' || playerChoice == 'rock' & ComputerChoice == 'scissors' ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
this function displays a message when there are no saved events | function displaySavedEmpty(id) {
if (id) {
partial = " for Organization #" + id;
}
savedEventFeed.empty();
const messageH2 = $("<h2>");
messageH2.css({ "text-align": "center", "margin-top": "50px" });
messageH2.html("No events saved yet");
savedEventFeed.append(messageH2);
} | [
"function noEventsFound() {\n\t$('#events_scroller').empty()\n\t\t.append($(\"<div id='no_events_container'>Sorry, no events found.</div>\"));\t\n}",
"function checkNrEvents() {\n if (!$rootScope.events) {\n $rootScope.events = Event.activeEvents({brand: $stateParams.brandId});\n }\n $scope.events.$... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
onWake() Description: Handler for when scene wakes. Sets the current player position based on where they left the previous map to provide consistency. Std handler does everything else. | onWake() {
//console.log("in Tortuga onWake");
// update life and resource displays.
//this.sys.PirateFunctions.updateHearts();
//this.sys.PirateFunctions.updateTortugaDisplay();
//console.log('attempting to resume audio in tortuga.');
// set Tortuga ambiance
... | [
"onWake() {\r\n //console.log(\"in Shipwrecked onWake\");\r\n this.player.x = playerStartX;\r\n this.player.y = playerStartY;\r\n //console.log(\"Set player position to \" + playerStartX + \", \" + playerStartY);\r\n\r\n // update life and resource displays.\r\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Create selection highlight inside table | createHighlightBorderInsideTable(cellWidget) {
let page = this.getPage(cellWidget);
let selectionWidget = undefined;
let left = cellWidget.x - cellWidget.margin.left + cellWidget.leftBorderWidth;
let width = cellWidget.width + cellWidget.margin.left
+ cellWidget.margin.right ... | [
"highlight(row){}",
"function highlight(){\n\tvar selected = document.getElementById(\"selected\");\n\tvar selectX = (selected.getAttribute(\"x\")*1);\n\tvar selectY = (selected.getAttribute(\"y\")*1);\n\ttbl.children[1].children[selectY].children[selectX].style.backgroundColor = 'yellow';\n}",
"highlight(row){... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Complete the balancedSums function below. | function balancedSums(arr) {
let sum=0;
let leftSum =0;
for(let i=0;i<arr.length;i++){
sum+=arr[i];
}
for (let i = 0; i < arr.length; ++i) {
sum -= arr[i]; // sum is now right sum for index i
if (leftSum == sum)
return "YES";
leftSum += arr[i];
... | [
"function balancedSums(arr) {\n // console.log(arr);\n let leftSum = 0;\n let rightSum = 0;\n let l = 0;\n let r = arr.length - 1;\n while (l < r) {\n // console.log(\"leftSum = \" + leftSum);\n // console.log(\"rightSum = \" + rightSum);\n // console.log(\"l = \" + l);\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Set current app section. | currentSection(state, section) {
state.currentSection = section;
} | [
"function setCurrentSection_(currentSection) {\n if(currentSection.length) {\n let newLoc = currentSection.find('a').attr('href');\n newLoc = !HOME_HASH && newLoc === '#home' ? ' ' : newLoc;\n history.pushState(1, '1', newLoc);\n }\n}",
"setTopSection(section) {\n SettingsDispatcher.... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return whether we're in alternate (Katakana) character mode. | isAlternateCharacters() {
return this.alternate;
} | [
"function isAnswer(char) {\n\t\treturn (char == display.getAnswerText());\n\t}",
"function isHanIdeograph(chr)\n{\n\tif (chr.length === 0)\n\t\treturn false;\n\n\tconst c = chr.codePointAt(0);\n\n\t// CJK Unified Ideographs (4E00-9FFF)\n\tif (0x4E00<=c && c<=0x9FFF)\n\t\treturn true;\n\n\t// CJK Unified Ideograph... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Reset the sign up form | function resetSignupForm() {
// Reset all error indicators
$('#signup-first-name').removeClass('error');
$('#signup-last-name').removeClass('error');
$('#signup-username').removeClass('error');
$('#signup-email').removeClass('error');
$('#signup-password-one').removeClass('error');
$('#signu... | [
"function clearSignupForm() {\n // Clear the forms\n $formClasses.find('.form__input-text').val('').removeClass('valid');\n $formClasses.find('.form__input-checkbox').removeAttr('checked');\n }",
"function resetRegistrationForm() {\n\t\tvar first_name\t\t\t\t\t\t= $('#first_name'),\n\t\t\t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Determining the amount of pages needed based on the number of students | function amountOfPages() {
let pages = Math.ceil(eachStudent.length / studentsPerPage);
return pages;
} | [
"function numberOfPages() {\n let pages = Math.ceil(eachStudent.length / studentsPerPage);\n return pages;\n}",
"function determineNumberOfPages() {\n let numberOfPages = Math.ceil(perStudent.length / studentsPerPage);\n return numberOfPages;\n}",
"function numberOfPages() {\n let totalPages = Ma... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Connect to a content origin's file DB. | async function fdbConnect( origin ) {
const { schema } = origin;
// Connect to the object store.
const cx = await idbConnect( schema, ObjStoreName );
/**
* Query the file object store.
* @param origin The content origin configuration.
* @param params T... | [
"function openConnectionTo(file) {\n let connection = connections.get(file.path);\n if (!connection) {\n connection = Services.storage.openDatabase(file);\n switch (connection.schemaVersion) {\n case 0:\n connection.executeSimpleSQL(\"PRAGMA journal_mode=WAL\");\n connection.executeSimple... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
this section deals with the simple random prize display we used for the MVP// this grabs a random prize from the prizeWheelArray[] and returns it | function currentSpin() {
var prize = prizeWheelArray[mathRand(prizeWheelArray.length)];
while (previousPrize === 'bankrupt' && prize === 'bankrupt') {
prize = prizeWheelArray[mathRand(prizeWheelArray.length)];
}
return prize;
} | [
"function showPrize() {\n\t//if (!prizeCache.length) prizeCache = prizesRep.value; // Refill prize cache if it's empty.\n\tif (!prizeCache.length) prizeCache = prizesTemp; // Refill prize cache if it's empty.\n\tvar random = getRandomInt(prizeCache.length);\n\tvar prize = prizeCache[random]; // Pick random prize fr... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Here the model is loaded and fed with an initial image to warm up the graph execution such that the next prediction will run faster. Afterwards, the network keeps on predicting saliency as long as no other model is selected. The results are automatically drawn to the canvas. | async function runModel() {
showLoadingScreen();
model = await tf.loadGraphModel(modelURL);
tf.tidy(() => model.predict(fetchInputImage())); // warmup
modelChange = false;
while (!modelChange) {
const saliencyMap = predictSaliency();
await tf.browser.toPixels(saliencyMap, canvas);
saliencyMa... | [
"function modelLoaded()\r\n{\r\n console.log(\"Model Loaded\")// this will trigger the image classification process\r\n}",
"function draw() {\r\n background(0);\r\n\r\n //loop to train this dude 1000 times\r\n for(let i=0; i<1000;i++){\r\n \tlet data = random(training_data);\r\n \tnn.train(data.inputs, da... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Add a helper function prepend | function prepend() {
} | [
"function prepend(prefix, result) {\n return prefix\n + ((result.length > 0 && prefix.length > 0) ? divider : '')\n + result;\n }",
"function prepend(x, list) {\n return (red, acc) => red(x, list);\n}",
"function el_prepend(args)... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
on mount: get model ID from URL, then send action "setCurrentModel" | componentWillMount() {
let modelId = this.props.params.model;
if (modelId.indexOf(MODEL_URL) != 0)
return;
modelId = modelId.slice(MODEL_URL.length);
const {setCurrentModel} = this.props.modelsActions;
const {models} = this.props;
let model = models.currentModel;
if (!model ... | [
"function SelectModel(i_ModelName)\r\n{\r\n\tDebug.Trace(\"Select Model \" + i_ModelName);\r\n\tvar Model = Loader.GetModel(i_ModelName);\r\n\tif(Model != null)\r\n\t\tTestModel = Model;\r\n}",
"function switchX3DomModel(idStr) {\n\t\tvar model;\n\n\t\t// prevent from unnecessary reloading\n\t\tif (curID === idSt... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Hurricane. 5 points. Write a function that prompts the user to enter a windspeed, and prints the hurricane category (if applicable) for that windspeed. We'll be using the SaffirSimpson scale, shown below in MPH. Category 5: 157+ Category 4: 130156 Category 3: 111129 Catgeory 2: 96110 Category 1: 7495 Tropical Storm: 39... | function hurricane() {
///////////////// DO NOT MODIFY
let windspeed; // DO NOT MODIFY
///////////////// DO NOT MODIFY
windspeed=Number(prompt('enter your windspeed'));
if (windspeed>=157){
document.getElementById('hurricane-output').innerHTML='Category 5 Hurricane.';
}
else if (windspeed>=130){
... | [
"function hurricane() {\n\n ///////////////// DO NOT MODIFY\n let windspeed; // DO NOT MODIFY\n ///////////////// DO NOT MODIFY\ndo {\n windspeed = prompt(\" Enter an Integer representing windspeed\")\n } while ((Number(windspeed) % 1) != 0 || Number(windspeed) < 0);\n\n windspeed = Number(windspeed);\n le... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
1814 // 1815 Bubble the click and show effect if .waveseffect elem was found // 1816 1817 | function showEffect(e) { // 1818
var element = getWavesEffectElement(e); // 1819
... | [
"function getWavesEffectElement(e){if(TouchHandler.allowEvent(e)===false){return null;}var element=null;var target=e.target||e.srcElement;while(target.parentElement!==null){if(target.classList.contains('waves-effect')&&!(target instanceof SVGElement)){element=target;break;}target=target.parentElement;}return elemen... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
constructor return a new object used for constructing a transaction. | function TransactionBuilder() {
_classCallCheck(this, TransactionBuilder);
this.actions = [];
/**
* If true, build the transaction as a partial tranaction.
* @type {Boolean}
*/
this.allowAdditionalActions = false;
/**
* Base transation provided by a third party
* @type {O... | [
"createTx(tx) {\n return new Transaction(tx, this)\n }",
"function TransactionFactory() {\n }",
"function Transaction() {\n bitcoin.Transaction.call(this)\n}",
"function Transaction() {\n if (!(this instanceof Transaction)) {\n return new Transaction();\n }\n this.Type = DEFAULT_TYPE;\n this.Pa... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets the key, which says which of the seams is closer | function getKey(p) {
const arr = [
{
key: '180',
distance: 180 - p[1]
},
{
key: '-180',
distance: Math.abs(-180 - p[1])
},
{
key: '0',
distance: Math.abs(p[1])
}
];
return arr.sort(compara... | [
"function kNearestNeighbours(temperature) {\n var closest_key = {\n \"temp\": 999,\n \"clothing\": undefined\n };\n var keys = getObject(\"training\");\n for (var i = 0; i < keys.length; i++) {\n if (Math.abs(temperature - keys[i].temp) < Math.abs(closest_key.temp)) {\n close... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function to get the value of the conversion | function getConversionValue(){
var convValue = 0;
var theForm = document.forms["conversion"];
var inValue = theForm.inputValue.value;
convValue = inValue;
return convValue;
} | [
"gallonConverter(value) {\n let result = value * (3.78)\n return result\n }",
"function __getValue () {\n\n var raw_value = __getRawValue();\n\n return typeCast(__type, raw_value);\n\n }",
"function determineConverter () {\n console.log(\"In determineConverter func... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
this function saves the block that has completed its journey to playerLevelEnvironment.listOfBlocksInThePlayingArea | function saveDoneBlock() {
let blockAlreadyInserted = false;
for (let i = 0; i < playerLevelEnvironment.listOfBlocksInThePlayingArea.length; i++) {
if (playerLevelEnvironment.listOfBlocksInThePlayingArea[i].blockCounter === playerLevelEnvironment.blockCounter) {
blockAlready... | [
"function saveBlock() {\n\t// find document lock icon element\n \t$(this).find('i').toggleClass('fa-unlock fa-lock')\n\t// get document hour input field value\n \tvar input = $(`#hour${this.id}`);\n \tvar inputValue = input[0].value;\n\n\t// set timeblock storage format\n \tvar activity = {\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
displayParcels() Purpose: Helper function update parcels list with attributes at the page designated area Parameters: none Returns: none | function displayParcels(){
//declare and clear the output are for parcels
var displayParcelOutput = document.getElementById("displayParcelOutput");
document.getElementById("formerParcelsHeader").innerHTML = "";
displayParcelOutput.innerHTML = "";
//build the header for the table... | [
"function showAllParks() {\n parkNames.forEach(function(park) {\n $(\"#\" + park + \"-result\").show();\n });\n}",
"function displayParks(responseJson) {\n $('#js-results-list').empty();\n\n //test code for pulling address from google geocode api, needs to be within the for loop below\n /*$('#js-results-l... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Adds line to Deposit Withdrawal Table with all the details gathered in the DepositWithdrawal function. | function AddDepositWithdrawal(userID, coin, quantity, transactionType, closePrice, transactionValue, oldFundValue, newFundValue, adminEmail){
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheet = "Deposit & Widthdrawal History"
//Insert New Row For Transaction and Update Transaction Number and Date
... | [
"function withdraw() {\n\tfs.appendFile(\"bank.txt\", \", -\" + amount , function(err, data) {\n\t\tif(err) {\n\t\t\tconsole.log(err);\n\t\t}\n\t\tconsole.log(\"You made a withdraw of: $\" + amount);\n\t})\n}",
"function addTransactionRow(transfer){\n // we will insert data into table here\n var tbody = doc... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
handle dragging of the content box | function dragHandler(event) {
var resultContainer = this;
var x = event.clientX - this.offsetLeft;
var y = event.clientY - this.offsetTop;
document.onmousemove = function(event) {
//calculate gap between the content box and window
var l = event.clientX - x;
var t = event.clientY - y;
... | [
"onMouseDrag(e){}",
"mouseDrag(){\n // If the equipment to be placed is selected, update it's position\n this.updateEquipmentBoxMovement();\n\n // Update the position of the object being moved by the mouse\n this.updateMovingEquipmentPos();\n }",
"function drag(event) {\r\n let c... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Use of this source code is governed by a BSDstyle license that can be found in the LICENSE file. VolumeManager is responsible for tracking list of mounted volumes. | function VolumeManager() {} | [
"addVolume(volume) {\n this.volumes.push(volume);\n }",
"function getVolumes() {\n var lRet = ISWIN32 ? [] : '/';\n \n if (ISWIN32)\n srvrequire('win').getVolumes(function(pVolumes) {\n Util.log(pVolumes);\n exports.VOLUMES = pVolumes... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
clearData() Description: Deletes the rows of the Form Sheet in ascending order Arguments: id([GoogeSheetId] string) depth([unsigned] integer) Returns: nothing Notes: | function clearData(id) {
var range = SpreadsheetApp.openById(id).getSheets()[0].getDataRange().offset(1,0);
range.clear();
} | [
"function clearData(id, depth) {\n var sheet = SpreadsheetApp.openById(id)\n var i;\n for (i = depth ; i > 1 ; i--) \n {\n sheet.deleteRow(i);\n }\n}",
"clearSheet() {\n const { sheet } = this;\n const row = this.numHeaders + 1;\n const column = 1;\n const numRows = sheet.getLastRow() - row + ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sprite A css Sprite: sheet is the spritesheet which this object will be using to render the sprite. So sheetX and sheetY is the top left hand corner of the area we're grabbing. dx and dy are used optionally to place the sprite offcenter | function Sprite(x, y, sheet, sheetX, sheetY, width, height, dx, dy){
this.x = x;
this.y = y;
this.sheetX = sheetX;
this.sheetY = sheetY;
this.width = width;
this.height = height;
this.dx = dx || 0;
this.dy = dy || 0;
this.div = document.createElement("div");
this.div.style.backgroundImage = sheet;
... | [
"function Sprite(x, y, sheet, sheetX, sheetY, width, height, dx, dy, maskRect){\n\t\tthis.x = x;\n\t\tthis.y = y;\n\t\tthis.sheetX = sheetX;\n\t\tthis.sheetY = sheetY;\n\t\tthis.width = width;\n\t\tthis.height = height;\n\t\tthis.dx = dx || 0;\n\t\tthis.dy = dy || 0;\n\t\tthis.div = document.createElement(\"div\");... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
graphEdges: Original edges of the graph | function _addEdges(vNodes, vEdges, graphEdges) {
let i, j, qtNodes, qtEdges;
qtNodes = vNodes.length;
//------- Includes edges
vNodes.forEach(function (node, k) {
graphEdges.forEach(function (edge) {
if (edge.sr... | [
"reset_edges(){\n for(let edge of this.edges){\n edge.visited = false;\n }\n }",
"getEdges() {\n const edgeArr = [];\n this.getVertices().forEach(v => {\n const incidentEdges = this.incidentEdges(v);\n incidentEdges.forEach(e => {\n const edgeObj = {};\n e... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
getPartsOfTypeInLucidNodesEntityArray() parameters: arr: An array of GraphElements type: a type of graphElementPart returns an array of the graphElementParts of type "type" associated with the array provided. Notes: Traverses array GraphElement.partsInScene to find all object3Ds associated with the GraphElement, regard... | function getPartsOfTypeInLucidNodesEntityArray( arr, type ){
var partsOfType = [];
var partOfType;
if ( arr && arr.length ){
arr.forEach( function( entity ){
if ( entity.isLucidNodesEntity && entity.partsInScene ){
entity.partsInScene.forEach( function( part ){
if ( part.isLucidNodesEntityPart && p... | [
"function getNodesByTypeHelper(childArray, type) {\n var nodes = [].concat(childArray.filter(function (element) {\n return element.type === type;\n }));\n var otherNodes = [];\n childArray.forEach(function (node) {\n if (hasChildren(node)) {\n otherNodes = otherNodes.concat(getNodesByTypeHelper(node.... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
LTEQ[] Less Than or EQual 0x53 | function LTEQ(state) {
var stack = state.stack;
var e2 = stack.pop();
var e1 = stack.pop();
if (DEBUG) console.log(state.step, 'LTEQ[]', e2, e1);
stack.push(e1 <= e2 ? 1 : 0);
} | [
"function LTEQ(state) {\n var stack = state.stack;\n var e2 = stack.pop();\n var e1 = stack.pop();\n\n if (exports.DEBUG) {\n console.log(state.step, 'LTEQ[]', e2, e1);\n }\n\n stack.push(e1 <= e2 ? 1 : 0);\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Display the area on the map | display() {
this.show = true;
if(this.polygonId == -1) {
// Create a new polygon
this.polygonId = areasPolygons.length ;
areasPolygons.push(L.polygon(this.edges, {
fillOpacity: qualityList.get(this.quality),
opacity: qualityList.... | [
"function showAreaOnMap()\n{\n fillPoly(areaIDData,pointArray);\n}",
"function showPolygons() {\n setAllPolygonsMap(map);\n}",
"show(){\n noFill();\n rect(this.boundary.x, this.boundary.y, this.boundary.w, this.boundary.h);\n if(this.isParent){\n this.northeast.show();\n this.northwest.... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
this is the initial SELECT statement for pulling the templates table | static async getAll() {
const sql = "SELECT id, template_name, visible, created FROM templates";
try {
return await query(sql);
} catch (error) {
throw error;
}
} | [
"getTemplates() {\r\n return document.querySelector(\"#tableTemplate\").innerHTML;\r\n }",
"function templateElements(){\n return getSelectedNodes(dataTable_templates);\n}",
"function updateTemplateSelect(){\n var templates_select =\n makeSelectOptions(dataTable_templates,\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Compares second level category, or 'category2' of two members | function compMemberCats(member1, member2) {
if (member1["category2"] == member2["category2"]) {
return true;
}
return false;
} | [
"function compareCategories(a, b) {\n return a === b ? 0\n : a === '(Uncategorised)' ? 1\n : b === '(Uncategorised)' ? -1\n : /* otherwise */ compare(a, b);\n}",
"function clubComparator(student1, student2) {\nvar s1;\nvar s2;\n\nswitch(student1.club.toLowerCase(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get all the tags from the database based on the tag title | getTag(tag_title) {
return new Promise((resolve, reject) => {
result = undefined;
db.transaction(tx => {
tx.executeSql(
Tag.Query.SELECT_TAGS_QUERY,
[tag_title],
(_, {rows: { _array } }) => result = _array
... | [
"function getNewsTags(title) {\n return new Promise(function (resolve, reject) {\n // create url\n let url = dandelion_endpoint + 'nex/v1/?token=' + dandelion_token\n url += '&text=' + title\n url = encodeURI(url)\n request(url, function (error, response, body) { // take tags f... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
new stats compared to previous day latestStats is CovidRecordStats from current record previousStats is CovidRecordStats from last record | constructor(latestStats, previousStats) {
super();
this.testResultsPositiveGrowthPercentFloat = 0;
this.testResultsNegativeGrowthPercentFloat = 0;
this.testResultsTotalGrowthPercentFloat = 0;
this.hospitalizedGrowthPercentFloat = 0;
this.deathGrowthPercentFloat = 0;
if (latestStats != null && previo... | [
"recalculateStats(year, newRecord) {\n const currentYear = this.getStatsByYear(year);\n let seasonStatsChanged = false;\n let playoffStatsChanged = false;\n\n if (newRecord.winRate && newRecord.winRate > currentYear.bestSeasonWins) {\n currentYear.bestSeasonWins = newRecord.winRate;\n }\n\n i... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets/sets the enabled state of the instant world tracker. Disable when not in use to save computational resources during frame processing. | get enabled() {
return this._z.instant_world_tracker_enabled(this._impl);
} | [
"get enabled() {\n return this._z.face_tracker_enabled(this._impl);\n }",
"function updateEnableState() {\n group.enabled = !editor.call('project:settings:hasLegacyPhysics') &&\n editor.call('permissions:write');\n }",
"get _enabled() {\n return !getPre... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Send order to chef | function sendOrderToChef(order_id, cart) {
client.messages.create({
body: formatOrderMessage(order_id, cart),
to: CHEF_NUMBER,
from: TWILIO_NUMBER
});
} | [
"sendOrder() {\n \n }",
"function sendOrder(data) {\n console.log(\"entered send Order\");\n //console.log(data);\n socket.emit(\"order\", data);\n console.log(\"exited send Order\");\n\n }",
"sendOrder(order) {\n const simpleOrder = {\n name: orde... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
shift triangles opacity slightly by a random amount | shiftOpacity() {
const shift = (Math.random() - 0.5) * this.opacityVar;
this.opacity = shift;
} | [
"function randomShade() {\n const cAArr = convertColorStringToArray(rgbaCustomPreview.style.backgroundColor);\n let cASum = 0;\n for(let i = 0; i < 3; i++) {\n cASum += cAArr[i];\n }\n\n let cBArr = [];\n const max = 255 * Math.max(cASum, 1) / Math.max(...cAArr, 1);\n const rand = Math.random() * max;\n\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return an array containg integers [ BankMSB, BankLSB, (zerobased) PC ] for the specified tone name | BankForName( a_name )
{
var tone = this.toneByName[ a_name ];
if (tone != null) {
return [ parseInt(tone.MSB), parseInt(tone.LSB), parseInt(tone.PC) - 1 ];
}
alert( '"' + a_name + '" is not a known Tone for this piano.\n' );
return [ 0, 68, 0 ]; // Acoustic piano as a de... | [
"BankForIndex( a_index )\n {\n let tone = this.toneArray[a_index];\n return [ parseInt(tone.MSB), parseInt(tone.LSB), parseInt(tone.PC) - 1 ];\n }",
"function loadWavesIntoArray() {\n var toneArray = [\"ukeTones/C.wav\", \"ukeTones/Cs.wav\", \"ukeTones/D.wav\", \"ukeTones/Ds.wav\", \"ukeTones/E.wav... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Emit buffered events (received and emitted). | emitBuffered() {
this.receiveBuffer.forEach((args) => this.emitEvent(args));
this.receiveBuffer = [];
this.sendBuffer.forEach((packet) => {
this.notifyOutgoingListeners(packet);
this.packet(packet);
});
this.sendBuffer = [];
} | [
"emitBuffered() {\n this.receiveBuffer.forEach(args => this.emitEvent(args));\n this.receiveBuffer = [];\n this.sendBuffer.forEach(packet => {\n this.notifyOutgoingListeners(packet);\n this.packet(packet);\n });\n this.sendBuffer = [];\n }",
"emitBuffered() {\n this.receiveBuffer.forE... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function for expanding shorten ipv6 addresses Takes valid ipv6 address in ip6addr argument Returns expanded ipv6 address in string This function should be only called on valid IPv6 address | function expandIPV6(ip6addr)
{
ip6addr = ip6addr.substring(1, ip6addr.length - 1);
var expandedIP6 = "";
//Check for omitted groups of zeros (::)
if (ip6addr.indexOf("::") == -1)
{
//There are none omitted groups of zeros
expandedIP6 = ip6addr;
}
else
{
//Split IP on one compres... | [
"function expandIPv6Address(address) {\n var fullAddress = \"\";\n var expandedAddress = \"\";\n var validGroupCount = 8;\n var validGroupSize = 4;\n\n var ipv4 = \"\";\n var extractIpv4 = /([0-9]{1,3})\\.([0-9]{1,3})\\.([0-9]{1,3})\\.([0-9]{1,3})/;\n var validateIpv4 = /((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Performs linting on a file and resolves the results | function lintFile(data, fileObj, finish) {
//run the linter promise
type_javascript_linter(data)
.then(function (results) {
//add the results to the fileObj
fileObj["lint"] = results;
//run the junction callback
finish();
});
} | [
"function lint() {\n return new Promise((resolve) => {\n linter.lint([\"*.js\", \"src/**/*.js\"]).then(resolve, (err) => {\n console.log(\"lint reject\");\n handleError(err);\n resolve();\n });\n });\n }",
"function lint() {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
16 Convert Score to Grade | function convertScoreToGrade(score) {
if (score > 100 || score < 0) {
return 'PUNTUACION INVALIDA';
}
if (score >= 90 && score <= 100) {
return 'A';
}
if (score >= 80 && score <= 89) {
return 'B';
}
if (score >= 70 && score <= 79) {
return 'C';
}
if (score >= 60 && score <= 69) {
... | [
"function convertScoreToGrade(score) {\n // your code here\n if ( score > 100 || score < 0 ) {\n return 'INVALID SCORE';\n } else if ( score >= 90 ) {\n return 'A'\n } else if ( score >=80 ) {\n return 'B';\n } else if ( score >= 70 ) {\n return 'C';\n } else if (score >= 60 ) {\n return 'D';\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Event that is triggered when the connection to the server is closed | function onClose() {
console.log('Client socket: Connection closed');
mWebSocket = null;
castEvent('onClose', event);
} | [
"onConnectionClosed() {}",
"onConnectionClosed() {\n this.sendDebugMessage(CLOSE_MESSAGE);\n this.setupSocket();\n }",
"onSocketClose() {\n this.disconnected();\n }",
"connectionClosed() {\n this.userId = null;\n this.userInfo = null;\n this.connectionListeners\n .filt... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Delete Category Modal calling the delete confirmation box | function deleteCat(catId) {
$('#myModalLabel').html("Delete Category");
var name = $("#deleteCat"+catId).data('name');
$.ajax({
url : "/category/delete",
data : {catid : catId,catname : name},
success : function(result) {
$("#modal-body").html(result);
}
});
} | [
"function delete_category(category_id){\n jQuery('#delete-category-form').attr('action', jQuery('#delete_category_action').val()+category_id);\n jQuery('#deleteCategory').modal('show');\n}",
"function okModal() {\r\n\t\t\t// execute deletion\r\n\t\t\tvm.del();\r\n\t\t\t// close confirm modal\r\n\t\t\tvm.con... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
! \brief the function called when a neighbor is unreachable and supposedly crashed/departed. It probabilistically keeps an arc up \param id the identifier of the channel that seems down | function onPeerDown(id){
console.log('@spray: The peer '+ JSON.stringify(id) + ' seems down.');
// #A remove all occurrences of the peer in the partial view
var occ = this.partialView.removeAll(id);
// #B probabilistically recreate an arc to a known peer
if (this.partialView.length() > 0){
f... | [
"function atomForNewBond (id)\n{\n\tvar neighbours = [];\n\tvar pos = ui.render.atomGetPos(id);\n\n\tui.render.atomGetNeighbors(id).each(function (nei)\n\t{\n\t\tvar nei_pos = ui.render.atomGetPos(nei.aid);\n\n\t\tif (Vec2.dist(pos, nei_pos) < 0.1)\n\t\t\treturn;\n\n\t\tneighbours.push({id: nei.aid, v: Vec2.diff(ne... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
save class object definition | function saveObjectDefinition(target, props = {}) {
saveClassMetadata(constant_1.OBJ_DEF_CLS, props, target, true);
return target;
} | [
"function writeClass() {\n const code = parseTemplateSync(pathTemplateClass, {\n classname,\n namespace\n });\n shell.mkdir('-p', path.dirname(fileClass));\n fs.writeFileSync(fileClass, code);\n}",
"function saveObj(){\n\t//ASSUMES doLMSGetValue(X); and doLMSSetValue(X,Y); exists (STANDARD SCORM FUNCTIO... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Auxillary function for parsing CSV files Converts CSV to array strData loaded CSV file Returns array containing CSV rows | function CSVToArray(strData){
// Create a regular expression to parse the CSV values.
var objPattern = new RegExp(
(
// Delimiters.
"(\\,|\\r?\\n|\\r|^)" +
// Quoted fields.
"(?:\"([^\"]*(?:\"\"[^\"]*)*)\"|" +
// Standard fields.
"([^\"\\,\\r\\n]*))... | [
"function parseCSVData(csvData) {\n\n var resultArray = [];\n try {\n var lines = csvData.split(\"\\n\");\n var headers = lines[0].split(\",\");\n for (var i = 1; i < lines.length; i++) {\n var obj = {};\n var currentline = lines[i].split(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Construct the waterline schema for the given connection. | buildSchema (connection, collections) {
return _.chain(collections)
.map((model, modelName) => {
let definition = _.get(model, [ 'waterline', 'schema', model.identity ])
return _.defaults(definition, {
attributes: { },
tableName: modelName
})
})
.indexBy... | [
"buildSchema (connection, collections) {\n return _.chain(collections)\n .map((model, modelName) => {\n let definition = _.get(model, [ 'waterline', 'schema', model.identity ])\n return _.defaultsDeep(definition, {\n attributes: { },\n tableName: modelName\n })\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Disable suspending Should be used only when Heartbeat is performing critical tasks like autosave, postlocking, etc. Using this on many screens may overload the user's hosting account if several browser windows/tabs are left open for a long time. | function disableSuspend() {
settings.suspendEnabled = false;
} | [
"suspend() {\n if (this.state_ === WindowState.LAUNCHING) {\n console.error('Call suspend() while window is still launching.');\n return;\n }\n this.state_ = WindowState.SUSPENDING;\n this.foregroundOps_.suspend();\n }",
"checkAutoSuspend() {\n if (this.audioContext !== undefined && ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
The logic of render the first page has been move to the "docreaderxblockBaidu.html" page, since there are multiple logic here, and put the logic in this page below will greatly increase the difficulty to response to all the require ment and logic flow here. For this page, the only variable that we care is the $('iframe... | function DocReaderXBlock(runtime, element)
{
function parse_cookie_and_get_value(key_name_para)
{
var cookie_value = null;
if (document.cookie && document.cookie != '')
{
var cookies = document.cookie.split(';');
for (var i = 0; i < cookies.length; i++)
... | [
"_blockChanged(newValue,oldValue){// ensure we have something and are not loading currently\nif(typeof newValue!==typeof void 0&&\"\"!==newValue&&!this.loading){// support going from a null element to a real one\nif(typeof this.blockEndPoint===typeof void 0&&typeof window.cmsblockEndPoint!==typeof void 0){this.bloc... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
adds subdirectory to the path | cddown(subdir,dir) {
//this.dirs.push(dir);
this.lastpath = this.path;
this.path += '/' + subdir;
this.resources = [];
} | [
"addSubDir(dirUri, dirStat) {\n\n }",
"addFolder(path) {\r\n addCustomFolder(path);\r\n }",
"addDir(name){\n const group = this._group;\n\n const existing = this.childDirs.find((dir)=>dir.name === name);\n if (existing) return existing;\n\n const newDirInfo = SourceFile.of... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Detects if Protection is included and returns an instance of ProtectionController.js | function getProtectionController() {
return detectProtection();
} | [
"function getProtectionController() {\n return detectProtection();\n }",
"function getProtectionController() {\n return detectProtection();\n }",
"get shouldProtect() {\r\n return this.routingConfig.protected;\r\n }",
"_protect(){\n\t\tthis.protectVar = \"a protect var\";\n\t\t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Incermensts coins by three | gainThreeCoins() {
this.coins += 3;
} | [
"loseThreeCoins() {\n this.coins -= 3;\n if (this.coins < 0) {\n this.coins = 0;\n }\n }",
"function makeChange(cents) {\n // -------------------- Your Code Here --------------------\n\n // Initialize the coins object\n\n \n // store the number of quarts as the dividend of the argument value di... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
When the user checks or uncheckes the ticky box next to the submit the button on a form: | function tick(){
if($("#ticky").prop("checked")){
$("#submit").prop("disabled", false);
} else {
$("#submit").prop("disabled", true);
}
} | [
"function toggleFinalizeButton(e) {\n\t\tif ($('#finalize').is(':checked')) {\n\t\t\tactivateFormValidation();\n\t\t\tif ($('.form-nav li a.recheck').length) {\n\t\t\t\t// Invalid elements still exist\n\t\t\t\t$('#finalisasi .recheck').show();\n\t\t\t\t$('.finalize-checkbox').hide();\n\t\t\t\te.preventDefault();\n\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return the number of subranges. | get count() {
return this.ranges.length;
} | [
"static countContainingRanges(data, value) {\n let n = 0;\n for (const range of data) {\n if (range.containsX(value))\n n++;\n }\n return n;\n }",
"count() {\n let n = 0;\n for (const group of this.groups) {\n n += group[1].elements... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Search the nearest parking from a coord and launch the callback function | function nearestParking(lon, lat, callback){
var url = "http://localhost:8080/geoserver/sig/ows?service=WFS&version=1.0.0&request=GetFeature&typeName=sig:search_nearest_parking&maxFeatures=1&outputFormat=application/json&viewparams=lon:" + lon + ";lat:" + lat;
$.ajax({
url: url,
datatype: 'json',
... | [
"checkNearestSlot(callback)\n {\n let nearestSlot=mainClassObject.checkForParkingSlot(undefined,(mainClassObject.noOfLots/2),mainClassObject.noOfSlots)\n callback(nearestSlot)\n }",
"function checkParkCoord() {\n // clear parkResults array and remove any results cards from previous search\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns "London" and deletes it from the cities array cities is now ["Chicago", "Delhi", "Islamabad", "Berlin"] / As we saw in the last challenge, the slice method does not mutate the original array, but returns a new one which can be saved into a variable. Recall that the slice method takes two arguments for the indic... | function nonMutatingSplice(cities) {
// Add your code below this line
return cities.slice(0, 3);
// Add your code above this line
} | [
"function nonMutatingSplice(cities) {\n \n return cities.slice(0, 3); \n \n}",
"function nonMutatingSplice(cities) {\n // Add your code below this line\n let newArray = cities.slice(0,3);\n\n return newArray;\n \n // Add your code above this line\n}",
"function deleteFromStorage( cityToDelete ) {\n \n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Request the server to change to 8bit color format (Color palette). Only works with Raw encoding. | _setPixelFormatToColorMap() {
this._log(`Requesting PixelFormat change to ColorMap (8 bits).`);
const message = new Buffer(20);
message.writeUInt8(0); // Tipo da mensagem
message.writeUInt8(0, 1); // Padding
message.writeUInt8(0, 2); // Padding
message.writeUInt8(0, 3);... | [
"function replace8bit(c) \n{\n\n var r = int(red(c) / (255/8)) * (255/8);\n var g = int(green(c) /(255/8)) * (255/8);\n var b = int(blue(c) /(255/4)) * (255/4);\n\n return color(r, g, b);\n\n}",
"set ATC_RGBA8(value) {}",
"function encodePickingColor(i) {\n return [i... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
converts a (.) aptamer/constrain string to a match array | function parseConstrain(constrain) {
// uses (.)- for constraints where - is "don't care"
if (!constrain) return [];
if (apDebug>1) console.log('con:'+constrain);
var match = new Array();
match.length = constrain.length;
var stack = new Array();
var sp = 0;
for (var i = 0; i<constrain.length; i++) {
... | [
"function addresses(str) {\r\n let pattern = /\\d[^\\.]+\\./g;\r\n return [...str.matchAll(pattern)];\r\n}",
"function ip2arr(ip) {\r\n return (new RegExp(ipParts, 'ig')).exec(ip).slice(1, 5).map(strVal => ~~strVal);\r\n}",
"static matchAll (string, regexp) {\r\n let matches = [];\r\n\r\n string.... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Assets When a vm is present (instance creation), we need to do a threeway merge between constructor options, instance options and parent options. | function mergeAssets(parentVal,childVal,vm,key){var res=Object.create(parentVal||null);if(childVal){"development"!=='production'&&assertObjectType(key,childVal,vm);return extend(res,childVal);}else{return res;}} | [
"function mergeAssets(parentVal,childVal,vm,key){var res=Object.create(parentVal || null);if(childVal){'development' !== 'production' && assertObjectType(key,childVal,vm);return extend(res,childVal);}else {return res;}}",
"function mergeAssets(parentVal,childVal,vm,key){var res=Object.create(parentVal||null);if(c... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Myaccount Reviews Tab Start // // Myaccount Accounts Tab Start // Click showEditAccounts Button | function showEditAccounts(){
$("#editAccounts").show();
$(".accountDetails").hide();
} | [
"function loadEditAccount() {\n\n\tcontent.innerHTML = \"\";\n\n\t//set the page title\n\ttoolbarTitle.innerHTML = \"\";\n toolbarTitle.appendChild(ctnode(\"Editing Account Access For Contact\"));\n\tupdateToolbarName();\n\n\t//create our address selects\n\tcontent.appendChild(createAccountSelect());\n\n\t//load t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
replaces prompts in a str by elements in the responses array in ascending order | function replacePromptsWithResponses(str, responses){
for(var i=0; i<responses.length; i++){
var regex = new RegExp(regexPattern);
str = str.replace(regex, responses[i].value);
}
return str;
} | [
"function playerPopulate(){\r\n\t for(i=0; i<toReplace; i++){\r\n\t\t console.log(sentence + replacements[i]);\r\n\t\t replacement=prompt(\"Enter a \"+sentence[replacements[i]]);\r\n\t\t sentence[replacements[i]]=replacement;\r\n\t }\r\n\t displayResult();\r\n }",
"function authorSetup(){\r\n\t se... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Called when user drops an agenda item into a day cell. | function myAgendaDropHandler(eventObj) {
// Get ID of the agenda item from the event object
var agendaId = eventObj.data.agendaId;
// date agenda item was dropped onto
var date = eventObj.data.calDayDate;
// Pull agenda item from calendar
var agendaItem = jfcalplugin.getAgendaItemByI... | [
"function myAgendaDropHandler(eventObj){\n\t\t// Get ID of the agenda item from the event object\n\t\tvar agendaId = eventObj.data.agendaId;\n\t\t// date agenda item was dropped onto\n\t\tvar date = eventObj.data.calDayDate;\n\t\t// Pull agenda item from calendar\n\t\tvar agendaItem = jfcalplugin.getAgendaItemById(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sets up a mutual peering relation between two ilp kits. | * setupPeering (kitConfig1, kitConfig2, options) {
const limit = options.limit || 200
const currency = options.currency || 'USD'
yield this._setupPeering(kitConfig1,
kitConfig2.API_HOSTNAME, limit, currency)
yield this._setupPeering(kitConfig2,
kitConfig1.API_HOSTNAME, limit, currency)
} | [
"function setupPrivateChat(user1,user2){\n \n // unplugg both users from their current \n // TODO make sure that these execute asynchronously (don't go onward before their completion)\n leaveCurrentChat(user1); \n leaveCurrentChat(user2);\n\n // subscribe them to each other\n dir[user1].peers... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
think as each cheking in group of two j, j+1 selection sort, but max to the left | function selectionSort_Max_to_Left(arr) {
var i, j;
for ( i = 0; i < arr.length; i++) {
var maxIndex = i;
for ( j = i + 1; j < arr.length; j++) {
if ( arr[maxIndex] < arr[j]) {
maxIndex = j;
}
}
var temp = arr[i];
arr[i] = arr[maxIn... | [
"function selectionSort(arr){\n for(let wall = 0; wall < arr.length -1; wall++){ //the wall increment is movign the wall by one number\n //find smallest number\n // wall - which is index, points to first number behind the wall\n //define a variable outside of the loop\n //wall is the ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Peer supports BEP0010, send extended handshake. This comes after the 'handshake' event to give the user a chance to populate `this.extendedHandshake` and `this.extendedMapping` before the extended handshake is sent to the remote peer. | _sendExtendedHandshake () {
// Create extended message object from registered extensions
const msg = Object.assign({}, this.extendedHandshake)
msg.m = {}
for (const ext in this.extendedMapping) {
const name = this.extendedMapping[ext]
msg.m[name] = Number(ext)
}
// Send extended han... | [
"_sendExtendedHandshake () {\n // Create extended message object from registered extensions\n const msg = extend(this.extendedHandshake)\n msg.m = {}\n for (const ext in this.extendedMapping) {\n const name = this.extendedMapping[ext]\n msg.m[name] = Number(ext)\n }\n\n // Send extended ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Accepts a span and either writes it to the stream, queues it to be sent, or drops it depending on stream/queue state | write(span) {
this._metrics.getOrCreateMetric(NAMES.SEEN).incrementCallCount()
// If not writeable (because of backpressure) queue the span
if (!this._writable) {
if (this.spans.length < this.queue_size) {
this.addToQueue(span)
return
}
// While this can be directionally ... | [
"send(span) {\n // false indicates the stream has reached the highWaterMark\n // and future writes should be avoided until drained. written items,\n // including the one that returned false, will still be buffered.\n this._writable = this.stream.write(span)\n this._metrics.getOrCreateMetric(NAMES.SEN... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Represents a speaker's list | function SpeakersList(speakingtime, instance){
this.speakingtime = speakingtime;
this.instance = instance;
this.speakers = [];
if (speakingtime <= 0)
throw new Error("Invalid speaking time: "+speakingtime);
if (instance < 0 || instance > 1)
throw new Error("Invalid speaking time: "+instance);
} | [
"function MusicList() {\n\tthis.m_list = [];\n\tthis.m_index = -1;\n\tthis.m_rhythm = 1;\n\tthis.m_notationCallback = null;\n\treturn this;\n}",
"function NoteList(){ //use the constructor to define a note list model object.\n this.list = [] // store an array of note model.\n }",
"function PlayerList(n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns whether the leftmost item in the expression is an object | function left_is_object(node) {
if (node instanceof AST_Object) return true;
if (node instanceof AST_Sequence) return left_is_object(node.expressions[0]);
if (node.TYPE === "Call") return left_is_object(node.expression);
if (node instanceof AST_PrefixedTemplateString) return left_is_object(node.prefix);... | [
"function left_is_object(node) {\n if (node instanceof AST_Object) return true;\n if (node instanceof AST_Sequence) return left_is_object(node.expressions[0]);\n if (node.TYPE === \"Call\") return left_is_object(node.expression);\n if (node instanceof AST_PrefixedTemplateString) return left_is_object(no... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This method generates the curvature warning for the provided trace points | function generateCurvatureWarningForTracePoints()
{
// create curvature warnings
for(var i = 0; i < tracePoints.length; i++)
{
var tp = tracePoints [i];
var matchedLinkId = tp.linkIdMatched;
if (matchedLinkId == undefined) matchedLinkId = tp.linkId;
var linkObject = routeLin... | [
"curvatureInfluence(point, i, allPoints) {\n const curvature = this.averageMCurvature(this.getPointsToMeasure(i, allPoints)) * this.segCurveMultiplier;\n const curveDirection = curvature < 0 ? 1 : -1;\n let nextPoint = allPoints[i + 1];\n if (!nextPoint && this.wrapEnd) // If wrapped, th... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This function returns the number of internships in the given country where the country_code is the id | function getCountryCount(id){
if(typeof internship_data.countries[id] == 'undefined'){
return 0;
}
return internship_data.countries[id].length;
} | [
"function getNbHospitalByCountry(country) {\n return Hospital.countDocuments({ country: country });\n}",
"function nbOfCountryPerContinent(countries, continent) {\n // TODO\n}",
"function countCountries(dataset) {\n\n var i = 1;\n for (elem in dataset) {\n if(dataset[elem].INDEX !... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
false window.c = undefined, c = "local" Declare a global variable | function func() {
var aa = "local"; // Declare a local variable
console.log(window.aa === aa); // false window.a = "global", a = "local"
} | [
"function notAcceptImplictDeclareGlobalVariable() {\n var a = 1;\n var b = 2;\n c = a + b; // Not accept on strict mode\n console.log(c);\n}",
"function c() {\n // a is the outer environment of c\n console.log(myVar); // 2\n // aVar does not exist in c, or a but exists at global l... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Display the Member section. By default, display only those members whose dates field has "current" as the second element. Click or tap an image to display details about the member. | function Members(props) {
const [display, setDisplay] = useState('recent');
const memberData = getMemberData();
const onClickToggle = (pushedButton) => {
if (pushedButton === 'recent') {
setDisplay('recent');
} else
if (pushedButton === 'all') {
setDisplay('all');
}
};
cons... | [
"function displayMember(member) {\t\n\tvar memberItem = createElement(\"li\", createMemberString(member), \"household-member\", pageStyles.memberItem)\n\tvar removeButton = createElement(\"button\", \"Remove\", \"remove-button\", pageStyles.removeButton)\n\tmemberItem.setAttribute(\"data-value\", member.id)\n\tmemb... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |