query stringlengths 9 34k | document stringlengths 8 5.39M | negatives listlengths 19 20 | metadata dict |
|---|---|---|---|
HandleFilterToggle ========= HandleFilterInactive =============== PR20220303 | function HandleFilterInactive(el_filter) {
//console.log( "===== HandleFilterInactive ========= ");
//console.log( "el_filter", el_filter);
// show active only when opening page
const filter_showinactive = (filter_dict && filter_dict.showinactive != null) ? filter_dict.showinactive : 1... | [
"filterToggle(e) {\n e.preventDefault();\n this.toggleFilter();\n }",
"handleFilterClose() {\n this.isFilterOpen = false;\n }",
"toggleFilterClick(){\n if (this.initializingFilter) {\n this.initializingFilter = false;\n }\n\n this.toggleFilter();\n }",
"function filterToggl... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
detects if something is very much left of the canvas | function OutOfCanvas(a) {
return (a.x< (-jaws.width/3));
} | [
"collisionLeft() {\n if (this.posX + this.canvasWidth * 0.05 <= 0) {\n return true;\n }\n }",
"out_of_canvas() {\n if (this.x > width || this.y > height){\n return true;\n }\n if (this.x <0 || this.y <0) {\n return true;\n }\n else{\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Updates, in eAndon, the comments of an alert based on the alertId from the websocket and | function getComment(token,alertId,sso){
//Verifies valid function parameters
try{
if (token == "") throw "No token";
if (alertId == "") throw "No alert i.d";
if (sso == "") throw "No sso";
}
catch(err){
console.error("Error:", err.messgae);
}
//Uses request module to make an 'http' calls required for AP... | [
"function updateAlert(alert) {\n const options = {\n uri: 'https://graph.microsoft.com/v1.0/security/alerts/' + alert.id,\n method: 'PATCH',\n form: {\n comments: ['This is an updated comment example'],\n vendorInformation: alert.vendorInformation\n },\n headers: {\n 'Authorization': ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
initial function listens for a click on all the buttons | function init() {
button.addEventListener('click', function(event) {
buttonClicked(event.target.innerText);
});
} | [
"function onIntermediateBtn() {\n console.debug('onIntermediateBtn');\n let idxs = [\"0\", \"1\"];\n idxs.forEach((elem) => {\n $(\"#btnGo\" + elem + \"Text-1\").click(function (e) {\n console.debug('onBeginnerInit --> btnGo' + elem + 'Text 1 clicked')\n fromLandingToInitView()... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This function encodes categorical values to binary array. | function encodeToBinary(source,all_values){
var vector = Array(all_values.length).fill(0);
for (var i in source){
var index = all_values.indexOf(source[i]);
vector.splice(index,1,1);
}
return vector;
} | [
"toBinary(arr, size) {\n var bitMask = 0b0;\n var shiftN;\n for (var i = 0; i < arr.length; i++) {\n shiftN = size - (arr[i].charCodeAt(0) - 97) - 1;\n bitMask = bitMask | (0b1 << shiftN);\n }\n return bitMask;\n }",
"static toBinary(val) {\n let ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Takes a string and adds a prefix and indentation to the first line. | function formatFirstLine(prefix, indent, value) {
return prefix + ' ' + indent + value;
} | [
"function blockHeader(string, indentPerLevel) {\n var indentIndicator = string[0] === ' ' ? String(indentPerLevel) : '';\n\n // note the special case: the string '\\n' counts as a \"trailing\" empty line.\n var clip = string[string.length - 1] === '\\n';\n var keep = clip && (string[string.length - 2] =... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
is this location a room in a POL? | function pols_is_pol(){
if (this.pols_is_building() && this.isOwnable) return 1;
// Support new homes
if (this.isOwnable && (this.is_home || this.home_id)) return 1;
return 0;
} | [
"function pols_is_building(){\r\n\r\n\tvar l = this.pols_get_parent_room();\r\n\r\n\tif (l.pols_has_map_location()){\r\n\t\treturn 1;\r\n\t}\r\n\r\n\treturn 0;\r\n}",
"function my_rooms(s){\n return s && s.pos && tables.my_rooms().indexOf(s.pos.roomName) !== -1;\n}",
"_atRoomCorner(room) {\n if (room.isCo... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Determines if a list has at least one verb Returns boolean | function isVerbCorrect(anArray) {
for(i = 0; i < anArray.length; i++) {
if(dictionary.verbs.includes(anArray[i])){
console.log("Verb matched: " + dictionary.verbs[i]);
return true;
}
} console.log("No verb found.")
} | [
"isVerb(verb, inVerbList) {\n if (!inVerbList) return false;\n if (!Array.isArray(inVerbList)) {\n inVerbList = inVerbList.split('|');\n }\n inVerbList = inVerbList.map(v => v.toLowerCase());\n return inVerbList.indexOf(verb.toLowerCase()) !== -1;\n }",
"function isListHasItem(list, item) {\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
1. Write a custom function power ( a, b ), to calculate the value of a raised to b. | function Power(a,b)
{
result=Math.pow(a,b);
return result;
} | [
"function power(a, b) {\n return Math.pow(a, b)\n}",
"function power(a, b) {\n var power = Math.pow(a, b);\n return power;\n}",
"function pow(a, b) {\n return a ** b;\n}",
"function powerFunc(a, b) {\n\n var ab = a**b;\n alert(\"The Value Of a \" + a + \" Raised To b \" + b + \" Is Equal To ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return a data series for a curve ax^2 + bx + c | function quadratic_series(a, b, c, xmin, xmax) {
var points = new Array();
for (var x = xmin*4; x<= xmax*4; x += 1) {
var xs = x*0.25; // Scaled down
points.push([xs, a*xs*xs + b*xs + c]);
}
return {
label: "y = " + a.toFixed(2) + "x<sup>2</sup> + " + b.toFixed(2) + "x + " + c.toFixed(2),
data: ... | [
"function computePlot(x,y){\n //Retrieves an,bn, then uses those to find the reconstructed function y values\n //then plots this\n [an, bn, alphan, thetan] = Fourier_coefficient(x);\n y2 = Trig_summation_n (an, bn, x);\n\n var data=[\n {\n type:\"scatter\",\n mode:\"line... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function to build Message Entity | function buildMessageEntity(message) {
let msg = {};
msg.messageText = message;
msg.date = Date.now();
msg.sentTo = sentTo;
msg.sentBy = userDisplayName;
return msg;
} | [
"function buildMessageEntity(message) {\n let msg = {};\n msg.messageText = message;\n msg.date = Date.now();\n msg.sentToUserName = sentToUserName;\n msg.sentByUserName = userName;\n msg.sentByDisplayName = userDisplayName;\n\n // If the user does not have \"name\" (Display Name) attribute in ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
framework/namespace/utility.js Returns a normalized namespace name based off of 'name'. It will register the name counter if not present and increment it if it is, then return the name (with the counter appended if autoIncrement === true and the counter is > 0). | function indexedNamespaceName(name, autoIncrement) {
if( isUndefined(namespaceNameCounter[name]) ) {
namespaceNameCounter[name] = 0;
} else {
namespaceNameCounter[name]++;
}
return name + (autoIncrement === true ? namespaceNameCounter[name] : '');
} | [
"uniqueName(prefix) { return `${prefix}${this.nextNameIndex++}`; }",
"function nameSpace(name) {\n var nsName = name;\n\n if (currentNameSpace) {\n //nsName = camelCase(currentModule) + '.' + name;\n nsName = currentNameSpace + '_' + name;\n }\n\n return nsName;\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
replaceHistState: save the clock state into the URL query string. | replaceHistState() {
const params = new URLSearchParams();
params.set('fg', this.fg);
params.set('bg', this.bg);
params.set('mode', this.numberType);
params.set('showHint', false);
params.set('directDrive', this.directDrive);
window.history.replaceState({}, '', '?' + params.toString());
} | [
"function updateHash() {\n let secondPart = \"\";\n if (window.location.hash.includes(\":\"))\n secondPart = \":\"+window.location.hash.split(\":\")[1];\n let hashStr = \"\";\n Object.keys(layers).forEach(layerName => {\n if (layers[layerName][\"visible\"])\n hashStr += layerNam... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
hide page loader function | function hidePageLoader(){
$('.loader').hide();
} | [
"function hidePageLoader()\n{\n var loading = Ext.get('page-loading');\n var mask = Ext.get('page-loading-mask');\n if(loading && mask)\n {\n loading.ghost('b', { duration: 1.5, remove:false, easing:'easeIn' }); // remove must be \"false\" prevent IE SSL warning\n mask.shift({\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
returns rows of tasks, each row containing 1 to 3 cols if available | getTasksRows(tasks, colSize) {
let taskRows = [];
for (let i = 0; i < tasks.length; i += colSize) {
if (tasks[i]) {
const taskRowArray = [];
for (let j = 0; j < colSize; j++) {
if (tasks[i + j]) taskRowArray.push(tasks[i + j]);
}
taskRows.push(
<div cla... | [
"function findTasks(row, type) {\r\n var results = new Array();\r\n for (var i = 0; i < taskQueue.tasks.count(); i++) {\r\n var task = taskQueue.tasks.items[i];\r\n // log(task.constructor.name);\r\n if (task instanceof type) {\r\n if (task.row) {\r\n if (row == null || task.row == row) resul... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Dispose the widget. This causes the view to be destroyed as well with 'remove' | dispose() {
if (this.isDisposed) {
return;
}
super.dispose();
if (this._view) {
this._view.remove();
}
this._view = null;
} | [
"dispose() {\n if (this.isDisposed) {\n return;\n }\n\n super.dispose();\n\n if (this._view) {\n this._view.remove();\n }\n\n this._view = null;\n }",
"destroy() {\n if (this.$$disposed) {\n return;\n }\n\n var parent = this.$$parent;\n if (parent) {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Shopping Lists Screen functions / retrieve all shopping list names from local storage and display them | function displayShoppingLists(){
var ShoppingLists = JSON.parse(localStorage.getItem("ShoppingListsArrayNames"));
if(ShoppingLists != null){
if(ShoppingLists.length > 0){
for (let item of ShoppingLists) {
$("#ShoppingLists").append("<li><a href='ShoppingListItems.html' data-transition='slide'>"
... | [
"function retrieveShoppingListItems(){\n var chosenList = localStorage.getItem(\"chosenList\");\n $(\"#ShoppingListItemsHeading\").html(chosenList);\n var shoppingList = JSON.parse(localStorage.getItem(chosenList));\n if (shoppingList.length > 0){\n shoppingList = convertObjArrayToItemArray(shoppingList);\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
getIgnoreKeywords_allWords_P_Words() Get the common words to ignore that start with: P. | function getIgnoreKeywords_allWords_P_Words() {
return [
'paces',
'pacing',
'par',
'part',
'parted',
'partly',
'parts',
'parting',
'particular',
'particularly',
'passed',
'passing',
'passings',
'patiently',
'peculiarly',
'per',
'perchance',
'perhaps',
'pg', // ... | [
"function getIgnoreKeywords_allWords_O_Words() {\n\t\treturn [\n\t\t\t'obstinately',\n\t\t\t'obviously',\n\t\t\t'occasion',\n\t\t\t'occasionally',\n\t\t\t'occassion',\n\t\t\t'occassionally',\n\t\t\t'occur',\n\t\t\t'occuring',\n\t\t\t'occurs',\n\t\t\t'occurred',\n\t\t\t'of',\n\t\t\t'off',\n\t\t\t'oft',\n\t\t\t'often... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
updates list of attendees whenever a checkbox is checked or unchecked | function updateAttendees(event) {
var attendee_name = $(this).attr("value");
var attendee_email = "";
var contacts_list = JSON.parse(localStorage.getItem("contacts"));
for(var count = 0; count < contacts_list.length; count++) {
if(contacts_list[count].name === attendee_name) {
attendee_email = contacts_list.e... | [
"function updateAttendees(event) {\n\tvar attendee_name = $(this).attr(\"value\");\n\tvar attendee_email = \"\";\n\n\tvar contacts_list = JSON.parse(localStorage.getItem(\"contacts\"));\n\tfor(var count = 0; count < contacts_list.length; count++) {\n\t\tif(contacts_list[count].name === attendee_name) {\n\t\t\tatten... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Wrapper to get the friend and the friendship status | async function getFriendAndStatus(ctx){
const friend = await ctx.findById(ctx.orm.player, ctx.params.friendId);
const friendshipStatus = await ctx.state.player.getFriendshipStatus(friend);
return { friend, friendshipStatus };
} | [
"getFriends() {\n return this.query(\"me/friends\")\n }",
"getFriends() {\n return this.sendRequest(\n 'GET',\n 'https://api.fitbit.com/1/user/-/friends.json',\n this.constructHeaders(),\n );\n }",
"get friends() {\n this._logger.debug(\"friends[get]\");\n return this._friends;\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
searches along line 'pk' for a point that satifies the wolfe conditions / See 'Numerical Optimization' by Nocedal and Wright p5960 / f : objective function / pk : search direction / current: object containing current gradient/loss / next: output: contains next gradient/loss / returns a: step size taken | function wolfeLineSearch(f, pk, current, next, a, c1, c2) {
var phi0 = current.fx, phiPrime0 = dot(current.fxprime, pk),
phi = phi0, phi_old = phi0,
phiPrime = phiPrime0,
a0 = 0;
a = a || 1;
c1 = c1 || 1e-6;
c2 = c2 || 0.1;
function z... | [
"function wolfeLineSearch(f, pk, current, next, a, c1, c2) {\n var phi0 = current.fx, phiPrime0 = dot(current.fxprime, pk),\n phi = phi0, phi_old = phi0,\n phiPrime = phiPrime0,\n a0 = 0;\n\n a = a || 1;\n c1 = c1 || 1e-6;\n c2 = c2 || 0.1;\n\n function zoom(a_lo, a_high, phi_lo)... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Maximum height the bullet will reach in flight | function BulletMaxHeight(verticalVelocity, gravity) {
var result;
result = Math.pow(verticalVelocity, 2) / (2 * gravity);
return result;
} | [
"getMaxHeight() {\n\t\n\t\tif (this.maxHeight >= 0) {\n\t\n\t\t\treturn this.maxHeight;\n\t\n\t\t} else {\n\t\n\t\t\treturn this.h + this.maxHeight;\n\t\n\t\t}\n\n\t}",
"getMaxHeightUnit(){return this.__maxHeightUnit}",
"getMaxHeight(){return this.__maxHeight}",
"calculateMaxFallHeight()\n {\n retur... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
propiedad calculada saldo, se accede como un atributo | get saldo() {
return this.ingreso - this.deuda
} | [
"get saldo() {\n return this._saldo;\n }",
"function saldoResta(cuenta,descuento){\n\tcuenta = cuenta - parseFloat(descuento);\n\treturn cuenta\n}",
"function sumarDineroACuenta(valorADepositar){\n\tsaldoCuenta += valorADepositar;\n}",
"function descuentaSaldoDolares(montoDescontar){\r\n\treturn sal... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
952 / Function: MV_GetVoice Locates the voice with the specified handle. | function MV_GetVoice(handle) {
var voice;
//var flags;
//flags = DisableInterrupts();
for (voice = VoiceList.next; voice != VoiceList; voice = voice.next) {
if (handle == voice.handle) {
break;
}
}
//RestoreInterrupts( flags );
if (voice == VoiceList) {
... | [
"function MV_VoicePlaying(handle) {\n var voice;\n\n //if (!MV_Installed) {\n // MV_SetErrorCode(MV_NotInstalled);\n // return (false);\n //}\n\n voice = MV_GetVoice(handle);\n\n if (!voice) {\n return (false);\n }\n\n return (true);\n}",
"function getMatchedVoice(rv) {\n\t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Prompt Given a function `foo` that produces random numbers between 1 5 with equal probability, write a function `bar` that generates numbers between 1 7, that uses`foo` internally and NOT the built in `random` function. Examples: ``` Input: None Output: 4 If we were to run this one hundred times, we would expect there ... | function foo5() {
return Math.floor(Math.random() * 5) + 1;
} | [
"function gerarProbabilidade(){\n var prob = Math.random()*100\n return prob\n}",
"function gerarProbabilidade() {\n return Math.random();\n}",
"function gerarProbabilidade() {\r\n return Math.random();\r\n}",
"function drawProb() {\n return getRandomInt(1, 100) / 100.0;\n}",
"function random() {... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
JD_TO_PERSIANA Calculate date in the Persian astronomical calendar from Julian day. | function jd_to_persiana(jd)
{
var year, month, day,
adr, equinox, yday;
jd = Math.floor(jd) + 0.5;
adr = persiana_year(jd);
year = adr[0];
equinox = adr[1];
day = Math.floor((jd - equinox) / 30) + 1;
yday = (Math.floor(jd) - persiana_to_jd(year, 1, 1)) + 1;
m... | [
"function p2j(year, month, day) {\n var epbase, epyear;\n epbase = year - (year >= 0 ? 474 : 473);\n epyear = 474 + mod(epbase, 2820);\n return day + (month <= 7 ? (month - 1) * 31 : (month - 1) * 30 + 6) + $floor((epyear * 682 - 110) / 2816) + (epyear - 1) * 365 + $floor(epbase / 2820) * 1029983 + (PE - 1);\n}... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Check if we are requested to perform a gateway signon, i.e. a check | function useGatewayAuthentication (req) {
// can be set on request if via application supplied callback
if (req.useGateway === true) { return true }
// otherwise via query parameter
var origUrl = req.originalUrl
var useGateway = false
var idx = origUrl.indexOf(gatewayParameter)
if (idx >= 0) {
useGat... | [
"function isGatewayReady() {\n return gatewayReady;\n}",
"checkSignedInStatus() {\n if (blockstack.isUserSignedIn()) {\n // showProfile(profile)\n return true;\n } else if (blockstack.isSignInPending()) {\n blockstack.handlePendingSignIn().then(function(userData) {\n window.location ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Clear this object If we're logging in to upload docs, then don't delete the docs list | clearAuth() {
this.accessToken = false;
this.meToken = false;
this.expires = false;
this.accountId = false;
this.externalAccountId = false;
this.accountName = false;
this.baseUri = false;
this.name = false;
this.email =... | [
"resetDocs() {\n logger_1.logger('Watch.resetDocs', this.requestTag, 'Resetting documents');\n this.changeMap.clear();\n this.resumeToken = undefined;\n this.docTree.forEach((snapshot) => {\n // Mark each document as deleted. If documents are not deleted, they\n // ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Shuffle the vertices and edges according to the given permutations. | _shuffle(vp, ep) {
let left = new Array(this.edgeRange).fill(0);
let right = new Array(this.edgeRange);
for (let e = this.first(); e != 0; e = this.next(e)) {
left[ep[e]] = this.left(e); right[ep[e]] = this.right(e);
}
this.clear();
for (let e = 0; e < left.length; e++) {
if (left[e] != 0)
this.jo... | [
"function shuffle() {\n\t\tfor (let i = 0; i < n * 100; i++) {\n\t\t\tconst adj = allAdjacent();\n\t\t\tconst target = adj[parseInt(Math.random() * 997, 10) % adj.length];\n\t\t\tconst tile = getTile(target.row, target.col);\n\t\t\tswap(tile);\n\t\t}\n\t\tshuffled = true;\n\t}",
"function permute ( permutation ){... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Appends GDAX data to the end of the intervalls array | appendGDAXData(gdaxArray) {
if ( gdaxArray[0].length == undefined || gdaxArray[0].length != 6){
throw new Error("Input needs to be a 2d Array like [[1,2,3,4,5,6], [7,8,9,10,11,12]] or [[1,2,3,4,5,6]]");
}
function contains(array, obj) {
var i = array.length;
while (i--) {
... | [
"addData(datum, idx = -1) {\n const k = this.getBin(datum);\n this.dens[k] = this.dens[k] === undefined ? 1 : this.dens[k] + 1;\n if (this.dataInv[k] === undefined) {\n this.dataInv[k] = [idx];\n } else {\n this.dataInv[k].push(idx);\n }\n }",
"addData(t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Button event handler for adding a query | onAddQuery() {
var queryInput = document.getElementById("addQueryInput");
if (queryInput.value !== "") {
this.addQuery(queryInput.value);
queryInput.value = "";
}
} | [
"function handleAddQuery(e) {\n \n var w = slider.value;\n \n // create the query mark at the top of the preview window\n // and set it as the current media query\n currentQuery = addQueryMark(w);\n\n // update inline editor with the newly selected query.\n up... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Promises for freqs, datasets, etc. | getFreqs() {
return axios.get("/freqs").then((result) => result);
} | [
"function buku(){\r\n\treadBooksPromise(10000,books[0])\r\n\t.then(readBooksPromise(setTimeout, books[1]))\r\n\t.then(readBooksPromise(setTimeout, books[2]))\r\n}",
"function callback_files_test(){\r\n console.log(\"Running callback_files_test()\");\r\n var results = [];\r\n for(var f in files){\r\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get candidates base on current line input and completionRules. This is the core of smart logic of autocompletion | autocompleteCandidates(typedArgs) {
const completionRules = this.autocompleteNormalizeRules();
const activeOption = autocompleteActiveOption(completionRules.options, typedArgs);
if (activeOption) {
// if current typedArgs suggests it's filling an option
// next value would be the possible value... | [
"function autocomplete()\n{\n\tvar locationInformation = collectDetailsAboutTheCurrentSelection();\n\t//showObject(locationInformation);\n\n\t// If first in a line, complete unfinished environment.\n\tif(locationInformation.firstPlaceInLine)\n\t{\n\t\tstack = locationInformation.environmentStack;\n\t\tif(stack.leng... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Load data for wallet | async loadData(wallet) {
// Update loaded / unloaded ranges for wallet
await wallet.fetchgetWalletData('last');
wallets.updateWalletsTable();
// Detemine if load data should be restricted due to overlapping prior loaded data from another blockchain
let latestIdToFetch = this.dete... | [
"function loadWallet() {\n if (!localStorage.getItem(\"currentWallet\")) {\n return;\n }\n currentWallet = JSON.parse(localStorage.getItem(\"currentWallet\"));\n}",
"loadWallet(data, isNCC) {\n if (!data) {\n this._Alert.noWalletData();\n return;\n }\n let wallet;\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
(pattern, txt) > score | function fuzzy_search_v2 (pattern, txt) {
let patt_len = pattern.length;
let txt_len = txt.length;
if (patt_len === 0) return 0;
else if (txt_len === 0) return null;
//
// This filter kinda defeats the point of the Smith-Waterman algo.
//
// Check if txt has all the chars from pattern... | [
"function getScore(str,pattern){\n\t\tif(pattern==\"\") return 0;\n\n\t\tvar words = pattern.split(/[\\W]/);\n\t\tvar scores = [];\n\t\tfor(var w = 0; w < words.length; w++){\n\t\t\tvar score = 0;\n\t\t\tvar i = str.toLowerCase().indexOf(words[w].toLowerCase());\n\t\t\tif(i >= 0){\n\t\t\t\tscore += 1/(i+1);//(str.l... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
all the welcomeView does is show some welcome messages if the user is visiting the first time | function WelcomeView () {
if ( ! ( this instanceof WelcomeView ) ) {
return new WelcomeView();
}
var self = this;
var publishers = addPublishers( self, 'message' );
var visitCount = 0;
var isOnline = false;
function show () {
var messages = [
'welcome.firstvisit.0',
'welcome.fi... | [
"function showWelcome() {\n const demo = action(\"load-demo\", \"demo database\");\n let message = `<p>${messages.invite}<br>or load the ${demo}.</p>`;\n message += `<p>Click the logo anytime to start from scratch.</p>`;\n if (!gister.hasCredentials()) {\n const settings = action(\"visit\", \"set... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Renders the AWS CloudFormation properties of an `AWS::WAFv2::RuleGroup.RateBasedStatement` resource | function cfnRuleGroupRateBasedStatementPropertyToCloudFormation(properties) {
if (!cdk.canInspect(properties)) {
return properties;
}
CfnRuleGroup_RateBasedStatementPropertyValidator(properties).assertSuccess();
return {
AggregateKeyType: cdk.stringToCloudFormation(properties.aggregateKe... | [
"function cfnWebACLRateBasedStatementPropertyToCloudFormation(properties) {\n if (!cdk.canInspect(properties)) {\n return properties;\n }\n CfnWebACL_RateBasedStatementPropertyValidator(properties).assertSuccess();\n return {\n AggregateKeyType: cdk.stringToCloudFormation(properties.aggreg... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function: submitData Usage: submitData() Params: none Returns: none Submits post request to results php script and ends the experiment | function submitData(data, demographics) {
$("#stage").fadeOut(); //fades out the stage slide
// console.log("input will be: " + inputfile + " and output will be " + outputfile);
var submiter = $.post("https://langcog.stanford.edu/cgi-bin/NPM_negsearch_mturk/negsearch_mturk_submit.php", {
result_file_path: "negsear... | [
"function submitData(expdata) {\n\tvar outfilepath = \"bayesentences_\" + subjectID + \"_Exp1results.csv\";\n\t$(\"#stage\").fadeOut(); //fades out the stage slide\n\tvar submiter = $.post(\"https://langcog.stanford.edu/cgi-bin/NPM_bayesentences/bayesentences_submit.php\", {\n\t\tresult_file_path: outfilepath,\n\t\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
When a cell div is double clicked this updates it to an editable cell, then focuses that cell after state is updated | handleDoubleClick(){
if (this.props.cellProperties.editable){
this.setState({
editing : true
},
() => {
document.getElementById('data-table-editing-cell').focus()
}
);
}
} | [
"handleDoubleClickOnCell() {\n this.setState({\n editing: true\n });\n }",
"function doubleClickedCell(cell){\r\n\t\tif (doubleClickFlag == 0)\r\n\t\t{\r\n\t\t\tvar day1 = getFirstDayOfTheMonth()\r\n\t\t\tif ((cell < day1) || (cell > day1 + maxDays(currMonth, currYear)))\r\n\t\t\t\tret... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
filter function used to limit displayed entries between renderLower and renderUpper indexes | filter(value,index){
return (index>=this.props.renderLower && index<=this.props.renderUpper);
} | [
"function filterSize(min, max){\r\n for(let i = 0; i < listings.length; i++){\r\n let l = listings[i].val;\r\n listings[i].visible = l.size >= min && l.size <= max && listings[i].visible;\r\n }\r\n}",
"static filterRange(list, key, lower, upper) {\n return list.filter(item => item[key] <= upper && item... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Scales in or out based on a specified scheduled time. | scaleOnSchedule(id, props) {
return super.doScaleOnSchedule(id, props);
} | [
"scale(timeScale){if(timeScale!==1.0){const times=this.times;for(let i=0,n=times.length;i!==n;++i){times[i]*=timeScale;}}return this;}",
"function time_scaled() {\n\n \tvar subDivision = 60;\n \n \ttickMark1 = Math.round( (timeScale / subDivision) * 100 ) / 100;\n \ttickMark2 = 2 * tic... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Creates the control arrows for the given section | function createSlideArrows(section) {
var arrows = [createElementFromHTML('<div class="' + SLIDES_ARROW_PREV + '"></div>'), createElementFromHTML('<div class="' + SLIDES_ARROW_NEXT + '"></div>')];
after($(SLIDES_WRAPPER_SEL, section)[0], arrows);
if (options.controlArrowColor !== '#fff') {
cs... | [
"function createSlideArrows(section) {\n var sectionElem = section.item;\n var arrows = [createElementFromHTML(getOptions().controlArrowsHTML[0]), createElementFromHTML(getOptions().controlArrowsHTML[1])];\n after($(SLIDES_WRAPPER_SEL, sectionElem)[0], arrows);\n addClass(arrows, SLIDES_ARROW);\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
declaring a function that contains a loop that reconizes our `printFamily` function | function list (){
// the loop I have here is accessing my `printFamily` and then `iterating` through each object in the `family array`
for (var i = 0; i < family.length; i++){
printFamily(family[i]);
}
} | [
"function displayFamily(searchedPerson, people) {\n let spouse = searchForSpouse(searchedPerson, people);\n let parents = searchForParents(searchedPerson, people);\n let siblings = searchForSiblings(searchedPerson, people);\n let familyMembers = familyFormatting(spouse, parents, siblings);\n\n alert(familyMemb... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
function isValidFormat(format) If the format does not define a `transform` function throw an error with more detailed usage. | function isValidFormat(fmt) {
if (typeof fmt.transform !== 'function') {
throw new Error([
'No transform function found on format. Did you create a format instance?',
'const myFormat = format(formatFn);',
'const instance = myFormat();'
].join('\n'));
}
return true;
} | [
"function isValidFormat(fmt) {\n if (typeof fmt.transform !== 'function') {\n throw new Error(['No transform function found on format. Did you create a format instance?', 'const myFormat = format(formatFn);', 'const instance = myFormat();'].join('\\n'));\n }\n\n return true;\n}",
"function isValidFormat(for... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
if avoid areas intersect themselves they are invalid and no route calculation can be done. Inform the user by showing an error message in the UI | function avoidAreasError(errorous) {
ui.showAvoidAreasError(errorous);
} | [
"function routeCalculationError() {\n\t\t\tui.endRouteCalculation();\n\t\t\tui.showRoutingError();\n\t\t\tui.hideRouteSummary();\n\t\t\tui.hideRouteInstructions();\n\t\t\tmap.updateRoute();\n\t\t}",
"function ErrorHandler(err) {\n routeDrawn = false;\n mapPoint = \"\";\n NewAddressSearch();\n HideProg... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
helper functions helper function to add website to time_spent | function addWebsite(website) {
let seen = false;
chrome.storage.sync.get("time_spent", (response) => {
var temp_time_spent = response.time_spent;
for (let i = 0; i < temp_time_spent.length; i++) {
const curr = temp_time_spent[i];
if (curr[0] === website) {
... | [
"function updateTotalTime() {\n var currDomain = getActiveWebsite(); \n if(isUserActiveNow() && isWatchedWebsite(currDomain)){\n totalTimeOnWebsites += 1; \n }\n}",
"function addOrInc(sitesObject, url, label, timeTotal) {\n let work = 0\n let play = 0\n let uncategorized = 0\n label\n ? la... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Check if GUI is enabled | async gui_is_enabled() {
var enabled = await this.settings.get('core', 'gui:enabled', false);
if (String(enabled) == "true")
return true;
else
return false;
} | [
"_checkEnabled() {\n\t\tthis.isEnabled = !!this._getFirstEnabledCommand();\n\t}",
"toggleGUI() {\n\t\tthis.displayGUI = !this.displayGUI;\n\t}",
"function toggleGUI() {\n guiIsLocked = !guiIsLocked;\n}",
"get hasControls() {\n return false;\n }",
"function isConsoleEnabled() {\n\t\tret = $(\"#c... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Given a directory name, checks if the directory name is not match the list of excluded patterns. | function notExcluded(dirname: string): boolean {
return !excludedPatterns.reduce(function testExclusion(
result: boolean,
pattern: RegExp,
): boolean {
return Boolean(dirname.match(pattern)) || result;
},
false);
} | [
"_isExcludedDirectory(directory) {\n for (var i=0; i<this._folderExcludes.length; i++) {\n if (this._folderExcludes[i].test(directory)) {\n return true;\n }\n }\n return false;\n }",
"function isExcludedDir(dirPath, dirExcludes) {\n for (const exclude of dirExcludes) {\n if ((... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Insert props lu_addresstype in state | componentWillReceiveProps(props) {
this.setState(...this.state, {
lu_addresstype: props.lu_addresstype
});
} | [
"function set_entityuse_code_on_add_address(type, fldname) {\n if (window.setting_new_address && (fldname == 'shipaddresslist' || fldname == 'billaddresslist')){\n window.set_entityuse_code();\n }\n}",
"updateL2CoinContractAddress(state, L2CoinAddress) {\n state.L2CoinContractAddress = L2CoinAddr... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Interval object, useful for pausing intervals no error handling, no cleverness the interval is passed as a parameter to f | function Interval(f, tick) {
var interval,
running = false,
self = this;
this.start = function start() {
interval = window.setInterval(f.curry(self), tick);
running = true;
return self
}
this.pause = undefined; // unimplemented, requires saving the time
this.stop = function stop() {
window.clearInterval(... | [
"function Interval() {}",
"function interval_example() {\r\n var start_time = new Date();\r\n sys.puts(\"\\nStarting 2 second interval, stopped after 5th tick\");\r\n var count = 1;\r\n var interval = setInterval(function() {\r\n if (count == 5) clearInterval(this);\r\n var end_time = new Date();\r\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function initBuffers creates the nurbs | initBuffers() {
let controlPoints =
//grau 1 em u e grau 1 em v
[
// u=1
[
[-0.5, 0, 0.5, 1],
[-0.5, 0, -0.5, 1]
],
//u=2
[
[0.5, 0, 0.5, 1],
... | [
"initBuffers() {\n this.vertices = [\n this.x1, this.y1, this.z1,\n this.x2, this.y2, this.z2,\n this.x3, this.y3, this.z3\n ];\n\n this.indices = [\n 0, 1, 2\n ];\n\n this.normals = [\n 0, 0, 1,\n 0, 0, 1,\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
remove item from restaurant | function removeItem(restaurant, item) {
let restaurant = findRestaurant(restaurant)
let index = restaurant.items.indexOf(item)
restaurant.items.splice(index, 1)
return restaurant
} | [
"function removeItem(id){\r\n\tif(order.hasOwnProperty(id)){\r\n\t\torder[id] -= 1;\r\n\t\tif(order[id] <= 0){\r\n\t\t\tdelete order[id];\r\n\t\t}\r\n\t\ttemp = getCurrentRestaurant();\r\n\t\tif (temp !== undefined){\r\n\t\t\tupdateOrder(temp);\r\n\t\t}\r\n\t}\r\n}",
"removeRecipeIngredient(recipe){\n cons... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Detects if the current browser is the Nokia S60 Open Source Browser. | function DetectS60OssBrowser()
{
if (DetectWebkit())
{
if ((uagent.search(deviceS60) > -1 ||
uagent.search(deviceSymbian) > -1))
return true;
else
return false;
}
else
return false;
} | [
"function DetectS60OssBrowser()\t{\n if (uagent.search(\"webkit\") > -1)\n {\n if ((uagent.search(\"series60\") > -1 || \n uagent.search(\"symbian\") > -1))\n return true;\n else\n return false;\n }\n else\n return false;\n\t}",
"function DetectS60OssBrowser(){\n if (... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Initializes a VBOBox, finds GPU locaiton of all variables. | init() {
// Set up shader
this.shader_loc =
createProgram(gl, this.VERTEX_SHADER, this.FRAGMENT_SHADER);
if (!this.shader_loc) {
console.log(this.constructor.name +
'.init() failed to create executable Shaders on the GPU.');
return;
}
gl.program = this.shader_loc;
this... | [
"initializeBuffers() {\n let attribs = [\n new PhysicsDebugVertexAttribute(3, \"aPosition\"),\n new PhysicsDebugVertexAttribute(3, \"aNormal\"),\n new PhysicsDebugVertexAttribute(3, \"aColor\")\n ];\n this.pointVBO = new PhysicsDebugVerte... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Given a category, returns all its subcategories with no children | static getLeaves(category) {
let children = [];
if (category.children.length == 0) {
children.push(category);
} else {
category.children.forEach(child => {
children = children.concat(Category.getLeaves(child));
});
}
return chil... | [
"static getTreeList(category) {\n let children = [];\n children.push(category);\n category.children.forEach(child => {\n children = children.concat(Category.getTreeList(child));\n });\n return children;\n }",
"function getAllChildren(category){\n\t\tfullCategoryLis... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
To show/hide share checkbob field if 'create PHR' option is set for component S & T. Author Valsaraj Added on 06/16/2010 | function showHideShareOption(root) {
if ($(root+':tolvenID').value!='' || $(root+':createPHR').checked==true) {
$('shareDataContainer').style.display='block';
}
else {
$('shareDataContainer').style.display='none';
}
} | [
"function EWSRP_ShowAdvanced(show)\n{\n this.GetControl(\"RP_SPN_ADV\").style.display = show ? \"inline\" : \"none\";\n}",
"function showHidePIN(root) {\r\n\tif ($(root+':createPHR').checked==true && $('createPHRContainer').style.display!='none') {\r\n\t\t$(root+':pinNumber').disabled=false;\r\n\t\t$('pinConta... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Bottom Sheet controller for Encounter search | function ResourceSheetController($mdBottomSheet) {
this.items = [
{name: 'Start new encounter', icon: 'encounter', index: 0},
{name: 'Back to face sheet', icon: 'person', index: 1},
];
this.title = 'Encounter search options';
... | [
"function search() {\n $log.debug(\"MapQueryForm.search called\");\n $state.go(\n \"map\",\n {\n mapQuery: mapQueryForm.mapQuery,\n time: Date.now()\n }\n );\n\n $mdSidenav(\"healthBamSiden... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
drum pads can be activated by click or by keypress | handleKeyPress(e) {
let drumKeys = drumData.filter(drum => drum.kit === this.state.kit).map(drum => drum.label)
let key = e.key.toUpperCase()
let audio = document.getElementById(key)
if(drumKeys.includes(key)) {
e.preventDefault()
this.setState({curDrum: audio.parentNode.id})
audio.par... | [
"function pressPadButton(key) {\n if(nes === undefined)\n return;\n\n nes.pad1.pressButton(key);\n }",
"function handlePadPress(e) {\n if (power) {\n let clip;\n let index;\n if (e.type == \"click\") {\n clip = $(\"#\" + e.target.textContent).get(0);\n i... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Submit a restaurant review | static submitRestaurantReview(review) {
return fetch(
`${DBHelper.DATABASE_URL_REVIEWS}`, {
method: 'POST',
body: review
}
).then(response => response.json());
} | [
"static async postReview (restaurant) {\r\n try {\r\n // Collect info for POST request\r\n const name = document.getElementById('reviewName').value\r\n const rating = document.getElementById('reviewRating').value\r\n const comment = document.getElementById('reviewComment').value\r\n cons... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Loads a molecule CML file from a given filename. | function loadMolecule(filename) {
var xhttp = new XMLHttpRequest();
xhttp.overrideMimeType('text/xml');
xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
parseResponse(this);
}
};
xhttp.open('GET', filename, true);
xhttp.send();
} | [
"load(filename) {\n loadnetwork(this,filename);\n }",
"function loadMolecule() {\n\n // Add atomic coordinates to molecule array\n addAtom(6, 0.000, 0.000, 0.000);\n addAtom(1, 0.874, 0.618, 0.000);\n addAtom(1, -0.874, 0.618, 0.000);\n addAtom(1, 0.000, -0.618, 0.874);\n addAtom(1, 0.0... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Evaluates, or attempts to evaluate, a BigIntLiteral | function evaluateBigIntLiteral({ node, environment }) {
// Use BigInt from the Realm instead of the executing context such that instanceof checks won't fail, etc.
const _BigInt = getFromLexicalEnvironment(node, environment, "BigInt").literal;
// BigInt allows taking in strings, but they must appear as BigIn... | [
"function IntegerLiteralExpression() {\n}",
"function evaluateNumericLiteral({ node }) {\n return Number(node.text);\n}",
"function NumberLiteralExpression() {\n}",
"visitBigintLiteral(ctx) {\n\t return this.visitChildren(ctx);\n\t}",
"function isBigInt(variable) {\n return typeof variable === \"bigi... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Define the class for speed controller It should encapsulate the logic of speed control for various type of languages. At the moment, they are Chinese, and space segmented Latin languages. The nuance is that Chinese needs to be read a lot faster than Latin. | function SpeedController(wpm) {
// wpm: words per seconds
this.wpm = wpm;
this.interval = 60000/this.wpm; // the interval in milli-seconds to show a word
this.wpmProjected = this.wpm;
this.readingChinese = false;
this.CHINESE_INTERVAL_COEEFICIENT = 0.5; // Chinese can be a lot faster
... | [
"setMotorSpeed () {\n var tickDelta = this.tickDelta()\n\n switch (true) {\n case (tickDelta <= 3):\n this.motor.speed = SPEEDS.SINGLE_KERNEL\n break\n case (tickDelta > 3 && tickDelta <= 8):\n //this.motor.speed = SPEEDS.VERY_SLOW\n this.motor.speed = SPEEDS.SLOW\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Resets the json editor fields. | function resetJsonEditorFields()
{
jsonEditorHandler.resetJsonEditorFields();
} | [
"function clearEditor()\r\n{\r\n jsonEditorHandler.clearJsonEditor();\r\n}",
"reset() {\n this.setFields();\n super.reset();\n }",
"function resetData(){\n editAmount.value=null\n editNotes.value=null\n}",
"reset() {\n if ('reset' in this.editor) {\n this.editor.reset();\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Event handler for the 'Try again' button that is shown upon an error during ActiveDirectory join. | onAdJoinErrorRetry_() {
this.showStep(ENROLLMENT_STEP.AD_JOIN);
} | [
"function onLoginFailed() {\n\t\tUIState.unauthenticated();\n\t\talert('Login Failed!');\n\t}// Event handler for login form button",
"function onSignupFailure() {\n $(\"#signupError\").show();\n $(\"#signupButton\").prop(\"disabled\", false);\n }",
"function unableToJoin() {\n\tview.alert(\"Un... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Clean polygon or polyline shapes (inplace) | function cleanShapes(shapes, arcs, type) {
for (var i=0, n=shapes.length; i<n; i++) {
shapes[i] = cleanShape(shapes[i], arcs, type);
}
} | [
"function deletePolylines() {\n polylines.forEach((line) => line.setMap(null));\n}",
"function clearPolyLines() {\n currentPolyLines = [];\n}",
"clearPolygons() {\n this.drawnMarkers.forEach(p => map.removeElement(p));\n this.drawnMarkers = [];\n \n this.removeConstructionLines... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Given options, attachSql2 will produce the correct SQL to attach a database file in sqlite3. This is for the second database file. | function attachSql2(options) {
console.log("attachSql1:options="+JSON.stringify(options));
// @todo possibly use something other than dbtable2
let retSql = "ATTACH DATABASE '" + options.cwd2 + options.dbfile2 + "' " + 'AS' + ' ' + options.dbtable2;
return retSql;
} | [
"function attachSql2(options) {\n debug(\"attachSql1:options=\"+JSON.stringify(options));\n // @todo possibly use something other than dbtable2\n let retSql = \"ATTACH DATABASE '\" + options.cwd2 + options.dbfile2 + \"' \" + 'AS' + ' ' + options.dbtable2;\n return retSql;\n}",
"function attachSql1(opt... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
check wether saving account or current account | function isSavingOrCurrentAcc(accNo,callback){
conn.query(`SELECT COUNT(account_num) AS count FROM current_account WHERE account_num = `+ accNo, function(err,result){
if(result[0].count == 1){
callback(null,"current");
}
else{
conn.query(`SELECT COUNT(account_num) AS ... | [
"function checkAcctAndSave()\n{\n\t//check to see if the ac_id entered is null\n\tvar parsed_ac_id = $('ac_id_part1').value +\n\t\t\t\t$('ac_id_part2').value +\n\t\t\t\t$('ac_id_part3').value +\n\t\t\t\t$('ac_id_part4').value +\n\t\t\t\t$('ac_id_part5').value +\n\t\t\t\t$('ac_id_part6').value +\n\t\t\t\t$('ac_id_pa... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Now write a second function called moreArrayMultiply that takes three arguments: a number, an array, and a function: (eg. num, arr, funct). Have this function return the result of number and array when called as arguments to arrayMultiplyAgain which you passed in as an argument. Define a variable and in it store the re... | function arrayMultiplyAgain(num, arr) {
const newArr = arr.map(item => item * num)
return newArr
} | [
"function moreArrayMultiply(num, arr, callback) {\n const result = callback(num, arr)\n return result\n}",
"function arrayMultiply(num1, num2, cb){\n res = num1 * num2\n return cb (res)\n}",
"function getMultipliedArray(array, number) {\n // Your code here.\n let newArr = [];\n\n for (const... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
sets all views back to default before task started | function resetViews(){
showElement(startTaskButton);
enableElement(startTaskButton);
hideElement(taskRunningText);
showElement(timerSection);
hideElement(proceedText);
hideElement(commentSection);
disableElement(stopTaskButton);
hideElement(taskFailureSection);
hideElement(taskFinish... | [
"setDefaultView() {\r\n this.stateView = \"all\";\r\n this.partyView = \"all\";\r\n }",
"executeDefaultAddTaskActions() {\n\t\t\tthis.route = new Route();\n\t\t\tthis.task = this.getDefaultTaskProperties();\n\t\t}",
"function setDefaultView(view) {\n var currentView = getCurrentView();\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
open a twitter stream based on a passed in track parameter uses the node event emitter to send events to itself that can be watched for. this is useful when extending twitter into other components. | stream(track) {
const _opts = {
method: "post",
url: this._stream,
qs: {
track,
language: "en",
stall_warnings: true
}
};
// create initial request with auth & options
this.activeStream = this._request(_opts);
this.activeStream.on("response", response ... | [
"function twitterInit() {\n\n\ntwit = new twitter( twitAuth );\n\ntwit.stream('statuses/sample', function(stream) {\n stream.on('data', function(data) {\n console.log( data );\n });\n});\n\n/*\ntwit.stream('user', {track:'moresheth'}, function(stream) {\n stream.on('data', function(data) {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
getCurrentImage Displays the image in /scannedmaps that has the provided filename. Inputs: Image filename Outputs: Displays the specified image on the result page Returns: None | function getCurrentImage(imageName){
fullImagePath = imagePath + imageName;
if (imageName != ""){
document.getElementById('quarryImage').src=fullImagePath; //Displays the image
}else{
document.getElementById('quarryImage').src = emptyImagePath; //Displays an empty white image, used when no image should be displa... | [
"function getCurrentImage() {\n\tvar currentImagePath = $(\".overlayImg img\").attr(\"src\");\n\tvar currentImage = currentImagePath.substring(currentImagePath.lastIndexOf(\"/\") + 1, currentImagePath.length);\n\t\n\treturn currentImage;\n}",
"static getCurrentImage() {\n var getByClass = document.getEleme... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Parse adResponse, put demand into outParcels. AppNexus response contains a single result object. | function __parseResponse(sessionId, adResponse, returnParcels) {
//? if (DEBUG){
var results = Inspector.validate({
type: 'array',
exactLength: 1,
items: {
type: 'object',
properties: {
htSlot: {
... | [
"function __parseResponse(sessionId, adResponse, returnParcels) {\n //? if (DEBUG){\n var results = Inspector.validate({\n type: 'array',\n exactLength: 1,\n items: {\n type: 'object',\n properties: {\n htSlot: {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Geocode an address and callback with zip5, address (formatted address), and location (lat, lng) properties | function geocode(address, callback) {
var query = qs.stringify({ address: address, sensor: false, components: 'country:US' })
, reqtmpl = "http://maps.googleapis.com/maps/api/geocode/json?%s"
, req = util.format(reqtmpl, query)
, geo
;
request(req, function(err, res, body) {
if (err) {
... | [
"function geocode( address, callback ) {\r\n\tnew gm.Geocoder().geocode({\r\n\t\taddress: address\r\n\t}, callback );\r\n}",
"function processAddress()\n{\n\tvar address = getAddress();\n\n\t//creating a geocoder object\n\tvar geocoder = new google.maps.Geocoder();\n\n\tgeocoder.geocode({'address': address}, func... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Santa's senior gift organizer Elf developed a way to represent up to 26 gifts by assigning ' + 'a unique alphabetical character to each gift. After each gift was assigned a character, ' + 'the gift organizer Elf then joined the characters to form the gift ordering code. Santa asked his organizer to order the characters... | function sortGiftCode(code){
let bits = code.split("");
bits.sort();
return bits.join("");
} | [
"function sortGiftCode(code) {\n return code.split('').sort().join('');\n}",
"function sortGiftCode(code) {\n return code.split('').sort().join('')\n}",
"function alphabetSoup(str) {\n inputStr = \"yellow pillow\";\n // get input string letters and assign it to index of alphStr\n inputArr = inputStr.split(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Find all the interior faces. Time complexity: O(E) | function getInteriorFaces(input) {
var vertices = input["vertices"];
var edges = input["edges"];
var graph = makeGraph(vertices, edges);
// Make a map from each edge to its next CCW edge.
// Time complexity: O(|E|).
var nextCCW = {};
for (var u = 0; u < vertices.length; u++) {
var i = 0;
... | [
"function findOuterEdges() {\n var edges = []\n var faces = geometry.faces\n for (var firstI = 0; firstI < faces.length; firstI++) {\n var firstFace = faces[firstI]\n firstFace.eachEdge(function(vertIndexA, vertIndexB, other) {\n var isEdge = true\n for (var secondI = 0; secondI < faces.length; s... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This can be a special character like a separator that shows up in a type name This is an odd set of characters. Some come from characters that are allowed by C++, like . Others are characters that are specified in the type and assembly name grammer. | function IsSpecialTypeChar(ch, ref) {
switch (ch) {
case ":":
case ".":
case "$":
case "+":
case "<":
case ">":
case "-":
case "[":
case "]":
case ",":
case "&":
case "... | [
"function isNameChar(c){return isNameStartChar(c)||c>=0x30&&c<=0x39||c===0x2D||c===0x2E||c===0xB7||c>=0x0300&&c<=0x036F||c>=0x203F&&c<=0x2040;}",
"function symbol(name){\r\n return lexeme(string(name));\r\n}",
"function fixSpecialNames(text){\n\n //if text in ['__proto__','NaN','Infinity','undefined','n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Drain the Hunger Bar | function hungerDrain () {
if (hungerBar.w > 0) {
hungerBar.w -= hungerBar.speed;
} else if (hungerBar.w <= 0) {
stopGame();
}
} | [
"update(){\n\t\tif(this.tick){\n\t\t\tthis.depleteBar(.00005);\n\t\t}\n\t}",
"function sleepBarHard() {\n if (energyRemaining >= 100) {\n return;\n } else {\n energyRemaining= energyRemaining + 6;\n energyBarUpdate();\n moneyRemaining= moneyRemaining - 4;\n moneyBarUpdate();\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
ModuleExportName : IdentifierName StringLiteral | parseModuleExportName() {
if (this.test(Token.STRING)) {
const literal = this.parseStringLiteral();
if (!IsStringWellFormedUnicode(StringValue(literal))) {
this.raiseEarly('ModuleExportNameInvalidUnicode', literal);
}
return literal;
}
return this.parseIdentifierName();
} | [
"function generateNameForImportOrExportDeclaration(node) {\n var expr = ts.getExternalModuleName(node);\n var baseName = expr.kind === 9 /* StringLiteral */ ? ts.escapeIdentifier(ts.makeIdentifierFromModuleName(expr.text)) : \"module\";\n return makeUniqueName(baseName);... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Renders proper page according to STORE.view value. Dependancy: renderStartQuiz renderQuestionText renderQuizStatusBar renderQuestionResult renderFinalResult | function render() {
if (STORE.view === 'start') {
renderStartQuiz();
$('.intro').show();
$('.quiz').hide();
$('.result').hide();
$('.quizStatus').hide();
} else if (STORE.view === 'quiz') {
renderQuestionText();
renderQuizStatusBar();
$('.intro').... | [
"function quizRender() {\n \n if (STORE.quizStart === false) {\n homePage();\n }\n else if (STORE.questionNumber >= 0 && STORE.questionNumber < 5) {\n questionGenerator();\n }\n else if (STORE.questionNumber >= 5) {\n resultPage(); \n scoreTracker();\n }\n}",
"function renderPage() {\n if (STO... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Shortcut Keys for Lowpass Res are R, T, Y | function lowPassResLow() {
lowPassFilter.Q.value = 2;
} | [
"function setLowPass() { //Called when any reverb slider is moved\n lowPassFilter.frequency = lowPassFrequency.value / 1;\n lowPassFilter.peak = lowPassPeak.value / 1;\n}",
"function LowResEncoding() {\n \"use strict\";\n this.REPEAT_HALF = 49;\n this.NEW_STROKE_CODE = 60;\n this.REVERSE_X_CODE ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Functions Takes a heading and adds a "" link for permalinks: | function upgradeHeading(h) {
const df = importTemplate("_permalink-template");
const a = df.querySelector(".permalink");
requestAnimationFrame(() => ((a.href = `#${h.id}`), h.appendChild(df)));
} | [
"function linkHeadings() {\n \n var headings = getHeadings();\n \n headings.forEach(function (heading) {\n heading.element.innerHTML = '<a href=\"#' + heading.id + '\">' +\n heading.element.innerHTML + \"</a>\";\n });\n }",
"function addPermalinkHead... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Prints the constructed ontology in turtle format after everything has been written to the graph. The rdf module doesn't print URI's in brackets which means '' symbols in the URIs are treated as turtle comments | function outputOntology(){
var arrayRep = graph.toArray().map(function(stmt){
return stmt.toTurtle(profile);
});
fs.appendFileSync(outputPath, arrayRep.join('\n'));
} | [
"function toTurtle(data) {\n var rval = '';\n var prefixesUsed = {};\n\n var subjects = data.getSubjects();\n for(si in subjects) {\n var s = subjects[si];\n var triples = data.getSubjectTriples(s);\n var predicates = triples.predicates;\n\n // print the subject\n if(s.charAt(0)... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Verify FTDC is already running if there is a relative log file path. | function verifyFTDCStartsWithRelativeLogFile() {
jsTestLog("Running verifyFTDCStartsWithRelativeLogFile");
verifyCommonFTDCParameters(admin4, true);
// Skip verification of diagnosticDataCollectionDirectoryPath because it relies on comparing
// cwd vs dbPath.
// 1. Enable successfully
assert.c... | [
"_validateFilePath() {\n // Ensure Log Directory Exists First\n let logDir = path.dirname(`./logs/temp.txt`);\n\n if (!fs.existsSync(logDir)) {\n console.log(`Unable to locate ${logDir}, creating now...`);\n fs.mkdirSync(logDir);\n this._validateFilePath();\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
function to clear all the previous results | function clearPreviousResults() {
setMapOnAllMarkers(null);
markersOnMap = [];
arrayOfLocations = [];
} | [
"function clearResults() {\n\tclosedSet = [];\n\topenSet = [];\n\tpath = [];\n}",
"function clearResults() {\n $results.children().remove();\n }",
"clearResults() {\r\n this.results.testStat = 0;\r\n this.results.terms = [];\r\n }",
"function clearResults(){\n $(settings.result... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Adds force in the X direction | addXForce(ddx) {
this.ddx += dx
return this
} | [
"function xF(){\n\tif(vx>0)\n\t\tvx = vx - xFriction;\n\tif(vx<0)\n\t\tvx = vx + xFriction;\n}",
"applyForwardForce(force) {\n let thrust = { x: 0, y: force };\n let newThrust = rotateAroundPoint(rads(this.rotation), { x: 0, y: 0 }, thrust);\n this.move.v.x += newThrust.x;\n this.move.... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Check Request GET /detail | async function inspectDetailRequest() {
const { body } = await supertest(app)
.get(`/detail?id=${demo_movie_id}`)
.expect(200)
} | [
"detail(accessPermissionId) {\n return this.request.get(`detail?accessPermissionId=${accessPermissionId}`);\n }",
"static getRideDetail(req, res) {\n if (helper.emptyChecker(req.params.id)) return ride.getRide(req, res);\n return res.status(400).json({ error: 'id[number] is required' });\n }",
"isDet... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
get the image sizes set within the theme. | getImageSizes() {
// current image, theme image sizes
const { image, imageSizes } = this.props;
// if ajax hasn't completed
if (!image) return [];
let options = [];
// image sizes of current image
const sizes = image.media_details.sizes;
//
for (co... | [
"static getImageSizes() {\n let imgWidth = parseFloat($(\"#image\").outerWidth());\n let imgHeight = parseFloat($(\"#image\").outerHeight());\n return [imgWidth, imgHeight];\n }",
"getImageSizes() {\r\n return this.imageSizes_;\r\n }",
"get _imageSize() {\n c... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Fill Timeslider with min and max Values > | function init_timeslider(data){
console.log("init_timeslider");
var minDatum = data[0][selectedOptions.dateField];
var maxDatum = data[data.length-1][selectedOptions.dateField];
document.getElementById("time_slider").setAttribute("max", data.length-1);
} | [
"function init_timeslider(data){\n\t\tvar minDatum = data[0].datum;\n\t\tvar maxDatum = data[data.length-1].datum;\n\t\tdocument.getElementById(\"time_slider\").setAttribute(\"max\", data.length-1);\n\t}",
"function setTimeSlider() {\n $('.range-slider').jRange({\n from: 1980,\n to: 2016,\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
1)Create a personAccount out function. It has firstname, lastname, incomes, expenses inner variables. It has totalIncome, totalExpense, accountInfo,addIncome, addExpense and accountBalance inner functions. Incomes is a set of incomes and its description and expenses is also a set of expenses and its description. | function personAccount()
{
let firstname='Snigdha',lastname='Sharma',income,expense
let incomes=[1000,2000,1340,5670],expenses=[100,56,789]
function totalIncome()
{
return incomes.reduce((total,income)=>total+income,0)
}
function totalExpense()
{
return expenses.reduce((total... | [
"function personAccount(fName, lName, income, expense, inc, exp) {\n const firstname = fName;\n const lastname = lName;\n let incomes = income;\n let expenses = expense;\n\n totalIncome = () => {\n return incomes;\n };\n totalExpenses = () => {\n return expenses;\n };\n \n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get the zone ID from the given root domain | async function getZoneIdFromDomain(domain) {
return new Promise((resolve, reject) => {
axios.request({
url: '/zones',
method: 'GET',
baseURL: cfBaseEndpoint,
headers: {
'Authorization': 'Bearer ' + cfAPIToken,
... | [
"function getOtDomainId() {\n const domains = {\n 'adobe.com': '7a5eb705-95ed-4cc4-a11d-0cc5760e93db',\n 'hlx.page': '3a6a37fe-9e07-4aa9-8640-8f358a623271',\n 'project-helix.page': '45a95a10-dff7-4048-a2f3-a235b5ec0492',\n 'helix-demo.xyz': 'ff276bfd-1218-4a19-88d4-392a537b6ce3',\n 'adobeaemcloud.co... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
} / second method called in the lifecycle of react is getderivedStatefromprops it is a n abstract method so use static we can use props of App classes is here | static getDerivedStateFromProps(props)
{
console.log("[App.js] props from class");
return null;
} | [
"static getDerivedStateFromProps(props, state){\n console.log('[App.js] getDeviredStateFromProps');\n console.log(props);\n console.log(state);\n return state;\n }",
"static getDerivedStateFromProps(nextProps, prevState) {\n console.log('--------------------------- getDerivedStateFromProps ----... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Renders the AWS CloudFormation properties of an `AWS::KafkaConnect::Connector.ApacheKafkaCluster` resource | function cfnConnectorApacheKafkaClusterPropertyToCloudFormation(properties) {
if (!cdk.canInspect(properties)) {
return properties;
}
CfnConnector_ApacheKafkaClusterPropertyValidator(properties).assertSuccess();
return {
BootstrapServers: cdk.stringToCloudFormation(properties.bootstrapSe... | [
"function cfnConnectorKafkaClusterPropertyToCloudFormation(properties) {\n if (!cdk.canInspect(properties)) {\n return properties;\n }\n CfnConnector_KafkaClusterPropertyValidator(properties).assertSuccess();\n return {\n ApacheKafkaCluster: cfnConnectorApacheKafkaClusterPropertyToCloudFor... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
startShieldBearer sets up the interval used to draw Shield Bearer on the HTML5 canvas, it also contains the game over state | function startShieldBearer(){
// set up keyboard tracker
tracker = new KeyTracker();
// set up the game
bearer = new Bearer();
shield = new Shield();
// set interval at 60 Frames per second
gameInt = setInterval(runShieldBearer, 1000/60);
// set interval to spawn enemies
spawnInt = setInterval(spawnEnemies,1000);
... | [
"function runShieldBearer(){\n\n// redraw the gameWindow\nupdate();\ndraw();\n\n}",
"function activate_shields(){\n\t\t\t//Log data\n\t\t\tvar end_time = performance.now();\n\t\t\tvar rt = end_time - shield_start_time;\n\t\t\tshield_activated = true;\n\t\t\tresponse.ships.rt_shield_activated.push(rt); //logging o... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
external nextprime: t > t Provides: ml_z_nextprime const Requires: bigInt, ml_z_normalize | function ml_z_nextprime(z1) {
// Interestingly, the zarith next_prime only returns
// probabalistic primes. We do the same, with the
// same probablistic parameter of 25.
// https://fossies.org/dox/gmp-6.1.2/mpz_2nextprime_8c_source.html
z1 = bigInt(z1)
var one = bigInt(1);
var two = bigInt(2);
i... | [
"function ml_z_nextprime(z1, z2) {\n\n}",
"function ml_z_probab_prime(z1, z2) {\n\n}",
"function bnIsProbablePrime(t){\nvar i,x=this.abs();\nif(x.t==1&&x[0]<=lowprimes[lowprimes.length-1]){\nfor(i=0;i<lowprimes.length;++i){\nif(x[0]==lowprimes[i])return true;}\nreturn false;\n}\nif(x.isEven())return false;\ni=1... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Initializes a new instance of the SimpleGauge class. | function SimpleGauge(config) {
_classCallCheck(this, SimpleGauge);
if (!config.el) {
throw new Error('The element must be valid.')
}
if (isNaN(config.height) || config.height <= 0) {
throw new RangeError('The height must be a positive number.... | [
"function SimpleGauge(config) {\n _classCallCheck(this, SimpleGauge);\n\n if (!config.el) {\n throw new Error('The element must be valid.');\n }\n\n if (isNaN(config.height) || config.height <= 0) {\n throw new RangeError('The height must be a positive number.');\n }\n\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Adds a restaurant obj to the excluded cookie. | function addExcludeCookie(excludedObj){
var newCookie = "";
var existingCookies = document.cookie; //existing cookies
if (existingCookies.length == 0) { //new cookie is first cookie
newCookie = "excluded=" + JSON.stringify(excludedObj) + "|";
}
else { //adding to existing cookies
newCookie = existingC... | [
"function addExcludeCookie(id) {\n\tvar newCookie = \"\";\n\tvar existingCookies = document.cookie; //existing cookies\n\tif (existingCookies.length == 0) { //new cookie is first cookie\n\t\tnewCookie = \"excluded=\" + id + \";\";\n\t}\n\telse { //adding to existing cookies\n\t\tnewCookie = existingCookies + \" \" ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Filter : Adjust saturation | function filter_saturation(dict) {
const s = dict['intensity'] || 1.2;
return function (img) {
const H = filter_getHSLChannel({ c: 'h' })(img);
const S = filter_getHSLChannel({ c: 's' })(img);
const L = filter_getHSLChannel({ c: 'l' })(img);
const Sp = S.map((e, i) => (i % 4 === 3) ? 255 : Math.min(255, s ... | [
"function set_saturation() {\n var saturation_val=document.getElementById(\"saturation_tool\").valueAsNumber;\n\tobj.saturate=saturation_val;\n\tdocument.getElementById('output_image').style.filter=\"contrast(\"+obj.contrast+\"%) blur(\"+obj.blur+\"px) opacity(\"+obj.opacity+\"%) grayscale(\"+obj.gscale+\"%) bri... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Create notes section `supportData` is a support_statement `browserId` is a compat_block browser ID | function writeNotes(strings, support, browserId, legendItems) {
let output = '<section class="bc-history" aria-hidden="true"><dl>';
if (Array.isArray(support)) {
for (supportItem of support) {
writeSingleNote(strings, supportItem, browserId, legendItems);
}
} else {
writeSingleNote(strings, sup... | [
"function writeSupportInfo(supportData, browserId, compatNotes) {\n let output = '';\n\n // browsers are optional in the data, display them as \"?\" in our table\n if (!supportData) {\n output += getVersionString(null);\n // we have support data, lets go\n } else {\n output += getVersionString(supportDat... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Normalizes a GUID to lowercase. Returns '' if guid is not given. | function normalizeLower(guid, includeBrackets) {
if (includeBrackets === void 0) { includeBrackets = false; }
return guid ? _normalizeBrackets(guid.toLowerCase(), includeBrackets) : '';
} | [
"function normalizeLower(guid, includeBrackets) {\r\n if (includeBrackets === void 0) { includeBrackets = false; }\r\n return guid ? _normalizeBrackets(guid.toLowerCase(), includeBrackets) : '';\r\n}",
"normalize(beacon) {\n if (!beacon) {\n return '';\n }\n\n return (beacon.... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
EXERCISE 3 Define a function, add2Numbers(num1, num2), to return the sum of 2 values | function add2Numbers(num1, num2){
return num1+num2
} | [
"function add2Numbers(num1, num2) {\n return num1 + num2;\n}",
"function add2Numbers(num1, num2){\n return num1+num2;\n}",
"function sum(num1, num2) {return num1 + num2}",
"function addNumbers(num1, num2) {\n return num1 + num2\n}",
"function sum(num1, num2) {}",
"function addNumbers(number1, number2... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |