query stringlengths 9 34k | document stringlengths 8 5.39M | negatives listlengths 19 20 | metadata dict |
|---|---|---|---|
Check if date is in future if so return false else true | function isfutureDate(value) {
var now = new Date();
var target = new Date(value);
if (target.getFullYear() > now.getFullYear()) {
return true;
}
else if (target.getFullYear() == now.getFullYear()) {
if (target.getMonth() > now.getMonth()) {
return true;
}
else if (target.getMonth() == now.getMonth()... | [
"function futureDate(date) {\r\n return ( new Date(date) > new Date() ) ? true : false ;\r\n}",
"dateInTheFuture(date) {\n return moment().diff(moment(date + ' Z'), 'minutes') < 0;\n }",
"function checkIfFutureDate(xxx) {\n let curdate = new Date();\n curdate.setDate(curdate.getDate() + 2... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
x and y are arrays of 4 bit integers z stores the resulting product array and is returned | function multiplyIntArrays(x, y) {
var xstart = x.length - 1;
var ystart = y.length - 1;
var z = new Array(x.length + y.length);
var carry = 0;
for(var j = ystart, k = ystart + 1 + xstart; j >= 0; j--, k--) {
var product = (y[j] * x[xstart]) + carry;
z[k] = nbits(4, product);
... | [
"function _uMult(x, y, z) {\n _resize(z, x.n + y.n);\n z.a.fill(0, 0, z.n);\n let carry = 0;\n let k = 0;\n for (let i = 0; i < y.n; i++){\n k = i;\n carry = 0;\n let b = y.a[i];\n if (b) {\n for (let j = 0; j < x.n; j++) {\n let t = x.a[j] * b + z.a[k] + carry;\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Logbook is the app display component. The left side is the sighting information entry form and the right side is the list of the the aircraft sightings. Hover over the image and the image expands (CSS). If user is not signed in, a Not Authorized page is displayed | function Logbook({ user }) {
const [sightings, setSightings] = useState([]);
if (!user) {
return (
<div className="text-center shadow container w-25">
<h2 className="text-warning">Not Authorized</h2>
<p>Please Login / Register before accessing this page</p>
</div>
);
} // addS... | [
"renderSummaryDetails() {\n\t\tlet imageSection = null;\n\t\tif (this.state.currentSidewalk.lastImage) {\n\t\t\timageSection = (\n\t\t\t\t<div className=\"drawerImageSection\">\n\t\t\t\t\t<img className=\"img-responsive\" alt=\"sidewalk-preview\" src={this.state.currentSidewalk.lastImage.url} />\n\t\t\t\t</div>\n\t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Combine all Fonts into single Array, write select list | function generateFontList() {
var fontList = [];
for (var val in fonts) {
// console.log(fonts[val]);
for (var fam in fonts[val]) {
fontList = fontList.concat(fonts[val][fam]);
}
}
// console.log(fontList);
var select = "";
for (val in fontList) {
sele... | [
"function updateFontOptions() {\n labelFontSelect.innerHTML = \"\";\n for (let i=0; i < fonts.length; i++) {\n const opt = document.createElement('option');\n opt.value = i;\n const font = fonts[i].split(':')[0].replace(/\\+/g, \" \");\n opt.style.fontFamily = opt.innerHTML = font;\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Count how many undo operations we will perform. | function count_undos(i,inputs) {
if(i < inputs.length && inputs[i] == "undo") {
return 1 + count_undos(i+1,inputs);
}
return 0;
} | [
"undoCount() {\n return this.store.get(ID).past.length;\n }",
"redoCount() {\n return this.store.get(ID).future.length;\n }",
"getUndoSize() {\n return this.mostRecentTransaction + 1;\n }",
"function getOpsCount( deltas ) {\n\treturn deltas.reduce( ( current, delta ) => {\n\t\tre... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
sm: global var set in WriteBookmarkMenu() used in BookmarkMenu() | function WriteBookmarkMenu() { console.log("sellwood_px: WriteBookmarkMenu called; this function is not defined in px."); } | [
"function setBookMark(bm) {\r\n\tif (DEBUG) alert(\"entering setBookMark() with bm = \" + bm.toString());\r\n\tbookmark = bm.toString();\r\n}",
"function setBookmark(){\n\tclearBookmarks();\n\taddBookmark();\n}",
"function saveCurrentMenuText() {\r\n menuContens[curMenu] = getBodyHtmlString();\r\n}",
"func... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
DESCRIPTION: Removes the tab with the given id from the tabs container specified. PARAMS: tabs The tabs container to remove that tab from. id The id of the tab to be removed (NO ) RETURNS: None | function removeTab(tabs, id)
{
var panelId = $("a[href='#" + id + "']").closest( "li" ).remove().attr( "aria-controls" );
$("#"+ id).remove();
tabs.tabs("refresh");
} | [
"function deleteTab(id) {\n // Remove the tab\n var index = w2ui[\"editortabs\"].get(id, true);\n w2ui[\"editortabs\"].remove(id);\n // Select a new tab\n var editors = getEditors();\n var cnt = editors.length;\n if (cnt > 0) {\n var newindex = (index < cnt) ? index : cnt - 1;\n v... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Promisepool for indeterminatelength tasks | function makePromisePool(limit) {
let running = 0
const pending = new Set()
return promiseMakerFn => {
const [promise, O, X] = makePromise()
promise.finally(() => ((running -= 1), next()))
pending.add({ promiseMakerFn, O, X })
next()
return promise
}
function next() {
Array.from(pend... | [
"function pool(promiseFactories, limit) {\n return new Promise(function (resolve, reject) {\n var running = 0;\n var current = 0;\n var done = 0;\n var len = promiseFactories.length;\n var err;\n\n function runNext() {\n running++;\n promiseFactories[current++]().then(onSuccess, onError... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Scroll to the middle of the block or to the top of the block if block is more than window size | function scrollToBlock(block) {
animationStop();
let offsetFromTop = ($(window).height() - block.outerHeight(true)) / 2;
if (offsetFromTop < 0) {
offsetFromTop = 0;
}
page.animate({scrollTop: block.offset().top - offsetFromTop}, scrollSpeed);
} | [
"function scrollToBlock() {\n\t$('.js-scrollToBlock').on('click', function (e) {\n\t\te.preventDefault();\n\t\t// console.log($(this).attr('href'))\n\t\tvar blockOffset = $($(this).attr('href')).offset().top;\n\t\t\n\t\t$('html, body').animate({\n\t\t\tscrollTop: blockOffset - 96\n\t\t}, 2000);\n\t})\n\t\n}",
"fu... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Show Settings Window (Application) THIS IS IMPLEMENTED IN COREWM | showSettings() {
// Implement in your WM
} | [
"function showSettings() {\n settingswin = new BrowserWindow({\n parent: win,\n width: 400,\n height: 600,\n resizable: false,\n icon: path.join(app.getAppPath(), 'umsg.ico'),\n title: 'UniversalMessenger ' + app.getVersion() + ' Settings',\n webPreferences: {\n preload: path.join(app.get... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return observer object from global observerList array / Requires: / elem: element being observed / Returns: / Object with the following properties: / elem: Observed element / obs: MutationObserver applied to elem / listIndex: Observer object position in global observerList array | function getObserver(elem) {
// Define observer var
let observer;
/* Locate a record index within the global observerList array based on */
/* the element */
let observerIndex = observerList.findIndex((obj) => obj.elem === elem);
// If a valid index is returned...
if (observerIndex > -1) {... | [
"function ObserverList() {\n /* list is an array of observers */\n this.list = [];\n /* add(obs) registers an observer to the array of observers */\n this.add = function (obj) {\n return this.list.push(obj);\n };\n /* count(obs) returns the number of observers re... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Write a function that accepts a positive number N. The function should console log a step shape with N levels using the character. Make sure the step has spaces on the right hand side! Examples steps(1) '' steps(2) ' ' '' steps(3) ' ' ' ' '' steps(4) ' ' ' ' ' ' '' | function steps(n) {
if (!n) {
return;
}
let count = 0;
let stepsCount = 1;
while (count < n) {
const spaces = ` `.repeat(n - stepsCount);
const steps = `#`.repeat(stepsCount);
stepsCount++;
count++;
console.log(`${steps}${spaces}`);
}
} | [
"function steps(n) {\n (n <= 0 ? alert(\"Only positive numbers allowed!\") : null)\n let step = '#';\n let space = ' ';\n\n for(let i = 1; i <= n; i++){\n let numOfSpaces = n - i;\n if(numOfSpaces < n) {\n console.log(step.repeat(i) + space.repeat(numOfSpaces));\n } else {\n console.log(step.... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Methods // / Receives a message and performs an action from the message type. For case 'enterPiP': creates a new window and fills it with the content of the video player. If the window is out of focus (i.e., blurred), the onblur method of the window is called, refocusing it. For case 'default': Throws an error. | function receivedMessage(message, sender, sendResponse) {
switch (message.type) {
case 'enterPiP':
var myWindow = window.open("", "", "width=200,height=100,titlebar=no,toolbar=no,statusbar=no,menubar=no");
myWindow.document.write(iframe[0].outerHTML);
myWindow.document.bo... | [
"function handleMessage(message_event) {\n document.getElementById('pi').value = message_event.data;\n}",
"function popupMessageReceived(msg) {}",
"function sendMessageToActiveWindow(message) {\n swfobject.getObjectById('lightIRC').sendMessageToActiveWindow(message);\n}",
"_startDialogue () {\n this.app.... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Remove all text and comment nodes | function removeText(node) {
[].slice.call(node.childNodes).forEach(function(child) {
if (child.nodeType === child.TEXT_NODE) {
node.removeChild(child);
} else if (child.nodeType === child.ELEMENT_NODE) {
removeText(child);
} else if (child.nodeType === child.COMMENT_NODE && !child.textCon... | [
"clean() {\n let node, nodes = [], walker = document.createTreeWalker(document, NodeFilter.SHOW_TEXT | NodeFilter.SHOW_COMMENT, null, false);\n while( node = walker.nextNode() ) {\n switch ( node.nodeType ) {\n case Node.TEXT_NODE:\n if ( !node.nodeValue.ma... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Ecma International makes this code available under the terms and conditions set forth on (the "Use Terms"). Any redistribution of this code must retain the above copyright and this notice and otherwise comply with the Use Terms. / es5id: 15.7.41 description: "Number prototype object: its [[Class]] must be 'Object'" inc... | function testcase() {
var numProto = Object.getPrototypeOf(new Number(42));
var s = Object.prototype.toString.call(numProto );
return (s === '[object Object]') ;
} | [
"function testcase(){\n Object.defineProperty(Object.prototype, \"x\", { get: function () { \"use strict\"; return this; } }); \n if(!(typeof (5).x === \"number\")) return false;\n return true;\n}",
"function testToStringObjectRadix_0() {\n function a() {\n this.value = \"2\";\n }\n a.prototype = new Obj... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Test the string encoding functionality | function testStringEncodings(){
var StringUtils = LanguageModule.StringUtils;
var stringUtils = new StringUtils();
var encodings = stringUtils.stringEncodings;
expect(_.isObject(encodings)).to.eql(true);
expect(_.has(encodings, "ASCII")).to.eql(true);
expect(_.has(encodings, "UTF8_BINARY")).to.eql(true);
... | [
"function utf8() {\n function verify(name, src, chars, str) {\n console.log();\n console.log(`${name} UTF8 test`);\n console.log(`${name} source: ${displayArray(src)}`);\n console.log(`${name} chars: ${displayArray(chars)}`);\n console.log(`${name} string: ${str}`);\n\n /* test dec... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Retrieve the those raw params from option, which will be cached separately. becasue they will be overwritten by normalized/calculated values in the main process. | function retrieveRawOption(option) {
var ret = {};
each(['start', 'end', 'startValue', 'endValue', 'throttle'], function (name) {
option.hasOwnProperty(name) && (ret[name] = option[name]);
});
return ret;
} | [
"function retrieveRawOption(option) {\n var ret = {};\n each$o(['start', 'end', 'startValue', 'endValue', 'throttle'], function (name) {\n option.hasOwnProperty(name) && (ret[name] = option[name]);\n });\n return ret;\n }",
"function retrieveRawOption(option) {\n var ret = {};\n ea... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Add REST API actions for the specified resource | function addResource(config){
var expressApp = config.expressApp,
dataModel = config.dataModel,
resourceName = config.resourceName,
resourceConfig = config.resourceConfig;
for(var action in resourceConfig.actions){
addResourceAction({
action: ... | [
"function addResourceAction(config){\r\n var action = config.action,\r\n verb = action.verb,\r\n apiConfig = config.apiConfig,\r\n expressApp = config.expressApp,\r\n resourceFacade = config.resourceFacade;\r\n \r\n //console.log('action: ' + JSON.stringify(action));\r\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
to use the sortByItem function each object in the array must contain a property called sort by that has a number value. | function sortByItem(array){
array = array.sort(function(a, b) {
if ((a.sortBy) > (b.sortBy)) {
return -1;
}
if ((a.sortBy) < (b.sortBy)) {
return 1;
}
// a must be equal to b
return 0;
});
} | [
"function sortItems(arr) {\r\n return arr.sort();\r\n}",
"function sortByProperty({\n array,\n propertyForSort,\n descending = false,\n withParse = true,\n}) {\n array.sort((item1, item2) => {\n let value1;\n let value2;\n if (withParse) {\n value1 = parseFloat(item1[propertyForSort]);\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Create a muti dimension List structure from seriesModel. | function createList(seriesModel) {
return createListFromArray(seriesModel.getSource(), seriesModel);
} // export function createGraph(seriesModel) { | [
"function _createList(seriesModel) {\n return (0, _chart_helper_createSeriesData__WEBPACK_IMPORTED_MODULE_0__[\"default\"])(null, seriesModel);\n } // export function createGraph(seriesModel) {",
"function createListModel(config) {\n var model = Object.create(ListModel);\n var idx;\n var item... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Creates a new site script. | createSiteScript(title, description, content) {
return __awaiter(this, void 0, void 0, function* () {
return yield this.clone(SiteScripts$1, `CreateSiteScript(Title=@title,Description=@desc)?@title='${encodeURIComponent(title)}'&@desc='${encodeURIComponent(description)}'`)
.execut... | [
"@action addNewScript(){\n this.titlePage = {title: 'NEW SCRIPT', author: 'AUTHOR', extra: 'EXTRA: this and that', contact: 'contact info:'};\n // First line is always FADE IN:\n this.paragraphs = [{type: 'para-fadein', focus: true, innerHTML: 'FADE IN:', text: 'FADE IN:', selectionStart: {line:0,offset:8}... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Call Echo Nest API for next recommended song. | function getRecommendedSong(){
if (session_id !== undefined){
$.getJSON(next_song_request + "&_=" + Math.floor(Math.random()*1000000), function(data) {
if (data.response.status.message === "Success"){
var lastRecommendedSong = data.response.songs[0];
console.log(session_id);
console.log(data);
con... | [
"function nextSong() {\n message = {\n intended: \"API\",\n action: \"nextSong\"\n }\n SendMessage(message);\n fetchMusicDetails();\n}",
"function nextSong() {\n songIndex++;\n // check songIndex number\n if (songIndex > songs.length - 1) {\n songIndex = 0;\n }\n loadSong(songs[s... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This function initializes the BD18.marketTokens array. It calls the MarketToken constructor for each token in BD18.gm.mktTks array and adds the new object to the BD18.marketTokens array. | function makeMktTokenList(){
BD18.marketTokens = [];
if (BD18.gm.mktTks.length === 0) return;
var token,sn,ix,flip,stack,bx,by;
for(var i=0;i<BD18.gm.mktTks.length;i++) {
sn = BD18.gm.mktTks[i].sheetNumber;
ix = BD18.gm.mktTks[i].tokenNumber;
flip = BD18.gm.mktTks[i].flip;
// stack = BD18.gm.mktTks... | [
"function updateMarketTokens() {\n BD18.marketTokens.sort(tokenSort);\n BD18.gm.mktTks = [];\n for (var i = 0; i < BD18.marketTokens.length; i++) {\n if (BD18.marketTokens[i]) {\n BD18.gm.mktTks.push(BD18.marketTokens[i].togm());\n }\n }\n}",
"function initializeArbMarkets() {\n\tconst arbCoins = g... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
compares errors with standard deviation array to find joint angles above threshold returns string containing results | function generate_results(errors, wrong_dir_indices, sd){
var results_str = "";
var numErrors = 0;
// list of combined velocity errors for each joint - first number
// is combined abs vel errors, second is combined signed vel errors
var velErrors = [];
for (var l = 0; l < errors[0].length; l++) {velErrors.... | [
"function error(){\n var i,m,i2,n0,n1,n2; \n var r,s,t,efig,d01,d12,d02; \n efig=0.0;\n for(i=0; i<N_in-2; i++){\n i2 = i+N;\n n0 = adj[i][0]; n1 = adj[i][1]; n2 = adj[i][2];\n d12 = d01 = d02 = 0.0;\n for(m=0; m<D; m++){\n t = points[i2][m];\n r = points[n0][m]-t; s = points[n1][m]-t; t =... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Synchronous Mustache rendering for Express. This method will attempt to autoload from the file system any partials not explicitly passed via the `options` parameter. Options extend `app.locals` when called from `app.render(name,options)` Options extend `response.locals` and `app.locals` when called from `response.rende... | function render(path, options) {
var view = this, // The Express View object to which this method is bound
settings = options.settings || {},
hoganOptions = extend(settings.Hogan || {}, options.Hogan || {}),
template, partials, layout = options.layout || settings.layout;
if (view.templ... | [
"function handleCache$1(options) {\n const filename = options.filename;\n if (options.cache) {\n const func = options.templates.get(filename);\n if (func) {\n return func;\n }\n return loadFile(filename, options);\n }\n // Caching is disabled, so pass noCache = true\n retur... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
fired when a direction is clicked changes the current direction to the clicked direction | function clickedDirection(event) {
var newIndex;
//determines the index of the clicked element in the list of directions
var items = $("#sidebar-directions li");
for (var j = 0; j < items.length; j++) {
if (elementHasElement(items[j], event.target) || items[j] == event.target) {
newIndex = j - 1;
}
}
//se... | [
"function switchDirection() {\n direction *= -1;\n}",
"function updateDirection() {\n currentCell\n .toggleFlag(DIRECTIONS.join(' '), false)\n .toggleFlag(direction, true);\n }",
"function switchDirection(){\n\t\tvar thisAnimatedWalker = $(this.parentNode.parentNode).data('walker');\n\t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Clears value of Edit Modal's form. | function resetEditModal() {
$('#userIdEdit').val('');
$('#firstNameEdit').val('');
$('#lastNameEdit').val('');
$('#ageEdit').val('');
} | [
"function clearInputEditModal(){\n clearInputValue([\"editInvoiceAmount\",\"editNotes\"])\n}",
"function clearModalDialogue() {\n inputPatientUR.val('');\n taskDescription.val('');\n $('#backgroundDescription').val('');\n contactNameInput.val('');\n contactN... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
generate the secret number and print it in the console | function secret() {
console.log(randomNumber);
} | [
"function generateNumber(){\n secret = Math.floor(Math.random()*100)+1;\n console.log(secret);\n}",
"function loggingSecretNumber(secretNumber) {\n console.log(`Current generated secret number is : ${secretNumber}`);\n}",
"function secretNumber() {\n secretNum = Math.floor(Math.random() * 100) + 1;\n }",... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Animates the movement of the opening and closing of the tray | function moveTray () {
//log ("moveTray ()");
// Calculate the position of the current movement
var movementRatio = (Math.cos (Math.PI * (moveTrayTrigger + movementCounter / movementDuration)) + 1) / 2;
// Calculate the width of the visible part of the tray
// --- Sliding horizontally ---
if (sliding == "hori... | [
"function startMoveTray () {\n\t\n\t// If the movement is running, return\n\tif (movementTimer.ticking == true) return;\n\t\n\t//log (\"startMoveTray ()\");\n\tsaveWindowPosition();\n\t\n\t// If the large images are used and the tray will be opened\n\tif (scaleModName == \"\" && trayState == \"closed\") {\n\t\t\n\t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Switch hosts to custom | function usehosts(name) {
var osh = oshosts();
var from = ip2file(name);
fs.writeFileSync(osh, fs.readFileSync(from, {encoding: 'utf8'}));
fs.renameSync(from, ip2mark(name));
} | [
"function setHost(newHost) {\n host = newHost;\n $(\".host\").html(host);\n}",
"function switch_host(host, newtab) {\n\tchrome.tabs.getSelected(null,function(tab) { \n\n\t\tvar url = tab.url;\n\t\tvar rel_url = parseUri(url).relative;\n\t\tvar new_url = host + rel_url;\n\n\t\tif (newtab == \"true\") {\n\t\t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
FILE INFO filename, scan number, precursor m/z and charge | function showFileInfo (container) {
var options = container.data("options");
var fileinfo = '';
if(options.fileName || options.scanNum) {
fileinfo += '<div style="margin-top:5px;" class="font_small">';
if(options.fileName) {
fileinfo += 'File: '+options.fileName;
}
if(options.scanNum) ... | [
"function processFileInfo() {\n var i = 0, field;\n\n while(i < 24) {\n field = metadata[i/2];\n field.length = buffer.readUInt16BE(i); i += 2;\n }\n}",
"function summarizeFileInTorrent (file) {\n return {\n name: file.name,\n length: file.length,\n numPiecesPresent: 0,\n numPieces: null\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Genere le feedback concernant chacune des images proposee lors de l'activite Utilise pour cela la variable globale feedbackList | function formatFeedback(){
let returnString="";
for (let i = 0; i < feedbackList.length; i++) {
let stringToAdd;
if (feedbackList[i].resultat == feedbackList[i].trueResultat) {
stringToAdd = "A la photo \"" + feedbackList[i].type + "\" vous avez correctement répondu \n";
returnString += stringToAdd;
}
... | [
"getFeedback() {\n\t\tconsole.log('Retrieving feedback');\n\t\tconst feedbackList = this.createMockFeedback();\n\t\tthis.props.initialList(feedbackList);\n\t\treturn feedbackList;\n\t}",
"function make_picture_description_trial(target_image,verb) {\n var target_image_flipped = random_image_flip(target_image)\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Determine if field is categorical or pseudocategorical | async function datasetFieldCategorical (fieldName) {
var {categoricalMax} = state;
const field = await getDatasetField(fieldName);
const stats = await getDatasetFieldUniqueValues(fieldName);
const categorical = stats.uniqueCount <= categoricalMax;
const pseudoCategoricalMin = .8; // the proportion o... | [
"get isCategory() {\n return this.i.cl;\n }",
"function categorise(data) {\n if (typeof(data) === \"string\" || data === null) return 0;\n if (typeof(data) === \"object\") {\n if (data.length === undefined) return 1;\n if (data.length === 1) return 2;\n return 3;\n };\n throw new Error(\"Un... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Performs an API request: Awaits an axios request, gets the axios response, and awaits the database commit. | async request(config) {
return await new Response(this.model, await this.axios.request(config), config).commit();
} | [
"async function performRequest(url) {\r\n return await axios\r\n .get(url)\r\n .then((res) => {\r\n return res.data;\r\n })\r\n .catch((error) => {\r\n console.log(error);\r\n });\r\n}",
"[GET_SAVED_REQUESTS]({ commit }) {\n axios.get('/qx/api/requests')\n .then(response => commi... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
[String] getPanelDocumentTitle() Returns the document title | function getPanelDocumentTitle()
{
return getElementTitle("title1");
} | [
"function getDocTitle() {\n return document.title;\n}",
"function dTitle(){return document.title;}",
"function getCurrentDocumentTitle() {\n return this.currentDocument.title.replace(/(\\\\|\\/)/g, '_');\n }",
"getTitle() {\n return this._doc.title;\n }",
"function GetDocumentTitle(docI... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
The VectorProtocol operates on port 9073 | function VectorProtocol(serverAddress, videoId, canvas){
this.canvas = canvas;
this.ctx = canvas.getContext("2d");
this.videoId = videoId;
this.serverAddress = serverAddress;
//types 0 = none, 1 = Video, 2 = Streaming
this.videoType = 0;
this.videoLength = 0;
this.handleData = function... | [
"function VectorManager () {\n this._vectorData = [];\n this._vectorCount = 0;\n }",
"function sc_u8vectorRef(v, pos) {\n\n\n return v[pos];\n}",
"function VectorManager () {\n this._vectorData = [];\n this._vectorCount = 0;\n }",
"function sc_s8vectorRef(v, pos) {\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Check why is this not working, meanwhile using require() to load the secrets file. | function readSecrets(){
let reqSecrets;
fs.readFile('topsecrets','utf8',(err,data)=>{
if(err) return console.log('Error loading the secrect file',err);
reqSecrets = JSON.parse(data);
console.log('secrets loaded', reqSecrets);
return reqSecrets;
})
} | [
"static LoadSecret(name){\n // Don't load if it's already set\n if(process.env[name])\n return;\n\n const secretEnv = name+\"_FILE\";\n if(process.env[secretEnv]){\n const value = fs.readFileSync(process.env[secretEnv]);\n process.env[name] = value.toStri... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Scans & searches given source with given regex(s) for excludes | function scanExcludes (source, regexs, grunt)
{
var regexType = "array";
var regexs_ = regexs;
if (Object.prototype.toString.call(regexs) === "[object Object]")
{
regexs = [0];
regexType = "object";
}
var contents = source;
for (var i = 0; i < regexs.length; i++)
{... | [
"function grepLines(src, ext, destFile){\n src = grunt.util.normalizelf(src);\n var lines = src.split(grunt.util.linefeed),\n dest = [],\n //pattern for all comments containing denotation\n denotationPattern = updatePattern({\n pattern: options.pattern, \n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
End saving approver status tracking info to set approverOrComplete status | function saveApproverStatusTrackerCompleted(selectRange){
if(selectRange == 0){
selectRange = 0;
}else{
selectRange = 1;
}
var approvalStatus = 1;
$.ajax({
url : '/ndcmp/api/saveApproverCompletedStatusTrackerDetails',
data :{
"subActivityId" : $('#subActivityIdReadonly').val(),
"userId" : $('#userIdR... | [
"function resetApprover(hwpCtrl, approvers, linecount, doctype, assistantlinetype, auditlinetype) {\r\n\ttry {\r\n\t\tclearApprover(hwpCtrl);\r\n\t\tif (typeof(doctype) == \"undefined\") {\r\n\t\t\tdoctype = \"\";\r\n\t\t}\r\n\t\t//setApprover(hwpCtrl, approvers, linecount, doctype, assistantlinetype, auditlinetype... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns the message string obtained by decrypting the payload with the given sk and pk and authenticating the attached tag | function decrypt (payload, curveSk, curvePk) {
payload = JSON.parse(payload)
const ciphertext = _ensureBuffer(payload[0], 'Tag ciphertext')
const nonce = _ensureBuffer(payload[1], 'Tag nonce')
const secretKey = _ensureBuffer(curveSk, 'Secret key')
const publicKey = _ensureBuffer(curvePk, 'Public key')
const... | [
"function crypto_box_seal(msg, pk) {\n var m = injectBytes(msg);\n var pka = check_injectBytes(\"crypto_box_seal\",\n \"pk\", pk, nacl_raw._crypto_box_publickeybytes());\n var c = new Target(msg.length + nacl_raw._crypto_box_sealbytes());\n check(\"_crypto_box_seal\", nacl... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Extend selection to next line. | extendToNextLine() {
if (isNullOrUndefined(this.start)) {
return;
}
this.end.moveToNextLine(this.upDownSelectionLength);
this.fireSelectionChanged(true);
} | [
"function expandSelectionToLine(cm, curStart, curEnd) {\n curStart.ch = 0;\n curEnd.ch = 0;\n curEnd.line++;\n }",
"function expandSelectionToLine(_cm, curStart, curEnd) {\n curStart.ch = 0;\n curEnd.ch = 0;\n curEnd.line++;\n }",
"extendToPreviousLine() {\n if (isNull... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns whether the current query is associated with any questions that have table context | function existsTableContextInCurrentQuery(){
var allSelectedQuestions = getAllSelectedQuestions();
for ( var i = 0; i < allSelectedQuestions.length; ++i ) {
if ( hasTableContext( allSelectedQuestions[ i ] ) ) return true;
}
return false;
} | [
"function hasTableContext( qId ) {\n\tif ( !qId ) return false;\n\t\n\t// if the question is not associated with any form data, then return false\n\tif ( !isFormTableQuestion( qId ) ) return false;\n\t\n\t// else, if the question is associated with both form data and non-form data,\n\t// return true if the appropri... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
find the ID of the minecraft server: | async function getMinecraftSubID () {
const server = await getMinecraftServer()
if (server) return server.SUBID
return null
} | [
"get serverIID() {\n return null;\n }",
"function getHostId(){\n\t\tsocket.emit('get host_id');\n\t}",
"get id() {\n let result = \"\";\n const session = this._session;\n if (session.local) {\n result += `local-${session.local.channel}_`;\n }\n if (session.remot... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
list.clear(); list.printValues(); console.log(list.getValue(2)); list2.printValues(); console.log(list2.getValue(2)); | function printValues(list) {
var str = '';
function rec() {
str = str + list.value + ', ';
if (list.next) {
list = list.next;
rec();
}
}
rec();
str = str.slice(0, (str.length - 2));
console.log(str);
return str;
} | [
"function collectList(){\n var listItems = [];\n for(var i=0; i<list.elements.length;i++){\n listItems.push(list.elements[i].value);\n }\n printList(listItems);\n clearList();\n}",
"function repopulateList() {\n instruments_list_obj.clear();\n populateList(instruments_list_obj);\n}",
"clearObserva... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Where 'id' is the submit for the form and dest is the div that spans the form | function submit( id, dest ) {
$(id).click( function() {
console.log( $(dest).serialize() );
$(dest).slideToggle();
return false;
})
} | [
"function editWorkout(id) {\n // create form to submit\n var form = '<form action=\"/saved\" method=\"post\" hidden> <input name=\"edit_type\" value=\"edit\" /><input name=\"id\" value=\"' + id + '\"/></form>';\n $(form).appendTo('body').submit();\n}",
"function showForm(ev)\n{\n document.distForm.sub... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This function will insert or update base on the value of button name. Set the url action of ajax Set message to be display | function insertOrUpdate() {
var action, message;
var getButtonName = $("#btnCargo").val();
if (getButtonName == "Register") {
action = "ajaxAddCargoUser";
message = "User has been added to the list successfully.";
} else {
action = "ajaxEditCargoUser";
message = "User has been updated successfully... | [
"function insertOrUpdateDeliveryType() {\r\n\tvar action, message;\r\n\tvar getButtonName = $(\"#btnDeliveryType\").val();\r\n\r\n\tif (getButtonName == \"Save\") {\r\n\t\taction = \"ajaxAddDeliveryRequest\";\r\n\t\tmessage = \"Delivery request has been added to the list successfully.\";\r\n\t} else {\r\n\t\taction... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
these following four functions change specific button values in firebase | function changeFB (value){
firebase.database().ref().set({
ledStatus : value
});
} | [
"async function Update(name = '', newName= '', newImage = '' ,toggle = '') {\n\n let con = firebase.database().ref(\"germs\");\n\n //if the toggle is in the default state\n if(toggle) {\n\n //uses a location that matches the string and returns a snapshot\n\n con.orderByChild(\"name\").startA... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
List of available spaces | get space_list() {
return this._list.getValue();
} | [
"function createAvailSpaces(){\n\t\tvar avail = [];\n\t\tvar id = 0;\n\t\tfor(var i = 0; i<ticGlob.boardSize; i++){\n\t\t\tfor(var j = 0; j<ticGlob.boardSize; j++){\n\t\t\t\tavail.push([i+1,j+1,id]);\n\t\t\t\tid++\n\t\t\t}\n\t\t}\n\t\treturn avail;\n\t}",
"function getAllOpenSpaces() {\n var spaces = [], t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns current ICU case. ICU cases are stored as index into the `TIcu.cases`. At times it is necessary to communicate that the ICU case just switched and that next ICU update should update all bindings regardless of the mask. In such a case the we store negative numbers for cases which have just been switched. This fu... | function getCurrentICUCaseIndex(tIcu, lView) {
var currentCase = lView[tIcu.currentCaseLViewIndex];
return currentCase === null ? currentCase : currentCase < 0 ? ~currentCase : currentCase;
} | [
"function getCurrentICUCaseIndex(tIcu, lView) {\n var currentCase = lView[tIcu.currentCaseLViewIndex];\n return currentCase === null ? currentCase : currentCase < 0 ? ~currentCase : currentCase;\n }",
"function getCurrentICUCaseIndex(tIcu, lView) {\n var currentCase = lView[tIcu.currentCaseLViewInde... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Comment Form Comment`s HTML | function commentHtml( comment ) {
return `<div class="media">
<img src=${ comment[ 'avatar' ] } class="mr-3" alt="..." width="64" height="64">
<div class="media-body">
<h5 class="mt-0">${ comment[ 'name' ] }</h5>
<span><small>${ comment[ 'date_ti... | [
"function renderCommentForm() {\n let commentForm = ''\n commentForm = `\n <input type=\"text\" class=\"mr-2 rounded-lg border px-3 py-2 focus:outline-none focus:ring-purple-500 focus:border-purple-500\" placeholder=\"Add a comment...\">\n <button class=\"tweet-comment-button py-2 px... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns the dot product of v1 and v2. | static dot(v1, v2)
{
return v1.dot(v2);
} | [
"function dot(v0, v1) {\n for (var i = 0, sum = 0; v0.length > i; ++i) sum += v0[i] * v1[i];\n return sum;\n}",
"function dot3( v1, v2 ) {\n\n var ret = 0;\n\n ret += v1[0]*v2[0];\n ret += v1[1]*v2[1];\n ret += v1[2]*v2[2];\n\n return ret;\n\n}",
"function dotProduct(vector1, vector2) { \n\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sets properties on a target object from a source object, but only if the property doesn't already exist on the target object. | function fillProperties(target, source) {
for (var key in source) {
if (source.hasOwnProperty(key) && !target.hasOwnProperty(key)) {
target[key] = source[key];
}
}
} | [
"function fillProperties(target, source) {\n for (var key in source) source.hasOwnProperty(key) && !target.hasOwnProperty(key) && (target[key] = source[key]);\n }",
"function fillProperties(target, source) {\n for (var key in source) {\n if (source.hasOwnProperty(key) && !target.... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
IMPLEMENT THIS should return a unique ID ID will be used to uniquely identify shapes | getNewId() {
return this.shapes.length;
} | [
"getId(shape) {\n for (var i = 0; i < shape.length; i++) {\n for (var j = 0; j < shape[i].length; j++) {\n if (shape[i][j] != 0) {\n return shape[i][j]\n }\n }\n }\n }",
"function uniqueShape(){\n ctx.beginPath();\n ctx.... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get the count for a word | getCount(word) {
return this.dict[word];
} | [
"getCount(word) {\n return this.dict[word];\n }",
"function wordOccurrences(word, text) {\n if (noInputtedWord(word, text)) {\n return 0;\n }\n const wordArray = text.split(\" \");\n let wordCount = 0;\n wordArray.forEach(function(element) {\n if (element.toLowerCase()===word.toLowerCase()) {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
setting background according to weather | function setBg(weatherObj){
if(weatherObj.main.humidity>=90 || weatherObj.weather[0].main=="Rain" ){
document.body.style.backgroundImage= "url('images/rainy.jpg')";
}
else if(weatherObj.main.temp<=10 || weatherObj.weather[0].main=="Snow"){
document.body.style.backgroundImage= "url('images/cold.jpg')";
}... | [
"function setBackground(weather){\n var background;\n var tempCelsius = getTemp(data.main.temp, false)\n var i = weatherConditions.indexOf(weather);\n if(i == 0){\n var j;\n if( tempCelsius <= 0){\n j = 0;\n }else if(tempCelsius > 0 && tempCelsius <=... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
call back function for home route displays the favorited books on the home page | function getFavorites(request, response) {
let sql = 'SELECT * FROM books;';
// return sql data
client.query(sql)
.then(sqlResults => {
// get book data and book count
let books = sqlResults.rows
let totalBooks = sqlResults.rowCount;
// render to home page
response.render('page... | [
"function renderFavorites() {\r\n removeBooksFromDOM();\r\n favorites.forEach(function (book) {\r\n insertNewBook(book.id, book.title, book.author, book.subject, book.photoURL, book.vendorURL, book.favorite);\r\n })\r\n}",
"function viewFavourites(){\n\tif(profile.favouritePrograms.length == 0){\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Define a markerSize function that will give each city a different radius based on its population | function markerSize(population) {
return population / 40;
} | [
"function markerSize(Population) {\n return Population / 30;\n}",
"function markerSize(population) {\n return population / 60;\n}",
"function markerSize(population) {\n return population / 40;\n}",
"function markerSize(size) {\r\n return size * 2.5;\r\n}",
"function markerSize(size) {\n return si... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
const [circles, setCircles] = useState([]); | constructor(){
super();
this.state={
circles: [],
p1: {x: 107, y: 163},
p2: {x: 215, y: 389},
a1 :10
}
} | [
"render()\n {\n var circles = this.circleBuilder();\n\n return (\n <>\n {circles}\n </>\n );\n }",
"__getCircles() {\n let out = [];\n let yearRecords = this.__yearRecords[this.state.year];\n\n for (let record of yearRecords) {\n // Max data\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
guess one of my favorite fruits | function fruitGame() {
var fruitList = ['raspberries','pomegranates','lemons','pineapples','grapes','strawberries','apples'];
for( var i = 0 ; i < 6 ; i++ ){
var fruitGuess = prompt('Guess one of my favorite fruits (plural).').toLowerCase();
for( var j = 0 ; j < fruitList.length ; j++ ) {
if( fruitG... | [
"function favoriteThing(){\n let favoritThing = ['travel', 'family', 'cat', 'animals'];\n let n = 6;\n while (n > 0) {\n let userFavorit = prompt('What is one of my favorit things? You have ' + n + ' attempts');\n for (let i = 0; i < favoritThing.length; i++) {\n if (userFavorit.toLocaleLowerCase() ==... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get complete and detailed people list from a specific project. | async getProjectPeople(input = { projectId: '0' }) {
return await this.request({
name: 'project.people.list',
args: [input.projectId],
page: input.pagination
});
} | [
"getListOfSelectedProject(){\n let self = this;\n return new Promise(function(resolve, reject){\n if(!projectService.project){ // if no project selected - request a to select a project first\n console.log(\"Please select first a project before to work on it\".warn);\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Computes farthest polygon point in particular direction. Thanks to knowledge of min/max x and y coordinates we can choose a quadrant to search in. Since we're working on convex hull, the dot product is increasing until we find the farthest point. | function supportPoint(polygon, direction) {
var index =
direction[1] >= 0
? direction[0] < 0
? polygon.maxY
: polygon.maxX
: direction[0] < 0
? polygon.minX
: polygon.minY,
max = -Infinity,
value;
while ((value = dot(polygon[ind... | [
"getFurthestPoint(direction) {\n const pts = this.getTransformedPoints();\n let furthestPoint = null;\n let maxDistance = -Number.MAX_VALUE;\n for (let i = 0; i < pts.length; i++) {\n const distance = direction.dot(pts[i]);\n if (distance > maxDistance) {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Make a particular network entirely offlimits (no automatic connects to it) | function SetLimited(net, fLimited = true) {
if (net == NET_UNROUTABLE)
return;
// LOCK(cs_mapLocalHost)
vfLimited[net] = fLimited;
} | [
"function cutNetwork (port) {\n portRuleNum[port] = nextRuleNum\n runProgram ('sudo', 'ipfw', 'add ' + nextRuleNum++ + ' deny tcp from any to any ' + port)\n runProgram ('sudo', 'ipfw', 'add ' + nextRuleNum++ + ' deny tcp from any ' + port + ' to any')\n //TODO: confirm it worked (since sudo may not wor... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
this function loads the score page | function loadScorePage(){
endPage.style.display = "none";
scorePage.style.display = "block";
} | [
"function viewScore() {\n window.location.href = \"score.html\";\n}",
"function getScoreboard() {\n let xhttp = new XMLHttpRequest();\n\n xhttp.onreadystatechange = () => {\n if (xhttp.readyState === xhttp.DONE && xhttp.status === 200) {\n displayScores(J... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns an appropriate emoji for this volume level (given in 0 to 1) | function getSymbol(volume) {
if (volume >= 0.5) return '🔊';//0.5 - 1.0
if (volume >= 0.1) return '🔉';//0.1 - 0.49
if (volume > 0) return '🔈';//0.01 - 0.09
return '🔇';//0
} | [
"get volume_mute () {\n return new IconData(0xe04e,{fontFamily:'MaterialIcons'})\n }",
"get volume_off () {\n return new IconData(0xe04f,{fontFamily:'MaterialIcons'})\n }",
"get volume_up () {\n return new IconData(0xe050,{fontFamily:'MaterialIcons'})\n }",
"get ring_volume () {\n return new Ic... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
/ Writes the given data to the given socket, suppressing all errors / Returns true if write successful; otherwise, returns false | function writeSafe(socket, data) {
try
{
socket.write(data);
return true;
}
catch(err)
{
log("Error writing to socket:" + err.message);
return false;
}
} | [
"function writeToSocket (socket, data) {\n if (typeof data === 'string') {\n socket.write(data, 'utf8');\n } else {\n socket.write(data, 0);\n }\n if (!handlers[counter]) nextInstruction();\n }",
"function writeToSocket(data) {\n logger.verbose(data);\n sock.... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Generates voicings for 251 progressions | generateVoicings() {
this.#chords.forEach((chord, i) => {
if(i<this.#chords.length-2){
if (chord.getGrade() == 2
&& this.#chords[i+1].getGrade() == 5
&& this.#chords[i+2].getGrade() == 1 ){
let root = this.#chords[i].getRoot().getMidiNote();
let pitches = [r... | [
"function generateProgression() {\n\t//console.log('Main function runs');\n\n\t//Every whole note in the musical scale.\n\tvar notes = [\"A\",\"B\",\"C\",\"D\",\"E\",\"F\",\"G\"];\n\tvar romanNumerals = [\"I\",\"ii\",\"iii\",\"IV\",\"V\",\"vi\",\"vii\"];\n\n\t//Picks a random key 1-7. Corresponds to notes\n\tvar ke... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Generate a presigned URL for PUT. Using this URL, the browser can upload to S3 only with the specified object name. __Arguments__ `bucketName` _string_: name of the bucket `objectName` _string_: name of the object `expiry` _number_: expiry in seconds (optional, default 7 days) | presignedPutObject(bucketName, objectName, expires, cb) {
if (!isValidBucketName(bucketName)) {
throw new errors.InvalidBucketNameError(`Invalid bucket name: ${bucketName}`)
}
if (!isValidObjectName(objectName)) {
throw new errors.InvalidObjectNameError(`Invalid object name: ${objectName}`)
... | [
"presignedPutObject(bucketName, objectName, expires, cb) {\n if (!isValidBucketName(bucketName)) {\n throw new errors.InvalidBucketNameError('Invalid bucket name: ${bucketName}')\n }\n if (!isValidObjectName(objectName)) {\n throw new errors.InvalidObjectNameError('Invalid object name: ${objectNa... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
getAddress(latitude, longitude) Uses the OpenCage API to reverse geocode the coordinates into actual readable addresses. This function sends a JSON request to the API and then accesses the road or the footway that is returned. If neither exists or if it is not accurate enough, then an error will be displayed which will... | function getAddress(latitude, longitude)
{
ranOnce = true;
let apikey = 'c8b580297e194d9dbac4e5ecf4fe8c5d';
let api_url = 'https://api.opencagedata.com/geocode/v1/json';
let request_url = api_url
+ '?'
+ 'key=' + apikey
+ '&q=' + encodeURIComponent(latitude + ',' + longitude)... | [
"function getAddress() {\n\tvar address = $('#address').val();\n\tvar geocoder = new google.maps.Geocoder();\n\tgeocoder.geocode({ address: address }, (results, status) => {\n \tif (status === \"OK\") {\n\t\t\tvar lat = results[0].geometry.location.lat();\n\t\t\tvar lng = results[0].geometry.location.lng();\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
randomizer function takes in array and will look at length | function randomNumber(arrayLength){
return Math.floor(Math.random() * arrayLength);
} | [
"function randomizeAnswer(arrLength) {\r\n return Math.floor(Math.random() * arrLength);\r\n}",
"function randomArrayLength() {\n return Math.floor((Math.random() * 10) + 3);\n}",
"function randomarraynumber () {\n return Math.floor(Math.random()* array.length);\n}",
"function shuffle(ary) {\n return... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
add clicked song and artist name to userSetlist array | addSong(selectedSong){
let newItem = this.userBand + " - " + selectedSong;
//prevents adding of duplicate songs
this.userSetlist.indexOf(newItem) === -1 ? this.userSetlist.push(newItem) : console.log("This song is already in the list");
} | [
"function setSongList(albumUI,albumSongs) {\n\t\n\t// gets the node that has the song listbox\n\tvar songsNode = albumUI.getElementsByClassName('songs')[0];\n\t\n\t// clears the node\n\twhile (songsNode.firstChild) {\n\t songsNode.removeChild(songsNode.firstChild);\n\t}\n\t\n\t// loops through each song, appending... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Initialize sub categories based on the string path (firebase database location) | function setCategories(path)
{
firebase.database().ref(path).on("child_added", function(snapshot) // Reference all child nodes
{
var subtopic = snapshot.key;
var div = document.getElementById("categoryContainer");
var a = document.createElement("a");
a.className = "btn btn-info";
// Set the onclick pa... | [
"function initCategories(db, callback) {\n categories = [];\n var ref = db.ref('/categories');\n var values = undefined\n\n ref.on('value', function(snapshot) {\n values = snapshot.val();\n\n if (values !== undefined) {\n categories = values.split(', ');\n } else {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
_________________________________________________________// Solo numeros en el campo | function numerico(campo)
{
var charpos = campo.value.search("[^0-9]");
if (campo.value.length > 0 && charpos >= 0)
{
campo.value = campo.value.slice(0, -1);
campo.focus();
return false;
}
else
{
return true;
}
} | [
"function preencheNumeros() {\n\t\tconst dicionario = [null, \"one\", \"two\", \"three\", \"four\", \"five\", \"six\", \"seven\", \"eight\"];\n\n\t\tfor(let celula = 0; celula < tamanho; celula++) {\n\t\t\tif(campo[celula] === null) {\n\t\t\t\tcampo[celula] = dicionario[bombasAoRedor(celula)];\n\t\t\t}\n\t\t}\n\n\t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
dropWhile :: (Applicative f, Foldable f, Monoid (f a)) => (a > Boolean, f a) > f a . . Retains the first inner value which does not satisfy the predicate, and . all subsequent inner values. . . This function is derived from [`concat`](concat), [`empty`](empty), . [`of`](of), and [`reduce`](reduce). . . See also [`takeW... | function dropWhile(pred, foldable) {
var take = false;
return filter(function(x) { return take = take || !pred(x); }, foldable);
} | [
"function dropWhile(pred, filterable) {\n var take = false;\n return filter(function(x) { return take = take || !pred(x); }, filterable);\n }",
"dropWhile(arr, pred){\n let newArr = arr;\n let count = 0;\n do {\n newArr.shift();\n count ++;\n } while (pred(newArr[0],count,arr));\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
end the card animation and resume play | function endCardAnimation() {
$(".computer-card").removeClass("animated-card");
animating = false;
if (!training && disabled) {
enableButtons();
}
} | [
"function endAnimation() {\n animationCount -= 1;\n if(animationCount < 1) {\n $(\".fore-cover\").hide();\n //$(\".back-cover, .red-ball, .blue-ball, .green-ball, .loading-text\").css(\"animation-play-state\",\"paused\");\n }\n}",
"function endAnimation() {\n animationCount -= 1;\n if(animationCount < ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Changes the timer object minutes when the user changes the length of the session and resets seconds to zero | function changeTimerObjMins(timerObj, newMins) {
timerObj.hours = Math.floor(newMins / 60);
timerObj.minutes = newMins % 60;
timerObj.seconds = 0;
} | [
"function sessionLengthChange (time) {\n if (!runTimer){\n if (sessionName === 'session') {\n sessionLength += time;\n if (sessionLength < 1) {\n sessionLength = 1;\n }\n $(\"#session-time\").val( sessionLength ) ;\n timeLeft = sessionLength;\n originalTime = sessionLength;\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
We don't do the purest simplest recursion, because we can avoid reading Blob objects entirely since the Tree objects tell us which oids are Blobs and which are Trees. | async function walk(oid) {
if (visited.has(oid)) return
visited.add(oid);
const { type, object } = await _readObject({ fs, cache, gitdir, oid });
if (type === 'tag') {
const tag = GitAnnotatedTag.from(object);
const obj = tag.headers().object;
await walk(obj);
} else if (type === '... | [
"function blobRecurse(blobs, nest, blobId) {\n const memo = Array.from(blobs)\n function r(blobs, nest, blobId) {\n\n // if(memo[0] == 1) {continue};\n\n if (blobs[0].toString() === nest) {\n // memo[0] = 1;\n if (blobs[1]) {\n blobs[1].push([blobId]);\n }\n else {\n blobs.... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Habilita el boton en caso de que se haya encontrado una palabra | function habilitarBoton(){
oFormObject = document.forms['formPalabraEncontrada'];
var botonEnviar = document.getElementById('botonPalabraEncontrada');
if (palabraEncontrada == false) {
botonEnviar.disabled = true;
}else{
oFormObject.elements["xyLetras"].value = xyLetras;
oFormObject.elements["xy"].valu... | [
"PillarBomba(player,bomba){\n if(!bomba.recogida && player.modifier !== 'bomba'){ // Si el player ya tiene una bomba la nueva bmba no se pilla\n bomba.PickMe();\n player.changeModifierBomba(bomba.index);\n }\n}",
"function turno(){\n for(let i = 0; i < carton.length ; i++){\n if (numero =... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get Ticket by Id | function getTicketById(query, cb){
debug('getting a ticket', query);
TicketModel.findOne(query)
.exec()
.then(function(ticket){
cb(null, ticket || {});})
.catch(function(err){
return cb(err)});
} | [
"GetTicket(ticketId) {\n let url = `/support/tickets/${ticketId}`;\n return this.client.request('GET', url);\n }",
"async getTicket (_id) {\n let ticket = await this.models.tickets.findOne({_id})\n .populate('user_id');\n if (!ticket) {\n throw new Error();\n }\n return tick... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Wrapper for the xtk:persistWriteCollection endpoint, which unencodes submitted data | function zon_persist_WriteCollectionZip(input) {
var queryXml = NL.ZON.unzipAsXml(input, "WriteCollectionZip");
xtk.session.WriteCollection(queryXml);
} | [
"clear(){this.collection.injectRaw({data:[]})}",
"persistLocalStorage() {\n console.log(\"persist\");\n localStorage.setItem(this.localStorage_key, JSON.stringify(this.collection));\n }",
"_saveOriginals() {\n if (!this._waitingForQuiescence()) {\n this._flus... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Con encadenamiento de promesas prom().then((mensaje) => console.log(mensaje)); Con async / await | async function ej3() {
var res = await prom();
console.log(res);
} | [
"async function funcionConPromesaYAwait(){\n let miPromesa = new Promise((resolved) => {\n resolved(\"Promesa con await\"); \n });\n\n //Ya no es necesario utilizar .then() sino que con await va a recibir el valor\n // y se va a mostrar en consola \n console.log( await miPromesa );\n}",
"async ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
card_onShown_close_siblings: Close all open siblings when card is shown BUT without animation | function card_onShown_close_siblings(){
var $this = $(this);
if ($this.hasClass('show')){
$this.addClass('no-transition');
card_onShow_close_siblings.call(this);
$this.removeClass('no-transition');
}
accordion_onChange($this);
} | [
"function card_onShow_close_siblings(){\n var $this = $(this);\n $this.siblings('.show').children('.collapse').collapse('hide');\n }",
"hideCards() {\n this.openCards.forEach(cardElement => {\n cardElement\n .classList\n .remove('open');\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
IN: stepWeights can be a positive integer or an aray of positive, real numbers. integer N: specifies progress will be made in N even steps from 0 to 1 array of numbers A: specifies progress will be made in A.length steps which may not be even. Each step has its own "weight." Example: stepWeights = [850, 50, 100] Will b... | function ProgressAdapter(stepWeights, progressCallback1) {
this.stepWeights = stepWeights;
this.progressCallback = progressCallback1;
if (!(isFunction(this.progressCallback) && (isArray(this.stepWeights) || isNumber(this.stepWeights)))) {
throw new Error("invalid params");
}
this._currentStep ... | [
"function ProgressAdapter(stepWeights, progressCallback1) {\n this.stepWeights = stepWeights;\n this.progressCallback = progressCallback1;\n if (!(isFunction(this.progressCallback) && (isArray(this.stepWeights) || isNumber(this.stepWeights)))) {\n throw new Error(\"invalid params\");\n }\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
! ORDER INDICATOR ANIMATION This is the function that runs to animate order indicator | function startAnimateOrderIndicator(){
$(orderIndicator)
.animate({ x:Math.round(canvasW/100 * 82)}, 300)
.animate({ x:Math.round(canvasW/100 * 81)}, 300, function(){
startAnimateOrderIndicator();
});
} | [
"function updateOrderIndicator(){\r\n\tif(orderListNum>=0){\r\n\t\torderIndicator.visible=true;\r\n\t\torderIndicator.x = Math.round(canvasW/100 * 81);\r\n\t\torderIndicator.y = gameOrderContainer.y + $.marks[orderListNum].y;\r\n\t}else{\r\n\t\torderIndicator.visible=false;\r\n\t}\r\n}",
"function show_order(){\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sets and writes all objects paths by type and number of objects by type. | function postAllObjectPaths() {
[allObjectsByType, numObjectsByType] = setAllObjectPaths();
return numObjectsByType;
} | [
"function setAllObjectPaths() {\n\n var allObjectTypes = objectTypes.objectTypes;\n\n var allObjectsByType = new Map();\n var numObjectsByType = new Map();\n\n for (var i = 0; i < allObjectTypes.length/10; i++) {\n for (var j = 0; j < 10; j++) {\n var objectNum = String(i) + String(j);... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Drop Generate new jwt tokens and drop them to the persistence layers (response headers/cookies). The persistence layers used will be those valid for the passed csrfType. | function drop(req, res, options) {
// Generate the jwt tokens we need to drop
var jwtTokens = generate(req, res, options);
// Add them to res.locals for other middlewares to consume
res.locals.csrfJwtTokens = jwtTokens;
// Loop through each persistence type for the current csrf driver
Object.keys(jwtToke... | [
"clearJwtStore() {\n this._clearStore();\n }",
"clearLocalStorage() {\n localStorage.removeItem(this.config.jwtTokenName);\n }",
"static removeAccessAndDidTokens() {\n ApiService.removeAccessTokenFromLocalStorage()\n ApiService.removeDidTokenFromLocalStorage()\n ApiService.removeUserFromL... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
convert number rating to unicode stars | function starRating(num){
let stars = "";
let flatRating = Math.floor(num);
for(let i = 0; i < flatRating; i++){
stars = stars + "☆";
}
return stars;
} | [
"function stars(num){\n let rating = ''\n for(var i=0;i<num;i++){\n rating += '*'\n }\n return rating\n}",
"function ratingToStars(rating) {\n //validate input\n if (rating === \"N/A\") rating = 0;\n\n //convert rating to out of 5 instead of 10\n rating = rating / 2;\n\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Index GH api and store to DB | async function indexAndStore() {
let organization;
// Index organization
try {
organization = await index(config);
} catch(e) {}
// Store it in the db
(organization) && (db.update(organization));
} | [
"function index_data(){\n client.index({\n index: 'demo',\n type: 'users',\n id: '4',\n body: {\n id: '4',\n name: 'Son Nguyen',\n gender: 'male',\n }\n }, function (error, response) {\n if (error) {\n console.error(error);\n }else{\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
updateGrayscale (1) Update "grayscale" settings with user input (2) save settings (3) send updated settings to tab.js to modify active tab blur css | function updateGrayscale () {
settings.grayscale = document.querySelector("input[name=grayscale]").checked
browser.storage.sync.set({"settings": settings})
sendUpdatedSettings()
} | [
"setGrayscale() {\n // do nothing for now\n }",
"function applyGrayscale() \n{ \n var filter = 'grayscale(100%)';\n setFilter(filter);\n}",
"set grayscale(value) {}",
"function updateSaturation(greyscale) {\n document.documentElement.style.setProperty('--gs', ((1 - greyscale).toString()));\n}",... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
5.4 Response class Constructor(optional FetchBodyInit body, optional ResponseInit init) | function Response(body, init) {
if (arguments.length < 1)
body = '';
this.headers = new Headers();
this.headers._guard = 'response';
// Internal
if (body instanceof XMLHttpRequest && '_url' in body) {
var xhr = body;
this.type = 'basic'; // TODO: ResponseType
this.url = USV... | [
"function Response(body, init) {\n if (arguments.length < 1)\n body = '';\n\n this.headers = new Headers();\n this.headers._guard = 'response';\n\n // Internal\n if (body instanceof XMLHttpRequest && '_url' in body) {\n var xhr = body;\n this.type = 'basic'; // TODO: ResponseType\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This is a function for deleteRepositoryPipelineKeyPair / Delete the repository SSH key pair. | deleteRepositoryPipelineKeyPair(incomingOptions, cb) {
const Bitbucket = require('./dist');
let apiInstance = new Bitbucket.PipelinesApi(); // String | The account // String | The repository.
/*let username = "username_example";*/ /*let repoSlug = "repoSlug_example";*/ apiInstance.deleteRepositoryPipelineK... | [
"function deleteSSH()\n{\n loader(true);\n let sshId = modal.current.dataset.sshId;\n let key = SSHKEYS[sshId];\n let keyName = key.name;\n retrieve('ssh/delete', keyName)\n .then( (response) => {\n if (!response.ok) {\n showBlihError(response.data);\n loader(false);\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
read a JavaScript object from the tangle | function readObjectFromTangle(txHash, callback){
readMessageFromTangle(txHash, function(msg){
var re = /\0/g;
var str = msg.toString().replace(re, "");
var dataFromTangle = JSON.parse(str);
callback(dataFromTangle);
});
} | [
"function parseLiftObject(){\n // var liftObject = JSON.parse()\n}",
"function get_js_object(id) {\n return js_objects[id];\n}",
"function ReadObjectFromStorage(name_to_read)\n{\n return JSON.parse(localStorage.getItem(name_to_read)); \n}",
"get serializedObject() {}",
"function getObjectFromJSON(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
feedCurrentPet method will reduce the currentPet's hunger by 2 every time it is called. It is attached to a button that will call it whenever it is clicked. | feedCurrentPet() {
if(this.currentPet.hunger > 1){
this.currentPet.hunger -= 1;
if (this.currentPet.age < 2) {
$('.petAlive').hide()
$('.petEat').append($petEatImage).velocity("fadeOut", {
duration: 1000
})
setTimeout(function () {
game.fadeInPetAlive()
}, 1000)
} else if(this.currentPet... | [
"function pet() {\n activeCat.pets++;\n //check if the pets has exceeded the cats tollerance\n if (activeCat.pets > activeCat.tolerance) {\n //Change the index of the mood to its secondary option\n activeCat.moodIndex = 1;\n }\n drawCat();\n}",
"playWithCurrentPet() {\n\t\tif(this.currentPet.boredom > ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Pos Pos(ition) object constructor. Prototype: new Pos(int x, int y, int z) Arguments: x ... a position on the x axis y ... a position on the y axis z ... a position on the z axis Results: A new Pos instance. | function Pos(x, y, z) {
this.x = x;
this.y = y;
this.z = z;
this.toString = function() {
return this.x + ',' + this.y + (z ? ',' + z : '');
};
} | [
"function Posn(x, y) {\n\tthis.x = x;\n \tthis.y = y;\n}",
"function absPos(o) {\r\n var x, y, z;\r\n if (arguments.length > 2) {\r\n x = arguments[1];\r\n y = arguments[2];\r\n z = arguments[3];\r\n } else if (arguments.length == 2) {\r\n x = arguments[1].x;\r\n y = arguments[1].y;\r\n z = ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Test Bed function for debugging while developing | function testRun()
{
} | [
"function BluetoothInternalsTest() {}",
"function logBam() {\n console.log('Bam!');\n}",
"function test() {\n\n// This spot reserved for quickdraw code testing.\n\n}",
"function ForDebug() {}",
"function rawtest(){\n\tlog(\"Info: rawtest: start\");\n\trawtest4();\n\tlog(\"Info: rawtest: end\");\n}",
"fun... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Changes votes of party "party" to "vote" and updates URL | changeVote(party, vote) {
let p = Array.from(this.state.parties)
const i = p.findIndex( o => o.party === party)
for(let j = 0; j < p.len; j++) {
p[j].active = false
}
p[i].vote = vote
p[i].active = true
this.setState({
parties: p
})
let currentUrlParams = new URLSearc... | [
"function updateVotes(space ,person , vote) {\n var base = FirebaseApp.getDatabaseByUrl(firebaseUrl, secret);\n base.setData(space + \"/votes/\" + person, vote);\n return base.getData().votes\n \n}",
"function updateBet(viewer, choice) {\n\tlet sql = `UPDATE bets SET betnum = ? WHERE username = ?;`;\n\tcon.qu... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Uses Promises to access a file from a URL Open the file use FileReader to convert to ArrayBuffer Splice and dice into sprites Returns array of img data URLs. | function loadImagesFromUrlAsync(url) {
return fetch(url)
.then(response => {
if (!response.ok) {
throw new Error(`Failed to read ${url}`);
}
return response.blob();
})
.then(blob => {
return readFileStreamAsync(blob);
})
.then(arrayBuf => {
return parseData(arrayBuf);
})
.catch(error =... | [
"function readFile() {\n reader.readAsDataURL(imageFiles[i])\n }",
"static async read() {\n let json = (await IO.parseFileJSON(Paths.FILE_PICTURES)).list;\n let l = json.length;\n this.list = new Array(l);\n let k, j, m, n, id, jsonHash, jsonList, jsonPicture, list, p... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get booking rules for the given user and space | function rulesForSpace(options) {
if (!options) {
throw Error('Options are needed to check for rule matches');
}
const space_rules_for_user = {
auto_approve: true,
hide: true,
};
/* istanbul ignore else */
if (options.space) {
for (const type of Object.keys(option... | [
"function rulesForSpace(options) {\n if (!options) {\n throw Error('Options are needed to check for rule matches');\n }\n const space_rules_for_user = {\n auto_approve: true,\n hide: false,\n };\n if (options.space) {\n for (const type of Object.keys(options.rules || {})) ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Logs the current build mode on the console. | function logBuildMode() {
if (isProduction()) {
gutil.log(gutil.colors.green('Running production build...'))
} else {
gutil.log(gutil.colors.yellow('Running development build...'))
}
} | [
"function logBuildMode() {\n\n if (isProduction()) {\n gutil.log(gutil.colors.green('Running production build...'));\n } else {\n gutil.log(gutil.colors.yellow('Running development build...'));\n }\n\n}",
"function logBuildMode() {\n \n if (isProduction()) {\n gutil.log(gutil.colors.green('R... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Progression 8: Change all chocolates of ____ color to ____ color and return [countOfChangedColor, chocolates] | function changeChocolateColorAllOfxCount(chocolates,color,finalColor)
{
if(color==finalColor)
{
return "Can't replace the same chocolates";
}
else
{
for(let i=chocolates.length;i>=0;i--)
{
if(chocolates[i] == color)
{
chocolates[i] = fin... | [
"function changeChocolateColorAllOfxCount(chocolates, color, finalColor) {\n let changed = chocolates.map(e => (e == color) ? finalColor : e);\n let count = changed.reduce((acc, val) => acc += (val == finalColor) ? 1 : 0, 0);\n return [count, changed];\n}",
"function changeChocolateColorAllOfxCount(choco... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Show a tool panel. | showTool(name) {
let tool = this.querySelector('.panel-tool');
if (tool.style.display) {
tool.style.display = '';
let rect = this.getBoundingClientRect();
this.width = (rect.width + tool.getBoundingClientRect().width) / rect.width * this.width;
this.style.width = this.width * 100 + 'vh';
}
let tabs... | [
"toggleTools() {\n if (this.panelTool.classList.contains(\"show\"))\n this.showTools(); \n else\n this.hiddenTools();\n }",
"function showTools() {\n console.log(\"TOOLS\");\n toolsPanel.style.display = \"block\";\n settingsPanel.style.display = \"none\";\n set... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |