query stringlengths 9 34k | document stringlengths 8 5.39M | negatives listlengths 19 20 | metadata dict |
|---|---|---|---|
Function: deleteRemote remove remote data, then clear local diff. Fires: error | function deleteRemote(path, local, remote) {
logger.info('DELETE', path, 'LOCAL -> REMOTE');
return remoteAdapter.
remove(path).
then(function() {
store.clearDiff(path);
});
} | [
"function deleteRemote(path, local, remote) {\n logger.info('DELETE', path, 'LOCAL -> REMOTE');\n wireClient.remove(\n path,\n makeErrorCatcher(path, util.curry(store.clearDiff, path, undefined))\n );\n }",
"async function deleteRemote ({\n core = 'default',\n dir,\n gitdir = join(dir, '.gi... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
newCommandName can be any camelCased command name | setCommandName(newCommandName) {
this.test.commandName = newCommandName
} | [
"changeCommandName(name) {}",
"changeCommandName(name) {\n database.updateCommand(this.state.command.id, {\n name: name,\n });\n }",
"function newCommandHelpFucntion(){\n console.log('\"new\" command is used to create a new instance of client/server. ');\n console.log('The syntax of the command is... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Creates the `MotionInput` module instance. | function MotionInput() {
_classCallCheck(this, MotionInput);
/**
* Pool of all available modules.
*
* @this MotionInput
* @type {object}
* @default {}
*/
this.modules = {};
} | [
"function MotionInput() {\n\t _classCallCheck(this, MotionInput);\n\t /**\n\t * Pool of all available modules.\n\t *\n\t * @this MotionInput\n\t * @type {object}\n\t * @default {}\n\t */\n\n\n\t this.modules = {};\n\t }",
"constructor() {\n\n /**\n * Po... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
internal function called in the process of unlocking a tag. | function unlockTagInternal(array) {
var message = [
ndef.uriRecord(array[0]),
ndef.textRecord(array[1]),
ndef.textRecord(array[2]),
ndef.textRecord(array[3]),
ndef.textRecord("unlock")
];
nfc.write(
message,
function () {
... | [
"function HandleUnlock() {}",
"unlock() {\n\t\tthis.locked = false;\n\t}",
"unlock() {\n this._locked = false;\n }",
"function unlock()\r\n{\r\n\tlocked = false;\r\n}",
"unlock() {\n Atomics.store(this.sabArr, this.lockIndex, this.UNLOCKED);\n Atomics.notify(this.sabArr, this.lockIndex);\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
removeTreeNode(element) this function removes the node from the tree | function removeTreeNode(element)
{
var removeRow = element.parentNode;
var removeTable = removeRow.parentNode.parentNode;
var removeRowIndex = removeRow.rowIndex;
var rowLength = removeTable.rows.length;
removeTable.deleteRow(removeRowIndex+1);
removeTable.deleteRow(removeRowIndex);
if (rowLength > 2) ... | [
"function removeTreeFromElement()/*: void*/ {\n this.emitSync(\"willDetachFromParent\");\n this[_renderElement].removeChild(this.elementTree);\n this[_renderElement] = null;\n this[_attached] = false;\n this.emit(\"didDetachFromParent\");\n}",
"function removeElement(node){\n\tif (node.parentNode){... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Styles is an array of properties returned by `create()`, a POJO, or an array thereof. POJOs are treated as inline styles. This version of the resolve function explicitly flips inline styles for an RTL context. This function returns an object to be spread onto an element. | function resolveRTL(css, styles) {
var flattenedStyles = (0, _arrayPrototype2['default'])(styles, Infinity);
var _separateStyles = (0, _separateStyles3['default'])(flattenedStyles),
aphroditeStyles = _separateStyles.aphroditeStyles,
hasInlineStyles = _separateStyles.hasInlineStyles,
inlineStyles ... | [
"_resolveStyle(reactNativeStyle, options) {\n const flatStyle = flattenStyle(reactNativeStyle);\n const domStyle = createReactDOMStyle(options.i18n === false ? flatStyle : i18nStyle(flatStyle));\n\n const props = Object.keys(domStyle).reduce(\n (props, styleProp) => {\n const value = domStyle[s... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
readonly attribute boolean canSubscribe; | get canSubscribe()
{
return true;
} | [
"get isSubscribed(): boolean {\n return this._rawEvent.event === 'subscribed';\n }",
"get isSubscribed() {\r\n return this.subTypes.includes('message_allow');\r\n }",
"get isSubscribed() {\n return this._rawEvent.event === 'subscribed';\n }",
"get _isSubscribed() {\n return this._subs... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Add more space for schedule. | function addMore() {
var new_div = document.createElement('div');
new_div.appendChild(create_checkbox('Sun'));
new_div.appendChild(create_checkbox('Mon'));
new_div.appendChild(create_checkbox('Tue'));
new_div.appendChild(create_checkbox('Wed'));
new_div.appendChild(create_checkbox('Thur'));
new_div.appendChild(... | [
"function showMoreSchedules() {\n\t\tdisplayNextSchedules(10);\n\t}",
"addNewSchedule() {\n var length = this.schedules.length;\n this.schedules.push({\n groupId: this.id,\n start: 0,\n end: 0,\n heatingOn: false,\n w... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Navigate to the settings page | function navigateToSettings() {
//initializeSettingsFields();
$.mobile.changePage("#setting_dialog", {
role : "dialog",
allowSamePageTransition : true
});
} | [
"function gotoSettings() {\n navigation.navigate('settingsScreen');\n }",
"openSettingsPage() {\n cy.visit(this.#settingURL)\n }",
"function goToSettings() {\n window.location.href = \"settings.html\";\n}",
"function openSettingsPage() {\n let winid = browser.windows.getCurrent({populate: ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
set scene and rewire render loop for scene | set scene(val) {
if (this.scene) {
//console.log(this.engine, this.name);
}
if (this._scene && this._scene._engine) {
this._scene._engine.stopRenderLoop();
}
this._scene = val;
this._scene._engine.runRenderLoop( () => this.tick() );
} | [
"function renderLoop() {\r\n requestAnimFrame(renderLoop);\r\n drawScene();\r\n}",
"function scene_init() {\n\tscene_render();\n\tscene_activate();\n}",
"function render()\n {\n sceneManager.render();\n }",
"static updateScene() { if (this._scene) this._updateExistingScene(); }",
"functio... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Removes a talent point from talents | function removePoint(talentId, talents, details, talentDetails) {
var row = talentDetails[talentId].row,
tree = talentDetails[talentId].tree,
lastActiveRow = details[tree].lastActiveRow;
// need to have points in there to remove it
if (talents[talentId] <= 0)
return false;
... | [
"function removePoint() {\n var pointRemoved = talentHelper.removePoint(scope.talentId, scope.talentsSpent, scope.talentsSpentDetails, scope.talentDetails);\n update(pointRemoved);\n }",
"function remove_point(point) {\n\tpoint.map_point.setMap(null);\n\tdelete spawned_points[point.index]... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Method, that returns promise, that returns Model instance with 'this.url' URI, if api query was successful. | get() {
if(this.cache) {
return Promise.resolve(this.cache);
}
return this.formQueryAndSend('get').then(response => {
let instance = this.model.getInstance(response.data, this);
let prefetch_fields = this._getPrefetchFields();
// if prefetch field... | [
"async fetchResource() {\n if (!this.id || this.type === 'url' || !this.type) {\n // No fetch required\n return this.getResource();\n }\n\n // Fetch model\n const model = await this.#urlTranslator.getResourceById(this.id, this.type, {absolute: true});\n retur... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Find children for row's parent id | function children(id) {
var items = []
rows.forEach(function(r, i) {
if (skip.indexOf(i) === -1 && r[parentRef] === id) {
items.push(r)
skip.push(i)
}
})
cleanUpRows()
items.forEach(function(row) {
var id = row[p... | [
"static async getChildren(nested=true, id=null) {\n if (typeof id != \"number\" && id !== null) throw new BadRequestError(`${id} is not an integer`)\n\n if (id){\n let {rows:[loc]} = await db.query(\n `SELECT id, name, notes, parent_id as \"parentId\"\n FROM location\n WHERE id=$1\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Balanced number is the number that The sum of all digits to the left of the middle digit(s) and the sum of all digits to the right of the middle digit(s) are equal. Task Given a number, Find if it is Balanced or not . Warmup (Highly recommended) Playing With Numbers Series Notes If the number has an odd number of digit... | function balancedNum(number) {
let str = '' + number, num = str.length, h = num >> 1;
let sum = str => str.split('').reduce((a, b) => a + +b, 0);
return `${sum(str.slice(0, h - ((num & 1) == 0 ? 1 : 0))) != sum(str.slice(h + 1)) ? 'Not ' : ''}Balanced`;
} | [
"function balancedNum(number) {\n const str = number.toString();\n const length = str.length;\n const halfLength = Math.ceil(length /2) -1;\n const firstHalf = str.slice(0, halfLength);\n const lastHalf = str.slice(length - halfLength, length);\n const firstTotal = firstHalf.split('').reduce((prev... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
funzione prevImg toglie la classe active al nodo corrente e la mette al precedente | function prevImg() {
// def var locali
let imgActive = $('.images img.active');
let circleActive = $('.nav i.active');
// rimozione class .active
imgActive.removeClass('active');
circleActive.removeClass('active');
// if block
if (imgActive.hasClass('first')) {
$('.images img.last').addClass... | [
"function prev() {\n\t\t\tgoToImage((curImage-1 < 0 ? numImages-1 : curImage-1), next ,true);\n\t\t}",
"function prev() {\r\n --current;\r\n showImage('l');\r\n }",
"function getPrevImage() {\r\n // I create the variables for the active image and the active ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Updating waiting room status | function updateIsWaitingRoom() {
setIsWaitingRoom(!isWaitingRoom);
} | [
"async function updateWaitingRoomStatus(){\n await runningQuizDocument\n .update({\n isWaitingRoomActive: false\n }, {merge: true})\n setWaitingRoomActive(false)\n }",
"function roomWaiting(data) {\n // Change the host's room status to 'waiting'\n rooms[data... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function to reset our buffs to false. | function resetCombatVariables()
{ for(var i=0;i < currentBuffStatus.length;i++)
{ currentBuffStatus[i] = false;
}
weakenCount = 0;
lastHP = 0;
} | [
"resetBuffer() {\n while (this.blocked == true) { }; // dangerous ...\n if (this.copybuffer != undefined) {\n this.copybuffer.length = 0;\n this.copybuffer = undefined;\n\n for (let idx = 0; idx > this.PreStageFilter.length; idx++) {\n this.PreStageFilter.resetMemories();\n }\n }... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function checkApostrophe parameter : array return : array | function checkApostrophe(array) {
array.forEach(function(element, index) {
//console.log(element+" : "+element.indexOf('\''));
if (element.indexOf('\'') == 1) {
//console.log('index: '+index);
var tmp = element.replace(/'/g, '');
array[index] = tmp.substr(1);
... | [
"function checkSafety(text) {\n text = text.toLowerCase();\n if (text.includes('\"') || text.includes('\\'') || text.includes('--') || text.includes('union')) {\n return false;\n }\n return true;\n}",
"function checkCharactersValid() {\r\n //var lstSpecialCharacters = ['\"', \"'\", ';', ':',... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get the full path of the template file for generating charts based on config. | function getTemplatePath(templateFileName, config) {
if (config.templatePath !== undefined) {
return path.join(untildify(config.templatePath), `${templateFileName}.pug`);
}
return path.join(fileURLToPath(import.meta.url), '../../views/chart', `${templateFileName}.pug`);
} | [
"function getTemplatePath(templateFileName, config) {\n if (config.templatePath !== undefined) {\n return path.join(untildify(config.templatePath), `${templateFileName}.pug`);\n }\n\n return path.join(__dirname, '..', 'views/chart/', `${templateFileName}.pug`);\n}",
"get templateFullPath() {\n return... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Update the height of a line, propagating the height change upwards to parent nodes. | function updateLineHeight(line, height) {
var diff = height - line.height;
if (diff) { for (var n = line; n; n = n.parent) { n.height += diff; } }
} | [
"function updateLineHeight(line, height) {\n var diff = height - line.height;\n if (diff) { for (var n = line; n; n = n.parent) { n.height += diff; } }\n }",
"function updateLineHeight(line, height) {\n var diff = height - line.height;\n if (diff) for (var n = line; n; n = n.parent) n.heigh... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
compile all tests and fire a callback when the all code is compiled and ready to be executed | function compileAll(tests, cb) {
var results = [];
var pending = tests.length;
tests.forEach(function (name, idx) {
compile(name, function (err, result) {
if (err) return cb(err);
results[idx] = result;
if (--pending === 0) {
cb(null, results);
}
});
});
} | [
"runTests() {\n this.testCorrect()\n this.testComplete()\n }",
"exec () {\n this.setupTests()\n return this.runTests()\n }",
"function testsRun() {\n for (var i = 0; i < _testsAllTests.length; i++) {\n var test = _testsAllTests[i];\n test();\n }\n}",
"async runTests() {... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Set auto launch option | function setAutoLaunch(autoLaunchValue) {
const appLauncher = new AutoLaunch({
name: 'Oversetter',
mac: {
useLaunchAgent: true,
},
});
autoLaunchValue ? appLauncher.enable() : appLauncher.disable();
} | [
"function start_auto_launch() {\n \n var quarkclientAutoLauncher = new AutoLaunch({\n name: 'QuarkClient',\n // path: '/Applications/QuarkClient.app',\n // path: '\"C:\\\\Users\\\\C9G\\\\AppData\\\\Roaming\\\\uTorrent Web\\\\utweb.exe\" /MINIMIZED',\n path: basepath + '\\\\quarkclient.exe',\n });\n\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Creates an instance of error terms store service. | function ErrorTermsStoreService() {
this.errorTerminologies = null;
this.errorCodeBase = {};
} | [
"function createStore(){}",
"function LoginTermsService(baseTermsService) {\n this.baseTermsService = baseTermsService;\n /**\n * Login terminologies of login terms service\n */\n this._loginTerminologies = null;\n this.terms = null;\n }",
"function createTerm(term... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Displays the profile of the user with code 'code', or an error message if code does not exist | function displayProfile(code, req, res) {
User.getUserByCode(code, function (err, user) {
if (!user) {
req.flash('error_msg', 'No user found');
res.redirect('/');
} else if (err) {
req.flash('error_msg', 'Error encountered, please try again');
res.redi... | [
"function displayProfile() {\n //Format and display the profile bits\n $('#profile-view .nickname').text(userProfile.nickname);\n $('#profile-view .full-profile').text(JSON.stringify(userProfile, null, 2));\n $('#profile-view img').attr('src', userProfile.picture);\n }",
"function s... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Verifies the error thrown by a LocalStore operation. If a LocalStore operation fails because the primary lease has been taken by another client, we ignore the error (the persistence layer will immediately call `applyPrimaryLease` to propagate the primary state change). All other errors are rethrown. | function Li(t) {
return r(this, void 0, void 0, (function() {
return s(this, (function(n) {
if (t.code !== T.FAILED_PRECONDITION || t.message !== Ji) throw t;
return di("LocalStore", "Unexpectedly lost primary lease"), [ 2 /*return*/ ];
}));
}));
} | [
"function tr(t) {\n return e.__awaiter(this, void 0, void 0, function () {\n return e.__generator(this, function (e) {\n if (t.code !== h.FAILED_PRECONDITION || t.message !== Ve) throw t;\n return de(\"LocalStore\", \"Unexpectedly lost primary lease\"), [2\n /*return*/\n ];\n });\n });\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
===========================================================// Utility functions for generating lists of frame parameters // =========================================================== | function generatePathFrameParameters() {
var path_sizes = [20, 50, 200, 300, 400];
var quantities = [10, 20, 50, 100, 500, 1000, 2000];
var shadow_blurs = [0, 1, 10, 20];
// Only draw combinations that contain shadows with this probability
// to reduce the number of permutations.
var shadowedPermutationPro... | [
"function list() {\n\t//create a variable to hold the number of incoming values from a list\n\tvar numberOfArgumentsEntered = arguments.length;\n\t//if that value is greater than the number of parameters, make that number smaller\n\tif(numberOfArgumentsEntered > 4) {\n\t\tnumberOfArgumentsEntered = 4;\n\t\t}\n\t//f... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns the quadrant of an angle. | _getQuadrant(angle) {
if (angle > 270) {
return 4;
}
else if (angle > 180) {
return 3;
}
else if (angle > 90) {
return 2;
}
else {
return 1;
}
} | [
"get quadrant() {\n const a = this.normalize().value;\n\n if (a > 0 && a < Angle.SPI) return 1;\n if (a > Angle.SPI && a < Angle.PI) return 4;\n if (a > -Angle.PI && a < -Angle.SPI) return 3;\n if (a > -Angle.SPI && a < 0) return 2;\n return undefined;\n }",
"function getQuadrant(angle) { \n r... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function fetches css applied styles. x needs to be a js object. y needs to be a css property. | function reqStyle(x, y){
return parseInt(window.getComputedStyle(x, null).getPropertyValue(y));
} | [
"function getRecStyle(x, y){\n return parseInt(window.getComputedStyle(x, null).getPropertyValue(y));\n}",
"function getStyles(el,arg) {\n\n\tlist = (arg||\"\").split( /\\s+/ );\n\t//console.log([\"getStyle\",el,arg,list]);\n\n\t// el = element or query\n\t//console.log( \"gbysel\", bySel( el ) );\n\tvar x = ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
endregion region function ValidateCheckBoxInputFields(groupName, errId) A standardized validation function that will check to see if the checkbox button input field group is validate according to the web browser, and if not report the problem in the errId tag innerHTML | function ValidateCheckBoxInputFields(groupName, errId) {
var isFieldValid = true;
// see https://www.w3schools.com/js/js_validation_api.asp
// Test the field based upon the id and if it fails, we set the isValidForm to false
var testCheckBoxElements = document.getElementsByName(groupName);
if (test... | [
"function ValidateRadioButtonInputField(groupName, errId) {\n var isFieldValid = true;\n // see https://www.w3schools.com/js/js_validation_api.asp\n\n // Test the field based upon the id and if it fails, we set the isValidForm to false\n var testRadioButtonElements = document.getElementsByName(groupName... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function: createSheet Makes an API call to create a new spreadsheet to use. Also populates the first row with the columns 'Vidoe Name' and 'Video URL'. | function createSheet() {
var spreadsheetName = prompt("Enter file name", "Youtube Sounboard");
gapi.client.sheets.spreadsheets.create({
properties: {
title : spreadsheetName
},
'sheets' : [
{
data : [
{
startRow : 0,
startColumn : 0,
rowD... | [
"function createSpreadsheet() {\n window.gapi.client.sheets.spreadsheets\n .create({\n properties: {\n title: \"Shppd\"\n }\n })\n .then(response => console.log(response));\n}",
"function createSheet () {\n ss.insertSheet(name, index, options);\n\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Check if a certain element is inside the root nav | function isElementInsideNav(el) {
const expandedLevel1El = rootEl.querySelector('[data-o-hierarchical-nav-level="1"] > [aria-expanded="true"]');
let expandedMegaDropdownEl;
let allLevel1Els;
if (expandedLevel1El) {
expandedMegaDropdownEl = getMegaDropdownEl(expandedLevel1El);
if (expandedMegaDropdownEl &... | [
"function isNavInMenu(list, elem) {\n var isChild = false;\n if (!list || !elem) {\n return false;\n } else if (elem == list) {\n return true;\n } else if (list.childNodes) {\n for (var i = 0; i < list.childNodes.length; i++) {\n var child = list.childNodes[i];\n if (child && ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sets the view to present the product. | function setProductInView() {
$scope.presentPercentageOff = $scope.product.percentage_off ? true : false;
$scope.presentOriginalPrice = $scope.product.original_price ? true : false;
$scope.changePercentageOff();
$scope.changeOriginalPrice();
... | [
"renderProductView() {\n const productView = new ProductView({ collection: productCollection });\n }",
"viewProduct(product){\n this.props.selectProduct(product);\n this.setState({view: true,edit: false,mode: false});\n this.open();\n }",
"function ProductView() {\n this.productList = B... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Handle each command, and return relevant information to slack Return stats on all case filters from Desk | function status(res,type) {
let dataEntries = []
// Recursively call Desk until there are no more pages of results
let i = 1
function getOpenCases() {
desk.cases({
labels:['Priority publisher,SaaS Ads,Direct publisher,Community publisher,Home,Community commenter'],
status:['new,op... | [
"function cases() {\n\tif (command === \"my-tweets\") {\n\t\tmyTweets();\n\t} else if (command === \"spotify-this-song\") {\n\t\tif (userInput){\n\t\tspotifySong();\n\t\t} else {\n\t\t\tuserInput = \"The Sign Ace of Base\";\n\t\t\tspotifySong();\n\t\t}\n\t} else if (command === \"movie-this\") {\n\t\tif (userInput)... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Generate javascript code for routes | function routeCode(procedure) {
console.log("Generating route for", procedure.name);
var js = "";
function add(line) {
js += line + '\n';
}
add("var express = require(\"express\");");
add("/**");
add(" * @function " + procedure.name);
for (i = 0; i < procedure.parameters.length; i++) {
var temp = " * @par... | [
"function routeCode(procedure) {\n\tvar js = \"\";\n\n\tfunction add(line) {\n\t\tjs += line + '\\n';\n\t}\n\n\tadd(\"var express = require(\\\"express\\\");\");\n\tadd(\"/**\");\n\tadd(\" * @function \" + procedure.name);\n\tfor (i = 0; i < procedure.parameters.length; i++) {\n\t\tvar temp = \" * @param {\" + proc... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
show or hide the dialogue name plates based on the current speaker indicated by the current text node | function UpdateNamePlates(speaker) {
switch (speaker) {
case "player":
namePlateLeftElement.style.visibility = "Visible";
namePlateRightElement.style.visibility = "Hidden";
break;
default:
// right name plate text also changes based on the speaker
... | [
"checkSpeaker() {\r\n this.leftNameText.alpha = 0.5;\r\n this.leftPortraitImage.alpha = 0.5;\r\n this.rightNameText.alpha = 0.5;\r\n this.rightPortraitImage.alpha = 0.5;\r\n if (this.currentChat.left) {\r\n if (this.currentChat.leftName) {\r\n this.leftNa... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Watch the value, mdbuffervalue, and mdmode attributes | function watchAttributes() {
attr.$observe('value', function(value) {
var percentValue = clamp(value);
element.attr('aria-valuenow', percentValue);
if (mode() != MODE_QUERY) animateIndicator(bar2, percentValue);
});
attr.$observe('mdBufferValue', function(value) {
ani... | [
"function watchAttributes() {\n attr.$observe('value', function(value) {\n var percentValue = clamp(value);\n element.attr('aria-valuenow', percentValue);\n\n if (mode() != MODE_QUERY) animateIndicator(bar2, percentValue);\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
concat links into one string with carrier returns | function concatLinks(links) {
var str=""; // string of links
for (var i=0; i<links.length; i++) {
if (i==0) {
str=links[i];
}
else {
str += '\n' + links[i];
}
}
return str;
} | [
"formatUrls(){\n urls = this._urls.map( (u) => { return 'url=' + \"'\" + u + \"'\"; });\n urls = urls.join(' or ');\n return urls;\n }",
"formatUris() {\n const { unescape } = Nullthrows(this.props.uriService);\n const uris = this.getUris().map(unescape);\n\n return uris.length > 1 ? \"\\n\" + ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This function takes the JSON from the previous function. It then gets out a lattitude or longitude. lat lng | function getLatLng(results){
//Output the results
console.log(results);
//Scroll down the array in the JSON. I ignore everything except the two lat long variables
var location = results["results"][0]["geometry"]["location"],
//Finds the lattitude value
lat = location["lat"],
//Finds the longitude value
lng ... | [
"function getLatLon(adres,lijst){\n\t$.getJSON(\"https://maps.googleapis.com/maps/api/geocode/json?address=\"+ adres+\"&key=AIzaSyA2hhwsyvOFvwf6YJABI74dDS8ccSyGvf8\", function(data) {\n\t\t$(data).each(function( index_pjct , value_pjct ) {\n\t\t\tif(value_pjct.status!=\"ZERO_RESULTS\"){\n\t\t\t\tcodeAddress(value_p... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Write a sum method which will work properly when invoked using either syntax below. console.log(sum(2,3)); // Outputs 5 console.log(sum(2)(3)); // Outputs 5 | function sum()
{
if (arguments.length > 1)
{
var total = 0;
for (var i = 0; i < arguments.length; i++)
{
if (arguments[i] instanceof Function)
{
total += arguments[i]();
}
else
{
total += argument... | [
"function sum(...args) {\n let cur = args.reduce((p, c) => p + c)\n\n let fn = (...args2) => {\n cur = cur + args2.reduce((p, c) => p + c)\n return fn\n }\n\n fn.sumOf = () => cur\n\n return fn\n}",
"function sum(){\n var args = (arguments.length === 1 ? [arguments[0]] : Array.apply(null, arguments));... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Embed the WAMI SWF and call the named callback function when loaded. | function embedWamiSWF(id, initfn) {
var flashVars = {
visible : false,
loadedCallback : initfn
};
var params = {
allowScriptAccess : "always"
};
if (supportsTransparency()) {
params.wmode = "transparent";
}
if (typeof console !== 'undefined') {
flashVars.console = true;
... | [
"function defaultLoader(flash, embedCallback) {\n\n document.body.appendChild(flash);\n embedCallback();\n\n\n}",
"function embedWamiSWF(id, initfn) {\n var flashVars = {\n visible : false,\n loadedCallback : initfn\n }\n\n var params = {\n allowScriptAc... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
handleMouseMove, setups up the mouse events for the canvas, this calculates the delta for the mouse dragging the grid on the canvas | function handleMouseMove(e) {
// only do this code if the mouse is being dragged
if (!isDown) {
return
}
// tell the browser we're handling this event
e.preventDefault()
e.stopPropagation()
// get the current mouse position
mouseX = parseInt(e.clientX - offsetX)
mouseY = parseInt(e.c... | [
"function drag(e){ //function called from nonogramMakerCanvas.js file\n\t//deal with horizontal shifting\n\tvar prev_xOffset = xOffset;\n\txOffset += e.movementX;\n\t\n\t\t//update display\n\tif(e.movementX > 0){\n\t\tvar pic = ctx.getImageData(0,0,window.innerWidth-e.movementX,window.innerHeight);\n\t\tctx.clearRe... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Create error message when doing an empty search | function errorMessageForEmptySearch() {
spinner.style.display = "block";
let errorMessageIfInputIsEmpty = `
<div class="errorMessageEmptySearch"><p>You have to write a title to be able to search</p></div>`
movieInformation.innerHTML = errorMessageIfInputIsEmpty
} | [
"function displayError() {\n alert(\"search term can not be empty!\");\n }",
"function displayError() {\n alert(\"search term can not be empty!\")\n }",
"function emptyMessage() {\n const list = $(results);\n if (!list.children().length) {\n list.append(`<li class=\"countr... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Handle the start/end value constraining to 0..180, etc... | function clean_start_end_value(value){
// In case we pass in a number
value = value.toString();
let changed = false;
let new_value;
if(value == ''){
// Check if empty string
new_value = 0;
changed = true;
}else if(value.charAt(0) == '0'){
// Remove leading zeroes
new_value = parseInt(value,10);
... | [
"function suppliedBounds(start, end, step) {\n\n}",
"function setBounds() {\n // The value was found\n if (focus === value) {\n // Gray out all values\n max = -1;\n playing = false;\n }\n else if (focus < value) min = focus + 1;\n else max = focus - 1;\n}",
"function checkBoundaries(value) {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
funcao que valida o cep | function validateCep(cep)
{
//valida se o cep foi preenchido
if(cep == "" || cep.length < 8)
{
// adicionas os li a lista de erros
$("#listaErrosLightBox").append("<li> Erro de Preenchimento </li>");
$("#listaErrosLightBox").append("<li> É necessário o preenchimento do campo CEP </li>");
... | [
"function MascaraCep(cep) {\n if (mascaraInteiro(cep) == false) {\n event.returnValue = false;\n }\n return formataCampo(cep, '00.000-000', event);\n}",
"function MascaraCep(cep)\n{\t\t\n if(mascaraInteiro(cep)==false)\n {\t\t\n event.returnValue = false;\t\n }\t\t\n return formataCampo(cep... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
GET hero by id. Will 404 if id not found | getHero(id) {
const url = `${this.heroesUrl}/${id}`;
return this.http.get(url).pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_4__["tap"])(_ => this.log(`fetched hero id=${id}`)), Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_4__["catchError"])(this.handleError(`getHero id=${id}`)));
} | [
"getHero(id) {\n const url = `${this.heroesUrl}/${id}`;\n return this.http.get(url).pipe(operators_1.tap(_ => this.log(`fetched hero id=${id}`)), operators_1.catchError(this.handleError(`getHero id=${id}`)));\n }",
"getHero(id) {\n const url = `${this.heroesUrl}/hero/${id}`;\n retur... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function for transition to repositories page | function goToRepos() {
var params = {
userName: $stateParams.userName,
basic: $stateParams.basic,
id: $stateParams.id,
token: $stateParams.token
};
console.log('Go back to repositories.');
$state.go('reposito... | [
"handleRepoNav() {\n if (this.userData.repo.edges === null\n || this.userData.repo.edges === undefined\n || this.userData.repo.edges.length === 0) {\n const emptyPrompt = `${this.userData.userLogin} has no public repositories.`;\n const pushEmpty = StackActions.push('Empty', { emptyPrompt... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Address object constructor. Constructor parameters: arg string representation or another address object Members: address IPv6 address (8 16 bit numbers) null, if invalid prefix prefix length in bits type 4 for IPv4, 6 for IPv6, 0 for invalid | function Address(arg) {
this.clear();
if (typeof arg == "string") {
this.fromString(arg);
} else if (typeof arg == "object" && arg.constructor.name == "Address") {
this.address = arg.address.slice();
this.prefix = arg.prefix;
this.type = arg.type;
} else {
throw "... | [
"static fromString(str) {\n if (!(0, account_1.isValidAddress)(str)) {\n throw new Error('Invalid address');\n }\n return new Address((0, bytes_1.toBuffer)(str));\n }",
"function expandIPv6Address(address) {\n var fullAddress = \"\";\n var expandedAddress = \"\";\n var validG... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Cancel or submit form in dialog | function cancel(form) {
$mdDialog.cancel();
} | [
"function cancelHAForm() {\n setForm();\n hideHAForm();\n}",
"function cancel(form) {\n $mdDialog.cancel();\n }",
"function submitCancelHandler()\n{\n\tvar bGoback=true;\n\t\n\tif(defined(CONTENTS.List.getCancelConfirmMessage))\n\t\tif(CONTENTS.List.contentsChanged())\n \t\t\tif(!confirmDialog(C... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Prevents the user from copying or pasting the text in the Fnn Textboxes This is done so that they have to physically type the fnn in twice. They can't copy/paste it | function FnnTextboxKeyHandler(objEvent)
{
// keyCode 37 is the left key
if (objEvent.shiftKey && objEvent.keyCode == 37)
{
// The user is trying to select text by pressing shift-left
// Jog the cursor left one character
objEvent.target.selectionEnd = objEvent.target.selectionStart = objEvent.target.sele... | [
"function fnNoQuotes(obj)\n{\n\tobj.onpaste=function () {event.returnValue=false; obj.value=trim_quotes(window.clipboardData.getData('Text'));};\n\tobj.onkeypress=function () {return filtrar_teclas(event,\"'\\\"\",true);};\n}",
"function preventNonNumPaste(e,textboxid) {\r\n\r\n\te.preventDefault();\r\n\tvar past... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
para llenar la tabla con los datos de programas | function llenar_tabla_programas(){
$.ajax({
url: 'data/programas/app.php',
type: 'post',
data: {llenar_tabla_programas:'asjkef'},
success: function (data) {
$('#tbt_programas tbody').html(data);
}
});
} | [
"function inicializar_tablas() {\n /* Inicializacion de la tabla de tipos de platillos activos\n Elementos de la tabla:\n l - length changing input control\n f - El buscador\n t - La tabla\n i - Table information summary\n p - Paginacion\n r - processing display el... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Filter collections list (creates new block) | function filterCollectionsBlock(block, callback, keepEmptyCategories = false) {
const result = {
type: 'collections-list',
showCategories: block.showCategories,
collections: collections.filterCollections(block.collections, callback, keepEmptyCategories),
};
return result;
} | [
"function makeBlockLists() {\n\tblockList.eachCategory((cat)=> {\n\t\tvar $list = $('#list_'+cat);\n\t\t$list.html('');\n\t\tblockList.eachId(cat, (cat, sid)=>{\n\t\t\t$list.append('<option>'+sid+'</option>');\n\t\t});\n\t});\n\tupdateInUse();\n}",
"getCollectionsBlock() {\n\t if (this.loading || this.erro... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function: objArc creates an arc (a linestring with n segments) Parameters: center center point radius radius of the arc alpha starting angle (in Grad) omega ending angle (in Grad) segments number of segments for drawing the arc flag true : create arc feature from center to start to endpoint to center false : create arc... | function objArc(center, radius, alpha, omega, segments, flag)
{
var pointList=[];
if(flag)
pointList.push(new ol.geom.Point(center.x, center.y));
var dAngle= segments+1;
for(var i=0;i<dAngle;i++)
{
var Angle = alpha - (alpha-omega)*i/(dAngle-1);
var x = center.x + radius*Mat... | [
"createArc() {\n var n = 20;\n var startPoint = this.start[0] - this.center[0];\n var endPoint = this.end[0] - this.center[0];\n var startAngle = Math.acos(startPoint/this.radius);\n var endAngle = Math.acos(endPoint/this.radius);\n var dtheta = (endAngle - startAngle)/n;\n var theta = startAng... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
check left diagonal winner combination | function checkDiagonalFromLeftToRight(){
for (let i = 0; i < gameSize; i++) {
let array = [i + 1];
let iCounter = gameSize - 1 - i;
for (let j = 0; j < i + 1; j++ ) {
array[j] = gameField[iCounter][j];
iCounter++;
}
if (isContaineWinCombination(array,... | [
"function diagonalCheck(player){\n\t\tvar diag1 = []; \n\t\tvar diag2= [];\n\t\tfor (var i=0; i<cellStates.length; i++) {\n\t\t\tdiag1.push(cellStates[i][i]);\n\t\t}\n\t\tif (diag1.every(arraySameValue)) {\n\t\t\thandleWinner();\n\t\t\treturn;\n\t\t}\n\t\tfor (var j=0; j<cellStates.length; j++) {\n\t\t\tdiag2.push(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Triggered when a file is selected via the media picker. | function onMediaFileSelected(event) {
event.preventDefault();
var file = event.target.files[0];
// Clear the selection in the file picker input.
imageFormElement.reset();
// Check if the file is an image.
if (!file.type.match('image.*')) {
... | [
"function onMediaFileSelected(event) {\n event.preventDefault();\n var file = event.target.files[0];\n\n\n // Clear the selection in the file picker input.\n imageFormElement.reset();\n\n // Check if the file is an image.\n if (!file.type.match('image.*')) {\n var data = {\n message: 'You can only sha... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
updates the task running status according to the current queue | updateTaskRunning() {
this.taskRunning = !this.isEmpty;
} | [
"updateTaskToDone(taskId) {\n this.getTask(taskId).status = \"Done\";\n }",
"function updateTaskStatus() {\n let foundNextTask = false;\n\n vm.tasks.forEach(task => {\n // Set isForbidden\n task.isForbidden = !task.non_admin_may_edit && User.isNonAdmin();\n\n // Hide controls if ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
list all internal timetable | function listalltimetable(req, res) {
internalSchema.find({}, { _id: 0, semester: 1, dateTimeSub: 1 }, function (err, internalsemester) {
res.send(internalsemester);
});
} | [
"function TablesList() {}",
"function getAllTimeEntries(callback) {\n var timeEntries = [];\n var timeEntryStore = this.db.transaction(\"time_entry\", \"readonly\").objectStore(\"time_entry\");\n timeEntryStore.openCursor().onsuccess = function(event) {\n var cursor = event.target.result;\n\n i... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Base device profile to be extended with device specific implementations. | function BaseDeviceProfile() {
this.audioNeedsTranscodingCodecs = []; // fill these with audio codecs that the implemented device can handle natively
this.videoNeedsTranscodingCodecs = []; // fill these with video codecs that the implemented device can handle natively
this.validFormats = []; // fill t... | [
"function DeviceProfile( server ) {\n this.impl = new require( './dao/' +\n nconf.get( \"impl_directory\" ) +\n '/deviceProfiles.js' );\n\n modelAPI = server;\n}",
"function device(profile_name) {\n\treturn _.assign({}, device_profiles[profile_name]);\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Requests doc, encodes to base64 | function getEncodedDoc(url) {
return new Promise((resolve, reject) => {
const filepath = `${__base}encoding/${url.substring(url.lastIndexOf('/')+1)}`;
const ws = fs.createWriteStream(filepath);
// Get file
request.get(url).pipe(ws);
// Watch results
ws.on('error', (error) => {
console.lo... | [
"function getDocumentAsBase64(documentId, caseId) {\n return new Promise(function (resolve, reject) {\n const request = new XMLHttpRequest();\n\n request.onreadystatechange = function () {\n if (request.readyState == 4) {\n if (caseId) {\n $(\"#loadLetter\")\n .empty()\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Display string for the list of active spaces | get spaces() {
return ((this.form.controls.space_list.value || []).map((space) => space.name).join(', ') ||
'No Spaces selected');
} | [
"get spaces() {\n return ((this.form.controls.space_list.value || []).map(space => space.name).join(', ') ||\n 'No Spaces selected');\n }",
"function renderSpacesList(spaces) {\n let spaceEl;\n\n nodes.openSpaces.innerHTML = '';\n nodes.closedSpaces.innerHTML = '';\n\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Add icons provided by ant design. | addIcon(...icons) {
icons.forEach(icon => {
this._svgDefinitions.set(withSuffix(icon.name, icon.theme), icon);
});
} | [
"_setupIcons() {\n const customIcons = getWithDefault(this, 'customIcons', {});\n var newIcons = smartExtend(customIcons, defaultIcons);\n set(this, 'icons', O.create(newIcons));\n }",
"setupIcons() {\n // Under icons\n this.add.image(this.canvasGame.width / 2 - 330, 150, 'en... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Show an input mask / Requires: / inputElem: Input element who's mask should be shown eslintdisablenextline nounusedvars | function showMask(inputElem) {
let inputMask = getMask(inputElem);
let inputValue;
if (inputMask !== false) {
$(inputMask).find('.input-mask-positioner').
removeClass('d-none');
inputValue = $(inputMask).find('.input-value');
if ($(inputValue).length > 0) {
re... | [
"function hideMask(inputElem) {\n let inputMask = getMask(inputElem);\n let inputValue;\n if (inputMask !== false) {\n $(inputMask).find('.input-mask-positioner').\n addClass('d-none');\n inputValue = $(inputMask).find('.input-value');\n if ($(inputValue).length > 0) {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Creates a modal and assign it as the form container. Then calls the builder. | modal() {
const modal = new Modal({
style: this.options.style,
title: 'Test',
});
this.container = modal.body;
document.body.appendChild(modal.modal);
this.insertForm();
modal.onHide(this.builder.clearForm.bind(this.builder));
return modal;
} | [
"createFormModal() {\n this.setModalHeader();\n this.setDisplayAndFocus();\n this.listenOnCloseModal();\n this.listenKeyNavigation();\n this.listenKeyClose();\n this.submitForm();\n }",
"function popupFormModal() {\n\n function onModalFormEvent(eventName /*, eve... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
creates the div elements that represent the pieces | function setupPieces(puzzle) {
puzzle.innerHTML = "";
for (var i = 1; i <= 15; i++) {
var piece = document.createElement("div");
piece.className = "piece normal";
piece.id = "x" + i;
piece.innerHTML = i;
piece.onmouseover = mouseOver;
piece.onmouseout = mouseOut;
puzzle.appendChild(piece);
}
... | [
"function addPieces() {\n for (var i=0;i<24;i++){\n $('div #pieces').append($('<div class=\"piece\"><div>'));\n }\n}",
"function createPuzzle(pieces) {\n\t\tvar area = document.getElementById('puzzlearea');\n\t\t\n\t\tfor (var i = 0; i < pieces; i++) {\n\t\t\tvar newPiece = document.createElement('div'... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Uses Dean McNamee's omggif library and Anthony Dekker's NeuQuant quantizer (JS 0.3 version with many fixes) | function Animated_GIF(options) {
'use strict';
var width = 160, height = 120, canvas = null, ctx = null, repeat = 0, delay = 250;
var frames = [];
var numRenderedFrames = 0;
var onRenderCompleteCallback = function() {};
var onRenderProgressCallback = function() {};
var workers = [], availab... | [
"function NeuQuant() {\n var exports = {};\n var netsize = 256;\n /* number of colours used */\n\n /* four primes near 500 - assume no image has a length so large */\n\n /* that it is divisible by all four primes */\n\n var prime1 = 499;\n var prime2 = 491;\n var prime3 = 487;\n var prime4 = 503;\n var mi... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
issue 246: on_after_filter callback triggered twice from checklist filter | function afterFilter(){
ct++;
module('TableFilter with on_after_filter callback');
test('after filter callback fired once', function() {
// assert
deepEqual(ct, 1, 'Nb of times is fired');
deepEqual(tf.getFilterValue(1), ['Canberra'], 'Selected option');
... | [
"on_global_filter_configuration_changed() {\n }",
"function _afterFilter(isGlobal, server, err, msg, session, resp, opts, cb) {\n let fm;\n if (isGlobal) {\n fm = server.globalFilterService;\n } else {\n fm = server.filterService;\n }\n\n if (fm) {\n if (isGlobal) {\n fm.afterFilter(err, msg... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Find all the locations around this block that are not infected | function vulnerable_neighbors (x, y) {
vulnerable = [];
list = calculate_Neighbors(x, y);
for (var dir in list) {
item = list[dir]
i = item[0]
j = item[1]
if (list_of_blocks[i] == undefined || (list_of_blocks[i][j] == null)) {
vulnerable.push(item)
}
}
return vulnerable;
} | [
"getAffectedLocations() {\n let c1 = this.source.clone();\n c1.reset();\n c1.transform(this.axis, this.layerMask, this.angle);\n return c1.getUnsolvedParts();\n }",
"function findUnexplored() {\n var unexplored = [];\n Object.keys(_robot.explored).forEach(function (loc) {\n var point = stringToP... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Just some polar functions to convert x/y into radius/angle | function polar_x(radius, angle) {return(radius * Math.cos(Math.PI/180*angle + Math.PI/180*270));} | [
"toPolarCoords() {\n return ({\n r: Math.sqrt(this.x ** 2 + this.y ** 2),\n a: Point.angle(this),\n });\n }",
"toPolar()\r\n {\r\n return createVector(this.center.x + this.radius * cos(this.angle), \r\n this.center.y + this.radius * sin(this.angle));\r\n }"... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Renders a Handlebars template, reading from a tag. Returns HTML. | function render(templateId, data) {
var source = document.getElementById(templateId).textContent
var template = Handlebars.compile(source)
return template(data)
} | [
"function renderTemplate() {\n\tvar app = document.getElementById('app')\n\tvar templateSource = document.getElementById('to-do-template')\n\tvar template = Handlebars.compile( templateSource.innerHTML )\n\tvar renderedTemplate = template( data )\n\n\tapp.innerHTML = renderedTemplate\n}",
"function render(context... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Reload the outbrain modules after the ajax call | function reloadOutBrainModules() {
if (typeof(OBR) !== "undefined" && typeof(OBR.extern) !== "undefined" &&
typeof(OBR.extern.researchWidget) !== "undefined") {
OBR.extern.researchWidget("http://" + document.location.hostname + document.location.pathname);
}
} | [
"function upcDoUpdate(){\n\tif(!singlePageSite){ //If it's not a single page site, remove the script for the modules loaded for the previous page\t\t\t\t\n\t\twhile($s(\"moduleScript\")) $(\"#moduleScript\").remove();\n\t}\t\t\t\t\n\tif(pageAjax.readyState===4){\n\t\tupdatePage();//parse response and finalize page ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Opens a printable boarding pass in a new window. Removes booking data from sessionStorage. | function printPass() {
var windowFeatures = "resizable=no,scrollable=no,width=900,height=450";
var passWindow = window.open("", '_blank', windowFeatures);
var type = "<!DOCTYPE html>";
var head = "<head><meta charset='utf-8'><title>Bookings</title><link rel='stylesheet' href='css/style.css'></head>";
var n... | [
"function Pophistory() {\r\n newWin=window.open('index.php?page=allshout','shouthistory','height=500,width=490,resizable=yes,scrollbars=yes');\r\n if (window.focus) {newWin.focus()}\r\n}",
"function openPrintable(sTitle, sURL)\r\n{\r\n\tvar win = null;\r\n\twin = window.open(sURL, sTitle, \"width=... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Searches from back of array, until a 1 is found that can be swapped, then swaps it as far to the right as it can go Returns index of last 1 that can be swapped. Returns 1 if there aren't any 1's in the array that can be swapped (no 1's with a 0 to it's right) | function swapNext1AsFarAsItCanGo(array) {
const end = array.length - 1;
let i = findIndexOfLast1NotAtTheEnd(array);
if(i !== -1) {
for(let j = i; j < end; j++) {
if(array[j+1] === 1) { // If next number is a 1, stop swapping. So in this situation: [1,0,1,1] - it... | [
"function minimumSwaps(arr) {\n\n if (arr.length < 1 || arr.length > 1000000) {\n return \"Invalid array length\"\n }\n\n let swaps = 0;\n\n for (let i = 0; i < arr.length; i++) {\n // at this position what is the right number to be here\n // for example at position 0 should be 1\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Save current window's state to settingsStore `layout.windows.json` at `local` | _saveWindowStates () {
this.settingsStore.set("MainWindow", this.mainWinName)
this.settingsStore.set('managed', this.windowStates)
this.settingsStore.set("LastOpen", this.lastOpen)
} | [
"saveSettings() {\n localStorage.setItem(this.localStorageKey, JSON.stringify(this.getLayout()));\n }",
"function setWindowState() {\n\tchrome.windows.getCurrent(currWindow => {\n\t\tchrome.storage.sync.set({\n\t\t\twindowState: {\n\t\t\t\tstate: currWindow.state,\n\t\t\t\twidth: currWindow.width,\n\t\t\t\the... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
event listener for schedule button click | function schedule(event) {
// local constants
const scheduleText = 'schedule';
const scheduledText = 'scheduled';
const targetElementId = event.target.id;
const targetElement = document.getElementById(targetElementId);
const parentElement = targetElement.parentElement;
... | [
"function schedule(event) {\n let targetElementId = event.target.id;\n let targetElement = document.getElementById(targetElementId);\n let parentElement = targetElement.parentElement;\n let newElement = targetElement.cloneNode(true);\n newElement.classList.toggle('button-schedule-active');\n if (t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
toggleMobileMenu(); Show and hide mobile menu by adding class "open" Change the burguer menu icon to "X" when clicked | function toggleMobileMenu() {
toggleIcon.addEventListener('click', function(){
this.classList.toggle("open");
mobileMenu.classList.toggle("open");
});
} | [
"function toggleMenu() {\n mobileMenu.classList.toggle('open');\n }",
"toggleMenu() {\n if(this.mobileMenuOpen) {\n document.body.classList.remove(\"mobile-menu-open\");\n this.mobileMenuOpen = false;\n } else {\n document.body.classList.add(\"mobile-menu-open\")... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
unSelectMatchingOptions(select_object,regex) This function Unselects all options that match the regular expression passed in. | function unSelectMatchingOptions(obj,regex) {
selectUnselectMatchingOptions(obj,regex,"unselect",false);
} | [
"function unSelectMatchingOptions(obj,regex) {\n selectUnselectMatchingOptions(obj,regex,\"unselect\",false);\n }",
"function unSelectMatchingOptions(obj,regex) {\n\tselectUnselectMatchingOptions(obj,regex,\"unselect\",false);\n\t}",
"function selectOnlyMatchingOptions(obj,regex) {\n select... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
VectorColorMapper.js Object for converting vector magnitude to color Developed by Wolfgang Christian | function VectorColorMap(lower, upper) {
this.lower =(lower === undefined) ? 0.5: lower;
this.upper =(upper === undefined) ? 1: upper;
} | [
"function colorPoly(ObjCol, LightColr , Normal, ColorVect ){\n\n var magNorm = Math.sqrt(Normal[0]*Normal[0] + Normal[1]*Normal[1]+ Normal[2]*Normal[2]);\n var magColV = Math.sqrt(ColorVect[0]*ColorVect[0] + ColorVect[1]*ColorVect[1]+ ColorVect[2]*ColorVect[2]);\n var unitVect = [Normal[0], Normal[1], Normal[2]]... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
======== XYZ vector operations. ======== Returns a new 3vector of floats (Float32Array), initially all zero. | static make3Vec() {
return new Float32Array(3);
} | [
"create(x, y, z) {\n var size = 3;\n var vector3x1 = new Float32Array(size);\n this.set(vector3x1, x, y, z);\n return vector3x1;\n }",
"function vector_98(x, y, z)\n{\n return float3_119 // [(Func Float Float Float Float3) | (Func (Array Float) Float3)]\n (x // Float\n ,y // Fl... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Cast waterline types into SQL data types | function sqlTypeCast(type) {
type = type.toLowerCase();
switch (type) {
case 'string':
return 'TEXT';
case 'int':
case 'integer':
return 'INT';
case 'float':
case 'double':
return 'FLOAT';
case 'date':
return 'DATE';
}
} | [
"function _toDbType (value) {\n\t\tlet type = typeof value\n\t\tlet primitive = null // for container types (objects, arrays) primitive stay's as null\n\t\tif (value === null) return { primitive, type }\n\t\tswitch (value.constructor) {\n\t\tcase Array: type = 'array'; break\n\t\tcase Object: break\n\t\tcase Buffer... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Scalar product between two velocities | function innerProduct(vel1, vel2) {
output = vel1['x'] * vel2['x'] + vel1['y'] * vel2['y']
return output;
} | [
"applyVelocity() {\n\t\tvectors.forEach(vector => {\n\t\t\tthis.position[vector] += this.velocity[vector];\n\t\t});\n\t}",
"updateVelocity() {\n vec3.scale(this.v, this.v, Math.pow((1 - drag), step));\n var increment = vec3.create();\n vec3.scale(increment, this.a, step);\n vec3.add(this.v, this.v, in... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Implementation of filtering by duration which takes in a list of adventures, the lower bound and upper bound of duration and returns a filtered list of adventures. | function filterByDuration(list, low, high) {
// TODO: MODULE_FILTERS
// 1. Filter adventures based on Duration and return filtered list
return list.filter( option => option.duration>=low && option.duration <= high)
} | [
"function filterByDuration(list, low, high) {\n\n // 1. Filter adventures based on Duration and return filtered list\n\n return list.filter(item => item.duration >= low && item.duration <= high)\n // TODO: MODULE_FILTERS\n // 1. Filter adventures based on Duration and return filtered list\n\n}",
"function fil... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Maps the group name to its event name | function groupToEventNameSpace(group) {
if (exports.NonSnakeCaseGroup.includes(group)) {
return group.toUpperCase();
}
return camelCaseToSnakeCase(group).toUpperCase();
} | [
"onName () {\n const group = get(this, 'group');\n this._validateGroupName(group);\n }",
"function groupToEventNameSpace(group) {\n switch (group) {\n case types_2.Group.ContextualSaveBar:\n return camelCaseToSnakeCase(group).toUpperCase();\n default:\n return g... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
where current rank 0 to account for zero level modifier | levelZeroPassCalc(Rank) {
this.progUp = 10 * ((this.rank + Rank - 1) ** 2);
if (this.rank + Rank - 1 === 0) {
this.progUp = 10 * ((this.rank + Rank + 1) ** 2);
}
return this.levelProgressCalc();
} | [
"similarLevelCalc(Rank) {\n if (this.rank === Rank) {\n this.progUp = 3;\n }\n if (this.rank === (this.Rank - 1)) {\n this.progUp = 1;\n }\n return this.levelProgressCalc();\n }",
"checkZero() {\n\t\tif(this.rank<0) {\n\t\t\tthis.rank = 0;\n\t\t\tvar msg4 = (`Error! minimom star rank is ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return active pool profile | returnActivePoolProfile() {
return this.activePoolProfile
} | [
"activeProfile(state) {\n return state.profile;\n }",
"getActiveProfile() {\n const activeProfile = this.profiles.find(x => x.active === true);\n\n if (!activeProfile) {\n Log.error(chalk.red('\\nThere is no active profile in your configuration.'));\n throw new Error('No active profile');\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
register a default handler | default(handler) {
this._default = handler || this._notfound;
return this;
} | [
"static addHandler(handler) {\n assert(handler.call, 'Handler must be a function');\n assert(handler.length === 2 || handler.length === 3, 'Handler function takes 2 (request handler) or 3 (response handler) arguments');\n this._default.push(handler);\n }",
"addDefaultHandler(commandHandler) {\n this.... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
duplicate :: Extend w => w a > w (w a) . . Adds one level of nesting to a comonadic structure. . . This function is derived from [`extend`](extend). . . ```javascript . > duplicate (Identity (1)) . Identity (Identity (1)) . . > duplicate ([1]) . [[1]] . . > duplicate ([1, 2, 3]) . [[1, 2, 3], [2, 3], [3]] . . > duplica... | function duplicate(extend_) {
return extend (identity, extend_);
} | [
"function duplicate(extend_) {\n return extend(identity, extend_);\n }",
"function deepDup(arr) {\n\n}",
"function duplicate(arr) {\n return arr.concat(arr);\n}",
"function deepDup(arr) {\n\n for (let i = 0; i < arr.length; i++) {\n if (Array.isArray(arr[i])) dup[i] = deepDup(arr[i]);\n };\n\n retu... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
type letter only function input text | function letterinputFunction(inputletter){
var ltrinput = /[^a-z ]/gi;
inputletter.value = inputletter.value.replace(ltrinput, '');
} | [
"function inputAlphabet(inputtext) {\n var alphaExp = /^[a-zA-Z\\s]+$/;\n if (inputtext.match(alphaExp)) {\n //document.getElementById('p1').innerText = '';\n return true;\n } else {\n //document.getElementById('p1').innerText = \"* For your name please use alphabets only *\"; // This ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sets the data attribute using a TrustedResourceUrl | function setData(obj, v) {
obj.data = (0, resource_url_impl_1.unwrapResourceUrl)(v);
} | [
"setURL(value)\n {\n\t\tthis.getData().url = value;\n\t}",
"replaceURL(url/*:string*/) {\n const { link, options: { keepOriginalAttributes } } = this;\n const { from } = link;\n if (keepOriginalAttributes && from && from.element && from.attribute) {\n const { element, attribute } = from;\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Closes no schedule warning modal, which is created when an admin adds data to a week where a resource was not working | closeNoScheduleWarningModal() {
this.setState({ openNoScheduleWarning: false });
} | [
"function DTReInitWarning(){\n \t$('#DTReInitWarnModal .DTReInitMsg').empty();\n $('#DTReInitWarnModal .DTReInitMsg').append(\"<p>A completed chain of custody is already on file.</p><p>Are you sure you wish to submit a new order?</p>\");\n $('#DTReInitWarnModal').modal('show');\n CONSTANTS.i... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
================== Search By Id ================== Searches through the catalog array and return a Promise containing the product that matches the id argument. The Promise will resolve in 1000 millisecond after the function has executed. The Promise will reject if an invalid id is searched. | function searchProductById(id){
var promise = new Promise(function(resolve,reject){
var i = 0;
setTimeout(function(){
while (i < catalog.length){
if (catalog[i].id == id){
resolve({id:id,price:catalog[i].price,type:catalog[i].ty... | [
"function searchProductById(id){\n var promise = new Promise(function(resolve, reject){\n var i = 0;\n setTimeout(function(){\n while(i < catalog.length){\n if(id == catalog[i].id){\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Elimina del archivo el objeto con el id buscado. | async deleteById(id){
let objetos = await this.getAll();
objetos = objetos.filter(producto => producto.id !== id)
await fs.promises.writeFile(this.nombreArchivo, JSON.stringify(objetos));
} | [
"async deleteById(id) {\n await this.readFile();\n const index = this.fileContent.findIndex((e) => {\n return e.id === id;\n });\n if (index > -1) {\n this.fileContent.splice(index, 1);\n this.writeFile();\n return true;\n } else {\n console.log(\"No se encontró el elemento e... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
if two consecutive clicks occur in less than CLICK_TIMEOUT miliseconds they will be classified as "double click". | static get CLICK_TIMEOUT() {
return 250; // miliseconds
} | [
"function checkclick(d){\n if (clickedOnce) {\n // If already clicked once then this is a double\n run_on_double_click(d);\n } else {\n // Save the first click and start a timer to \n //... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Folder Check (To check if the folder exists) | function folderCheck() {
if (!fs.existsSync(`${process.env.LOCALAPPDATA}/gamiTask`))
fs.mkdir(`${process.env.LOCALAPPDATA}/gamiTask`, err => {
if (err) console.log(err.message);
else console.log("Folder Successfully Created!");
});
} | [
"function CheckFolderExists (path)\r\n{\r\n\treturn FSO.FolderExists(path);\r\n}",
"function checkExists(folderName) {\r\n var folderExists = false;\r\n for (var i = 1; i <= app.project.numItems; i += 1) {\r\n var cItem = app.project.item(i);\r\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
SETS ARM AND BALL TO BE DRAGGABLE | function dragBall() {
_ballDrag = Draggable.create("#leverRedBall", {
type: "y",
edgeResistance: 0.4,
bounds: "#holderLever",
throwProps: true,
dragResistance: 0.002,
cursor: "pointer",
onDrag: checkDrag,
... | [
"setBreed (breed) { breed.setBreed(this) }",
"set armStretch(value) {}",
"function reset_brcalls() {\n // reset br calls for both teams\n settings.set('lastbrcall', 0);\n settings.set('lastbrcall_team', 0);\n settings.set('brcall_team1', false);\n settings.set('brcall_team2', false);\n setting... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get collections block. Used by child views. Result is copied, ready to be modified | getCollectionsBlock() {
if (this.loading || this.error !== '') {
return null;
}
const blocks = this.render();
return blocks !== null && blocks.collections !== null
? objects.cloneObject(blocks.collections)
: null;
} | [
"getCollectionsBlock() {\n\t if (this.loading || this.error !== '') {\n\t return null;\n\t }\n\t const blocks = this.render();\n\t return blocks !== null && blocks.collections !== null\n\t ? blocks.collections\n\t : null;\n\t }",
"get collections() {... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Parse .TPL and .PHP files | function parseTemplates() {
// Load paths in array containing PHP and TPL Files via src
return gulp.src([paths.locale.classes, paths.locale.templates])
// Pipe all files in generator (concat)
.pipe(phpParser.generatePOT(paths.locale.potName, {project: 'TestProject', company: 'BestCompany' }))
// Save the P... | [
"function processFile(text){\n var flows = JSON.parse(text);\n var servers = getServers(flows);\n var time_stats = generateTimeStats(flows);\n\n flow_map = buildFlowMap(flows, time_stats);\n //console.log(flow_map);\n\n\n //console.log(flows);\n //console.log(time_stats);\n\n /* TODO: I shou... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
public method, allow the parent clear varCache | clearVarCache() {
const { delta } = this;
delta.varCache = {};
delta.varLastCalcIndex = 0;
} | [
"static clearCache() {\n codeCache = new Storage();\n _cache = new Storage();\n }",
"updateAllVarCache() {\n const { delta: { varLastCalcIndex }, updateVariable } = this;\n updateVariable(varLastCalcIndex);\n }",
"updateAfterCache(index) {\n const { delta } = this;\n delt... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sets up markers for the nearby cabins | function setupNearbyCabins(nearCabinsJson){
//create a marker for each cabin
var markers = new Array();
for(var i=0;i<nearCabinsJson.length;i++){
//get id
var id = nearCabinsJson[i].id;
//get point
var latlon = new GLatLng(nearCabinsJson[i].lat,nearCabinsJson[i].lon);
var name = nearCabinsJson[i... | [
"function initMarkers() {\n // creating marker from places\n for (var i = 0; i < markerList.length; i++) {\n var marker = new google.maps.Marker({\n position: markerList[i].location,\n map: map,\n title: markerList[i].title,\n animation: google.maps.Animation.DROP,\n id... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
make a 'comment builder' style function, and punch these in to the showsInfo array build the shows table based off of this, use the same stylings as the already existing table in the table builder, hard code the DATE, LOCATION, etc. headers change the classes given to the tds to IDs, then just use classlist.add to add ... | function buildTable(tableInput) {
// create date descriptor
const dateDescriptor = document.createElement('td');
dateDescriptor.classList.add('shows__descriptor');
dateDescriptor.innerText = "DATE";
// create date td
const showDate = document.createElement('td');
showDate.classList.add('show... | [
"function drawNotesTable(tableID,limitationSelectName,limitationNoteName,majorTextArea,majorRecommendationID,minorTextArea,minorRecommendationID,generalNote)\n{\n var body = [];\n var table = document.getElementById(tableID);\n var majorRecommendation = document.getElementById(majorRecommendationID).value;... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Checksum creates a checksum for a string and returns the checksum value in a string (or as an integer). Originally found at And modified by | function checksum(s, type = 'i')
{
var chk = 0x5F378EA8;
var len = s.length;
for (var i = 0; i < len; i++) chk += (s.charCodeAt(i) * (i + 1));
if(type === 's') return (chk & 0xffffffff).toString(16);
else return (chk & 0xffffffff);
} | [
"function checksum(s) {\n var hash = 0, strlen = s.length, i, c;\n if ( strlen === 0 ) {\n return hash;\n }\n for ( i = 0; i < strlen; i++ ) {\n c = s.charCodeAt( i );\n hash = ((hash << 5) - hash) + c;\n hash = hash & hash; // Convert to 32bit integer\n }\n return hash;\n}",
"function checksum(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
se crean la cantidad de cohortes por sede y la lista de sus cohortes | function getCohorts() {
for (var i = 0; i < centers.length; i++) {
// cohortes por sede
keys = Object.keys(data[centers[i].key]);
// numero de cohortes
centers[i].cohorts = keys.length;
// cohortes
centers[i].cohortsList = keys;
}
} | [
"function getCohorts() {\n for (var i = 0; i < centers.length; i++) {\n // cohortes por sede\n keys = Object.keys(data[centers[i].key]);\n // numero de cohortes\n centers[i].cohortLength = keys.length;\n // cohortes\n centers[i].cohortList = keys;\n }\n}",
"function getCohortNumbers(){\n\tretu... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |