query stringlengths 9 34k | document stringlengths 8 5.39M | negatives listlengths 19 20 | metadata dict |
|---|---|---|---|
thing, string, search element column, int, column to search isReturned, boolean, get elements that are returned if true | function search(thing, column, isReturned) {
var result = [];
var doc = SpreadsheetApp.openById(SCRIPT_PROP.getProperty("key"));
var sheet = doc.getSheetByName('record');
var data = sheet.getDataRange().getValues();
//var data = SpreadsheetApp.getActiveSheet().getDataRange().getValues();
for (var i = 0; i <... | [
"function genericSearchColumnReturn(table, fieldToSearch, valueToSearch, columnReturn)\r\n{\r\n\tvar internalID=0;\r\n\tvar retVal = 'not found';\r\n\t\r\n\t// Arrays\r\n\tvar invoiceSearchFilters = new Array();\r\n\tvar invoiceSearchColumns = new Array();\r\n\r\n\ttry\r\n\t{\r\n\t\t//search filters ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
images goes through the list of files and returns all the images. | function images(files) {
const images = [];
files.forEach(function(f) {
if (isImage(f.mediatype.mime)) {
images.push(f);
}
});
return images;
} | [
"function getAllImages()\n{\n\n for (var i = 0; i < g_imageList.length; i++)\n {\n var img = new Image();\n img.src = \"img/companyPhotos/\" + g_imageList[i];\n g_images.push(img);\n \n }\n}",
"function getImages(){\n return images;\n }",
"function loadImag... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
convert a point ( or array of points ) in global ( scene graph space ) to local space | globalToLocal(point) {
if (Array.isArray(point)) {
return point.map(pt => this.globalToLocal(pt), this);
}
return this.inverseTransformationMatrix.multiplyVector(point);
} | [
"localToGlobal(point) {\n if (Array.isArray(point)) {\n return point.map(pt => this.localToGlobal(pt), this);\n }\n return this.transformationMatrix.multiplyVector(point);\n }",
"toLocal(position, from, point, skipUpdate) {\n return from && (position = from.toGlobal(position, point, skipUpdate))... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This function is for the case when the user deletes a reaction and forgets to edit the previous or following reactions to make sure all of the substrates line up. It returns true when all reactions are valid. Else false; | function areReactionsValid() {
for(var i = 0; i < currentReactionNumber; i++) {
currentSubs = addedReactions[i]["substrates"];
currentEnz = addedReactions[i]["enzyme"];
currentProds = addedReactions[i]["products"];
if(!isValidReaction(currentSubs, currentEnz, currentProds, i)) {
... | [
"function validateReaction() {\n const node = $('#sections');\n const validateNode = $('#reaction_validate');\n const reaction = unloadReaction();\n utils.validate(reaction, 'Reaction', node, validateNode);\n // Trigger all submessages to validate.\n $('.validate_button:visible:not(#reaction_validate_button)'... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
init(): create elements of pics with id, css, background num_pic_input: pictures number num_row_input: row number num_col_input: column number | function init(num_pic_input, num_row_input, num_col_input, pic_width, pic_height) {
num_row = num_row_input;
num_col = num_col_input;
num_pic = num_pic_input;
var back_img = []; //background-image
back_img[0] = 'url("img/111126_kis_manzara_resmi_hareketli_2.jpg")';
back_img[1] = 'url("img/Featured-Image1.jpg")... | [
"function createPicsHolders() {\n for (var i = 0; i < 9; i++) {\n var pictureHolder = document.createElement(\"div\");\n pictureHolder.className = \"apepictures\";\n pictureHolder.id = \"picture-holder\" + i;\n pictures.appendChild(pictureHolder);\n }\n}",
"function createImgs(pr... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Focus on the previous enabled tab relative to `from` Announce focus change with new focusIndex if appropriate | function focusPrevious(from) {
var focusIndex = focusOn('previous', from );
if ( focusIndex != list.indexOf(selected)) {
// Announce focus change
$scope.$broadcast(EVENT.FOCUS_CHANGED, focusIndex);
}
return focusIndex;
} | [
"focusPrevious() {\n if (this._focusIndex === 0) {\n // hover last item\n this._focusIndex = this._tabs.length - 1;\n } else {\n this._focusIndex -= +1;\n }\n this._tabs[this._focusIndex].triggerFocus();\n }",
"focusPrevious() {\n const focusable = this.#getFocusable();\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
generate a list of possible scores for each possible next move | function genMoves(state, player){
// store board states of possible next moves
let moves = []
// store list of possible moves scores (1 means player x wins, -1 means player 0 wins)
let scores = []
// temporarily store a score value
let tempScore
// find possible next moves and generate scores array
for (let ... | [
"nextBestMove() {\n let moves = this.availableMoves.map(move => {\n let score = this.minimax(this.board, move, this.computerMarker);\n return { score, move };\n });\n\n let result = moves.reduce((maxScores, nextScore) => {\n if (maxScores.length) {\n const maxScore = maxScores[0].scor... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
/ 2. Harmless Ransom Note /// | function harmlessRansomNote(noteText, magazineText) {
var noteArr = noteText.split(' ');
var magazineArr = magazineText.split(' ');
var magazineObj = {};
magazineArr.forEach(word => {
if (!magazineObj[word]) magazineObj[word] = 0;
magazineObj[word]++;
});
var noteIsPossible = true;
noteArr.f... | [
"enharmonic(note) {\n if (this.isFlat()) {\n if (note.indexOf(\"#\") != -1) {\n return noteName(parseNote(note), false)\n }\n }\n\n if (this.isSharp()) {\n if (note.indexOf(\"b\") != -1) {\n return noteName(parseNote(note), true)\n }\n }\n\n return note\n }",
"fun... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Converts a WAV to MP3 | function convertToMp3(wav_file_path, callback){
console.log("Starting conversion from WAV to MP3 for " + wav_file_path);
var job = sox.transcode(wav_file_path + ".wav", wav_file_path + ".mp3");
job.on('end', callback);
job.on('error', function(err){
console.log("ERROR:" + util.inspect(err));
});
job.on('pro... | [
"function convertToWav() {\n exec(\n `sox ${outputDataFile} ${outputAudioFile}`,\n () => console.log(`Output to ${outputAudioFile}`)\n );\n}",
"asWavFile() {\n return writeWavFile(this.asAudio(), DEFAULT_SAMPLE_RATE);\n }",
"function decodeMP3(soundData, ondurationchanged) {\r\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
save vs currency to storage | function saveVsCurrency(VsChoice) {
localStorage.setItem('VsCurrency', VsChoice);
} | [
"function savePriceBtc(price) {\n localStorage.setItem(\"btcUsdPrice\", price)\n}",
"function saveMoney() {\n localStorage[\"money\"] = money;\n}",
"function save_price() {\n localStorage.setItem(\"storageName\",ticket_amt);\n }",
"setDataBaseCurrenciesLocalStorage(data) {\n const localStorageD... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Check if the string is a Semantic Versioning Specification (SemVer). If given value is not a string, then it returns false. | function isSemVer(value) {
return typeof value === 'string' && validator_lib_isSemVer__WEBPACK_IMPORTED_MODULE_1___default()(value);
} | [
"function isSemVer(value) {\n return typeof value === \"string\" && validator.isSemVer(value);\n }",
"function isSemVer(value) {\n return typeof value === \"string\" && validator.isSemVer(value);\n}",
"function isSemver(str) {\r\n if (!isString(str))\r\n return false;\r\n else\r\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Method: clearDiff Clear diff flag of given node on it's parent. Recurses upwards, when the parent's diff becomes empty. Clearing the diff is usually done, once the changes have been propagated through sync. Parameters: path absolute path to the node timestamp new timestamp (received from remote) to set on the node. | function clearDiff(path, timestamp) {
return getNode(path).then(function(node) {
function clearDiffOnParent() {
var parentPath = util.containingDir(path);
if(parentPath) {
var baseName = util.baseName(path);
return getNode(parentPath).then(function(parent) {
de... | [
"function clearPath(node, key, parent, path) {\n if (node == null) {\n return;\n }var result = undefined;\n del(node, cursorSymbol);\n\n if (path.length > 0) {\n var nextKey = path[0];\n var nextNode = get(node, nextKey);\n result = clearPath(nextNode, nextKey, node, path.slice(1));\n } else {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
given a row and a sudoku, returns true if it's a legal row | function isCorrectRow(row,sudoku) {
var rightSequence = new Array(1,2,3,4,5,6,7,8,9);
var rowTemp= new Array();
for (var i=0; i<=8; i++) {
rowTemp[i] = sudoku[row*9+i];
}
rowTemp.sort();
return rowTemp.join() == rightSequence.join();
} | [
"function IsPossibleRow(number, row, sudoku){\n \n}",
"function isPossibleRow(number,row,sudoku) {\n for (var i=0; i<=8; i++) {\n if (sudoku[row*9+i] == number) {\n return false;\n }\n }\n return true;\n}",
"function isPossibleRow(number,row,sudoku) {\n\tfor (var i=0; i<=8; i++) {\n\t\tif (sudo... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
getIgnoreKeywords_onomatopoeia() Get the onomatopoeia to ignore. For example: aahhh, oooo, ohhhhh, haaaa, etc.. | function getIgnoreKeywords_onomatopoeia() {
var onolist = [];
onolist = onolist.concat(getIgnoreKeywords_onomatopoeia_singles());
onolist = onolist.concat(getIgnoreKeywords_onomatopoeia_doubles());
return onolist;
} | [
"function getIgnoreKeywords_onomatopoeia_singles() {\n\t\tvar onolist = [];\n\t\t\n\t\tvar pieces = getIgnoreKeywords_onomatopoeia_singleLetter();\n\t\tvar pieceslength = pieces.length;\n\t\t\n\t\tfor(var i = 0; i < pieceslength; i++) {\n\t\t\tvar piece = pieces[i];\n\t\t\tonolist = onolist.concat(getIgnoreKeywords... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Injectable servicelevel options for FocusMonitor. | function FocusMonitorOptions() { } | [
"function FocusMonitorOptions() {}",
"function FocusOptions() {}",
"function FocusOptions() { }",
"function ServiceOptions() {}",
"get options() { return this.optionsService.options; }",
"function AbstractControlOptions() {}",
"function AbstractControlOptions(){}",
"function optionsProvider(options, r... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
picturepicturepicturepicturepicture /picture's size imgurl:picture url imgid:picture id [a html object by jq or js] framew,frameh:the frame include the picture | function PicturE_auto(imgurl,imgid,framew,frameh,topIs){
/*picture:width,heightpicture:width,heightpicture:width,height*/
//custom the img's object
var img=new Image();
//set the object img's src
img.src=imgurl;
img.onload=function(){
//computer the img w and h based on frame
imgsw=img... | [
"function PopUpImage(ucn,did,ccisucn,imagefile,tabname,x,y) {\n if (x=='undefined') {\n x=612;\n y=792;\n }\n \n // 1.48x gets me original size on my 30\" dell 2560x1600 monitor\n x=parseInt(x)*1.48;\n y=parseInt(y)*1.48;\n \n //var path = 'image.cgi?ucn='+ucn+'&did='+did+'&ccisu... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Players ( INTEGER n ): ARRAY [INTEGER index] = OBJECT Player | function Players(n)
{
let players = [];
for(let i = 1; i <= n; i++)
{
players.push(new Player(i));
}
return players;
} | [
"function getPlayers(players) {\n var playerList = [];\n for(var i =0; i< players; i++) {\n playerList[i] = {\n faceDown:[], \n faceUp:[], \n hand:[],\n dealCard: function(card) {\n if (this.faceDown.length < 3) {\n this.faceDown.push(card);\n } else ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Check and resposition headers according to cell positions. | function checkAndRepositionHeaders() {
checkAndRepositionRowHeader(_renderer.getHeaders().row);
checkAndRepositionColumnHeader(_renderer.getHeaders().col);
} | [
"function checkAndRepositionColumnHeader(header) {\n header.children().each(function(index, element) {\n var containerOffset = _renderer.getContainer().offset();\n var elementOffset = jQuery(_renderer.getCellElements()[0][index]).offset();\n var left = elementOffset.left - containerOffset.... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
populateSearchResults dot maps through the searchResultsArray creating resultCard(s). | function populateSearchResults(){
let searchResultsSection = document.querySelector('.results');
// remove existing child elements from searchResultsSection, found at https://stackoverflow.com/questions/3955229/remove-all-child-elements-of-a-dom-node-in-javascript
while (searchResultsSection.firstChild) {
sea... | [
"function populateSearchResults(results) \r\n{\r\n\t// Align search results with search input\r\n\tvar searchBar = $('.header-search-bar');\r\n\tvar left\t = searchBar.offset().left;\r\n\tvar top\t \t = searchBar.offset().top + searchBar.innerHeight();\r\n\tvar width\t = searchBar.outerWidth();\r\n\tvar searchV... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Check that the string is already highlighted. | function isAlreadyHighlighted(highlighted) {
var highlights = getFinalText();
for (var i = 0; i < highlights.length; i++) {
if (highlights[i].includes(highlighted)) {
return true;
}
}
return false;
} | [
"function check_highlight(text){\n for (var i=0; i<settings.highlight.length; i++)\n {\n if(text.indexOf(settings.highlight[i]) != -1)\n return true;\n }\n return false;\n}",
"function checkWord() {\n\t// clears the pos array so that a player cannot highlight the same word twice\n\tf... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Does this scope have any declared variables? | hasDeclarations() {
return !!this.declaredVariables().length;
} | [
"hasDeclarations() {\n return !!this.declaredVariables().length;\n }",
"function checkScope() {\n \"use strict\";\n \n if (true) { //A block is anything within { }.\n let i = \"block scope\"; //'let' declaration not being accessible outside of block\n console.log(\"Block scope i is: ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get the storage where images are captured by platform. It will be resources/app nam/platform name | get storageByPlatform() {
return this._storageByPlatform;
} | [
"get storageByDeviceName() {\n return this._args.storageByDeviceName;\n }",
"static get pathToStorage() {\n return path.join(config_1.StaticConfig.homePath, this.storageFileName);\n }",
"getStorageName() {\n return STORAGE_NAME_FILESYSTEM;\n }",
"static getConfigStoragePath () {\n r... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Private : Compare Row Viewport | function compareRowViewport(rowViewport, relativedViewport, isHorizontalMode, compareToPos) {
var rowBackPos = rowViewport.getTopPos(relativedViewport);
var rowFrontPos = rowViewport.getBottomPos(relativedViewport);
if (isHorizontalMode) {
rowBackPos = rowViewport.getLeftPos(relativedViewport);
rowFron... | [
"function compare_row(a, b)\n{\n return a.row - b.row\n}",
"checkRowIsSame(row) {\n for (let c = 0; c < this.COLUMNS - 1; c++) {\n if (this.GRID[row][c] != this.GRID[row][c + 1] || this.GRID[row][c] == 0) {\n return false;\n }\n }\n return true;\n }",
... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This function colors the single charts and each area | function singleCharts(array) {
var wBar, elColor;
// Transforming answers in percentage values for single charts and coloring them
for( i=0; i<array.length; i++) {
wBar = array[i]*33.33;
elColor = assignColor(array[i]);
$('.result-value[data-answer="'+(i+1)+'"]').find('.bar').addCla... | [
"function di_setChartAndPlotareaBgUI(uid)\n{\n\tvar chartObj = di_getChartObject(uid);\n\tvar renderChartObj = di_getRenderedChartObject(chartObj);\n\tdi_setColorDialogBox('dicolor1'+uid,renderChartObj.backgroundColor);\n\tdi_setColorDialogBox('dicolor2'+uid,renderChartObj.plotBackgroundColor);\n}",
"function col... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
get image corresponding to given string of cipher letters | function getImg(s) {
var result = "";
for (var i=0; i<s.length; i++) {
result += "<img src=\"alphabet/" + getName(s.substring(i,i+1)) + ".jpg\">";
}
return result;
} | [
"function findImage(sign){\n var imageSign = sign.toLowerCase();\n return imageSign;\n\n}",
"function getImage(c) {\n\t\n\t//console.log(\"c at start: \" + c);\n\tvar returnImg = imageArray[DEFAULT_IMAGE_TAG];\n\t\n\t//Check if the given char is in the array.\n\tif(sessionChars.indexOf(c) > -1)\n\t{\n\t\t/... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
enableOrDisableDefaultWords() is called when the default words switch is toggled | function enableOrDisableDefaultWords() {
// Check the state of the switch
if (document.getElementById('generalSettings1').checked) {
//**************
// SWITCH IS ON
//**************
// Apply default words
wordArray.push.apply(wordArray, defaultWords);
} else {
//***************
// SWITCH IS OFF... | [
"function checkAutoReplaceSettings(){\n chrome.storage.local.get([\"enableAutoReplaceWords\"], function(items){\n enableAutoReplaceWordsBool = items.enableAutoReplaceWords;\n if(enableAutoReplaceWordsBool == true){\n switchWords();\n }\n });\n}",
"function toggle() {\n\t v... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
updateDom with the new response | function updateDom(response){
$( ".response-line" ).empty();
$( "#response" ).append(response);
} | [
"function updateDOM() {\n\tvar newTree = render(data);\n\tvar patches = diff(tree, newTree);\n\trootNode = patch(rootNode, patches);\n\ttree = newTree;\n}",
"function do_full_update() {\n const rendered_dom = exports.render_tag(new_dom);\n replace_content(rendered_dom);\n }",
"function setHTML(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
`findById(id)`: Expects a scheme `id` as its only parameter. Resolve to a single scheme object. On an invalid `id`, resolves to `null`. | function findById(id) {
return db('schemes').where({ id }).first();
} | [
"function findById(id) {\n return db('schemes')\n .where({ id })\n .first();\n}",
"function findById(id) {\n return db('schemes').where({ id }).first();\n}",
"findById(id) {\n let path = `/learningObjects/${id}`;\n return this.get(path)\n }",
"async findById(id) {\r\n let... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
End spaceShip Object / Function to push all created objects into empty globally declared array, which takes two arguements: asteroids: The now (after initialised) populated array itself that holds the asteroid objects maxAsteroids: The size of the maxAsteroids to be passed as parameter | function fillAsteroidArray(asteroids, maxAsteroids)
{
for(var i = 0; i < maxAsteroids; i++)
{
asteroids.push({
x: Math.floor(Math.random()*W), //x-coordinate
y: Math.floor(Math.random()*H), //y-coordinate
r: Math.random()*25 + 4, // radius
d: Math.random() * maxAsteroids // density
});
}
} | [
"function fillAsteroids(){\r\n while(asteroids.length != minAsteroid){\r\n \r\n // if(counter < 30)\r\n // console.log(\"generating asteroid | Counter is now at \" + counter)\r\n asteroids.push(new generateAsteroid());\r\n }\r\n}",
"spawnAsteroids() {\n for (let i = 0; i < this.config.ASTEROID_CO... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
The handler's main function. This is called when a job is retrieved that this handler can service. log: The logger to use for log messages. config: The properties to use (workerconfig.json) job: The job that was pulled from the Beanstalk tube handlerCallback: The call back to call when the handler is done. | function handle(log, config, environment, job, handlerCallback) {
log.debug('vler-das-doc-retrieve-handler.handle : received request to VLER job: %j', job);
if (!job) {
log.debug('vler-das-doc-retrieve-handler.handle : Job was null or undefined');
return setTimeout(handlerCallback, 0, errorUtil... | [
"function handle(log, config, environment, job, handlerCallback) {\n log.debug('vler-das-xform-vpr-handler.handle : received job %j', job);\n\n if (!job) {\n log.error('vler-das-xform-vpr-handler.handle : Job was null or undefined');\n return setTimeout(handlerCallback, 0, errorUtil.createFatal(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Make sure the mongodb user for forms exists. | function ensureFormsUserExists(cb) {
var appConfig = fhconfig.getConfig().rawConfig;
var mongoConfig = appConfig.mongo;
var mongoConfigKey;
if (mongoUtils.hasUserSpaceDb()) {
mongoConfig = appConfig.mongo_userdb;
mongoConfigKey = 'mongo_userdb';
}
var mongoAdminDbUrl = mongoUtils.getAdminDbUrl(fhcon... | [
"'submit .consent-form'(event) {\n event.preventDefault();\n\n if (!Meteor.userId()){\n let userSession = Session.get('username');\n\n //if there is no user, add a user\n if (!userSession){\n const random_username = Random.id();\n const ra... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
arrayOfArrays(myCountries); 7. Check if there is a country or countries containing the word 'land'. | function ifCountriesHave(word) {
let newArray = [];
for (const item in countries) {
if (countries[item].includes(word)) {
newArray.push(countries[item]);
}
}
if (newArray.length != 0) {
return console.log(newArray);
} else {
return console.log(`All these countries are without ${word}`);
... | [
"function exercise7(){\nlet arr = []\nfor (let i = 0; i < countries.length; i++){\n if(countries[i].match(/land/gi)){\n arr.push(countries[i])\n }\n}\nif(arr.length > 0){\n console.log(arr)\n}else{\n console.log('all these countries are without land')\n}\n}",
"function exercise4(){\nlet arr = []\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Maps a GroupMatchResult to a friendlier data structure. | function mapGroupMatchResult( groupMatchResult ) {
var createGroup = {
'metadata': metadataGroup,
'alternationDelimiter': alternationDelimiterGroup,
'null': nullGroup,
'plain': plainGroup
}[ groupMatchResult.type ];
if( ! createGroup ) {
throw new GroupMatchError( '"' + groupMatchResult.type + '" is not a... | [
"function compute_matcher_metrics(source_group) {\n return {\n all:function () {\n return source_group.all().map(function(d) {\n var result = Object.keys(d.value).map(function(key) {\n return {'key':key,... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
OK, so here's the deal. Consider this code: var db1 = new PouchDB('foo'); var db2 = new PouchDB('foo'); db1.destroy(); ^ these two both need to emit 'destroyed' events, as well as the PouchDB constructor itself. So we have one db object (whichever one got destroy() called on it) responsible for emitting the initial eve... | function prepareForDestruction(self, opts) {
function constructorDestructionListener(name) {
if (name === opts.originalName) {
self.removeListener('destroyed', destructionListener);
self.emit('destroyed', self);
}
}
function destructionListener() {
// we destroyed ourselves, so no need t... | [
"_clear () {\n log('_clear database', this._dbName);\n // We don't need to call removeEventListener or remove the manual \"close\" listeners.\n // The memory leak tests prove this is unnecessary. It's because:\n // 1) IDBDatabases that can no longer fire \"close\" automatically have listeners GCed\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Method: O.FileButtonViewdraw Overridden to draw view. See . For DOM structure, see general notes. | draw(layer) {
const children = FileButtonView.parent.draw.call(this, layer);
return [this.drawControl(), ...children];
} | [
"draw ( layer ) {\n let icon = this.get( 'icon' );\n if ( typeof icon === 'string' ) {\n icon = ButtonView.drawIcon( icon );\n } else if ( !icon ) {\n icon = document.createComment( 'icon' );\n }\n return [\n this._domControl = el( 'input', {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
openPage hides all informations about films | function openPage() {
$(".information").hide();
} | [
"function hideFiles() { showFiles(true,this); }",
"function visualiserFeed(){\n ///var files = document.getElementById(\"txtedFich\").value;\n // service pour visualiser feed\n var url = \"/feed\";\n window.open(url,\"_blank\");\n} // end visualiser pdffeed",
"function ShowPerDisplayOthers(limit,filename,O... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
main: called in 'index.html' after everything was loaded checks if WebGL works or shows an error initializes and runs the demo | function main() {
canvas = document.getElementById( "canvas" );
if ( !! window.WebGLRenderingContext ) {
/**
set the global 'gl' with the WebGLRenderingContext of the 'canvas'
*/
gl = canvas.getContext( "experimental-webgl" );
}
if ( gl ) {
init();
run();
} else {
document.getElementById( "... | [
"function main() {\n var canvas = document.querySelector(\"#glcanvas\"); // or document.getElementById(\"myGLCanvas\");\n canvas = WebGLDebugUtils.makeLostContextSimulatingCanvas(canvas);\n\n const gl = WebGLDebugUtils.makeDebugContext(createGLContext(canvas)); // Init the GL context\n const wgl = {}; /... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
The users name Will load the users name. Local storage is used for faster loading but chromes storage beats local. | function loadName() {
//First get local storage name to have it right now.
let name = 'Friend'
let localName = localStorage.getItem('name')
if (localName) {
name = localName
}
emit('name-changed', name)
//Then check chrom storage.
if (!chrome.storage) return
chrome.storage.... | [
"function initName() {\n name = \"\";\n if (localStorage[\"user\"] == null)\n name = \"Annonymous\";\n else\n name = user.First_name + \" \" + user.Last_name;\n}",
"function userName(){\r\n\t\tvar username = localStorage.getItem(\"username\");\r\n\t\tif (username == undefined || username ==... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get file path for this month's expenses. | function getTodaysExpensesFilePath()
{
// January starts with 0
var month = date.getMonth() + 1;
var year = date.getFullYear();
return getExpensesFilePath(month,year);
} | [
"function getFilePath() {\n\t\t\treturn $BASE_PATH + 'adminPanel/flatForms/export';\n\t\t}",
"static get file() {\n return `board_agenda_${Agenda.#$date.replace(/-/g, \"_\")}.txt`\n }",
"function datafilePath() {\n return path.resolve(__dirname, DOWNLOAD_STATS_FILENAME);\n}",
"function getLogFileName()... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function: incrementEnemySpeed() Desc: Increases the enemy speed by 0.1 | function incrementProjectileSpeed()
{
if(enemySpeed <= 2)
{
enemySpeed = enemySpeed + 0.1;
}
} | [
"function incSpeed() {\n\n allEnemies.forEach(function(enemy) {\n enemy.speed=enemy.speed+50;\n \n });\n\n\n}",
"increaseSpeed(increaseValue){\r\n\t\tthis.speed+=increaseValue;\r\n\t}",
"increaseSpeed(value){\n this.Speed=this.Speed+value;\n }",
"increaseSpeed() { \n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Reproduce una secuencia de tonos dtmf | function PlaySeqDTMF(cad)
{
try
{
if (gb_use_fast === true)
{
switch (cad)
{
case '#00*': cad = 'D'; break;
case '#01*': cad = '1'; break;
case '#02*': cad = '2'; break;
case '#03*': cad = '3'; break;
case '#04*': cad = '4'; break;
case '#05*': cad = '5'; break;
ca... | [
"_didReceiveDtmfDigit({ callId, dtmf }) {\n console.log('_didReceiveDtmfDigit ' + callId + \"***\" + dtmf)\n }",
"function Poll_Pad_DTMF()\r\n{ \r\n try\r\n {\r\n if (gb_use_gamepad_dtmf === false)\r\n {\t\r\n return;\r\n }\r\n\t\r\n let pads = navigator.getGamepads();\r\n let pad0 = pads[0];\r\n let ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Send string message (forward string message) over WS session by the key | sendString(key, stringMessage) {
const me = this;
debug(`${me.sendString.name}: ${key}`);
me._lock(key);
me.wsFactory.getSocket(key)
.then((wSocket) => {
if (me.wsFactory.hasSocket(key)) {
wSocket.sendString(stringMessage, () => me._unlo... | [
"function doSend(message){websocket.send(message);}",
"sendTestMessage(ws){\n ws.send(JSON.stringify(new Message(\"1\", \"debugMessage\", \"hello there\")));\n }",
"function wsSend(myString) {\n //console.log(\"Sending \" + myString);\n var length = myString.length;\n var pos = 0;\n\n whil... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Helper function to install a getteronly accessor property. | function InstallGetter(object, name, getter, attributes) {
%CheckIsBootstrapping();
if (typeof attributes == "undefined") {
attributes = DONT_ENUM;
}
SetFunctionName(getter, name, "get");
%FunctionRemovePrototype(getter);
%DefineAccessorPropertyUnchecked(object, name, getter, null, attributes);
%SetNa... | [
"function InstallGetterSetter(object, name, getter, setter) {\n %CheckIsBootstrapping();\n SetFunctionName(getter, name, \"get\");\n SetFunctionName(setter, name, \"set\");\n %FunctionRemovePrototype(getter);\n %FunctionRemovePrototype(setter);\n %DefineAccessorPropertyUnchecked(object, name, getter, setter, ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Create dataBox for tabata workout | function createTabataDataBox(dataBoxIndex) {
addFooterInput(dataBoxIndex, 'Score');
} | [
"function TabData() {\r\n}",
"function makeDataTab() {\n\n var note = '';\n var numShow = 20; // if column type is str, show this many number of possible values\n\n // add tab and container\n note += '<div class=\"row\"><div class=\"col-sm-12\">';\n ['description','source','meta... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Creates new frame aligned to top of other | topOf(other) {
return new Frame(this.origin.x, other.origin.y - this.size.height, this.size.width, this.size.height);
} | [
"topOf(other) {\n return new Frame(this.origin.x, other.origin.y - this.size.height, this.size.width, this.size.height);\n }",
"bottomOf(other) {\n return new Frame(this.origin.x, other.origin.y + other.size.height, this.size.width, this.size.height);\n }",
"bottomOf(other) {\n return new Frame(t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
SMS Status after send and stored in smslog | function smsStatus(req, res, next) {
console.log("SMS status");
console.log(req.body);
var smsLog = new SMSLog();
smsLog.from = req.body.From;
smsLog.to = req.body.To;
smsLog.status = req.body.Status;
smsLog.totalRate = req.body.TotalRate;
smsLog.totalAmount = req.body.TotalAmount;
s... | [
"function alertSMS() {\n if (!config.TWILIO_ACCT_SID || !config.TWILIO_AUTH_TOKEN) {\n return;\n }\n\n // only send SMS every 1 minute\n if (smsSent) {\n return;\n }\n\n var opts = { to: config.NUMBER_TO_SEND_TO,\n from: config.TWILIO_OUTGOING_NUMBER,\n body: \"fall detected\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Easy Difficulty Have the function vowelCount(str) take the str string parameter being passed and return the number of vowels the string contains (ie. "All cows eat grass" would return 5). Do not count y as a vowel for this challenge. | function vowelCount(str) {
// put all vowels from the string into an array
var vowels = str.match(/[aeiou]/gi);
// if there are no vowels in the string return 0
// else return the length of the array containing the vowels
return (vowels === null) ? 0 : vowels.length;
} | [
"function VowelCount(str) {\n\n var vowels = /[aeiou]/i;\n var count = 0;\n for (i = 0; i < str.length; i++) {\n if (vowels.test(str[i]) === true) {\n count++;\n }\n }\n return count;\n\n}",
"function vowelCounter(str) {\n\nreturn str.match(/[aeiou]/gi).length;\n\n// var numVow = 0;\n// var vo... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Extracts landing pages from Fusion response data. | function getLandingPagesFromData(data) {
return _.get(data, 'fusion.landing-pages');
} | [
"function computeAdLandingPages(ads) {\n var ret = []\n for ( var i = 0; i < ads.length; i++) {\n ads[i]['possible_landing_urls'] = []\n var ad_urls = ads[i].ad_urls; \n for (var j = 0; j < ad_urls.length; j ++) {\n ads[i]['possible_landing_urls'] = ads[i]['possible_landing_urls'].concat(extractLa... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Checks if year matches current year | isCurrentYear(year) {
const date = this.createMoment(this.value).year(year);
return date.isSame(this._current, 'year');
} | [
"function checkYear(byear, nic_year) {\n\n if (byear != nic_year) {\n return false\n }\n\n return true\n\n }",
"isYearActive(year) {\n const date = this.createMoment(this.value).year(year);\n return date.isSame(this.value, 'year');\n }",
"function isThisYear(d... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Declare a function to process the Remove Role event request | function removeRoleHandler() {
alert("Remove Selected Role - This feature is not yet implemented");
// Loop over the roles in teh list box
$.each($("#orgRoleList input"), function (index, value) {
// check to see if the current record is selected
if ($(value).prop('check... | [
"function removeRoleHandler() {\n alert(\"Remove Selected Role - This feature is not yet implemented\");\n }",
"function deleteRole() {\n\n}",
"removeRole() {\n // collect role info\n inquirer.prompt([\n questions.functions.roleId\n ])\n // send results to de... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return true iff the user matches our models socket information, and room information. This will prevent spoofing a username on the client side. | function validateUser(socket, room, username, roomUsers){
return (room
&& roomUsers[room] && socket.id in roomUsers[room]
&& roomUsers[room][socket.id] == username
&& socket.store && socket.store.data
&& socket.store.data.nickname == username
&& socket.store.data.room == room);
} | [
"function inside(socket, room) {\n return !!socket.manager.roomClients[socket.id][room];\n }",
"function validateDriver(socket, room, username, roomDrivers, roomUsers){\n return validateUser(socket, room, username, roomUsers)\n && roomDrivers[room] && roomDrivers[room] == socket.id;\n}",
"f... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
REQUEST TO BBB API | callBBBapi (path, callback) {
let options = {
host: 'api.bbb.org',
port: 443,
path: path,
method: 'GET',
headers: {
'User-Agent': 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.13) Gecko/20080311 Firefox/2.0.0.13',
'Authorization': constants.BBB_TO... | [
"callBBBapi (path, callback) {\n let options = {host: 'api.bbb.org',port: 443,path: path,method: 'GET',\n headers: {\n 'User-Agent': 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.13) Gecko/20080311 Firefox/2.0.0.13',\n 'Authorization':config.get('BBB_TOKEN')\n }};\n let req... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
DebugInfo constructor `DebugInfo` displays information about the state of a player | function DebugInfo() {
/**
* ### DebugInfo.table
*
* The `Table` which holds the information
*
* @See nodegame-window/Table
*/
this.table = null;
/**
* ### DebugInfo.interval
*
* The interval checking node propert... | [
"function DebugInfo() {\n }",
"getPlayerInfo() {\n\t\tconsole.log('Player [ID: %d, Tile: %s]', this.id, this.tile);\n\t}",
"getPlayerInfo() {\n\t\tconsole.log('ComputerPlayer [ID: %d, Tile: %s, Difficulty: %s]', this.id, this.tile, this.difficulty);\n\t}",
"function showDebugInfo() {\n\t\t\tconsole.log();\n\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Handler for modem answer. Define function every call for correct remove listner. Modem answer can be cut to a lots of chunks so collect them all. | function handler(buffer) {
let chunks = buffer.toString().split("\n");
for (let chunk of chunks) {
chunk = chunk.replace(/(\r\n|\n|\r)/gm, "").trim();
if (chunk == "OK") {
// if end of message stop listner and return resul... | [
"function remove_answer_evt(){\n\t\t\tif(confirm('Bạn có chắc chắn ?')){\n\t\t\tdelete answers[id];\t//delete from manager\n\t\t\tcurrent_index--;\n\t\t\tanswers_container.removeChild(main);\n\t\t\treset_answers();\t//reset elements\n\t\t\tif(typeof answer_delete_event=='function') answer_delete_event(data); //call... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sell the bids. Only the owner of the bidding game can sell the bids | function sellBid(address receiver, uint bidCount) returns(bool sufficient) {
/*Only the owner of the bidding agency can sell bids*/
if(msg.sender != owner){
return false;
}
/*Either all bids sold, or max bids requested*/
if (totalBids[owner] < bidCount){
return false;
}
totalBids[owner] -= bidCount;... | [
"function hitTheBid () {\n // get bid price\n // place limit sell order at bid\n domInterface.getBestBid()\n .then((price) => {\n domInterface.placeSellOrder(price)\n })\n }",
"function _bid($player) {\n\t\t\t_resetStatuses();\n\n\t\t\tconst paState = _$pennyAuction.data(\"state\");\n\t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
SmartPlantEater Does not breed very fast, which makes the cycles between abundance and famine intense. Does not wipe out the local plant life Targets plants or waits for plants to grow near by. | function SmartPlantEater () {
this.energy = 20
this.didNotReproduceInPreviousTurn = true
} | [
"function SmartPlantEater(){\n this.energy = 25;\n this.direction = randomElement(direction_names);\n}",
"function SmartPlantEater() {\n this.energy = 30;\n this.direction = \"s\";\n}",
"function LessStupidPlantEater() {\n this.energy = 20;\n this.originChar = \"o\";\n this.previousLocations = [n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
copy image smaller2 size 1280x1308 | function image_smaller2() {
return gulp
.src(smaller2.src, { nodir: true })
.pipe(newer(smaller2.dist + "smaller"))
.pipe(imageresize({
width: smaller2.params.width,
height: smaller2.params.height,
crop: smaller2.params.crop,
upscale: false
}))
.pipe(imagemin({
progressive: t... | [
"function image_small2() {\r\n return gulp\r\n .src(small2.src, { nodir: true })\r\n .pipe(newer(small2.dist + \"small\"))\r\n .pipe(imageresize({\r\n width: small2.params.width,\r\n height: small2.params.height,\r\n crop: small2.params.crop,\r\n upscale: false\r\n }))\r\n .pipe(imagemin({\r\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
setUpDeckView(), Shows the deck cards | setUpDeckView(deck) {
// Get the deck view icon
var deckView = document.getElementById("deckView");
// Clear all images from the view
while (deckView.hasChildNodes()) {
deckView.removeChild(deckView.lastChild);
}
// Loop through the cards in the deck
for (var i = 0; i < deck.deckSize(); i++) {
// ... | [
"function Window_MonsterCardsManager_DeckCards() {\r\n this.initialize.apply(this, arguments);\r\n }",
"display() {\n this.shuffle();\n const deckElem = $('.deck');\n deckElem.empty();\n this.cards.forEach((card) => {\n deckElem.append(card.toHtml())\n })\n }",
"function displayDe... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
create and return a new collapsible item for an entry | function createEntry(notebookFileName, entryId) {
var id = notebookFileName + '-' + entryId;
// entry
var $entry = $('<div class="entry" data-role="collapsible" id="' + id + '"></div>').width(getTabWidth(notebookFileName));
// title
$entry.append('<h3 id="' + id + 't"><div class="title"></div></h3>'... | [
"function addCollapsibleListItem() {\n return this.each(function () {\n var li = jquery__WEBPACK_IMPORTED_MODULE_0___default()(this);\n var ul = li.find('> ol, > ul').first();\n\n if (ul.length > 0) {\n var prev = li.clone();\n prev.find('ol, ul').remove();\n var listId = li.attr('id');\n\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
refresh list with only active tasks | function filter_active()
{
//reset/reload tasks
document.getElementById("tasks").innerHTML="";
load_active_tasks(curr_list.todos);
update_count();
} | [
"function assignActiveList() {\n\tassignTasksToList(tasks.active, activeList, appendToActiveList);\n\thideClearBtns();\n}",
"function changeStatus(){\n if(list){\n activeTasksCounter = 0;\n tasksStatus = !tasksStatus;\n for(let i = 0 ; i < list.length; i++){\n tasksStatus == tru... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
stuff a line at a time into the LINBF buffer | function pollLineStuff() {
var bufsz = 97, // maximum line length
bufptr = 0x8046, // start at LINBF
thrufl = 0x81de, // line input done flag
len = 0;
if (ccemu.rd(thrufl) === 0) { // buffer is in accepting state
// leading zero
ccemu... | [
"function lineBuffer(callback) {\n\tvar buffer = ''\n\treturn function(data) {\n\t\tvar i\n\t\tbuffer += data\n\t\twhile((i = buffer.indexOf(\"\\n\")) != -1) {\n\t\t\tcallback(buffer.slice(0, i))\n\t\t\tbuffer = buffer.slice(i + 1)\n\t\t}\n\t}\n}",
"function writeLine() {\n var log = journal.shift();\n if (... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Checks whether the user's browser support Shadow DOM. | function _supportsShadowDom() {
if (shadowDomIsSupported == null) {
var head = typeof document !== 'undefined' ? document.head : null;
shadowDomIsSupported = !!(head && (head.createShadowRoot || head.attachShadow));
}
return shadowDomIsSupported;
} | [
"checkShadowDomSupport() {\n return typeof(document.documentElement.attachShadow) !== 'undefined';\n }",
"function _supportsShadowDom() {\n if (shadowDomIsSupported == null) {\n var head = typeof document !== 'undefined' ? document.head : null;\n shadowDomIsSupported = !!(head && (head.... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Upload the new property to the server so it can persist into database | function submitNewPropertyToServer()
{
var name = viewModel.productEditNewPropertyName();
var key = viewModel.productEditNewPropertyDialog();
if (name != null && name != "")
{
$.post(BASE_AJAX_PATH + "Api/Upload/StaticProperty?key=" + encodeURIComponent(key) + "&name=" + encodeURIComponent(name... | [
"function saveProperty(property, doAssign) {\n\t$.ajax({\n\t\ttype: \"POST\",\n\t\tcontentType: \"application/json\",\n\t\turl: projectPathPrefix + \"/api/resources/property\",\n\t\taccept: \"application/json\",\n\t\tdata: JSON.stringify(property),\n\t\tsuccess: function (response) {\n\t\t\taddAvailableProperty(res... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Auto adjust the bar width by determining the time span in days and setting the bar width according introduced cutoff values. | function AutoAdjustBarWidth(
timeFrameBegin,
timeFrameEnd,
dailyCutoff,
weeklyCutoff,
monthlyCutoff,
quarterlyCutoff,
barFirst,
barSecond) {
var start = new Date(timeFrameBegin);
var end = new Date(timeFrameEnd);
var timespan = end - start;
var days = timespan / standard... | [
"function adjustWidth() {\n width += 0.0166666666666667;\n bar.style.width = width + \"%\";\n bar.innerHTML = width.toFixed(1) + \"%\";\n\n // set width value to a var\n barWidth = width;\n }",
"function setTimelineBarsWidth() {\n\t\t\t//the width is the result of dividing ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Converts the Julian days to Julian centuries since 2000. | function calcTimeInJulianCenturiesSince2000(inpJulianDayNbr) {
var julianCenturiesNbr = (inpJulianDayNbr - JULIAN_NBRS.JAN_1_2000_DAYS) / JULIAN_NBRS.CENTURY_DAYS;
return julianCenturiesNbr;
} | [
"function julian_centuries(tee) {\n return (dynamical_from_universal(tee) - J2000) / 36525;\n}",
"function calcJulianDay(){\n\tvar j = (document.daycounter.julianday.value); // extract Julian Day, numeric value (not necessarily integer) expected.\n\tj = j.replace(/\\s/gi, \"\"); j = j.replace(/,/gi, \".\"); j = ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Script closeAssociatedPlanReviewTask.js Record Types: all Event: ACAA Desc:for plan reviews being completed using the conditions, close the associated WF task Created By: Silver Lining Solutions Change Log DateNameModification 06/18/2018EricOrig 01/31/2020ChadAssign task before closing to document who updated the condi... | function closeAssociatedPlanReviewTask()
{
logDebug("START of closeAssociatedPlanReviewTask");
var tempStr = conditionObj.getDispConditionDescription().toString();
var condDesc = "" + tempStr.toString();
var lenDesc = condDesc.length;
var startPos = condDesc.indexOf(":");
var lookupValue = condDesc.substr(... | [
"function closeAssociatedPlanReviewTask()\r\n{\r\n\t\r\n\tlogDebug(\"START of closeAssociatedPlanReviewTask\");\r\n\tvar tempStr = conditionObj.getDispConditionDescription().toString();\r\n\tvar condDesc = \"\" + tempStr.toString();\r\n\tvar lenDesc = condDesc.length;\r\n\tvar startPos = condDesc.indexOf(\":\");\r\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Prefer locally installed version of standard | function requireStandard (cwd) {
try {
return require(resolve.sync('standard', { basedir: cwd }))
} catch {
return require('standard')
}
} | [
"function preferredCliVersion() {\n const pjLocation = findUp('package.json', __dirname);\n if (!pjLocation) {\n return undefined;\n }\n const pj = JSON.parse(fs.readFileSync(pjLocation, { encoding: 'utf-8' }));\n return pj.preferredCdkCliVersion ? `${pj.preferredCdkCliVersion}` : undefined;\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
function calling the AES encrypt function of CryptoJS library | function aesEncryption(message, password){
var ciphertext = CryptoJS.AES.encrypt(message, password).toString();
return ciphertext;
} | [
"function encodingAES(){\n const aesEncrypt = CryptoJS.AES.encrypt(message, keyAES).toString();\n const aesDecrypt = CryptoJS.AES.decrypt(aesEncrypt, keyAES).toString(CryptoJS.enc.Utf8);\n console.log(colors.green('AES'));\n console.log(`Mi mensaje cifrado con AES es: ${colors.yellow(aesEncrypt)}`);\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Swap Two Elements in the DOM | function swapElements(elm1, elm2)
{
var parent1, next1,
parent2, next2;
parent1 = elm1.parentNode;
next1 = elm1.nextSibling;
parent2 = elm2.parentNode;
next2 = elm2.nextSibling;
parent1.insertBefore(elm2, next1);
parent2.insertBefore(elm1, next2);
} | [
"function swap(el1, el2) {\r\n var tmp = el1.cloneNode(true);\r\n el1.parentNode.replaceChild(tmp, el1);\r\n el2.parentNode.replaceChild(el1, el2);\r\n tmp.parentNode.replaceChild(el2, tmp);\r\n}",
"function swapElements(elm1, elm2) {\n var parent1, next1,\n parent2, next2;\n\n parent1 = elm1.parentNod... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function to turn tab separated text into a 2D array. | function textToArray(text) {
// Trim newlines at the end.
while (text.endsWith('\n')) {
text = text.substring(0, text.length - 1);
}
var newArray = text.split('\n');
for (var i = 0; i < newArray.length; i++) {
newArray[i] = newArray[i].split('\t');
}
return newArray;
} | [
"function convertTextToTableArray(txt) {\n txt = txt.toString().replace(/ /g, '');\n\n let newArray = [[], [], []];\n let r3Count = 1;\n let bitCount = 0;\n\n for (let i = 0; i < txt.length; i += 3) {\n\n if (txt.substring(i + 2, i + 3) === 'l') {\n newArray.push([]);\n newArray.push([]);\n n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
We're using this method because of a weird bug where autobinding doesn't seem to work w/ straight this.forceUpdate | update() {
this.forceUpdate();
} | [
"forceUpdate() {\n if (this[_queuedUpdate]) {\n this[_dirty] = true;\n return;\n }\n\n this[_virtualRender]();\n this[_queuedUpdate] = true;\n\n TaskQueue.push(() => {\n if (this[_dirty] && !this.isDisposed) {\n this[_virtualRender](... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Determine whether the given properties match those of a `ResponseInspectionBodyContainsProperty` | function CfnWebACL_ResponseInspectionBodyContainsPropertyValidator(properties) {
if (!cdk.canInspect(properties)) {
return cdk.VALIDATION_SUCCESS;
}
const errors = new cdk.ValidationResults();
if (typeof properties !== 'object') {
errors.collect(new cdk.ValidationResult('Expected an obje... | [
"function CfnWebACL_ResponseInspectionPropertyValidator(properties) {\n if (!cdk.canInspect(properties)) {\n return cdk.VALIDATION_SUCCESS;\n }\n const errors = new cdk.ValidationResults();\n if (typeof properties !== 'object') {\n errors.collect(new cdk.ValidationResult('Expected an objec... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets network requests that have been made from local storage | function getRequestsFromStorage() {
if(sessionStorage.getItem('requests')) {
return JSON.parse(sessionStorage.getItem('requests'));
}
else {
return null;
}
} | [
"function getCachedUrls() {\n\tlet cache = localStorage.getItem(cachedUrlsLocalStorageKey);\n\t\n\treturn cache ? JSON.parse(cache) : { list: '' };\n}",
"async getRequests() {\n let user = await this.getUserByCert(true);\n\n return user.requests;\n }",
"function monitorNetworkRequest() {\n let ids = [... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
A ReliableHttpStream is a readable stream for a given HTTP resource that abstracts over transient failures of the underlying connection (including those resulting from unexpected upstream connection closes) by issuing subsequent requests for the same resource from where we left off. Arguments include: clientrestify HTT... | function ReliableHttpStream(args)
{
mod_assert.equal('object', typeof (args['client']),
'"client" arg must be a restify client');
mod_assert.equal('string', typeof (args['path']),
'"path" arg must be a string');
mod_assert.equal('object', typeof (args['log']),
'"log" arg must be a bunyan log');
mod_a... | [
"function ReadableStream(client) {\n if (this instanceof ReadableStream === false) {\n return new ReadableStream(client);\n }\n\n if (!ReadableStream) {\n throw new Error('Must configure an S3 client before attempting to create an S3 download stream.');\n }\n\n this._client = client;\n}",
"function Opc... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
element list parsing is currently very very primitive, and limited to polygonal faces one typically sees in PLY files. | function parse_element_list(element_header) {
if (element_header.name !== 'face' ||
element_header.properties.length !== 1 ||
element_header.properties[0].element_type !== 'int') {
throw new Error("element lists are only currently supported for 'face' element ... | [
"parseBindingElementList_(elements) {\n this.parseElisionOpt_(elements);\n elements.push(this.parseBindingElement_());\n while (this.eatIf_(COMMA)) {\n this.parseElisionOpt_(elements);\n elements.push(this.parseBindingElement_());\n }\n }",
"elements() {\n this.element();\n while(this... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Calls prompt() to get a player's choice Compares the player's response to the CHOICES array to determine if the choice is valid. Repeats the question until the player chooses a valid response Returns player's choice | function getPlayerChoice()
{
const CHOICES = ["rock", "paper", "scissors"];
let choice;
var isValid = false;
// Asks player to type a choice, and converts to lowercase for comparison
do {
choice = prompt("Rock, paper, or scissors?").toLowerCase();
// Cycles through CHOICES array to check for valid p... | [
"function playerChoice() {\n let playerOption;\n let isValid = false;\n // continue to prompt until valid response\n while(!isValid) {\n playerOption = prompt(\"Pick Rock or Paper or Scissors\", \"Rock\");\n //check for empty responses\n if(playerOption) {\n playerOption ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Method to add playlist to DB | static addPlaylist(playlist) {
return fetch('http://localhost:8888/insertplaylist/', {
method: 'PUT',
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json'
},
body: JSON.stringify(playlist)
})
} | [
"function createPlaylistInDb(){\n\tconst playlistName = document.querySelector('.title-input')\n\n\tfetch(playlistUrl, {\n\t\tmethod: 'POST',\n\t\theaders: {\n\t\t\t'Content-Type': 'application/json',\n\t\t\t'Accept': 'application/json'\n\t\t},\n\t\tbody: JSON.stringify({\n\t\t\ttitle: playlistName.value\n\t\t})\n\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Loads all of the router modules. | function loadRouters(app) {
var foundModuleNames = routerDir.map(function (el) {
return {
routePrefix: '/v1/' + el.split('.')[0],
route: './v1/' + el.split('.')[0] + '.js'
};
});
foundModuleNames.forEach(function (el) {
var router = require(el.route);
... | [
"loadModules () {\n\t\tthis.readModuleDirectory();\n\t\tthis.processModuleFiles();\n\t\tthis.collectDependencies();\n\t\tthis.resolveDependencies();\n\t\tthis.registerModules();\n\t}",
"async load () {\n // First, locate all the modules that we need to load.\n const collector = new BlueprintModuleCollector ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
set the active status of the buttons of modifyEntryPage | function setModifyEntryPageButtonStatus() {
$('#btnSaveEntry').removeClass('ui-btn-active');
$('#btnCancelEntryModification').removeClass('ui-btn-active');
$('#btnPreview').removeClass('ui-btn-active');
if (currentModifyEntry == 'title') {
$('#btnModifyEntryContent').removeClass('ui-btn-... | [
"function setCheckButtonToActive() {\n\t\t_myDispatcher.dispatch(\"iteration.checkbutton\", {\"state\":\"active\"});\t\n\t}",
"setBtnStatus() {\n if (this.hClueBtn)\n this.hClueBtn.setInactive(this.advance !== 'ADVANCE_RIGHT');\n if (this.vClueBtn)\n this.vClueBtn.setInactive(this.advance !== 'ADV... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Deletes the comment of the given ID in the given postElement. | function deleteComment(postElement, id) {
var comment = postElement.getElementsByClassName('comment-' + id)[0];
comment.parentElement.removeChild(comment);
} | [
"function deleteComment(postElement, id) {\n\tvar comment = postElement.getElementsByClassName('comment-' + id)[0];\n\tcomment.parentElement.removeChild(comment);\n}",
"function deleteBoat(postElement, id) {\n var comment = postElement.getElementsByClassName('comment-' + id)[0];\n comment.parentElement.remo... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This task wraps lua_compressed.js into a UMD module. | function packageLua() {
return packageGenerator('lua_compressed.js', 'lua.js', 'Blockly.Lua');
} | [
"function transformUMDModule(node){var _a=collectAsynchronousDependencies(node,/*includeNonAmdDependencies*/false),aliasedModuleNames=_a.aliasedModuleNames,unaliasedModuleNames=_a.unaliasedModuleNames,importAliasNames=_a.importAliasNames;var moduleName=ts.tryGetModuleNameFromFile(node,host,compilerOptions);var umdH... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Composite account type to expose account piece types with individual implementations (ex: imap, smtp) together as a single account. This is intended to be a very thin layer that shields consuming code from the fact that IMAP and SMTP are not actually bundled tightly together. | function CompositeAccount(universe, accountDef, folderInfo, dbConn,
receiveProtoConn,
_LOG) {
this.universe = universe;
this.id = accountDef.id;
this.accountDef = accountDef;
// Currently we don't persist the disabled state of an account because it's
// eas... | [
"function CompositeAccount(universe, accountDef, folderInfo, dbConn,\n receiveProtoConn,\n _LOG) {\n this.universe = universe;\n this.id = accountDef.id;\n this.accountDef = accountDef;\n\n // Currently we don't persist the disabled state of an account because i... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
=================================================================== from functions/interpreted/optimise/stack/Stack_D_A_A_d.java =================================================================== Needed early: StackFunctionSupport PORT NOTE: We've changed all original uses of the constructor (which were only reflectio... | function Stack_D_A_A_d() {
} | [
"function Stack() {}",
"function Stack_D_A_A_A_A_d() {\r\n}",
"function Stack_A_A_A() {\r\n}",
"function Stack_A_A() {\r\n}",
"function Stack_A() {\r\n}",
"function Stack_A_A_R() {\r\n}",
"function Stack_A_R() {\r\n}",
"constructor(stackSize) {\n this.numberOfStacks = 3;\n this.stackCapacity = s... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
End FnGetProtocolList /End FnGetProtocolVersionList | function FnGetProtocolVersionList(VarFlag) {
var VarMake = $('#deviceMake').val();
var VarDeviceType = $('#deviceType').val();
var VarDeviceModel = $('#deviceModel').val();
var VarProtocol = $('#deviceProtocol').val();
if(VarFlag == 1){
GblEditVersion = '';
$('#deviceProtocolVersion').html('<opti... | [
"function fetchProtocolList() {\n const transport = lookup('service:transport');\n return transport.send('/logcollection', {\n message: 'ls'\n });\n}",
"getProtocolVersion() {\n debug('GetProtocolVersion');\n\n return this.writeCommand(new Uint8Array([\n 0x00, // \"Version Command\"... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function to calculate reduced carbon | function calculateReducedCarbon(overLayEvent) {
if (overLayEvent.name === 'Forest Reduction'){
console.log('Do something to show forest reduction to carbon');
const GIS_ACRES = forestNew[0].properties.GIS_ACRES;
console.log('GIS_ACRES :',GIS_ACRES);
// calculate reduction
// convert ac... | [
"function calcActRev(actArray){\n if(actArray.length > 0){\n actArray.forEach(function (x) {\n //Count activity only if conservee\n if(x.conservee && x.conservee == \"true\"){\n d.activitiestot ++;\n }\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
get working video path | function get_working_video_path(){
if (working_video_path !== undefined) {
return working_video_path;
} else {
return update_working_video_path("./media/working-video/video.mp4");
}
} | [
"function getVideoPath()\n {\n var codecs = [\n { type: 'video/mp4; codecs=\"avc1.4D401E, mp4a.40.2\"', path: 'pathMP4' },\n { type: 'video/webm; codecs=\"vp8.0, vorbis\"', path: 'pathWEBM' },\n { type: 'video/ogg; codecs=\"theora, vorbis\"', path: 'pathOGG' }\n ];\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Render the view. Returns: RB.FileAttachmentRevisionSelectorView: This object, for chaining. | render() {
const numRevisions = this.model.get('numRevisions');
const labels = [gettext('No Diff')];
for (let i = 1; i <= numRevisions; i++) {
labels.push(i.toString());
}
RB.RevisionSelectorView.prototype.render.call(
this, labels, true /* whether the f... | [
"render() {\n RB.ReviewablePageView.prototype.render.call(this);\n\n this._$controls = $('#view_controls');\n\n if (!this.model.commits.isEmpty()) {\n const commitListModel = new RB.DiffCommitList({\n commits: this.model.commits,\n historyDiff: this.mode... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This function determines when to show calendar button and when to not it also resets sor value to blank when flight info or product is changed | function enableDisableCalendar(){
var productId = $("#sosProductId", "#lineItemTargeting").val();
var salesTargetId = $('#sosSalesTargetId', '#lineItemTargeting').val();
var start = jQuery('#startDate', '#lineItemTargeting').val();
var end = jQuery('#endDate', '#lineItemTargeting').val();
if(productId != "" ... | [
"function showCalendar(event) {\n if (event.target.value === \"Custom\") {\n setShowCustomDate(true);\n } else setShowCustomDate(false);\n }",
"function tripTypeChange(tripType) {\r\n\tif (tripType.value === 'round') {\r\n\t\t$(\"#return-date\").datepicker( \"option\", \"disabled\", false );\r\n\t} el... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Helper function for sorting nulls to top | function nullsToTop(obj) {
var value = obj[vm.sortPredicate];
return (value == null ? -1 : 0);
} | [
"function nullsToTop(obj) {\n var value = null;\n var index = vm.sortPredicate.indexOf('.');\n if (index >= 0) {\n var predicate = vm.sortPredicate.substr(index + 1);\n var aircraft = obj['aircraft'];\n value = aircraft = aircraft[predica... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Add HTML tags to mark up the result of FizzBuzz. say: text to display for this step vmode: 0 basic html, single colum of steps | function addHtmlStep(say, vmode) {
var tag; //will be appended to document
// vmode controls how simple the HTML output
switch (vmode) {
case 0: // simple html for each step
var txt = document.createTextNode(say);
tag = document.createElement("h3");
if(say.length > 5)... | [
"function outputFizzbuzzHtml(num){\n //$('.js-results').html(generateDiv(fizzBuzzUpTo()));\n $('.js-results').html(generateDiv(num));\n}",
"function fizzBuzz() {\r\n\r\n let output = \"\";//initialize empty string\r\n for (let i = 1; i <= 100; i++){\r\n //get multiples of 3's\r\n if (i %... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
this is the method that changes dashes to an X or O depending on who the current player is, and then changes the current player so the next player can take a turn we pass it down as props to each row, and then from each row to each box, so boxes can trigger an update of Board's state | toggle(row, column) {
// we only want to change a box's value if its value is '-' and if no one has won yet
if (this.state[row][column] === '-' && this.state.winningPlayer === '') {
// when an update to state depends on the previous state, it's best practice to use a callback and return the new s... | [
"function playerMove(event){\r\n const box = event.target; // Get the specific box that triggered click event\r\n let currentPlayer; // Tells us who's turn is this, Holds the X or O character based on that\r\n \r\n if(circleTurn){//Determine who's turn is this and assign corresponding sign the to the va... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
DOCTYPE system identifier (singlequoted) state | [DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED_STATE](cp) {
if (cp === $$5.APOSTROPHE) {
this.state = AFTER_DOCTYPE_SYSTEM_IDENTIFIER_STATE;
} else if (cp === $$5.NULL) {
this._err(ERR$1.unexpectedNullCharacter);
this.currentToken.systemId += unicode$1.REPLACEMENT_CHARACTER... | [
"[DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED_STATE](cp) {\n if (cp === $$5.APOSTROPHE) {\n this.state = AFTER_DOCTYPE_SYSTEM_IDENTIFIER_STATE;\n } else if (cp === $$5.NULL) {\n this._err(ERR$1.unexpectedNullCharacter);\n this.currentToken.systemId += unicode$1.R... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
change a user's favorite resort based on star press | function resortFav(icon, id, username, activity, userId) {
if (icon.textContent === "star") {
const userObj = {
username: username,
fav_activity: activity,
fav_resort: null
}
$.ajax({
method: "PUT",
url: `/user/${userId}`,
... | [
"function changeStarType(story){\n if (currentUser.isFavorite(story)){\n return \"fas\";\n }else {\n return \"far\";\n }\n}",
"async toggleFavorite(){\n\t\t//return if we haven't recieved a result from the last attempt to favorite\n\t\tif(this.waitingForFavorite)return;\n\t\tthis.waitingForFavorite = tru... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Copy a traversal so as to reset and reuse it. | clone() {
return new GraphTraversal(this.graph, this.traversalStrategies, this.getBytecode());
} | [
"clone() {\n var clone = new TraversalState(this.root);\n clone._currentNode = this._currentNode;\n clone._containers = this._containers.clone();\n clone._indexes = this._indexes.clone();\n clone._ancestors = this._ancestors.clone();\n return clone;\n }",
"function clone (...args) {\n\treturn c... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Linearly interpolate the position where an isosurface cuts an edge between two vertices, each with their own scalar value / double isoLevel; XYZ p1,p2; double valp1,valp2; double mu; XYZ p; | function vertexInterp(isoLevel,p1,p2,valp1,valp2)
{
let mu = 0.0
let p = new THREE.Vector3()
if (Math.abs(isoLevel-valp1) < 0.00001) return(p1);
if (Math.abs(isoLevel-valp2) < 0.00001) return(p2);
if (Math.abs(valp1-valp2) < 0.00001) return(p1);
mu = (isoLevel - valp1) / (valp2 - valp1);
... | [
"vertexInterpolation(isolevel, A, B) {\n if (Math.abs(isolevel-A.isovalue) < 0.00001)\n return {pos: A.pos, normal: A.normal};\n if (Math.abs(isolevel-B.isovalue) < 0.00001)\n return {pos: B.pos, normal: B.normal};\n if (Math.abs(A.isovalue-B.isovalue) < 0.00001)\n return {pos: A.pos, normal... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
check if any of the orders for a particular stocks is hit or not | function checkForStock(stock, price){
var orders = this.orders[stock] || {};
for(var order_id in orders){
var {order, trader} = orders[order_id];
status = this.checkStatus(order, price);
if(status == this.status.TARGET_TRIGGERED){
var {variety, parent_order_id} = order;
... | [
"function checkActiveOrders(orders) {\n // TODO if cllosed - close\n if (!tradingIsClosed) {\n orders = JSON.parse(orders);\n let isNoOrders = _.isEmpty(orders);\n \n let sellOrders = _.filter(orders[CURRENCY_PAIR], { type: 'sell' });\n let buyOrders = _.filter(orders[CURRENCY_PAIR], { type: 'buy' })... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Updates the navigation routes with hrefs relative to the current location. Note: This method will likely move to a plugin in a future release. | refreshNavigation() {
let nav = this.navigation;
for (let i = 0, length = nav.length; i < length; i++) {
let current = nav[i];
if (!current.config.href) {
current.href = _createRootedPath(current.relativeHref, this.baseUrl, this.history._hasPushState);
... | [
"refreshNavigation() {\n const history = this.history;\n for (const nav of this.navigation) {\n const config = nav.config;\n if (!config.href) {\n nav.href = util_1._createRootedPath(nav.relativeHref, this... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Loop over the cluster tiles and execute a function | function loopClusters(func) {
for (var i=0; i<clusters.length; i++) {
// { column, row, length, horizontal }
var cluster = clusters[i];
var coffset = 0;
var roffset = 0;
for (var j=0; j<cluster.length; j++) {
func(i, cluster.co... | [
"forEachTile(func) {\n for (let t in this.tiles) {\n func(this.tiles[t]);\n }\n }",
"function loopClusters(func) {\n for (var i = 0; i < clusters.length; i++) {\n // { column, row, length, horizontal }\n var cluster = clusters[i];\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Makes guard instance for the defined driver inside the mapping config. | makeGuardInstance(mapping, mappingConfig, provider, ctx) {
if (!mappingConfig || !mappingConfig.driver) {
throw new utils_1.Exception('Invalid auth config, missing "driver" property');
}
switch (mappingConfig.driver) {
case 'session':
return this.makeSessi... | [
"makeDriver(mappingName, driver, config) {\n const driverCreatorName = this.getDriverCreatorName(driver);\n /**\n * Raise error when the parent class doesn't implement the function\n */\n if (typeof this[driverCreatorName] !== 'function') {\n throw new Error(`\"${driv... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
function that reconstructs the File | async function reconstructFile(file_path, malicious_transactions){
file={}
log = await getFileLog(file_path);
for(const log_row of log){
if(malicious_transactions.includes(log_row.transaction_id)){
await deleteFileLogRow(log_row.id)
}
else{
if(log_row.t... | [
"coerceFile (file) {\n file.contents = Buffer.from(file.text)\n delete file.text\n file.modifiedDate = new Date(file.updated)\n delete file.updated\n file.slug = slugify(file.name)\n file.path = join(this.destPath, file.slug)\n Object.assign(file, file.properties)\n delete file.properties\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |