query stringlengths 9 34k | document stringlengths 8 5.39M | negatives listlengths 19 20 | metadata dict |
|---|---|---|---|
stopDelegating(element[, selector[, eventName[, handler]]]) | function stopDelegating(element, selector, eventName, handler){
element = $(element);
var store = Element.retrieve(element, 'prototype_delegates');
if (Object.isUndefined(store)) return;
switch(arguments.length){
case 1: store.each(function(pair){ clearEvent(element, store, pair.key); }); break;... | [
"function stopObserving(element, eventName, handler) {\n element = $(element);\n \n var registry = Element.retrieve(element, 'prototype_event_registry');\n \n if (Object.isUndefined(registry)) return element;\n\n if (eventName && !handler) {\n // If an event name is passed without a handler, ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
The last worm is dead, needs to start a new round and maybe a new match | function lastWormCrushes(currentWorm)
{
clearKeys();
getMaxScore();
getScoreToWin();
setRound();
if(maxScore >= scoreToWin)
matchOver(currentWorm);
else
roundOver(currentWorm);
} | [
"finishMatch(round, match) {\n this.matchStatus[round][match] = true;\n this.updateStatus();\n }",
"_resolveRound(warringPlayers, result) {\n\n const draw = this._draw(warringPlayers, result);\n const max = this._findCardWithMaxValue(draw);\n const atWar = draw.filter(c => c && c.rank === max.rank... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
The construct handler affects objects made using the new keyword. | construct (target, args) {
return new target(...args)
} | [
"construct(target, args, newTarget) {\n return constructTrap(target, args, newTarget);\n }",
"construct(target, argumentsList, newTarget) {\n return trap.construct(target, argumentsList, newTarget);\n }",
"new() {\n let newInstance = Object.create(this);\n\n newInstance.init(..... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Emits a function to project from the cell ID space to the scatterplot or spatial coordinate space, via the `updateViewInfo` prop. | viewInfoDidUpdate(getCellCoords) {
const { updateViewInfo, cells, uuid } = this.props;
const { viewport } = this;
if (updateViewInfo && viewport) {
updateViewInfo({
uuid,
project: (cellId) => {
const cell = cells[cellId];
try {
const [positionX, position... | [
"function updatePinsOnView() {\n var camera = _viewerMain.getCamera();\n\n _viewerPin.each(function(pinid, label, position) {\n var vec = positionToVector3(position);\n var newPos2D = worldToClient(vec, _viewerMain.getCamera());\n d3.select(\"#\"+pinid)\n .attr(\"cx\", newPos2D.x)\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
```ts const QST = 0.0975; const GST = 0.05; console.log(QST + GST); ``` Were you expecting `0.1475`? The result is `0.14750000000000002`. Another example of double behaving in unintuitive ways. The solution is to convert the values to a `DECIMAL(M, D)` type, add those, then convert the result back to a `double`. + Cast... | function addAsDecimal(decimal, ...arr) {
const decimalArr = arr.map(rawExpr => function_1.__internalCastAsDecimal(rawExpr, decimal.maxDigitCount, decimal.fractionalDigitCount));
const usedRef = raw_expr_1.RawExprUtil.intersectUsedRefTuple(...arr);
const queryTree = [];
for (let rawExpr of decimalArr) {
... | [
"_computeRawTotalFromQuantityAndRate(newState)\n{\n newState.rawTotal.floatValue = newState.quantity.floatValue.times(newState.rate.floatValue);\n newState.rawTotal.value = this._formatFloat(newState.rawTotal.floatValue);\n}",
"function updateGPA(qp, units) {\n\tif (printRealNum(units) > 0 && printRealNum(q... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
The request handler for "sampleContextActor". Adds its actor to the tab actor's contextActorPool, which will last until the next navigation or the tab is closed. | function sampleContextActorHandler(aTab, aRequest) {
// Reuse a previously-created actor, if any.
if (aTab._sampleContextActor) {
return aTab._sampleContextActor;
}
let actor = new SampleContextActor(aTab);
aTab._sampleContextActor = actor;
aTab.contextActorPool.addActor(actor);
return actor.grip();
} | [
"function sampleTabActorHandler(aTab, aRequest) {\n // Reuse a previously-created actor, if any.\n if (aTab._sampleTabActor) {\n return aTab._sampleTabActor;\n }\n let actor = new SampleTabActor(aTab);\n aTab._sampleTabActor = actor;\n aTab.tabActorPool.addActor(actor);\n return actor.grip();\n}",
"asyn... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
['EURUSD', 'GBPJPY', 'AUDUSD'] Get quotes for specified symbols: | function getQuotes(symbols, cb){
//console.log(symbols.toString())
fetch("https://www.freeforexapi.com/api/live?pairs=" + symbols.toString(), {
"Accept" : "application/json",
"Content-Type" : "application/json",
"User-Agent" : random_useragent.getRandom() // gets a ra... | [
"async function getQuote(symbol) {\n const param = await getParam(\"AlphaVantageApiKey\");\n\n var result = await get(\n `https://www.alphavantage.co/query?function=GLOBAL_QUOTE&symbol=${symbol}&apikey=${param.Parameter.Value}`\n );\n\n if (result[\"Error Message\"]) {\n console.error(\"Error: \", result[... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
load in associator checkboxes based on the current page number | function populateAssociatorCheckboxes(currentPage) {
var associatorPreview = {
'excavations' : 'Title',
'archival objects' : 'Name',
'subjects' : 'Resource_Identifier'//go ask kora for this pls
};
var populateCheckboxes = "<hr>";
currentPage = currentP... | [
"function checkISECheckboxes() {\r\n\t//first maps the current page of IDs into an associative array\r\n\tvar pageIDs = $('.ise-checkbox').map(function() {\t//this line maps all of the elements ids if they have class '.ise-checkbox' into an object key=[0] value=[id], key=[1] value=[id]... where id would be the id o... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Saves the array of watched sets and channel IDs to the data file | function saveWatchedSets() {
fs.writeFile(WATCHEDSETCODESFILENAME, JSON.stringify(watchedSetcodes), (err) => {
if (err) console.log(getDate() + err);
console.log(getDate() + "Successfully written to file " + WATCHEDSETCODESFILENAME + ".");
});
} | [
"function saveQueues() {\n console.log(\"Writing timeQueue to file\");\n var link;\n var file = fs.openSync('queue.csv', 'w');\n for (var key in timeQueue) {\n if (!timeQueue.hasOwnProperty(key)) {\n //The current property is not a direct property of p\n continue;\n }... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Recieve parameter and pass it to function to handle | function doPost(e){
return handleResponse(e);
}
// here handle with parameter | [
"function requestHandler(handler) {\n //passing parameter\n let value = handler('response');\n console.log(value);\n}",
"function handleTheThing(num, str, func) {\n console.log(\"handleTheThing\");\n // this will invoke the function that was passed in, passing \"num + str\" as the argument\n fun... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Derives keypair from given mnemonic string and path. mnemonic should be a sentence comprised of 12 words with single spaces between them. path is a formatted string describing the stark key path based on the layer, application and eth address. | function getKeyPairFromPath(mnemonic, path) {
const seed = bip39.mnemonicToSeedSync(mnemonic);
const keySeed = hdkey
.fromMasterSeed(seed, 'hex')
.derivePath(path)
.getWallet()
.getPrivateKeyString();
const starkEcOrder = ec.n;
return ec.keyFromPrivate(grindKey(keySeed, s... | [
"static fromMnemonic(mnemonic, passphrase) {\n return __awaiter(this, void 0, void 0, function* () {\n if (mnemonic._isLegacy) {\n return mnemonic._legacyToPrivateKey();\n }\n const input = mnemonic.toString();\n const salt = `mnemonic${passphrase}`;... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
start a typewriter animation for a text in the dataText array | function StartTextAnimation(i) {
if (typeof dataText[i] == 'undefined'){
setTimeout(function() {
StartTextAnimation(0);
}, 20000);
}
// check if dataText[i] exists
if (i < dataText.length) {
// text exists! start typewriter animation
typeWriter(dataText[i], 0, fun... | [
"function StartTextAnimation(i) {\r\n if (typeof dataText[i] == 'undefined'){\r\n setTimeout(function() {\r\n StartTextAnimation(0);\r\n });\r\n }\r\n // check if dataText[i] exists\r\n if (i < dataText[i].length) {\r\n // text exists! start typewriter animation\r\n ty... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Update a summary object with the values of a stat | updateSummary(summary, stat, character) {
let propertyName = statTypeMap[stat.displayType];
if (!summary.hasOwnProperty(stat.displayType)) {
let statType =
// We only include a '%' if the stat is NOT in percentTypes, because those are the only stats that will always
// display as a percen... | [
"setStat(stat, value) {\n this._stats[stat] = value\n // recompute stage of stat\n this.setStatStage(stat)\n // recompute level\n this.updateLevel()\n // remember to recompute anchors for drawing\n this.element.computeAnchors(this)\n }",
"setStatsSummary(target, path, stats) {\n set(targe... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Does the filter observe a minRSSI parameter? | get hasMinRSSI() {
return this.hasOwnProperty('minRSSI');
} | [
"get hasMaxRSSI() {\n return this.hasOwnProperty('maxRSSI');\n }",
"function rssi_ping (sig) {\n if (sig > 199) {\n frq_ping(30, 0.2, 0.3) // ERROR\n } else {\n if (sig < 30) sig = 30\n const frq = Math.pow(2, (100 - sig) / 12) * 100\n frq_ping(frq, 0.5, 0.15)\n }\n }",
"static... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
searches the front of the string looking for an equal sign returns boolean | function matchEqual() {
var pattern = /^=/;
var x = lexString.match(pattern);
if(x !== null) {
return true; }
else {
return false;
}
} | [
"function isStrEqualSign(value){\n if(value.search(/[=]+$/) > -1){\n return true;\n }\n }",
"function checkForEquals(str){\n // console.log(\"hei\")\n var i = str.indexOf(\"=\");\n var res;\n if(i != -1){\n res = {dir: str.slice(i+1), alias: str.slice(0, i)}\n }el... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
assigns value to playerDetails.level | function getLevel() {
playerDetails.level = 1; //<--- hard-coded. will need to be replaced by db query.
} | [
"updateLevel(value) {\n this.level=value;\n }",
"function updateLevel() {\r\n\t\t$( \"span.level\" ).text( SpaceInvaders.level );\r\n\t}",
"function setLevel() {\n\n var level = player.level;\n var levelMarker = document.getElementById('levelMarker');\n levelMarker.innerHTML = level;\n\n var enemyRules ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
openCurrentUser: redirects the user into the users page, and display his information | openCurrentUser() {
window.location.href = window.location.origin + '/users?name=' + this.state.currentUser.firstName + ' ' + this.state.currentUser.lastName;
} | [
"function showUserInfo() {\n\tvar currentUser = sessionStorage.getItem('currentUser');\n\tif(currentUser === null){\n\t\t$(\"#loginBtn\").html(\"<span class=\\\"glyphicon glyphicon-log-in\\\" style=\\\"margin-right: 5px\\\"></span>Login\");\n\t}\n\telse{\n\t\tcurrentUser = JSON.parse(currentUser);\n\t\t$(\"#loginBt... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
disables / enables dropdown . bool True = disabled | function disableDropdown(id,bool){
$('#'+id).prop('disabled', bool);
} | [
"enableDropDown($combo) {\n window.$('li.dropdown', $combo).removeClass('disabled');\n window.$('li.dropdown > a.dropdown-toggle', $combo).removeClass('disabled');\n }",
"function EnableDisableQuestionSelectionDropdown(isEnabled) {\n var selCombo = document.getElementById(\"selQuestion\");\n if (isEnable... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Try to update the next node, if any, to the given data. Checks prematches to avoid overwriting nodes that could still be used. | updateNextNode(node, outerDeco, innerDeco, view, index) {
for (let i = this.index; i < this.top.children.length; i++) {
let next = this.top.children[i];
if (next instanceof NodeViewDesc) {
let preMatch2 = this.preMatch.matched.get(next);
if (preMatch2 != null && preMatch2 != index)
... | [
"updateStoryNode(data) {\n //Node.update(data.id, data)\n var node = this.graph().getNode(data.id)\n node.updateData(data)\n this.calculateAcception(node)\n this.forceUpdate()\n this.saveStory()\n }",
"updateAt(data, index){\r\n if(index <0 || index > this.getSize()){\r\n retu... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Complete the render height of the given page by substracting the page height with the top and bottom paddings | computeRenderHeight(page) {
return unitConverter.get(page.height, 'px', false) - (
unitConverter.get(page.padding.top, 'px', false) +
unitConverter.get(page.padding.bottom, 'px', false)
);
} | [
"function adaptPageHeightUI() {\n let elem = document.getElementById(\"page-body-cont\"); //get page container\n let pc_h = document.getElementById(\"page-body-wrapper\").offsetHeight;\n let w_h = window.innerHeight;\n\n //check to set page height to window height\n if (pc_h < w_h... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
end polling end of functions concerned with getting my recent orders crucial intervals polls current grill status | function pollCurrentGrillStatus() {
globals.currentGrillStatus(null, true, true);
} | [
"polling() {\n const hourInSec = PASConfig.pollingTimeDevelop || 3200; // Use develop value if available for this RI\n const hourInMS = hourInSec * 1000;\n const fiveMin = hourInMS / 12;\n\n // Poll every 5 minutes in the first half hour\n let numPolls = 1;\n let context = this;\n let polling =... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This is where the message has properties set on it before being put to the queue. First we have to create a message handle, then use that handle to set the properties. Then the handle is set as one of the MQPMO structure fields as the message is put to the queue. Once we're done, the message handle is deleted. | function putMessage(hConn,hObj) {
var msg = "Hello from Node at " + new Date();
var mqmd = new mq.MQMD(); // Defaults are fine.
var pmo = new mq.MQPMO();
var cmho = new mq.MQCMHO();
mq.CrtMh(hConn, cmho,function(err,mh) {
if (err) {
console.log(formatErr(err));
} else {
var smpo = new m... | [
"function setQ(hObj) {\n // We will set 3 attributes of the queue.\n var selectors = [new mq.MQAttr(MQC.MQIA_INHIBIT_PUT,MQC.MQQA_PUT_INHIBITED),\n new mq.MQAttr(MQC.MQIA_INHIBIT_GET,MQC.MQQA_GET_INHIBITED),\n new mq.MQAttr(MQC.MQCA_TRIGGER_DATA,\"TrigData After\"),\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Subtract the value from max and print out the new value till zeroed out | function subtractValueFromMax(max, subtract) {
for (var i = max; i >= 0; i= i- subtract) {
console.log(i);
}
} | [
"function decrease(val, max) {\n var v = parseInt(val) - 1;\n return v < 0 ? max : v;\n}",
"showMax() {\r\n\t\treturn Math.max(...this.data);\r\n\t}",
"function decrement() {\n number.update((n) => (n - 1 >= min ? n - 1 : n));\n }",
"function get_max()\n {\n var max,swap;\n max=tempera... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function to display operations of Address Book. | function menu() {
console.log("---------Address Book Operations--------");
console.log("\t0. Close File and Exit");
console.log("\t1. Add New Person and Save");
console.log("\t2. Edit Person Data");
console.log("\t3. Delete a Person");
console.log("\t4. Sort by Last Name");
console.log("\t5. Sort by ZIP");
console.log(... | [
"function displayBookInfo(book) {\n\t// Add code here\n\n}",
"function list() {\r\n var contactsLength = contacts.length;\r\n console.log(\"Address Book:\");\r\n for (var i = 0; i < contactsLength; i++) {\r\n printPerson(contacts[i]);\r\n }\r\n}",
"function showAddresses() {\n app.getView().rend... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
7 kyu Equalize the array! Input :: [10,20,25,0] Output :: ["+0", "+10", "+15", "10"] Input :: [] Output :: [] Input :: [10,20,25,0] Output :: ["+0", "+10", "+15", "10"] | function equalize(array) {
return array.map((num, ind, arr) => {
return (String(num - arr[0])).replace(/^(\d)/, '+$1');
});
} | [
"function equalize(array) {\n return array.map((item) => `${item - array[0] >= 0 ? '+' : ''}${item - array[0]}`);\n}",
"function upArray(arr){\r\n if( !arr.some( n => n.toString().length > 1) && !arr.some( n => !Number.isInteger(n) ) && arr.length !== 0 ) {\r\n let array = arr;\r\n for(let i=1; ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Used to send an order of dishes | sendOrder() {
Actions.sendOrderScreen({ orderedDishes: this.props.cartItems });
} | [
"function sendOrder(data) {\n console.log(\"entered send Order\");\n //console.log(data);\n socket.emit(\"order\", data);\n console.log(\"exited send Order\");\n\n }",
"sendOrder() {\n \n }",
"sendOrder(order) {\n const simpleOrder = {\n name: orde... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Removes the paused state from the pause button and calls onResume(). | resume(){
if(this._isPaused){
this._isPaused = false;
this._togglePauseBtn.classList.remove("paused");
this.onResume();
}
} | [
"pause(){\n if(this._isRunning && !this._isPaused){\n this._isPaused = true;\n this._togglePauseBtn.classList.add(\"paused\");\n this.onPause();\n }\n }",
"function togglePause() {\n\n if (isPaused()) {\n resume();\n }\n else {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
description: downlod the data 2 second after clicking on export params: void return: void | exportDatasToCsv(){
setTimeout(
function() {
window.location.reload();
}
.bind(this),
2000
);
} | [
"function exportData() {\n viz.showExportDataDialog();\n}",
"static exportData() {\n request.get(ApiEndpoints.DATA + '/export')\n .set('Accept', 'application/json')\n .set('Authorization', _getAuthorizationHeader())\n .end(function(error, res) {\n handleResponse(error, res,\n fu... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
in the constructor we provide SharedCustomerDataService for service and Router for routing to another components ActivatedRoute to contain the customer id that sent from allCustomersComponent and FormBuilder for form validation | function UpdateCustomerComponent(_sharedDataService, _router, _route, _formBuilder) {
this._sharedDataService = _sharedDataService;
this._router = _router;
this._route = _route;
this._formBuilder = _formBuilder;
this.customerUpdate = new _Common_Customer__WEBPACK_IMPORTED_MODULE_... | [
"function GetAllCustomersComponent(_sharedDataService, _router) {\n this._sharedDataService = _sharedDataService;\n this._router = _router;\n }",
"function CreateCustomerComponent(_sharedDataService, _formBuilder) {\n this._sharedDataService = _sharedDataService;\n this._formBuilder... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Toggles visibility of main and side contents on S screen size (mobile device). | toggleContents() {
if (this.breakpoint === this.sizeS && this.sideContentVisibility !== _SideContentVisibility.default.AlwaysShow) {
this._toggled = !this._toggled;
}
} | [
"toggleContents() {\n\t\tif (this.breakpoint === this.sizeS && this.sideContentVisibility !== SideContentVisibility.AlwaysShow) {\n\t\t\tthis._toggled = !this._toggled;\n\t\t}\n\t}",
"function toggleSidenavVisibility(){\n\t\tvar width = $(document).width();\n\t\tif(width < 992){\n\t \t\tcloseDepartureDate();\n\t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIE... | function CustomerCreditTransferFile(groupHeader) {
/**
* @var GroupHeader
*/
this.groupHeader = groupHeader;
/**
* @var array<PaymentInformation>
*/
this.paymentInformations = [];
} | [
"function FileTransferService(nodeService, gatewayService, authorizationService) {\n return _super.call(this, nodeService, gatewayService, authorizationService) || this;\n }",
"function FileServiceFile(){}",
"function SIFileTransfer(im) {\n\tconsole.log('Initializing [SI File Transfer] extension.');\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return a JSON representation of this ammo | getJSONRepresentation() {
return {
type: "AmmoRifleEnv",
x: this.x,
y: this.y,
radius: this.radius,
colour: this.colour
}
} | [
"toJSON() {\n return {\n r: this.r,\n g: this.g,\n b: this.b,\n a: this.a,\n };\n }",
"toJSON() {\n const data = super.toJSON();\n data.class = 'Roll';\n return data;\n }",
"toString() {\n return JSON.stringify({\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
only send in 'review_create' events | function validate({ event }) {
return event === 'review_create';
} | [
"async createReview () {\n\t\tif (!this.attributes.review) {\n\t\t\treturn;\n\t\t}\n\t\tconst reviewAttributes = Object.assign({}, this.attributes.review, {\n\t\t\tteamId: this.team.id,\n\t\t\tstreamId: this.stream.id,\n\t\t\tpostId: this.attributes.id\n\t\t});\n\t\tconst usersBeingAddedToTeam = (this.transforms.in... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Magento 2: customer generateToken normalizer | function normalizer(rawData) {
const token = get(rawData, 'data.generateCustomerToken.token', null);
return {
token,
};
} | [
"function newTokenGeneration(request) {\r\n return \"ABC\";\r\n}",
"convertToToken() {\n return TokenModel.toJson({\n id: this.tokenId,\n isPrivacy: true,\n name: this.name,\n symbol: this.pSymbol,\n isInit: false,\n // listTxs,\n // image,\n // amount\n });\n }",
... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Copy a cURL command from the currently selected item. | async copyAsCurl() {
let selected = this.selectedRequest;
// Create a sanitized object for the Curl command generator.
let data = {
url: selected.url,
method: selected.method,
headers: [],
httpVersion: selected.httpVersion,
postDataText: null
};
// Fetch header values... | [
"copyUrl() {\n copyToClipboard(this.selectedRequest.url);\n }",
"function copyUrl() {\n var copyText = document.getElementById('new_url');\n copyText.select();\n document.execCommand(\"copy\");\n}",
"shareResultForumCopyButtonClickHandler() {\n UI.$shareResultForum.select();\n document.execCommand(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Determines if the element has an ancestor prior to this cell content that handles the scroll delta | _hasScrolledAncestor(el,deltaX,deltaY){if("vaadin-grid-cell-content"===el.localName){return!1}else if(this._canScroll(el,deltaX,deltaY)&&-1!==["auto","scroll"].indexOf(getComputedStyle(el).overflow)){return!0}else if(el!==this&&el.parentElement){return this._hasScrolledAncestor(el.parentElement,deltaX,deltaY)}} | [
"_hasScrolledAncestor(el, deltaX, deltaY) {\n if (el.localName === 'vaadin-grid-cell-content') {\n return false;\n } else if (this._canScroll(el, deltaX, deltaY) && ['auto', 'scroll'].indexOf(getComputedStyle(el).overflow) !== -1) {\n return true;\n } else if (el !== this && el.parentElement) {\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
AdicionaLivro: adiciona um novo livro a partir dos dados introduzidos | function adicionaLivro() {
var eLivro = { id: "", titulo: "", autor: ""};
eLivro.id = $('#id').val();
eLivro.titulo = $('#titulo').val();
eLivro.autor = $('#autor').val();
if (eLivro.id && eLivro.titulo && eLivro.autor) {
var objectStore = dbLivros.transaction(["eLivros"], "readwrite").obje... | [
"function adicionarUmLivro(req, res) {\n let novoId = livros.length + 1;\n\n const novoLivro = {\n id: novoId,\n titulo: req.body.titulo,\n autor: req.body.autor,\n ano: req.body.ano,\n numPaginas: req.body.numPaginas\n };\n\n if (req.query) {\n livros.push(novo... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
offersExercisedMap is, with three exceptions, the same as the map function used in the CouchDB view offersExercised the only exceptions are 'emit' as a parameter, emit only being called once, and the line that parses the exchange_rate | function offersExercisedMap(doc, emit) {
var unix = moment.utc(doc.close_time_timestamp).unix();
doc.transactions.forEach(function(tx) {
if (tx.metaData.TransactionResult !== 'tesSUCCESS') {
return;
}
if (tx.TransactionType !== 'Payment' && tx.TransactionType !== 'OfferC... | [
"function offersExercisedMap(doc, emit) {\n var unix = moment.utc(doc.close_time_timestamp).unix()\n\n doc.transactions.forEach(function(tx) {\n if (tx.metaData.TransactionResult !== 'tesSUCCESS') {\n return\n }\n\n if (tx.TransactionType !== 'Payment' &&\n tx.TransactionType !== 'OfferCreate... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Parse another JSONLD document. | parse(jsonld) {
return doParse(jsonld, this);
} | [
"async function fromJSONLD (obj) {\n const opts = {\n // don't unbox arrays so that object structure will be predictable\n compactArrays: false\n }\n if (!('@context' in obj)) {\n // if context is missing, try filling in ours\n opts.expandContext = this.context\n }\n const compact = await jsonld.co... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Below code will search the fields using Webelement:id | findSearchFields(){
this.driver.findElement(By.id('keywords'));
this.driver.findElement(By.id('location'));
this.driver.findElement(By.id('RadialLocation'));
} | [
"searchIds(){ \n let c=0; \n let newid; \n let origin=this.objeto.id;\n while(document.getElementById(this.objeto.id)!=null){ \n newid=origin+c;\n c++; \n this.objeto.id=newid;\n }\n }",
"function byId(id, cb) {\n $r.hgetall('searches:#' + id, cb)\n}",
"function onSearchById(va... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Detects if the current device is on one of the Maemobased Nokia Internet Tablets. | function DetectMaemoTablet()
{
if (uagent.search(maemo) > -1)
return true;
//Must be Linux + Tablet, or else it could be something else.
if (uagent.search(maemoTablet) > -1 &&
uagent.search(linux))
return true;
else
return false;
} | [
"function DetectMaemoTablet()\n{\n if (uagent.search(maemo) > -1)\n return true;\n //Must be Linux + Tablet, or else it could be something else.\n if (uagent.search(maemoTablet) > -1 &&\n uagent.search(linux) > -1)\n return true;\n else\n return false;\n}",
"function isNokia() {\n\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Given A Route, by going through all of the legs, and each step inside each leg. | scoreIndvRoute(route, griddedData ) {
let legs = route["legs"];
let totalValue = 0;
let totalWeight = 0;
for (const leg of legs) {
const legIndex = legs.indexOf(leg);
console.log("In leg " + (legIndex + 1) + " of " + legs.length + " the legs array in the 1st rout... | [
"createRoutes(route){\n\n // Google Maps API is limited to 10 waypoints so need to break into batches\n const batchSize = 10;\n\n // Create roundtrip by adding first waypoint to end of list (route is optimized for this)\n route.push(route[0]);\n\n // Create road trip segments\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
isAllWhiteNodeSignificant() Given a node whose inner html is all white, this routine examines the node's siblings and returns true if the whitespace is significant and false otherwise. | function isAllWhiteNodeSignificant( node )
{
if (!node.parentNode) return false;
var siblings = node.parentNode.childNodes;
var nSiblings = siblings.length;
var siblingIdx = 0;
// If we're an only child, then we really need
// to look at uncles and aunts.
if ( (nSiblings == 1) && (node.parent... | [
"function oneSignificantChild(element)\n{\n\tvar sigChildren = 0;\n\tfor(var i=0; i< element.childNodes.length; i++)\n\t{\n\t\tif(!((element.childNodes[i].nodeType == Node.TEXT_NODE) && (element.childNodes[i].isWhitespaceOnly)))\n\t\t\tsigChildren++;\n\t}\n\t\t\t\t\t\t\n\tif(sigChildren == 1)\n\t\treturn true;\n\n\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Clear the whole waveform | clearWave() {
this.canvases.forEach(entry => this.clearWaveForEntry(entry));
} | [
"function clearWaveform() {\n ctx.clearRect(0, 0, canvasRect.width, canvasRect.height);\n}",
"function clearWave(){\n ctxWave.beginPath();\n ctxWave.clearRect(0, 0, Wave.width, Wave.height); \n ctxWave.stroke();\n}",
"clear() {\n this.tracks.length = 0;\n this.loop = false;\n this.lengt... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Handles a resize of the screen by width but ignores height changes. Deletes the current visualisation and the instance of the LineChart class so it will be created from scratch again. | resize() {
if (window.innerWidth === this._windowWidth) return
this._windowWidth = window.innerWidth
this._lineChart = undefined
const wrapper = document.querySelector("[data-viz='wrapper']")
wrapper.removeChild(wrapper.lastChild)
this.lineChart().createDataVis()
} | [
"_resize() {\n\t\tthis.graphOptions.width = window.innerWidth * 0.7;\n\t\tthis.graphOptions.height = window.innerWidth * 0.5;\n\t\tthis.notifyPath('graphOptions.width');\n\t\tthis.notifyPath('graphOptions.height');\n\t}",
"onCustomWidgetResize(_width, _height){\r\n\t\t\t\r\n\t\t\tthis.wdth = _width;\r\n\t\t\tthis... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Redirect to the thank you page | function timeoutRedirect()
{
$location.path("/merchants/" + merchantId + "/thankyou");
} | [
"function redirectThankPage(order_data){\n window.location.href = `${root_pathname}thanking.html?orderId=${order_data.data.number}`\n}",
"function renderThankYouPage(request, response) {\n saveAndDestroySession(request);\n renderPage('thankyou', {}, response);\n}",
"function pageRedirect() {\n set... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
validateForm() SUB FUNCTIONS DISPLAY RESULTS FUNCTION Displays results; sends the BMR and TDEE output from calculateResults() back to the user. Fires when user clicks submit form, and inputs are determined valid based on validateForm() Main Function | function displayResults () {
if(validateForm()) {
// If all inputs are valid, create a user profile to calculate results
const user = createUserProfile();
// TDEE Results
document.getElementById("tdee-results").innerHTML = "Your TDEE: results";
// BMR Results
docume... | [
"function CalculateResults()\r\n {\r\n var inputsAllValid;\r\n\r\n // Fetch all input values from the on-screen form.\r\n\r\n inputsAllValid = FetchInputValues();\r\n\r\n // If the fetched input values are all valid...\r\n\r\n if (inputsAllValid)\r\n {\r\n // Do the natural gas pressure ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
import ProfileTitle from "../components/ProfileTitle"; | function Profile() {
return (
<div>
{/* <ProfileTitle/> */}
<CardWrapper>
<UsersProfile />
</CardWrapper>
</div >
);
} | [
"function StaffProfiles() {\n return (\n <div className=\"StaffProfiles\">\n <h1>StaffProfiles Component</h1>\n\n </div>\n );\n}",
"function App() {\n return (\n <Profile\n Title=\"Hello,\"\n subTitle=\"Full stack JS student\"\n subTitle2=\"a bit about me:\"\n bio= \"\"\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Insert a `value` into an `array` so that the array remains sorted. NOTE: Duplicates are not allowed, and are ignored. This uses binary search algorithm for fast inserts. | function arrayInsertSorted(array, value) {
var index = arrayIndexOfSorted(array, value);
if (index < 0) {
// if we did not find it insert it.
index = ~index;
arrayInsert(array, index, value);
}
return index;
} | [
"function arrayInsertSorted(array, value) {\n var index = arrayIndexOfSorted(array, value);\n\n if (index < 0) {\n // if we did not find it insert it.\n index = ~index;\n arrayInsert(array, index, value);\n }\n\n return index;\n }",
"function arrayInsert... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Takes a config object and serializes/URI encodes the contents of the body property. If the "ContentType" header is set to "application/json", it encodes the payload as JSON. Otherwise, we assume that the payload should be xwwwformurlencoded. | function _getUriEncodedBody(config){var contentType=config&&config.headers&&config.headers["Content-Type"];var body=config&&config.body||"";if(contentType==="application/json"){body=JSON.stringify(body);}else{if(_isObj(body)){body=_getUriEncodedParams(body);}}return body;} | [
"function _getUriEncodedBody (config) {\n var contentType =\n config && config.headers && config.headers[\"Content-Type\"];\n var body = (config && config.body) || \"\";\n\n if (contentType === \"application/json\") {\n body = JSON.stringify(body);\n } else {\n if (_isObj(body)) {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
resets the all series select button | function resetSelectAllSeriesButton() {
document.getElementById("selectAllButton").setAttribute("toggle", "off");
} | [
"function resetAllSelectSeriesButtons() {\n\tresetSelectAllSeriesButton();\n\tvar select_buttons = document.body.querySelectorAll(\".seriesSelectButton\");\n\tfor (var i = 0; i < select_buttons.length; i++) {\n\t\tselect_buttons[i].setAttribute(\"toggle\", \"off\");\n\t}\n}",
"addResetSeries () {\n const s... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Complete the startDbAndServer function, which connects to the MongoDB server and creates a Node web server listening to port 3000. | async function startDbAndServer() {
db = await mongodb.connect(MONGO_URL);
collection = db.collection('card');
await app.listen(3000);
console.log('It is on 3000');
} | [
"async function setupAndStart () {\n if(await db.setup())\n app.listen(3000, ::console.log('Server listening on port', 3000))\n}",
"function setUpMongoDB() {\r\n mongoose.connect('mongodb://' + config.IP + '/' + config.dbName, { useNewUrlParser: true });\r\n mongoose.set('useCreateIndex', true);\r\n\r\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
returns the layer set heirarchy | function getSetHeirarchy(layers) {
var ret = {};
if (layers.typename === "ArtLayer")
return ret;
for (var i = 0; i < layers.layers.length; i++) {
ret[layers.layers[i].name] = getSetHeirarchy(layers.layers[i]);
}
return ret;
} | [
"get layers() {\r\n return this._layers;\r\n }",
"get layers() {\n return this._layers;\n }",
"function wmsLayerGetSubLayers()\n{\n\treturn Object.keys(wmsLayerDimensionValues);\n}",
"layers() {\n return this._layers;\n }",
"static get visibleLayers() {}",
"function tp_get_laye... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
FINAL FUNCTION Generates a random recipe from the data sets above and prints it to the console in a specific format. | function generateRecipe() {
// Potion Name
const randPotionDescriptor = getRandomElement(potionDescriptors);
const randPotionType = getRandomElement(potionTypes);
// Potion Ingredients
const randLiquid = getRandomElement(ingredients.liquids);
const randPrimary = getRandomElement(ingredients.pri... | [
"function generateRecipe(){\n let rolls = dice();\n\n let steps = [\"Temperature\",\"Steep Time / Grind\",\"Water / Coffee\",\"Stirring\",\"Position / Bloom\"]\n\n let recipe = {\n temperature: `${steps[0]}: ${temperatureOptions[rolls[0]]}`,\n steepTimeGrind: `${steps[1]}: ${steepTimeGrindOpt... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
populate the parameter element with a list of column names | function populate_parameter(selected_table) {
d3.json("/arborapi/projmgr/project/" + project + "/CharacterMatrix/" + selected_table, function (error, result) {
// clear out previous contents
$("#parameter").empty();
var contents = "<option>Select...</option>";
var headerRow = result[0];
$.each(he... | [
"function paramHandleColumnNames(parameters)\n{\n var splitted = parameters.split(\"+\")\n splitted[0] = splitted[0].substring(1)\n splitted[splitted.length-1] = splitted[splitted.length-1].substring(0,splitted[splitted.length-1].length-1)\n var newParam = ' ('+splitted[0]\n for(var i=1; i<splitted.l... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Creates header and feed divs and appends it to main div | function feedHeader() {
//create all the divs and stuff
const feed = document.querySelector('#feed');
//create and append feed header div
var headerText = 'Popular Posts';
if(helper.loggedIn()) {
headerText = 'My Feed';
}
const feedHeader = helper.createEleTextless('div', 'feed-head... | [
"function createContentHeader() {\n // creates content div\n contentDiv = document.createElement(\"div\");\n contentDiv.className = \"content\";\n // creates header div\n headerDiv = document.createElement(\"div\");\n headerDiv.className = \"header\";\n}",
"function addDivs()\r\n{\r\n\t// find ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
user clicks a card, turns over X or O depending on turn | function turnCard() {
count++;
if (count % 2 === 0) {
this.innerText = 'X';
} else {
this.innerText = 'O';
}
} | [
"function cardClick() {\n\tif (clickedCards.length === 2 || matchedCards.includes(this.id)) {\n\t\treturn;\n\t}\n\tif(clickedCards.length === 0 || this.id != clickedCards[0].id){\n\n\t\tif(timeTrigger){\n\t\t\ttimerStart();\n\t\t\ttimeTrigger = false;\n\t\t}\n\t\tthis.classList.add('show', 'open');\n\t\tclickedCard... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
The same as `timeout`, but instead of producing a `None` in the event of timeout, it will produce the specified error. | function timeoutFail_(self, d, e, __trace) {
return (0, _flatten.flatten)((0, _timeoutTo.timeoutTo_)(self, d, (0, _core.suspend)(() => (0, _fail.fail)(e())), _core.succeed, __trace));
} | [
"timeoutError() {\n var time = this._timeout\n var err = new Error('timeout of ' + time + 'ms exceeded')\n err.timeout = time\n this.response.error(err)\n }",
"identifyTimeout() {\n this.statemachine.goto(\n 'ERROR',\n new Error('Timed out identifying with nsqd')\n )\n }",
"functio... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Bound a number by 1e6 and 1e20 to avoid exponents after toString | function boundNumber(num) {
if (num === 0) {
return num;
} else if (num < 0) {
return -boundNumber(-num);
} else {
return Math.max(1e-6, Math.min(num, 1e20));
}
} | [
"function boundNumber( num ) {\n\t\t\t\tif ( num === 0 ) {\n\t\t\t\t\treturn num;\n\t\t\t\t} else if ( num < 0 ) {\n\t\t\t\t\treturn -boundNumber( -num );\n\t\t\t\t} else {\n\t\t\t\t\treturn Math.max( 1e-6, Math.min( num, 1e20 ) );\n\t\t\t\t}\n\t\t\t}",
"function scientificNotation(num) {\n var data = parseInt(n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Fades out loading screen and removes it from DOM | function fadeOutLoadScreen() {
setTimeout(() => {
$('.loading-page, .loading-page svg').addClass('fade-out');
setTimeout(() => {
$('body').removeClass('no-scroll');
}, 700);
setTimeout(() => {
$('.loading-page').remove();
}, 2000);
}, 500);
} | [
"function loadingFadeOut() {\n\t\t$(\".loading\").fadeOut();\n\t}",
"function destroyLoadingScreen() {\n\t\t\t$('.imdbLoading').fadeOut('slow',function(){\n\t\t\t\t$('.imdbLoading').remove();\n\t\t\t});\n\t\t}",
"removeLoadingScreen () {\n document.getElementById('loadingScreen').remove()\n }",
"function ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Take an Array of nodes, and whenever an _iter node is encountered, splice in its recursivelyflattened children instead. | function flattenIterNodes(nodes) {
var result = [];
for (var i = 0; i < nodes.length; ++i) {
if (nodes[i]._node.ctorName === '_iter') {
result.push.apply(result, flattenIterNodes(nodes[i].children));
} else {
result.push(nodes[i]);
}
}
return result;
} | [
"function flatten(arr) {\n for (var i = 0, l = arr.length, current; i < l; i++) {\n current = arr[i]\n if (is.Array(current)) {\n // Make sure we loop to the Array's new length\n l += current.length - 1\n // Replace the current item with its contents\n splice.apply(arr, [i, 1].concat(curr... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Creates a preview frame and necessary objects | function createPreview() {
// Create fullscreen preview
var capturePreviewFrameStyle = document.createElement("link");
capturePreviewFrameStyle.rel = "stylesheet";
capturePreviewFrameStyle.type = "text/css";
capturePreviewFrameStyle.href = urlutil.makeAbsolut... | [
"function createPreview() {\n video = document.createElement('video');\n video.style.cssText = \"width: 100%; margin: auto; position: absolute; top: 0; bottom: 0\";\n video.setAttribute('autoplay', true);\n var previewPanel = document.createElement('sectio... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
////////////////////////////////FUNCTION THAT RETURNS THE DATE THE BOOKING WAS AUTHORIZED | authorizedOn(){
return this.authorizedDate;
} | [
"static date_bill(){\r\n \t\treturn new Date();\r\n \t}",
"function getRevDate() {\r\n //build the revision date\r\n var now = new Date();\r\n var revDate = String(now.getUTCFullYear());\r\n revDate += String(now.getUTCMonthFull());\r\n revDate += String(now.getUTCDateFull()) + \"T\";\r\n revDate += String(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Create a container for the upload elements and append it to the form, and return in. | appendUploadContainer(){
let container = document.createElement("div");
container.setAttribute("id", "file-input-container");
container.classList.add("file-upload-container");
container.setAttribute("style", "text-align:center;");
this.form.appendChild(container); // Probably ... | [
"createUploadElements() {\n\n this.form = this.options.get(\"useExistingForm\") ? document.getElementById(this.options.get(\"formId\")) : this.appendFormElement();\n this.uploadContainer = this.appendUploadContainer();\n this.fileInput = this.appendFileInput();\n\n if(document.querySelec... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
set random landing positions | function setLandingPosition(){
landingPosition.x = Math.floor(Math.random() * (landingLimitCoordinates.right - landingLimitCoordinates.left + 1) + landingLimitCoordinates.left);
landingPosition.y = Math.floor(Math.random() * (landingLimitCoordinates.down - landingLimitCoordinates.up + 1) + landingLimitCoordinat... | [
"function setLoc() {\n xLoc = random(60, width - 60);\n yLoc = random(60, height - 60);\n}",
"generateRandomLocation()\n {\n this.babylonBox.position.x = Math.random() * worldBounds;\n this.babylonBox.position.y = Math.random() * worldBounds;\n this.babylonBox.position.z = Math.rando... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
dfsPostOrder(): Traverse the array using postorder DFS. Return an array of visited nodes. | dfsPostOrder() {
const visitedNodes = [];
const nodeStack = [this.root];
while(nodeStack.length){
const currentNode = nodeStack.pop();
const {left, right} = currentNode;
visitedNodes.push(currentNode.val);
if(right) {
nodeStack.push(right);
}else{
visitedNodes... | [
"dfsPostOrder() {\n const visited = [];\n traverse(this.root);\n function traverse(node) {\n if (node.left) traverse(node.left);\n if (node.right) traverse(node.right);\n visited.push(node.val);\n }\n return visited;\n }",
"dfsPostOrder(node = this.root) {\n const visited = [];\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Generate a nominatim search link for a feature name | function nominatimLink(name, coordinates) {
const NOMINATIM_BASE = 'http://nominatim.openstreetmap.org/search.php?q=';
// Limit search to the vicinity of the given coordinates
try {
var left = coordinates[0] - 1;
var top = coordinates[1] - 1;
var right = coordinates[0] + 1;
var bottom = coordin... | [
"function magiQueryHrefFn() {\n var datasets = 'datasets=' + addedList.join('%2C'),\n genes = 'genes=' + loadedGenes.join('%2C'),\n search = [genes, datasets];\n\n return 'view?'+search.join('&');\n }",
"function getLink(url, term, label) {\n formattedTerm = term.split(' ').join('+');\n ret... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Initial class where the home page, menu page and scenarios are created Parameters: container: container where the game will be Scenarios: map with scenario data | constructor(container,Scenarios) {
this.container = container;
this.dataset = Scenarios;
this.home_page();
this.menu_page();
this.create_scenery();
} | [
"constructor (container) {\n // Root container\n this.container = container;\n\n // Pages\n this.pageHome = new HomePage();\n this.pageOpleiding = new OpleidingPage();\n this.pagePGMTeam = new PGMTeamPage();\n this.pageStudentDetail = new StudentDetailPage();\n this.pagePortfolio = new Portf... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
work on ephem1 source display the ephemerides for the day on the zone1 (main) the content is modified but the logo and the title are the same function uses : get_a_month(month) > js/date.js | function glc_render_ephemeride_for_main_same_title(datas, zone, timeInfo) {
timeInfo = typeof timeInfo !== 'undefined' ? timeInfo : 3;
var logo = '<img src="img/logos/absence.png"/>';
zone.loadImage("img/logos/absence.png");
var title = "Ephemeride";
var time = timeInfo;
var content = "";
var day = datas.day;
... | [
"function updateTitle(dateText, elevText) {\n\t\n //This symbol indicates when does the date and elevation text start\n\t\n if ((dateText !== \"\") || (elevText !== \"\")) {\n\t\t\n var endDate = \" \";\n\t\t\n if (typeof calEnd !== 'undefined') {\n var locendSel = calEnd.selection.ge... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Update the classList to remove or add the className to the element | function classList(element, className, state) {
// update the class using the classList attribute if present,
// falling back onto a more tradional approach otherwise
if ('classList' in element) {
element.classList[state ? 'add' : 'remove'](className);
}
else {
element.className = element.className.re... | [
"function swui_removeCSSClass(widget, className) {\r\n cssClasses = widget.getAttribute(\"class\");\r\n if (cssClasses == null) {\r\n cssClasses = \"\";\r\n } else {\r\n cssClasses = cssClasses.replace(className + \" \",\"\"); // className is always the head of the list\r\n cssClasses = cssClas... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Find indices of lowest/highest votes. Loser boolean denotes high or low order | function getIndex(countArray, loser) {
var i, n = countArray.length;
var point = loser ? Infinity : -Infinity;
var index = [-1];
for (i = 0; i < n; i++) {
if ( loser ? point > countArray[i] : point < countArray[i]) {
point = countArray[i];
index = [i];
} else if (... | [
"getOptionIdWithLowVotes(){\n let result;\n const list = Object.keys(this.votes) // Get the ids\n .map(id => [id, Math.abs(this.votes[id])]) // Make them into objects containing id and # of votes\n .sort((a, b) => a[1] - b[1]) ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Adds all the usernames as competition participants. | async function addParticipants(id, verificationCode, usernames) {
const competition = await getCompetitionForParticipantOperation(id, verificationCode, usernames);
// Find all existing participants
const existingIds = (await competition.getParticipants()).map(p => p.id);
// Find or create all players with the... | [
"async function setParticipants(competition, usernames) {\n if (!competition) {\n throw new BadRequestError(`Invalid competition.`);\n }\n\n const uniqueUsernames = _.uniqBy(usernames, p => p.toLowerCase());\n\n const existingParticipants = await competition.getParticipants();\n const existingUsernames = ex... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Load info/loved status for current song from last.fm. | function loadCurrentLastfmInfo() {
song.lastfmInfo = null;
song.loved = null;
var songInfo = song.info;
getLastfmInfo(songInfo, function(loved, lastfmInfo) {
if (songInfo != song.info) return;//song meanwhile changed
song.lastfmInfo = lastfmInfo;
song.loved = loved;
if (settings.... | [
"function loadInfoMC() {\n //load now playing\n WSBF.playlist.nowplaying.getInfo(function (trackinfo) {\n $(\".wsbf-player-widget .song-album\").html(trackinfo.song + \"/\" + trackinfo.album);\n $(\".wsbf-player-widget .artist-name\").html(trackinfo.artist);\n var show... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Start the event filter in the merkletree microservice, for the given contract | async function startEventFilter(contractName) {
console.log(`\nCalling startEventFilter(${contractName})`);
return new Promise((resolve, reject) => {
const options = {
url: `${url}/start`,
method: 'POST',
json: true,
body: { contractName },
};
request(options, (err, res, body) =>... | [
"function doContractEventWatchStart() {\n\n if(contractEvent){\n doContractEventWatchStop();\n }\n\n // Reset the UI\n setData('watch_contract_instance_event_count','0',false);\n\n contractEvent = createContractEventInstance();\n\n contractEvent.watch(function(error, result){\n if... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets the column to be searched with the coilumns header / Returns Column position | function getColumn(sheet,name){
var curSheet = ss.getSheetByName(sheet);
var headers = curSheet.getRange(1,1,1,curSheet.getLastColumn()).getValues();
var column = headers.indexOf(name)+1;
return column
} | [
"function getColumnPosition(colName) {\n return _.find(columns, (c)=>(c.name==colName))?.pos;\n }",
"function column(headers, header, firstCol, startZero)\n{\n var index = headers.indexOf(header);\n if(index < 0)\n {\n throw new Error(\"Pas de colonne dont la clé est \" + header + \" dans \" + headers);... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Summary Generate a random HD wallet. Description Generate a random HD wallet from the ethers library. | function generateRandomHDWallet() {
return ethers.Wallet.createRandom();
} | [
"function hdRandom() {\n const mnemonic = StellarHDWallet.generateMnemonic(); // 24 words\n const wallet = StellarHDWallet.fromMnemonic(mnemonic);\n const keypair = wallet.getKeypair(0);\n return {\n mnemonic,\n keypair\n };\n}",
"async function createHDWalletDapp() {\n\n try {\n \n const pr... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Checks if the given card is in the list of fusions Assumes the given card is an Object with an "Id" field TODO: Generalize to take Object, Name (string) or Id (int) | function hasFusion(fusionList, card) {
return fusionList.some((c) => c.Id === card.Id);
} | [
"function cardExists(list, value, index) {\n return list[index].cards.some(function (item) {\n return item.ID === value.ID;\n });\n }",
"function containsObject(obj, list) {\n var i;\n for (i = 0; i < list.length; i++) {\n if (list[i].name === obj.name) {\n return true;\n }\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Check whether the given url matches our target format (some form of PR page) | function isEligibleUrl(url)
{
return url.match(/\/pull\/([0-9]+)(\/?)/g);
} | [
"function isReviewPage() {\n return window.location.href.match(/^(http|https):\\/\\/www.stumbleupon.com\\/url/i);\n}",
"function checkUrl(url) {\n if ((url.match(DOC_REGEX) != null) &&\n (url.match(DOC_REGEX) != undefined) &&\n (url.match(DOC_REGEX)[0] == url)) {\n return true;\n }\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Modifies query so that it no longer has $in on relation fields, or equaltopointer constraints on relation fields. Returns a promise that resolves when query is mutated | reduceInRelation(className: string, query: any, schema: any): Promise<any> {
// Search for an in-relation or equal-to-relation
// Make it sequential for now, not sure of paralleization side effects
const promises = [];
if (query['$or']) {
const ors = query['$or'];
promises.push(
...o... | [
"reduceInRelation(className: string, query: any, schema: any): Promise<any> {\n // Search for an in-relation or equal-to-relation\n // Make it sequential for now, not sure of paralleization side effects\n if (query['$or']) {\n const ors = query['$or'];\n return Promise.all(\n ors.map((aQue... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Interpolate series with gaps | function interpolateSeries(series) {
var left, right;
// Interpolate series
for (var i = series.length - 1; i >= 0; i--) {
if (!series[i][0]) {
left = findNearestLeft(series, series[i]);
right = findNearestRight(series, series[i]);
if (!left) {
left = right;
}
if (!right... | [
"function interpolateSeries(series) {\n var left, right;\n\n // Interpolate series\n for (var i = series.length - 1; i >= 0; i--) {\n if (!series[i][0]) {\n left = findNearestLeft(series, series[i]);\n right = findNearestRight(series, series[i]);\n if (!left) {\n left = r... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Takes an array of numeric dates and tries to understand if the days come before the month or the other way around by checking if numbers go above 12 Output is true if days are first, false if they are second, or null if it failed to understand the order | function checkAbove12(numericDates) {
var daysFirst = numericDates.some(indexAboveValue$1(0, 12));
if (daysFirst) {
return true;
}
var daysSecond = numericDates.some(indexAboveValue$1(1, 12));
if (daysSecond) {
return false;
}
return null;
} | [
"function hasTwoMonths(arr) {\n const length = arr.length;\n let index = null;\n for (var i = 0; i < length - 1; i++) {\n if (parseInt(arr[i].date) > parseInt(arr[i + 1].date)) {\n index = i + 1;\n break;\n }\n }\n return index;\n}",
"function daysBeforeMonths(numericDates) {\n var firstCh... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
count of labels (i.e [["Italy"],["Spain", "Greece"]] > 3) | function countLabels(arr) {
let i,
total = 0
if (Array.isArray(arr[0])) {
for (i = 0; i < arr.length; i++) {
total += countLabels(arr[i])
}
} else {
for (i = 0; i < arr.length; i++) {
total += 1
}
}
return total
} | [
"function totalLabelLength(arr) {\n var i,\n total = 0;\n\n if (Array.isArray(arr[0])) {\n for (i = 0; i < arr.length; i++) {\n total += totalLabelLength(arr[i]);\n }\n } else {\n for (i = 0; i < arr.length; i++) {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Prints states of several course interaction variables to the console for debugging | function logVarStates(){
console.log();
console.log("currentSelectedItem: " + currentSelectedItem);
console.log("inProgressNode: " + inProgressNode);
console.log("currentInProgressGroups: " + currentInProgressGroups);
console.log("nodeFrontier: " + nodeFrontier);
console.log("nodePath: " + nodePath);
cons... | [
"function showState() {\n console.log(\"Huts = \" + NSH);\n console.log(\"Trees = \" + NST);\n \n}",
"function printStates() {\n console.log('\\nStates')\n Object.keys(Dialogs).forEach(e => \n console.log(`${e} : ${stateNames(Dialogs[e].unit).join(', ')}`))\n //console.log('\\n')\n\n return this \... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets the user input according to provided `options`.Returns directly if single choice is provided. | getUserInput(options, withBackChoice = false) {
return __awaiter(this, void 0, void 0, function* () {
if (options.choices) {
if (options.choices.length < 2) {
// single choice to return:
let choice = options.choices[0];
choi... | [
"function userOptions(){\n console.log(\" \")\n console.log(\"____________________________________\")\n console.log(\" \")\n console.log(\" a .... to attack \")\n console.log(\" \")\n console.log(\" r .... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Represents a single user in the hierarchy. |force| and |show| the same as PrefNetwork. | function PrefUser(parent, name, force, show)
{
if (":" + name in parent.users)
return parent.users[":" + name];
this.parent = parent;
this.unicodeName = name;
this.viewName = name;
this.canonicalName = name;
this.collectionKey = ":" + name;
this.encodedName = name;
this.pret... | [
"function PrefNetwork(parent, name, force, show)\n{\n if (\":\" + name in parent.networks)\n return parent.networks[\":\" + name];\n \n this.parent = parent;\n this.unicodeName = name;\n this.viewName = name;\n this.canonicalName = name;\n this.collectionKey = \":\" + name;\n this.enc... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Update Shipments: updates Shopify orders using the API | function updateShipments (next) {
Log.log('');
Log.log('TASK THREE: Shipment updates');
async.waterfall([
// Get files from directory
function (callback) {
Files.getParsedCSVs({
'path': config.directories.shipments,
}, function (err, files) {
callback(err, files);
});
},
// Make orders ma... | [
"function shipApi(shipment, order_id) {\n return __awaiter(this, void 0, void 0, function* () {\n return new Promise((resolve) => {\n for (const product_id in shipment) {\n let params = [product_id, order_id, shipment[product_id]];\n database_1.default.query('INSER... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
get professors from database | function getProfessors(){
$http.get('/members/role/professor').then(
res => {
vm.professors = res.data;
},
err => {
alert(err.data.message);
}
);
} | [
"async function getProfessors () {\n try {\n let professors = await Api.get('/disciplinas')\n await Utils.storage.setItem('ufabc-extension-last', Date.now())\n await Utils.storage.setItem('ufabc-extension-disciplinas', professors)\n return professors\n } catch(e) {\n console.log('❌ Er... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
places a flag on a particular point given a set of coords | function placeFlag(posX, posY){
var idx = getSpaceIndex(posX, posY);
identifyBoardRegion(idx);
if(!spaces[idx].flagged){
if(playerStats.flags > 0){
var myCircle = drawCircle(idx,10,'pink');
spaces[idx].flagged = true;
playerStats.flagsUsed++;
playerStats.flags--;
}
} else{
var my... | [
"flag([y, x]) {\n let tile = this.grid_[y][x];\n if (!tile.isRevealed) {\n tile.isFlagged = !tile.isFlagged;\n this.numFlags_ = this.numFlags_ + (tile.isFlagged ? 1 : -1);\n this.update_([[y, x]]);\n }\n }",
"function drawFlag(coords){\n let positionx = coords.x * squareSide + 0.1 ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Method for click prev button. | function onClickNaviPrev(el) {
if(curPageNumber <= 0) {
return false;
}
curPageNumber = curPageNumber -1;
refreshTable();
debug('Prev button clicked. page number : ' + curPageNumber);
} | [
"prevButtonClicked(){\n $('#project-evaluation-page #project-evaluation-carousel').get(0).prev();\n }",
"previous() {\n const elem = this.node();\n const selector = '.skipControl__previous';\n const btn = elem.querySelector(selector);\n\n btn.click();\n }",
"handlePreviousClick() ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
API test for 'GetIPsecServices', Get IPsec service configuration | function Test_GetIPsecServices() {
return __awaiter(this, void 0, void 0, function () {
var out_ipsec_services;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
console.log("Begin: Test_GetIPsecServices");
return... | [
"ListAvailableServices() {\n let url = `/saas/csp2`;\n return this.client.request('GET', url);\n }",
"function getIpConfig(req,res,nex){\n cmd.get(\n 'ipconfig',\n function(err, data, stderr){\n if(data){\n return res.status(200).send(data);\n }\n });\n}",... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Handle the filter form initialise search event. | handleFilterFormInitSearchEvent() {
this.listingElement.classList.add('registry-component-list--loading');
this.listingElement.setAttribute('aria-busy', 'true');
} | [
"function initListener(){\n $('.search-form').submit(event => {\n event.preventDefault();\n const queryTarget = $(event.currentTarget).find('.search-field');\n searchTerm = queryTarget.val();\n queryTarget.val('');\n getNews(searchTerm, renderNews);\n });\n}",
"function in... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
UnMount mutation observer and delete SimpleBar instance from DOM element | unMount() {
this.removeListeners();
SimpleBar.instances.delete(this.el);
} | [
"unMount() {\n this.removeListeners();\n this.el.SimpleBar = null;\n }",
"_removeMutationObserver() {\n if (this._observer) this._observer.disconnect();\n }",
"destroy() {\n this.teardown();\n $.removeData(this.element, COMPONENT_NAME);\n }",
"onDOMNodeRemoved() {\n this.destroy();\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns unique position value based on selected position in collection | function getPosition(position, collection) {
var prev = collection.at(position - 1)
, next = collection.at(position);
if (prev) prev = prev.get('position');
if (next) next = next.get('position');
var betweenVal = between(prev, next);
// For value close to 0 or too close with next
// like... | [
"get selectedIndex() {\n let item = this.itemData.filter((i) => i.id === this.selection);\n return item && item[0] ? item[0].index : 0;\n }",
"function findUniqueInsertPoint(select, text) {\r\n\tif (select.options.length == 0) {\r\n\t\tanswer = 0;\r\n\t} else {\r\n\t\tanswer = binarySearch(select, 0,... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
A utility function to print the constructed MST stored in parent[] | function printMST(parent,n,graph)
{
console.log("Minimum spanning tree is following:")
console.log("Edge | Weight");
for (let i = 1; i < V; i++)
console.log( parent[i]+" -" ,i,"| "+ graph[i][parent[i]]);
} | [
"toString(){\n if(this.isEmpty()) return console.log(\"The treap is currently empty.\");\n let arr = this.levelOrder(this.root);\n console.log(\"Treap: [\",arr.toString(),\"] Size:\",this.size); \n console.log(this.printTreap());\n }",
"printDetails()\r\n {\r\n this.log(th... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Store / ReducerManager, StateObservable, ActionsSubject StateObservable / ActionsSubject ReducerManager ScannnedActionsSubject => leaf InitialState ActionsSubject (leaf) ReducerManager / ReducerManagerDispatcher INITIAL_STATE => pass in parameters INITIAL_REDUCERS => ActionReducerMap (pass in parameters) REDUCER_FACTOR... | function factory() {
var actionSubject = new store.ActionsSubject();
var scannerActionSubject = new store.ScannedActionsSubject();
var reducerManagerDispatch = actionSubject;
var actionReducerFactory = store.combineReducers;
var reducerManager = new store.ReducerManager(actionSub... | [
"function factory() {\n const actionSubject = new ActionsSubject();\n const scannerActionSubject = new ScannedActionsSubject();\n const reducerManagerDispatch = actionSubject;\n const actionReducerFactory = combineReducers;\n const reducerManager = new ReducerManager(actionSubject, buildInitialState(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Call plugins sequentially and pass on a value (waterfall style). Plugins that expose the supplied property will be called. The plugins can either modify the value or return an updated one. Will return the latest, updated value which ran through all plugins. | async callPluginsWithValue(prop, value) {
for (const plugin of this.getPluginsByProp(prop)) {
const newValue = await plugin[prop](value);
if (newValue) {
value = newValue;
}
}
return value;
} | [
"async callPlugins(prop, ...values) {\r\n for (const plugin of this.getPluginsByProp(prop)) {\r\n await plugin[prop].apply(plugin, values);\r\n }\r\n }",
"async run(prop, value, ignoreErrors) {\n\t if (!prop) {\n\t return await this.runAll()\n\t }\n\n\t try {\n\t thi... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
show sweet aleart, if user confirm delete, move to searchscholarship page if user click cancle, sweetaleart will be closed, and this already implemente in swal | function cancelShareBtnClickEvent() {
// show sweetaleart
swal({
title: "Are you sure!",
text: "You want to cancel sharing",
icon: "warning",
dangerMode: true,
buttons: ["No", "Yes"]
}).then((value) => {
// if value=true > confirm cancle registration > move sear... | [
"function cancelBtnClickEvent() {\n// show sweetaleart \n swal({\n title: \"Are you sure!\",\n text: \"Do you want to cancel adding the opportunity?\",\n icon: \"warning\",\n dangerMode: true,\n buttons: [\"No\", \"Yes\"]\n }).then((value) => {\n // if value=true > co... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Template for all cursors. A cursor may be a table cursor, a indexed table cursor or the result of a query. A cursor has to initialize itself to be ready for the first walkthrough. Providing a new storage backend to SQLinMemory.js is easy as you just have to provide cursors to walk through tables (or walk through indice... | function Cursor() {
/**
Restart walking through the data.
This function should reinizialize the cursor as if you were
creating the cursor again. This should also work after closing
the cursor and should not leak memory when not all data was fetched.
*/
this.reset = function() {};
/**
Fetch one row of ... | [
"function createCursor() {\n var _defaultCursor = _marsdb2.default.defaultCursor();\n\n var MongoCursor = function (_defaultCursor2) {\n _inherits(MongoCursor, _defaultCursor2);\n\n function MongoCursor(db, query, options) {\n _classCallCheck(this, MongoCursor);\n\n return _possibleConstructorRetu... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Count Num Posts for each URL | function countNumPosts(callback){
let url = getNextURL();
if (!url)
{
currentURL = 0;
return callback();
}
let currentPage = (!url["currentPage"] ? 1 : url["currentPage"]); //Default page = 1;
getBeachNumPages(url["url"], function(numPages){
let numUnread = numPages - currentPage +... | [
"function get_post_count(){\r\n\treturn app.getSourceCount(this, [\"Post\"], new NativeFilter(\"published:true\"));\r\n}",
"function countLinks() {\n var x = document.links.length;\n document.getElementById('count').innerHTML = x;\n}",
"getCount() {\n this.info.linkCounter += 1;\n return thi... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
uses instrument.name to get the HTML element for that instrument or if a card with this id isnt found it clones the template and returns it | function getInstrumentCard(instrument) {
const id = instrument.name;
const card = document.getElementById(id);
if (card) {
return card;
}
const newCard = document.getElementById('Instrument-template').cloneNode(true);
// newCard.querySelector('.location').textContent = location.label;
... | [
"_getTemplate() {\n const cardElement = document.querySelector(this._templateSelector)\n .content\n .querySelector('.element')\n .cloneNode(true);\n return cardElement;\n }",
"function getTemplate(card) {\n var r = card[0]; // get rank\n var s = card[1]; // get suit\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |