query stringlengths 9 34k | document stringlengths 8 5.39M | negatives listlengths 19 20 | metadata dict |
|---|---|---|---|
count down the score each time user fills out a card correctly | function scoreDown() {
if(score > 0) {
score -= 1
scoreBoard.textContent = `Cards Remaining: ${score}`;
} else if(score = 0) {
scoreBoard.textContent = "Great work, scientist!"
}
} | [
"function cardcount() {\n if (unbr.score === 8){\n win();\n }\n if (unbr.drawdeck.length < 0){\n loss();\n return;\n }\n if (unbr.gameover !== true){\n unbr.lamppercent = Math.round((unbr.drawdeck.length/unbr.lamptotal)*10)/10;\n lampfade();\n }\n $(\"#scoreca... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Draws an options popup (without text) on a canvas, using the roundRect() method. Should be used in conjunction with a styled textbox (see drawTextBox()). | function drawOptionsPopup (context, width, height, frameWidth) {
var fontSize = 14;
context.fillStyle = "rgba(0, 0, 0, 0.5)";
roundRect(context, CANVAS_WIDTH - (width - 2 * frameWidth),
CANVAS_HEIGHT - (height - frameWidth), width - (2 * frameWidth),
height - (2 * frameWidth), 0, true, false)
// dr... | [
"function paint_options(x, y, answer) {\n\t\tctx.fillStyle = \"green\"; // differentiate options from snake and paint it to green\n\t\tctx.fillRect(x*optionsize, y*optionsize, optionsize, optionsize);\n\t\tctx.strokeStyle = \"white\";\n\t\tctx.strokeRect(x*optionsize, y*optionsize, optionsize, optionsize);\n\t\tctx... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Note: SimpleInterval is used only internally | function SimpleInterval(a, b) {
if (!(a instanceof SimpleFloat) || !(b instanceof SimpleFloat) || a.add(b.negate()).sign() > 0) {
throw new TypeError();
}
this.a = a;
this.b = b;
} | [
"function Interval() {}",
"get interval(){return 1000/this._ticksPerSecond;}",
"_make (units) {\n let inst = new Interval(this.time)\n inst.units = units\n return inst\n }",
"function timeInterval() {\n\tthis.increment = 0;\n}",
"function Interval(start , stop ) {\"use strict\";\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Check if the provided selector is scoped (has context) | function isScoped(selector) {
return selector && scopedSelectorRegex.test(selector);
} | [
"function isSelectorUniqueAmongSiblings(element, selector) {\n return (element.parentElement.querySelectorAll(supportScopeSelector() ? combineSelector(':scope', selector) : selector)\n .length === 1);\n}",
"function inPolymerFlavorContext(context) {\n var _a, _b;\n var declaration = context.getDec... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
returns true if this is the last one in the opened overlays stack | get _last() {
return this === OverlayElement.__attachedInstances.pop();
} | [
"get _last() {\n return this === OverlayElement.__attachedInstances.pop();\n }",
"get _last(){return this===OverlayElement.__attachedInstances.pop();}",
"isLastFrame()\n {\n return this.runningFrame === 9\n }",
"get isTopLayer()\n {\n return this.parent.index == -1;\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
if active is null, set active to target, setList, toggle else if active is button clicked, untoggle else, nothing, because something else is active | function buttonClick(e) {
if (active === null) {
setActive(e.target.id);
tools.find(obj => obj.category === e.target.id && setList(obj.skills));
set(!toggle);
} else if (active === e.target.id) {
setActive(null);
set(!toggle);
} else return;
} | [
"toggleActive() {\n\t\tif (this.active) {\n\t\t\tthis.deactivate();\n\t\t}\n\t\telse {\n\t\t\tthis.activate();\n\t\t}\n\t}",
"function toggleActive () {\n setIsActive(!isActive);\n }",
"function setActive(element)\n {\n //if the selected element isn't already active\n if(!element.hasClass(\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function for submit multiple timesheets | function validateMulti(act)
{
var ele = document.getElementById("timesubmit");
elehref = ele.href;
ele.href = 'javascript:void(0)';
form=document.sheet;
var val_tot=0;
val=form.rowcou.value;
val_tot=form.rowcou.value;
var timeSubmitFlag = 0;
var temp_arr = form.servicedatefrom.value.split("... | [
"async submitWithTimeSheet() {\n this.loading = true;\n try {\n let { value } = await this.createMessagePrompt();\n let savedTemplate = await this.requestSaveTemplate({\n name: value,\n content: this.timeSheetData\n });\n if (savedTemplate) {\n await ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Delete target from a state collection (object). | function deleteTargetFromStates(states, target){
if(target === undefined){
delete states[''];
} else if (typeof target.test === 'function') {
// Regexp
for (var id in states) {
if (typeof id === 'string' && target.test(id)) {
delete states[id];
}
... | [
"function destroyTarget(user, target, i) {\n // Save data before the removal, for message.\n var curID = target['_id'];\n var curInstance = target.instance;\n var curName = target.name;\n\n // Remove from world targets. Notice that instance is not an index!\n delete world.targets[target['_id']][target.instanc... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Append this to the list of buckets to potentially delete At the end of a test, we clean up buckets that may not have gotten destroyed (for whatever reason). | function rememberToDeleteBucket(bucketName) {
bucketsToDelete.push(bucketName);
} | [
"removeBucket(bucket) {\n this.bucketsToRemove.push(bucket);\n }",
"clear() {\n this.buckets.length = 0;\n this.instanceSet.clear();\n this.instances.length = 0;\n }",
"_updateBuckets() {\n\n\t\tvar now = this._clock.getTickCount();\n\t\tvar rollingStartedAt = ( now - this._dur... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
save the current choice | function saveChoice(c) {
var pn = getPlayerNameFromCharpane();
var cnum = choiceNum();
if (pn && cnum) {
var map = getChoices();
map[cnum] = c;
saveChoices(map);
}
} | [
"function saveCurrentAnswer() {\r\n const selections = UI.getSelectedAnswers();\r\n currentQuestion().userAnswers = selections;\r\n}",
"function saveSelection()\n{\n\tlocalStorage.setItem(\"chosenFlag\" , flagIndex)\n\tlocalStorage.setItem(\"chosenCarbody\" , carbodyIndex);\n\tlocalStorage.setItem(\"chosenC... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
eslintdisable function to call in the console to skip time to 5 seconds | function skipTime() {
chrome.runtime.sendMessage({cmd: 'SET_TIME', timeLeft: '5'});
} | [
"function testMode() {\n seconds = 3;\n}",
"static get timeToSleep() {}",
"function logTime() {\n console.log(\"hello\");\n\n if(counter === 5) {\n clearInterval(intervalId);\n }\n\n counter++;\n}",
"static async delayIfAutomating() {\r\n if (process.env.VSLS_TEST_DELAY_RELOAD) {\r\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Fills the internal grid with zeros, i.e. deletes all block markers | _empty_grid() {
for (var x = 0; x < this._internal_grid_size[0]; x++) {
for (var y = 0; y < this._internal_grid_size[1]; y++) {
this._set_grid_value(x, y, 0);
}
}
} | [
"clear() {\n\t\tlet i;\n\t\tthis.grid = [];\n\t\tfor (i = 0; i < this.w; i++) {\n\t\t\tthis.grid[i] = new Array(this.h).fill(null);\n\t\t}\n\t}",
"function clearGhostGrid(){\n for (var i = 0; i < gridHeight; i++)\n {\n for (var j = 0; j < gridWidth; j++)\n {\n setGridCell(ghostGrid,... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
function returns a dictionary with k:v as mealName: price | function getMealsPrices(){
const ss = getSpreadSheet(MEAL_SHEET);
const priceCol = getColumnNumber(PRICE_COL);
const nameCol = getColumnNumber(NAME_COL);
// Check if Columns exist
if(priceCol === 0 || nameCol === 0) return {};
const len = priceCol - nameCol;
var meals = ss.getRange(2,nameCol + 1,ss.... | [
"function dish(name, ingredients, price) {\n return {\n name: name,\n ingredients: ingredients,\n price: price\n };\n}",
"function getPrice(name, our) {\n if (name == \"Scrap Metal\") {\n return { metal: 0.11 };\n } else if (name == \"Reclaimed Metal\") {\n return { ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
================================= Normalize the data =================================== | function normalize(data) {
var ret = { input: [], output: [] };
for (var i = 0; i < data.length; i++) {
var datum = data[i];
ret.output.push(datum.output);
ret.input.push(datum.input);
}
ret.output = Matrix(ret.output);
ret.input = Matrix(ret.input);
return ret;
} | [
"function normalizeData()\n{\n // Get number of dimensions (assumed to be the same for all elements)\n dimensionCount = descriptorData[0].length;\n normalizedData.length = descriptorData.length;\n\n // Initialize normalizedData as array of empty arrays\n for (var i = 0; i < normalizedData.length; i++)\n {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns true if the argument is a valid Shade value | function isValidShade(shade) {
return typeof shade === 'number' && shade >= Shade.Unshaded && shade <= Shade.Shade8;
} | [
"function isValidShade(shade) {\n 'use strict';\n return typeof shade === 'number' && shade >= Shade.Unshaded && shade <= Shade.Shade8;\n}",
"static isHex(value) {\r\n if (value.length % 2 === 1) {\r\n return false;\r\n }\r\n return /^[\\da-f]+$/g.test(value);\r\n }",
"f... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sets the callback that wil be called when a client has published data to a topic | onClientPublished(callback) {
this.pubCallback = callback;
} | [
"onClientSubscribed(callback) {\n this.subCallback = callback;\n }",
"authorizeClientPublish(callback) {\n this.authPubCallback = callback;\n }",
"function subscribed (topic, client) {\n console.log('subscribed : ', topic);\n}",
"__broker_subscribed(topic, client) {\n console.log... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Splash screen hides only when application is loaded and ready | function HideSplashScreenWhenReady() {
navigator.splashscreen.hide();
console.log('Splashscreen hiding...');
} | [
"function loadSplashScreen(){\n\t\t\t\tsetTimeout(function(){\n\t\t\t\t\tgenerateFramework(\"splash\", generatePage)\n\t\t\t\t\t},1500);\n\t\t\t\tsetTimeout(initialisePage, 4000);\n\t\t}",
"function showSplashScreen() {\n toggleElements($main, $splash);\n const hideSplashScreenTimeout = setTimeout(function ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Initialize metronome by extracting video title, quering bpm etc. startMetro bool (describes if metro should be started after init) | function initMetro(startMetroAfterInit, title) {
if (!title) {
//Extract video title from HTML
try {
state.title = document.querySelector("#container > h1 > yt-formatted-string").innerText;
} catch {
throw new Error("Could not retrieve the Vid... | [
"function mobileInit () {\n self.load(self.initialVideo)\n self.mobileStart = true\n $rootScope.$broadcast(playerLoadedEvent.name)\n }",
"function initializeYouTubeMetronome(t_metronome) {\n\t\tvar Metronome = function( position_helper, position, refresh_ms){\n\t\t\tthis.position = position || 0... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get the policy on a bucket or an object prefix. __Arguments__ `bucketName` _string_: name of the bucket `callback(err, policy)` _function_: callback function | getBucketPolicy(bucketName, cb) {
// Validate arguments.
if (!isValidBucketName(bucketName)) {
throw new errors.InvalidBucketNameError(`Invalid bucket name: ${bucketName}`)
}
if (!isFunction(cb)) {
throw new TypeError('callback should be of type "function"')
}
let method = 'GET'
... | [
"getBucketPolicy(bucketName, cb) {\n // Validate arguments.\n if (!isValidBucketName(bucketName)) {\n throw new errors.InvalidBucketNameError(`Invalid bucket name: ${bucketName}`)\n }\n if (!isFunction(cb)) {\n throw new TypeError('callback should be of type \"function\"')\n }\n\n let me... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Query ES index for the provided term | queryTerm (term, offset = 0) {
const body = {
from: offset,
query: {
multi_match: {
"type": "best_fields",
"query": term,
"lenient": true
}
},
highlight: {
fields: {"*": {}},
"pre_tags": ["<em>"],
"post_tags": ["</em>"],
... | [
"queryTerm(term, offset = 0) {\r\n const body = {\r\n from: offset,\r\n query: {\r\n match: {\r\n text: {\r\n query: term,\r\n operator: 'and',\r\n fuzziness: 'auto'\r\n }\r\n }\r\n },\r\n highlight: {fields: {text: {}}}\r\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Deletes release with releaseId, then creates new one. | deleteRelease (releaseId) {
console.log('Deleting release...')
this.octo.repos.deleteRelease({
owner: this.config.owner,
repo: this.config.repo,
release_id: releaseId
}).then(result => {
console.log('Release was deleted successfully...')
// Use previous name and body.
co... | [
"async function createRelease(releaseDescription, prevReleaseId) {\n // Create draft release if BOOL_CREATE_RELEASE is undefined\n // Publish release if BOOL_CREATE_RELEASE is not undefined\n const boolCreateDraft = !BOOL_CREATE_RELEASE\n\n const releaseResponse = await octokit.repos.createRelease({\n owner:... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Create table cell with object ALT and AZ as strings | function create_alt_az_cell(alt_az) {
return $("<td>", {
class: "objects-alt-az",
}).append(
$("<span>").append(
$("<span>", {
class: "objects-label",
text: "ALT:",
}),
$("<span>", {
text: alt_az[0],
... | [
"function createObjectTable(obj) {\n var heads = [], colWidths = [], vals = [];\n _.each(obj, function(v, k) {\n v = String(v);\n heads.push(k.replace(/(^|\\s)([a-z])/g, uppercaseRegexMatch));\n vals.push(v);\n var width = Math.max(strlen(k), strlen(v)) + 2;\n if (width > exports.maxTableCell) {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Given maybeArray, print an empty string if it is null or empty, otherwise print all items together separated by separator if provided | function join(maybeArray, separator) {
return maybeArray ? maybeArray.filter(function (x) {
return x;
}).join(separator || '') : '';
} | [
"function join(maybeArray, separator) {\n return maybeArray\n ? maybeArray\n .filter(x => x)\n .join(separator || \"\")\n : \"\";\n }",
"function join(maybeArray, separator) {\n\t return maybeArray ? maybeArray.filter(function (x) {\n\t return x;\n\t }).join(separator || '') :... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Create a function to start drawing the dashboard and visualizations for Industry Collaborators and Research Strategists | function createDashboardIr(data, data2) {
/*
* Loading all Units os Assessment and use this for populating
* select box which will control the whole layout and all the visualizations
* on this page
*/
// Load all Unit of Assessment options
var uoas = dataManager.loadAllUoAs(data);
// Load all City... | [
"function initDash(){\n\n\t\n\t//get parameters from URL ant puts in array\n\tvar parameters = getParameters();\n\n\t//populates an array with all given values extracted from the csv\n\tvar features = populateFeatures(parameters);\n\n\t//filters and build the GUI\n\tfilteredFeatures = filterData(features, parameter... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
xCreateElement, Copyright 20012007 Michael Foster (CrossBrowser.com) Part of X, a CrossBrowser Javascript Library, Distributed under the terms of the GNU LGPL | function xCreateElement(sTag)
{
if (document.createElement) return document.createElement(sTag);
else return null;
} | [
"function xCreateElement(sTag)\n{\n if (document.createElement) return document.createElement(sTag);\n else return null;\n}",
"function getCreateElement(element) {\n\treturn document.createElement(element);\n}",
"function create(element){\r\n\treturn document.createElement(element);\r\n}",
"function newElem... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Handle table Load More and Less buttons with row calculations, handle showing and hiding | function checkLoadMoreButton() {
var $trs = $(".table-loader").DataTable().rows().count();
var $trs_length = $trs;
var $current_length = $('.table-loader>tbody>tr:visible').length;
if ($current_length >= $trs_length || $current_length < 10) {
$btn_more.hide();
} else ... | [
"function showMoreRowsOfData(showMore) {\n var $showMoreDataButton = $(\"#AuditTrackingExpand_Helm\");\n var $igGridScroller = $(\"#AuditTrackingResultsListWrapper_helm .ui-iggrid-scrolldiv\");\n if (showMore) { //show more\n if (auditTrackingScrollHeight === null) {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Iteratively renders a list of events onto either term1 or term2 calendar, according to identifier | function eventsRender(events, identifier) {
if(activeTab == "term1"){
for (var i = 0; i < events.length; i++) {
calendar_term1.fullCalendar('renderEvent', events[i], true);
}
} else if(activeTab == "term2"){
for (var i = 0; i < events.length; i++) {
... | [
"function renderEvents(month, year)\n{\n $('div.day').empty();\n\n events[month].forEach(function(curEvent) \n {\n \n var checked = $(':checkbox').filter(\n function() {\n return $(this).val() === curEvent.organizer.displayName;});\n\n var begin = curEvent.start.dateTime || curEvent.start... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sets tickets to be chunks of 25 a.k.a pagination manually | function setTicketsToChunks(ticketArray, chunkSize) {
let array = [];
while(ticketArray.length) {
array.push(ticketArray.splice(0, chunkSize))
}
return array;
} | [
"setPageSize(cnt) {\n this.pageSize = cnt;\n }",
"getTickets(page=1){\n return axios.get(`https://${this.domain}.zendesk.com/api/v2/tickets?page=${page}&per_page=${this.perPage}`, {\n headers: {\n Authorization: `Basic ${this.token}` \n }})\n }",
"setPageSize(c... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns the popper's placement, ignoring shifting (topstart, etc) | function getBasicPlacement(popper) {
var fullPlacement = popper.getAttribute(PLACEMENT_ATTRIBUTE);
return fullPlacement ? fullPlacement.split('-')[0] : '';
} | [
"function getPopperPlacement(popper) {\n var fullPlacement = popper.getAttribute('x-placement');\n return fullPlacement ? fullPlacement.split('-')[0] : '';\n}",
"function getBasicPlacement(popper) {\n var fullPlacement = popper.getAttribute(PLACEMENT_ATTRIBUTE);\n return fullPlacement ? fullPlacement.split('-... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Checks to see if a char is used to mark begining and ending of string. Returns bool result. True = special, False = not special | function isMarkStrChar(compareChar) {
if ( markStrChars.indexOf(compareChar) == -1 )
return false; // found no marked string chars, return false
return true;
} | [
"function isMarkStrChar(compareChar)\r\n{\r\n if ( markStrChars.indexOf(compareChar) == -1 )\r\n return false; // found no marked string chars, return false\r\n else\r\n return true;\r\n}",
"function isMarkStrChar(compareChar)\n{\n if ( markStrChars.indexOf(compareChar) == -1 )\n return false... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
unset modifier keys on keyup | function clearModifier(event){
var key = event.keyCode, k,
i = index(_downKeys, key);
// remove key from _downKeys
if (i >= 0) {
_downKeys.splice(i, 1);
}
if(key == 93 || key == 224) key = 91;
if(key in _mods) {
_mods[key] = false;
for(k in _MODIFIERS)... | [
"function clearModifier(event){\n var key = event.keyCode, k,\n i = index(_downKeys, key);\n\n // remove key from _downKeys\n if (i >= 0) {\n _downKeys.splice(i, 1);\n }\n\n if(key == 93 || key == 224) key = 91;\n if(key in _mods) {\n _mods[key] = false;\n for(k in _MODIFIERS) ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
set common var in column range | function setCommonVar(row) {
// crpmst_bat_flg or CRPMST_BAT_FLG
cPhysicalNameOfColumn = gValuesOfRange[row][gIndexOfPhysicalNameOfColumn];
// CRPMST_BAT_FLG
cPhysicalNameOfColumnUpper = cPhysicalNameOfColumn.toUpperCase();
// batFlg
cPhysicalNameOfColumnReplaceTblNameWithCamel = convCamel(cPhy... | [
"function CellBoundMulti() {}",
"function make_range_number_cols(start_column, repeat_number, tab) {\n let from_to1 = {\n filter_type: \"custom_func\",\n// html5_data: \"\",\n custom_func: rankedRangeFiltert1,\n };\n let from_to2 = {\n filter_type: \"custom_func\",\n// ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
function which gets added to the function for the mouseenter listener on the microblog_icons | function mouseEnterMicroblogIcon(e) {
// Change the cursor style as a UI indicator.
map.getCanvas().style.cursor = "pointer";
// get the coordinates and description of the microblog_icon
var coordinates = e.features[0].geometry.coordinates... | [
"function mouseEnterMicroblogIcon(e) {\n // Change the cursor style as a UI indicator.\n map.getCanvas().style.cursor = \"pointer\";\n\n // get the coordinates and description of the microblog_icon\n var coordinates = e.features[0].geometry.coordinates.slice();\n var des... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Check if promo code exists and returns promo discount amount | function checkPromoCode() {
if (document.getElementById("promoCode").value) {
const promoEntered = document.getElementById("promoCode").value;
const promo = promos.find(findPromo => findPromo.code == promoEntered);
if (promo) {
document.getElementById("bookError").innerHTML = "";... | [
"function getPromoAmount() {\n\tvar promoCodeAmount = 0;\n\tif(bp_validate_promo_code_obj){\n\t\tpromoCodeAmount = bp_validate_promo_code_obj.promoCodeAmount;\t\n\t}\n\tif(promoCodeAmount) {\n\t\treturn promoCodeAmount;\n\t}\n\treturn 0;\n}",
"function checkCode(code) {\n if (DISCOUNTCODE === code){\n h... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This is for banner only. If the creative is changed, then we need to put different suggested initial banner outline on the video area. Different creatives have different aspect ratios, hence this is needed. If the user choose "add new creative", but have yet to specify any, then we will have a default aspect ratio & in... | function handleCreativeChanged(cxt) {
if (currObj) {
console.log('handleCreativeChanged (currObj valid, ' + cxt + ", ad_type=" + currObj.infoWindow.ad_type);
if (currObj.infoWindow.ad_type != 1)
return;
}
else {
console.log('handleCreativeChanged (currObj NULL, ' + cxt);
... | [
"function editHSObjDrawPositioningRect(imgsrc, aspect_ratio) {\n //console.log(' editHSObjDrawPositioningRect ar=' + aspect_ratio);\n var visible = true;\n var oldhs = $('#hs_new');\n if (oldhs.length > 0) \n visible = oldhs.is(\":visible\");\n oldhs.remove();\n var cannot_use = false;\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Set global variable source with the content of file selected. | function selectSource() {
fileSource = document.getElementById("cksource").files[0];
selectFile("cksource",function (text) {
source = cleanLatexStress(text);
});
} | [
"setSourceContent(aSourceFile, aSourceContent) {\n this.sourceContents[util.toSetString(aSourceFile)] = aSourceContent;\n }",
"setSourceContent(aSourceFile, aSourceContent) {\n this.sourceContents[util.toSetString(aSourceFile)] = aSourceContent;\n }",
"set source (src) {\n // reset state befo... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
flush alias module export | flushAliasExport(g, type, file) {
g = g || THINK.CACHES.ALIAS_EXPORT;
file && require.cache[file] && delete require.cache[file];
THINK.loadCache(g, type, null);
} | [
"flushAliasExport(g, type, file) {\n g = g || THINK.CACHES.ALIAS_EXPORT;\n file && require.cache[file] && delete require.cache[file];\n THINK.cache(g, type, null);\n }",
"exit(path, state) {\n if (state.reexport) {\n const source = state.reexport.source;\n co... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
3261 3262 Transitions the caption depending on alignment // 3263 | function captionTransition(caption, duration) { // 3264
if (caption.hasClass("center-align")) { // 3265
caption.velocity({opacity: 0, translateY: -100}, {duration: du... | [
"function captionTransition(caption, duration) {\n if (caption.hasClass(\"center-align\")) {\n caption.velocity({ opacity: 0, translateY: -100 }, { duration: duration, queue: false });\n } else if (caption.hasClass(\"right-align\")) {\n caption.velocity({ opac... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Does the provider require a Vault token | requireVaultToken() { } | [
"function verifyToken( ) {\n\n }",
"function tokenIsVaild(ctx) {\n bearerHeader = ctx.header['authorization'];\n token = bearerHeader.split(' ')[1];\n console.log(token);\n try {\n Jwt.verify(token, appsecret);\n } catch {\n return false;\n }\n return true;\n}",
"hasToken()... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
problem 63 powerful digit counts | function powerfulDigitCounts() {
var count = 0;
//we only need to search 1 through 9, anything above 10 is hopeless
var base, exp, val, digit;
for (base = 1; base <= 9; base++) {
val = base;
exp = 1;
digit = 1;
while (val >= digit && val < digit * 10) {
count+... | [
"function getCount(n)\n{\n n=n.toString();\n var len=n.length;\n var i=0;\n var count=0;\n var j=1;\n while(j<len)\n {\n i=0;\n while(i<len)\n {\n if((i+j)<=len)\n {\n //console.log(n.substring(i,i+j));\n if(parseInt(n)%p... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Logs an error that a property is not supported on an element. | function logUnknownPropertyError(propName, tNode) {
var message = "Can't bind to '".concat(propName, "' since it isn't a known property of '").concat(tNode.value, "'.");
console.error(formatRuntimeError("303"
/* UNKNOWN_BINDING */
, message));
} | [
"function logUnknownPropertyError(propName, tNode) {\n console.error(`Can't bind to '${propName}' since it isn't a known property of '${tNode.tagName}'.`);\n}",
"function logError( prop ) {\n console.error( prop + \" already exists, please change the name to avoid conflicts with the Phaser engine!\" );\n}",... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Keeps track of the bubble movement | function bubbleMovement() {
bubble.x += bubble.vx;
bubble.y += bubble.vy;
//Bubble resets when reaches the top
if (bubble.y < 0) {
bubble.x = random(width);
bubble.y = height;
}
//Added difficulty: Faster bubbles.
if (currentScore > fasterSpeedScore) {
bubble.vy -= 0.05;
}
} | [
"moveBubble() {\n this.x += this.vx;\n this.y += this.vy;\n }",
"function moveBubble() {\n bubble.x += bubble.vx;\n bubble.y += bubble.vy;\n}",
"function move() {\n //loop through every bubble\n for (var i = 0; i < numBubbles; i++) {\n var currentBubble = bubbleArray[i];\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
calculate and display remaining players required to meet pool size | function remainers() {
let remaining = poolSize - pool.length;
stepTwo.className = "alert alert-warning";
stepTwo.textContent = "You need " + remaining + " more players.";
} | [
"getPotSize() {\n var potSize = 0;\n this.players.forEach(function(player) {\n potSize += player.roundBetAmount;\n });\n return potSize;\n }",
"function computeTotalProportionMoneyWithheld() {\n var totalProportionMoneyWithheld = 0\n Object.keys(strategies).forEach(player => {\n const alloc... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
!!! BONUS EXERCISE !!! / Calculate the square root of n as follows: 1 start with a guess 2 if your guess is good enough, return your guess 3 improve your guess 4 repeat step 2 | function sqrt(n) {
for(var guess = makeGuess(); !checkGuess(n, guess); guess = improveGuess(n, guess))
return guess
} | [
"function squareRt(n) {\n for(let guess = 1; guess <= n; guess++) {\n if(guess * guess === n) {\n return guess;\n }\n }\n return -1;\n }",
"function squareRootFn(square){\n\n //we're going to be guessing at what the squareroot is\n let guess = squ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This assertions compares with other input column to check whether the last name is unique | function test_last_name_unique(colName1, colName2){
var result_query = `${colName1} != ${colName2}`
return result_query
} | [
"validateDuplicatedName(currentAttribute, nextAttributes) {\n if (!_.isEmpty(currentAttribute.name)) {\n const validName = !isDuplicatedField(currentAttribute.name, nextAttributes.map(attribute => attribute.name));\n this.setState({ nameValidationError: validName ? '' : 'Name already exists' });\n }... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Do not touch anything above this line / Implement your solution here `node` is a node in the list `f` is the function that should be applied on every value | function traverse(node, f) { //tar två arg. en node lista och en funktion
f(node.value) //du vill att funktionen appliseras på varje listitem. Kalla på funk och ge den listan som argument.
if(node.next){ //i listan finns två keys. Value och next.
traverse(node.next, f) //finns keyN next så kalla på funktio... | [
"forEach(fn){\n\t\tlet node = this.head;\n\t\twhile(node){\n\t\t\tfn(node);\n\t\t\tnode = node.next;\n\t\t}\n\t}",
"forEach(fn) {\n //assign node to head\n let node = this.head;\n //assign couner for iterator\n let counter = 0;\n //while a node exists\n while (node) {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
invoke when player click the square | function squareClicked(e) {
let square = e.target;
let alreadyClicked = square.dataset.clicked !== "-1";
if (alreadyClicked) {
// if the square has been clicked
console.log("You must select a different square");
} else {
if (playerTurn == 0) {
// if the red player clicks a square
playerC... | [
"clickedOnSquare(e){\n game.xTurn = !game.xTurn\n\n if(game.xTurn){\n UI.addClassX(e.target.id)\n }else{\n UI.addClassO(e.target.id)\n };\n }",
"function click(box, player, square) {\n\tbox.style.backgroundColor = player.color;\n\tplayer.moves.push(square);\n\t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Intialize all chess pieces | initPieces() {
let black_pos = 0;
let black_pawn_pos = 1;
let white_pos = 7;
let white_pawn_pos = 6;
let king_x = 4;
let queen_x = 3;
this.initEachPiece(this.id++, 0, black_pos, Const.TEAM.B, Const.CHESS.Rook);
this.initEachPiece(this.id++, 7, black_pos, Const.TEAM.B, Const.CHESS.Rook);
this.initEac... | [
"initPieces() {\n\t\tlet black_pos = 0;\n\t\tlet black_pawn_pos = 1;\n\t\tlet white_pos = 7;\n\t\tlet white_pawn_pos = 6;\n\n\t\tlet downward = this.team == Const.TEAM.W ? this.downward : !this.downward;\n\t\tlet king_x = downward ? 3 : 4;\n\t\tlet queen_x = downward ? 4 : 3;\n\n\t\tif (downward) {\n\t\t\tblack_pos... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
takes user to invoices | function goToInvoices(source) {
hideExtraInvoiceValues();
//sets the selected PE to a global var
SELECTED_PE_ID = source;
displayInvDisplay();
} | [
"function goToEditInvoice() {\n\t\t\t\t\t\t\tif (data.invoiceId > 0) {\n\t\t\t\t\t\t\t\tdiState.go('portal.invoices.editById', { id: data.invoiceId });\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}",
"function goToInvoice(service) {\n $state.go('restricted.invoices.view', {\n userId: service.cstmr_id,... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Name: checkgamewining Desc: Check persons on both side and determine whether player won the game or loose Input: None Output: null | function checkgamewining() {
console.log('CheckWining Start>');
let personOnSide2 = side2.childElementCount;
let personOnSide1 = side1.childElementCount;
if ((personOnSide2 == '6') || (personOnSide1 == '0')) {
alert(`You Won The Game\n Time Played: ${playingHours}:${playingMinutes}:${playingSeco... | [
"function checkgamewining(){\n console.log('CheckWining Start>');\n let personOnSide2 = side2.childElementCount;\n let personOnSide1 = side1.childElementCount;\n if((personOnSide2 == '6')||(personOnSide1=='0')){\n alert(`You Won The Game\\n Time Played: ${playingHours}:${playingMinutes}:${playing... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
we'll need to actually do a walk from the root, because you can have a cycle of deps that all depend on each other, but no path from root. Also, since the ideal tree is loaded from the shrinkwrap, it had extraneous flags set false that might now be actually extraneous, and dev/optional flags that are also now incorrect... | [_resetDepFlags] () {
const tree = this.idealTree
const marked = new Set()
for (const node of this.idealTree.inventory.values()) {
node.extraneous = true
node.dev = true
node.devOptional = true
node.optional = true
}
} | [
"[_loadShrinkwrapsAndUpdateTrees] (seen = new Set()) {\n const shrinkwraps = this.diff.leaves\n .filter(d => (d.action === 'CHANGE' || d.action === 'ADD') &&\n d.ideal.hasShrinkwrap && !seen.has(d.ideal))\n\n if (!shrinkwraps.length)\n return\n\n const Arborist = this.constructor\n retu... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Any time the part property is set, tell that part its associated with this model | __updatePart(part) {
part._messageTypeModel = this;
} | [
"function processPart(part) {\n part.requested = true;\n updateStatusDisplay();\n dataSource.process(czmlPath + part.url).then(function() {\n part.loaded = true;\n updateStatusDisplay();\n\n // Follow the vehicle with the camera.\n if (!viewer.trackedEntity) {\n viewer.tracke... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Complete elliptic integral of the 1st kind. | function comp_ellint_1(k) {
return ellint_1(k, Math.PI / 2);
} | [
"function ellint_1(k, phi) {\r\n // FORMULA OF INTEGRAL\r\n var formula = function (x) {\r\n return 1.0 / _Common_formula(k, x);\r\n };\r\n return _Post_process(k, phi, formula);\r\n}",
"function _computeIntegral( scope ) \n {\n var w = scope.width, h = scope.height, rowLen = w<<2,\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
increment animateUnit slowly from startUnit to endUnit | animationLoop() {
// increment animateUnit by a fraction each loop
let delta = this.endUnit - this.startUnit;
if (delta < 0) {
delta = this.totalUnits + delta;
}
this.animateUnit += delta / this.framesPerSec;
if (this.animateUnit >= this.totalUnits) {
// wrap around from max to 0
... | [
"function animateCounter (el, start, end) {\n\n\t\tvar num = start;\n\n\t\tvar timer = setInterval(function(){\n\t\t\t\n\t\t\tif (num <= end) {\n\t\t\t\tel.innerText = num;\t\n\t\t\t\tnum++;\n\t\t\t} else {\n\t\t\t\tclearInterval(timer);\n\t\t\t\tanimated = true;\n\t\t\t}\t\n\t\t}, 100);\n\t}",
"function animate(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
validates a new meeting to include all required fields,has to be real profile_id for host and attendee_id | function validNewMeeting(req, res, next) {
const meeting = req.body;
if (!meeting) {
res.status(400).json({
message: 'Missing Meeting Data',
});
} else if (!meeting.meeting_topic) {
res.status(400).json({
message: 'Missing meeting_topic field',
});
} else if (!meeting.meeting_date) {... | [
"function validateCreateMeeting(meeting) {\n\n const schema =\n {\n topic: Joi.string().required(),\n discussion_points: Joi.string().required(),\n timming: Joi.string().required(),\n sender_email: Joi.string().required(),\n reciever_email: Joi.array(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
=========================================================================== Compress as much as possible from the input stream, return the current block state. This function does not perform lazy evaluation of matches and inserts new strings in the dictionary only for unmatched strings or for short matches. It is used ... | function deflate_fast(s,flush){var hash_head;/* head of the hash chain */var bflush;/* set if current block must be flushed */for(;;){/* Make sure that we always have enough lookahead, except
* at the end of the input file. We need MAX_MATCH bytes
* for the next match, plus MIN_MATCH bytes to ... | [
"function zip_deflate_fast() {\n while (zip_lookahead != 0 && zip_qhead == null) {\n var flush; // set if current block must be flushed\n\n /* Insert the string window[strstart .. strstart+2] in the\n * dictionary, and set hash_head to the head of the hash chain:\n */\n zip_INSERT_STRING();\n\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function that changes the card to show and disables it so that you cannot click it. | function displayCard(card) {
card.className = "card open show disable";
} | [
"function hideCard() {\n\t$('.card').each(function() {\n\t\tif ($(this).hasClass('not-match')) {\n\t\t\t$(this).attr('class', 'card');\n\t\t}\n\t})\n\t//make the cards clickable again\n\tenabled = true;\n}",
"function showCard() {\n $(\"#no-article-card\").show();\n }",
"function enable() {\n\tallCards.forE... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Create function to initialize circles, randomizing their locations and velocities and pushing them to the circle array | function init(){
circleArr = [];
for (var i = 0; i < 1000; i++){
var radius = Math.random() * 2 + 1;
var x = Math.random() * (innerWidth - radius * 2) + radius;
var y = Math.random() * (innerHeight - radius * 2) + radius;
var dx = (Math.random() * -0.5) * 5;
var dy = (Math.random()... | [
"function initCircle(){\n circleArray = [];\n for (var i = 0; i < 300; i++){\n var fill = colorArray[Math.floor(Math.random() * colorArray.length)];\n var radius = ((Math.random() * 5 + 1) * 2);\n var x = Math.random() * (innerWidth - (radius * 2)) + radius;\n var y = Math.random() * (innerHeight - (r... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
execute a set of commands from config.js file to create a Clever Cloud Application uses by the `app...` templates | function createBrandNewApp ({template, db, answers, promptsAnswers}) {
try {
// call the template commands
let config = require(`${process.cwd()}/templates/${template}/config.js`)
let cmd = config.cmd({
template: template
, application: answers.application
, displayName: answers.displa... | [
"function createHybridApp(config) {\n config.projectDir = path.join(config.targetdir, config.appname);\n // console.log(\"Config:\" + JSON.stringify(config, null, 2));\n\n // Make sure the Cordova CLI client exists.\n var cordovaCliVersion = cordovaHelper.getCordovaCliVersion();\n if (cordovaCliVersi... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Adding addedtohomescreen class to be targeted when used as PWA. | function ath(){
(function(a, b, c) {
if (c in b && b[c]) {
var d, e = a.location,
f = /^(a|html)$/i;
a.addEventListener("click", function(a) {
d = a.target;
while (!f.test(d.nodeNa... | [
"function ath(){\n\t\t\t(function(a, b, c) {\n\t\t\t\tif (c in b && b[c]) {\n\t\t\t\t\tvar d, e = a.location,\n\t\t\t\t\t\tf = /^(a|html)$/i;\n\t\t\t\t\ta.addEventListener(\"click\", function(a) {\n\t\t\t\t\t\td = a.target;\n\t\t\t\t\t\twhile (!f.test(d.nodeName)) d = d.parentNode;\n\t\t\t\t\t\t\"href\" in d && (d.... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
PROTECTED Makes visible the popup menu associated to this connection. | function showConnectionPopupMenu(x, y) {
if (this.popupListItems.getLength() > 0) {
document.getElementById(MAP).map.setPopupMenu(this.popupListItems, x, y);
}
} | [
"function showMenu() {\n\t\tsuper.showMenu();\n\t}",
"function showPopupMenu() {\n\t\tif (document.getElementById(this.id) != null) {\n\t\t\tdocument.getElementById(this.id).style.visibility = \"visible\";\n\t\t}\n\t}",
"onShowMenu(){\n\t\tif(!this.menu_shown){\n\t\t\tactions.toggleMenu();\n\t\t}\n\t}",
"func... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Continues the enumeration of leds started using yFirstLed(). | function YLed_nextLed()
{ var resolve = YAPI.resolveFunction(this._className, this._func);
if(resolve.errorType != YAPI_SUCCESS) return null;
var next_hwid = YAPI.getNextHardwareId(this._className, resolve.result);
if(next_hwid == null) return null;
return YLed.FindLed(next_hwid);
... | [
"function iterate_full() {\n\tconsole.log(\"Switching Xmas LEDs ON with iterative with colours mode\");\n\toffset = 0;\n\tleds = setInterval(function () {\n\t\tvar i=NUM_LEDS;\n\t\twhile(i--) {\n\t\t\tpixelData[i] = colorwheel((offset + i) % 256);\n\t\t}\n\t\tpixelData[offset] = colorwheel(ic % 256);\n\n\t\toffset ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
add the att to decision tree based on user selection, add the row to table and update mask | function addLogic(att){
//we need to know what the user select (i.e. blue musk with seByUser) in the
//current tab
chrome.tabs.executeScript(
null,
{ file: 'app/tableCtrl/getBlueSeByUser.js' },
(results) => {
let commonAttSeByUser = JSON.parse(results[0]);
let commonAttVal = commonAttSeByUser[att];
... | [
"function onClickAddCompoundAttributeToTable() {\n var sUpperAttributeName = document.getElementById(\"idUpperAttributeName\").value;\n var aSubValues = [];\n var oTable = document.getElementById(\"idTableCompoundAttribute\");\n\n //prepare array for sub attributes\n for (var i = 1; i < oTable.rows.l... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This function fills the comboId combobox with the list of journals already in existance. | function listJournals(comboId, entries, bAddNewEntry) {
var comboSelector = $('#'+comboId);
comboSelector.empty();
if(bAddNewEntry) {
// Default option is to create a new journal
comboSelector.append(new Option('<New...>', ''));
}
// Existing
if(0 < entries.le... | [
"function loadJournals() \n\t{\n\t\t// Clean the current list\n\t\t$('#bibliography_journal').html(\"\");\n\n\t\tvar url = Routing.generate('edb_bibliography_journal_list');\n\n\t\t$.getJSON(url + '.json', function(data) \n\t\t{\n\t\t\tif(data.length == 0)\n\t\t\t\t$('#bibliography_journal').html(\"<option></option... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
An processor to include events in a web page in ascending order. The following classes will be associated to the generate elements: Table for the main table element Caption for the table caption | function DrawTableEventProcessorAsc(container, caption, cssClassPrefix){
this.eventFound = false;
this.container = container;
this.addRow = function(event){
if (!this.eventFound){
this.table = createEmptyTable(caption, cssClassPrefix);
this.container.appendChild(this.table);
this.eventFound = tr... | [
"function DrawTableEventProcessorDec(container, caption, cssClassPrefix){\r\n\tthis.lastRow = null;\r\n\tthis.container = container;\r\n\t\r\n\tthis.addRow = function(event){\r\n\t\tvar row = createEventTableRow(event, cssClassPrefix);\r\n\t\tif (this.lastRow==null){\r\n\t\t\tthis.table = createEmptyTable(caption, ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Initializes a new instance of the PrefetchedDataEventArgs class | function PrefetchedDataEventArgs(appId, url, data) {
var _this = this;
_microsoft_sp_core_library__WEBPACK_IMPORTED_MODULE_1__["Validate"].isNonemptyString(appId, 'id');
_microsoft_sp_core_library__WEBPACK_IMPORTED_MODULE_1__["Validate"].isNonemptyString(url, 'url');
_this = _super.call(... | [
"function init() {\n fetchData(); \n registerEventListeners();\n }",
"constructor() {\n\t\tsuper();\n\t\tthis._callback = this._defaultCallback;\n\n\t\tthis._data = {data: []};\n\t\tthis._createObserverList();\n\t\tthis._getUserDataFromDB();\t\t\n\t}",
"constructor() {\n\t\tsuper();\n\t\tthis._... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Method that initializes the connext client for a specific address, along with all the listeners required | async init(address) {
const { provider } = Engine.context.NetworkController.state;
if (SUPPORTED_NETWORKS.indexOf(provider.type) !== -1) {
initListeners();
Logger.log('PC::Initialzing payment channels');
client = new PaymentChannelsClient(address);
try {
Logger.log('PC::setConnext', provider);
a... | [
"function _initialise(ipAdress, port) {\n console.log(\"STM ARM Client initialisation...\");\n\n ipAdress = ipAdress.split(\" \").join(\"\");\n armClient.connect(port, ipAdress, function() {\n console.log(\"\\nSTM ARM Client connected on \" + ipAdress + \":\" + port);\n });\n armClient.on(\"error\", functio... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gera o resumo para uma arma do estilo. | function GeraResumoArmaEstilo(arma_personagem, primaria, estilo) {
var resumo = '';
var arma_estilo = primaria ? estilo.arma_primaria : estilo.arma_secundaria;
for (var categoria in arma_estilo.bonus_por_categoria) {
var bonus = arma_estilo.bonus_por_categoria[categoria];
var string_ataque = '';
bonus... | [
"function almacenar(){\n\tmemoria = getResult();\n\tguardar();\n}",
"function _GeraResumoEstilo(estilo) {\n var resumo = estilo.nome + ': (';\n resumo += estilo.arma_primaria.nome + ': [' +\n GeraResumoArmaEstilo(\n ArmaPersonagem(estilo.arma_primaria.nome), true, estilo) + ']';\n if (estilo.nome =... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Set the data to display as preformatted text in the "input" element. | function setDataDisplay(dataText) {
$("#input").empty().append($("<pre>").append(dataText));
} | [
"formatValue(data) {\n if (this.allowRichText) {\n this.formatText({ newText: data });\n }\n }",
"function inputToText() {\n $('input[type=\"text\"]').each(function() {\n $(this).parent().text($(this).parent().data('value'));\n });\n }",
"_syncTextBoxConte... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Helper function for markdown rendered marked Renders links outside apify.com in readme with rel="noopener noreferrer nofollow" and target="_blank" attributes | function markedSetNofollowLinks(href, title, text) {
let urlParsed;
try {
urlParsed = new URL(href);
}
catch (e) {
// Probably invalid url, go on
}
const isApifyLink = (urlParsed && /(\.|^)apify\.com$/i.test(urlParsed.hostname));
return (isApifyLink)
? `<a href="${hre... | [
"getHTMLCode() {\n let Remarkable = require('remarkable');\n let md = new Remarkable();\n // Get markdown\n let content = md.render(this.props.note.message);\n\n // Include regex to add links\n let regex = /https?:\\/\\/(www\\.)?[-a-zA-Z0-9@:%._~#=]{2,256}\\.[a-z]{2,4}\\b([... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Buscar todos los rols | function getRols(req,res){
var identity_usuario_id = req.usuario.sub;
var page = 1;
if(req.params.page){
page = req.params.page;
}
var itemsPerPage = 100;
Rol.find().sort('_id').paginate(page,itemsPerPage,(err,rols,total)=>{
if(err) return res.status(500).send({
message:'Error en la peticion'});
if(!rol... | [
"function cargarRoles(){\n onRequest({ opcion : 3 ,rol:\"\"}, respRoles);\n \n}",
"function rotaList(bot, message, args) {\n var rotaName = getFirstWord(args);\n\n if (Object.keys(rotas).length == 0) {\n bot.replyPrivateDelayed(message, 'There are no existing rotas');\n } els... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
To set size of Attachments and Links list fields. Arguments: 1) ID of list field Sample Call: SP_SetAttachnLinkFieldSize("mastercontrol.attachments.Supporting"); | function SP_SetAttachLinkFieldSize() // renamed function: old name was SP_SetAttachnLinkFieldSize()
{
var oField = document.getElementById(arguments[0]);
// Browser check for Safari & Chrome. When items are less than 4.
if(oField.options.length <= 4 && (navigator.userAgent.indexOf("Safari") > 0 || navigator.userAge... | [
"function AdjustNewLinkInputSize() {\n\tvar newlink = $(\"#newlink\");\n\t$(\"#magicbox3\").text( newlink.val() );\n\t\tvar width = $(\"#magicbox3\").width();\n\t\n\t\tnewlink.width( width );\n}",
"function medium_setElementSizes() {\n \n medium_setFolderElementSizes();\n medium_setWebmailElementSizes();... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
saves data to algolia | function saveAlgolia(idx){
algolia.clearIndex(function(err) {
algolia.addObjects(idx, function(err, content) {
if(err===null && idx.length>0){
console.log("modules published!");
}else if(idx.length===0){
console.log("nothing to publish!");
}else{
console.log(err);
}... | [
"function uploadToAlgolia(dataset) {\n index.saveObjects(dataset)\n .then(() => {\n console.log('Expectations data uploaded to algolia');\n mainIndexSetting(dataset);\n })\n .catch(err => console.log(err))\n}",
"function saveAlgolia(idx){\n\talgolia.saveObjects(idx, f... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return array of language codes of translations under STRINGS_PATH | function getTranslationCodes() {
var translationCodes = [];
grunt.file.recurse(STRINGS_PATH, function(abspath, rootdir, subdir, filename) {
// treat any non-empty directories that can be mapped to a Transifex language code
// as translation directories
if (subdir && m... | [
"getLanguages() {\n let langs = []\n this.getModulesPaths().forEach(modPath => {\n fs.readdirSync(modPath).forEach(lang => {\n // Language files should end with '.yml'\n if (!lang.endsWith('.yml')) {\n return\n }\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Thumb move and mouseleave event handler. | _thumbMoveMouseleaveHandler(event) {
const that = this;
if (that.disabled || that.readonly) {
return;
}
const target = event.target;
if (event.type === 'move') {
const targetRect = target.getBoundingClientRect(),
windowScrollX = window.s... | [
"function onMouseOver(objThumb){\n\t\t\t\n\t\t\t\n\t\t\t//if touch enabled unbind event\n\t\t\tif(g_temp.touchEnabled == true){\n\t\t\t\tobjThumbs.off(\"mouseenter\").off(\"mouseleave\");\n\t\t\t\treturn(true);\n\t\t\t}\n\t\t\t\n\t\t\tif(isThumbSelected(objThumb) == false)\n\t\t\t\tt.setThumbOverStyle(objThumb);\n\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Creates a foreign key. | async createForeignKey(model_name, column, type, references, verbose = false) {
return Promise.resolve();
} | [
"async createForeignKey(model, column, type, references) {\n return;\n }",
"function createFK(remote, tableName, mapping) {\n return kv.runT(remote, function(tx) {\n return internalAddFK(tx, tableName, mapping);\n });\n}",
"foreignKey(key) {\n\t\treturn this.setKey('foreign', key)\n\t}",
... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Just like semver.satisfies(), except it handles simple wildcard + range operators in the "version" operand. Note that this is a quick and basic version that could probably be optimized for common cases but will worry about that later. | function wildcardSatisfies(ver, range) {
if (ver.major === 'x' && ver.minor === 'x' && ver.patch === 'x') {
return true;
} else if (ver.major === 'x') {
var verCopy = copyVersion(ver);
for (var i = 0; i <= 9; i++) {
verCopy.major = i;
if (wildcardSatisfies(verCopy, range)) {
return t... | [
"filterVersion(range) {\n range = semver.validRange(range);\n if (!range) {\n return () => true;\n }\n\n return (i) => {\n // i.version is the version to check\n let instanceVersion = i.version;\n\n return semver.satisfies(instanceVersion, range);\n };\n }",
"function satisfies... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Runtime helper for rendering vfor lists. | function renderList(val,render){var ret,i,l,keys,key;if(Array.isArray(val)||typeof val==='string'){ret=new Array(val.length);for(i=0,l=val.length;i<l;i++){ret[i]=render(val[i],i);}}else if(typeof val==='number'){ret=new Array(val);for(i=0;i<val;i++){ret[i]=render(i+1,i);}}else if(isObject(val)){keys=Object.keys(val);re... | [
"renderList() {\n let liElements = this.contents.map((content, index) => this.getLi(content.text, content.isSelected, index));\n for( let li of liElements ){\n this.appendLi( li );\n }\n }",
"function renderList(val,render){var ret,i,l,keys,key;if(Array.isArray(val)||typeof val=... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
take a currentUrl and a url it links to create a new node(if necessary) for the nextUrl create a link between them return newNode if it was a new node, and false if the node already existed | function addNodeLink(currentUrl, nextUrl) {
var currentIndex = getNodeIndex(currentUrl);
var currentObj = dataHolder.nodes[currentIndex];
nextUrlIndexSearch = getNodeIndex(nextUrl);
if(nextUrlIndexSearch === -1) {
nextObj = createNode(nextUrl, currentObj.depth + 1);
nextIndex = dataHolder.nodes.push(nextObj) ... | [
"addNewNode(nodeURL) {\n let node = (nodeURL.url ? nodeURL : { url: nodeURL })\n if (this.networkNodes.indexOf(node) === -1 && this.nodeURL !== node.url) {\n this.networkNodes.push(node);\n let newNode = new NodeModel(node);\n newNode.save((err) => {\n i... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Initialize contextual help links. Use like this: ? | function init_contextual_help_links() {
jQuery("a[data-podlove-help]").on("click", function (e) {
var help_id = jQuery(this).data('podlove-help');
e.preventDefault();
// Remove 'active' class from all link tabs
jQuery('li[id^="tab-link-"]').each(function () {
jQuery(this).removeClass('active');
});
/... | [
"function fillHelpMenu(title) {\n getLinks(title, \"help-menu\");\n}",
"openHelpPage() {}",
"function helpLink( linkToPart )\r\n{\r\n _helpLink( linkToPart, 'help' );\r\n}",
"contextualHelp() {\n const hoveredHelpEls = document.querySelectorAll(\":hover[data-help],:hover[data-help-proxy]\");\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Splits an event whose parameter is a union type into 2 separate events for each type in the union. NOTE that this function returns an `Event` and it MUST be called with a `DisposableStore` whenever the returned event is accessible to "third parties", e.g the event is a public property. Otherwise a leaked listener on th... | function split(event, isT, disposable) {
return [
Event.filter(event, isT, disposable),
Event.filter(event, e => !isT(e), disposable),
];
} | [
"function mergeEvents(events, e) {\n return assign({}, events, mapObject(e, (handler, name) => {\n const hdl = events[name];\n return isFunction(hdl) ? (...args) => {\n handler(...args);\n hdl(...args);\n } : handler;\n }));\n}",
"function parseEvent(event) {\n var eventParts = event.match(/... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Determine whether the given properties match those of a `WebCrawlerAuthenticationConfigurationProperty` | function CfnDataSource_WebCrawlerAuthenticationConfigurationPropertyValidator(properties) {
if (!cdk.canInspect(properties)) {
return cdk.VALIDATION_SUCCESS;
}
const errors = new cdk.ValidationResults();
if (typeof properties !== 'object') {
errors.collect(new cdk.ValidationResult('Expec... | [
"function CfnDataSource_WebCrawlerBasicAuthenticationPropertyValidator(properties) {\n if (!cdk.canInspect(properties)) {\n return cdk.VALIDATION_SUCCESS;\n }\n const errors = new cdk.ValidationResults();\n if (typeof properties !== 'object') {\n errors.collect(new cdk.ValidationResult('Ex... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
_For internal use._ Empty the underlay registry and the layers container elements. Done on page reload. | resetLayers() {
this.underlays = [];
this.layersContainers.forEach((container) => {
container.innerHTML = '';
});
} | [
"reset() {\n this.underlays = [];\n this.layersContainers.forEach((container) => {\n container.innerHTML = '';\n });\n }",
"function clearMap() {\n for (var layerId in window.Layers) {\n window.Layers[layerId].remove();\n }\n window.Layers = {};\n updateLayers();\n}",
"function... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
unlink the whole chain of marker objects that were added to objects when processing | function removeMarkers()
{
var next;
while (markerHead)
{
next = markerHead[marker].prev;
delete markerHead[marker];
markerHead = next;
}
} | [
"function removerExistMarker() {\r\n markers.clearLayers();\r\n }",
"function deleteObjects() {\n clearObjects();\n mapObjects = [];\n}",
"_deleteReferences() {\n delete this._factory;\n delete this._map;\n delete this._options;\n }",
"function cleanPointers() {\n var i = 0;\n whil... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
check textarea content for terms | function checkTerms(editableObj) {
if (editableObj.isAutoCompleting)
return;
var savedSel;
// store current sel
if (rangy.hasOwnProperty('saveSelection'))
savedSel = rangy.saveSelection();
highlightTerms(editableObj);
// Restore the original selection
if (rangy.hasOw... | [
"function checkTerms(editableObj) {\n var savedSel;\n // store current sel\n if (rangy.hasOwnProperty('saveSelection'))\n savedSel = rangy.saveSelection();\n \n highlightTerms(editableObj);\n\n // Restore the original selection\n if (rangy.hasOwnProperty('restoreSelection'))\n rang... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
when the clear button is pressed this removes the movie to be cleared from the showDates object array | clearMovieDates() {
var id = document.getElementById("movieId").value;
document.getElementById("movieShowDates").innerHTML = "";
var arrayLength = this.showDates.length;
this.showDates.forEach((item, index) => {
if (item.id === id) {
var indx = this.showDates.... | [
"function removeDate() {\n var idx = dates.indexOf(document.getElementById(\"calendar\").value);\n if(idx != -1) {\n dates.splice(idx, 1);\n displayDates();\n }\n }",
"function clearCard() {\r\n date.textContent = '';\r\n total.textContent = ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
The quick way to detect for a tier of devices. This method detects for all other types of phones, but excludes the iPhone and RichCSS Tier devices. NOTE: This method probably won't work due to poor support for JavaScript among other devices. | function DetectTierOtherPhones()
{
if (DetectMobileLong())
{
//Exclude devices in the other 2 categories
if (DetectTierIphone())
return false;
if (DetectTierRichCss())
return false;
//Otherwise, it's a YES
else
return true;
}
else
return false;
} | [
"function DetectTierOtherPhones()\n{\n if (DetectMobileLong())\n {\n //Exclude devices in the other 2 categories\n if (DetectTierIphone())\n return false;\n if (DetectTierRichCss())\n return false;\n\n //Otherwise, it's a YES\n else\n return true;\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Retorna una lista con todos los filtros | function construyeFiltros(){
let x = [];
for(var i in _data){
x.push(_data[i]);
}
return x;
} | [
"function getFilterValuesAndFilterList() {\n var inputs = $(\"input[type='checkbox']\");\n var chosenInputs = [];\n\n for (var i = 0; i < inputs.length; i++) {\n var input = inputs[i];\n var isChecked = $(input).prop(\"checked\");\n if (isChecked) {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
A webpack plugin is a JavaScript object that has an apply method. This apply method is called by the webpack compiler, giving access to the entire compilation lifecycle. | apply(compiler) {
//webpack刚开始运行时
compiler.hooks.run.tap(pluginName, compilation => {
console.log('🍊🍊🍊The webpack build process is starting!!!');
});
} | [
"apply(compiler) {\n // createSettings responsibe for extending the defaults values with the user's settings.\n // It also adds a uniqe hash which in the form of:\n // [env]_instance_[index]_[settingsHash]\n // [env] - settings.env provided by the user. defaults to NODE_ENV\n // [index] - the index o... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
when a user presses enter the message gets appended to the chat message list | updateChatMessageList(event){
socket.emit('typing', 'customer typing...');
// 13 is the Enter keycode
if (event.keyCode === 13) {
let message = {
text: event.target.value,
type: 'sender',
humanized_time: moment().fromNow(),
machine_time: moment().format('MMMM Do YYYY, hh:mm:ss')
};
this... | [
"function newEntry() {\n if (document.getElementById(\"chatbox\").value != \"\") {\n lastUserMessage = document.getElementById(\"chatbox\").value;\n document.getElementById(\"chatbox\").value = \"\";\n messages.push(lastUserMessage);\n reloadChatlog();\n }\n}",
"function chatHandleKeyup(event) {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns token with given state or undefined | function getToken(state) {
return tokenTable[state]
} | [
"tokenizeWithState(index, state) {\n\t\t\tconst {tokenizeWithState} = this.impl;\n\t\t\tif (tokenizeWithState !== undefined) {\n\t\t\t\treturn tokenizeWithState(this, index, state);\n\t\t\t}\n\n\t\t\tconst token = this.tokenize(index);\n\t\t\tif (token !== undefined) {\n\t\t\t\treturn [state, token];\n\t\t\t}\n\n\t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
If a select element has a required attribute specified, does not have a multiple attribute specified, and has a display size of 1; and if the value of the first option element in the select element's list of options (if any) is the empty string, and that option element's parent node is the select element(and not an opt... | get _hasPlaceholderOption() {
return this.hasAttributeNS(null, "required") && !this.hasAttributeNS(null, "multiple") &&
this._displaySize === 1 && this.options.length > 0 && this.options.item(0).value === "" &&
this.options.item(0).parentNode._localName !== "optgroup";
} | [
"get _hasPlaceholderOption() {\n return this.hasAttributeNS(null, \"required\") && !this.hasAttributeNS(null, \"multiple\") && this._displaySize === 1 && this.options.length > 0 && this.options.item(0).value === \"\" && this.options.item(0).parentNode._localName !== \"optgroup\";\n }",
"selectBlank() {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
calculating ledger total values | function calLedgerTotalValues(){
var finalBillAmount=0;
var finalAmountPaid=0;
var finalCumulativeAmount=0;
var finalRecoveryAmount=0;
$(".BillAmountCls").each(function(){
finalBillAmount+=parseFloat($(this).text()==''?0:$(this).text().replace(/,/g,''));
})
$(".AmountPaidCls").each(function(){
finalAmountP... | [
"handleTotal() {\n let coinData = this.state.coinData;\n let total = 0;\n coinData.forEach(function(num, index) {\n if (index === 0) total += num;\n if (index === 1) total += (num * 5);\n if (index === 2) total += (num * 10);\n if (index === 3) total += (num * 25);\n })\n return p... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Inserts the new control below the existing control. | function insertAtBottom(newControl, dropControl, dropControlIsField) {
insertControl(newControl, containers.vertical, false, dropControl, dropControlIsField);
return true;
} | [
"function insertBelow() {\n\n\t\t// Hide the toolbar\n\t\thideToolbar();\n\n\t\t// Insert the row below and select the placeholder below the selected element\n\t\tinsertRow(currentElement, false, $(currentElement).column());\n\t}",
"function insertAtTop(newControl, dropControl, dropControlIsField) {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Build an include file tree and return the depth of the file relative to the root of the project... | getDepthByFilename() {
let projectPath = this._projectPath;
let includesByFilename = {};
let includeByFilename = {}; // To check for circular includes...
let depthByFilename = {};
const makeNodeByFilename = (node) => {
if (node.includes) {
includesByFilename[node.filename] = node.includes;
node.includes.forE... | [
"getDepthByFilename() {\n let projectPath = this._projectPath;\n let includesByFilename = {};\n let includeByFilename = {}; // To check for circular includes...\n let depthByFilename = {};\n const makeNodeByFilename = (node) => {\n if (node.includes) {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Loops through all md converters, checking to see if the node nodeName matches. Returns the replacement text node or null. | function replacementForNode(node, doc) {
// Remove blank nodes
if (VOID_ELEMENTS.indexOf(node.nodeName.toLowerCase()) === -1 && /^\s*$/i.test(node.innerHTML)) {
return doc.createTextNode('');
}
for (var i = 0; i < converters.length; i++) {
var converter = converters[i];
if (canConvertNode(node, c... | [
"function process(node) {\n var replacement, content = getContent(node);\n\n for (var i = 0; i < converters.length; i++) {\n var converter = converters[i];\n\n if (canConvert(node, converter.filter)) {\n if (typeof converter.replacement !== 'function') {\n throw new TypeError(\n '`repla... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Formats tournament output while simulating matches' outcomes. | function formatOutput( matches, turn ) {
const result = [];
for( let i = 0; i < matches[turn].length; i++ ){
if( turn === 0 )
result.push(`Rodada ${i+1}:`);
else if( turn === 1 )
result.push(`Rodada ${teams.length+i}:`);
else
... | [
"function printTournamentResult(tr) {\n let badPlayers = tr.badPlayers.map(player => player.getId());\n let allGames = tr.matchTable.getAllGames().map(gr => [gr.winner, gr.loser]);\n process.stdout.write(JSON.stringify(badPlayers) + '\\n');\n process.stdout.write(JSON.stringify(allGames) + '\\n');\n}",
"funct... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This method takes care of initializing the partytoen feature. | _initPartytown() {
var _a2, _b2;
if (!((_b2 = (_a2 = this.frontspec) === null || _a2 === void 0 ? void 0 : _a2.google) === null || _b2 === void 0 ? void 0 : _b2.gtm)) {
if (!SEnv2.is("production") && !__isInIframe()) {
console.log(`<yellow>[SFront]</yellow> You have enabled <magenta>partytown</mag... | [
"initialize() {\n this.featureManager_.loadFeature('account_provider');\n this.featureManager_.loadFeature('player_colors');\n }",
"function thirdpartyapiInit () {\n\t debug('Initialized');\n}",
"constructor() { \n \n AdditionalFeatures.initialize(this);\n }",
"function party... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
PUBLIC Sets the width and height of the network element rectagle. The minimum values are 20x20 pixels. | function setBoundsNE(width, height) {
var w = eval(width);
var h = eval(height);
this.width = w < 20 ? 20 : w;
this.height = h < 20 ? 20 : h;
} | [
"setDimensions () {\n const bbox = this.element.getBoundingClientRect()\n this.elementWidth = bbox.width\n this.elementHeight = bbox.height\n }",
"setHeightAndWidth() {\n\n let element = d3.select(\"#node-link-column\")[0][0];\n\n if (!element.clientHeight) {\n this.width = 250;... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Set the window's default text color. | set text_color( colorval ) {
this.window.style.color = colorval;
} | [
"setDefaultColors(){\n\t\tthis.st.write(\"\\x1b[0m\");\n\t}",
"static setDefaultTextColor(color) {\n this.defaultTextColor = color;\n }",
"function resetTextColor () {\r\n\teditValue('textColor', '#FFFFFF');\r\n\tchangeTextColor('textColor');\r\n}",
"set text_color(value){\n this._text_color ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |