query stringlengths 9 34k | document stringlengths 8 5.39M | negatives listlengths 19 20 | metadata dict |
|---|---|---|---|
' 'Title : cmdQCPause_ClickCase10 'Function : 'Input : 'Output : 'Remark : ' | function cmdQCPause_ClickCase10() {
console.log("cmdQCPause_ClickCase10");
if (config.strSkipWOTrackingPrompt) {
setupPauseCase20();
} else {
var answer = false;
$.confirm({
title: 'Confirm!',
con... | [
"function cmdQCStart_ClickCase12() {\n console.log(\"cmdQCStart_ClickCase12\");\n if (String($scope.OrderType).trim().toLocaleLowerCase() == \"assembly\") {\n //todo line3946-3970\n console.log(\"setupStartCase12 subassembly\", $scope.subAssembly);\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
BUTTON PLUGIN DEFINITION ======================== | function Plugin(option){return this.each(function(){var $this=$(this);var data=$this.data('bs.button');var options=(typeof option==='undefined'?'undefined':_typeof2(option))=='object'&&option;if(!data)$this.data('bs.button',data=new Button(this,options));if(option=='toggle')data.toggle();else if(option)data.setState(op... | [
"button(x, y, content, opts){\n\n let button = new Button(x, y, content, opts);\n this.layer.buttons.push(button);\n return button;\n\n }",
"static set toolbarButton(value) {}",
"function add_users_browtab_ui_buttons(){\n $( \"#button-activate-all\" ).button({\n icons: {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
PROPAGATE: Channel > Guild > Group Nickname > Username > ID Emoji > Banner(?) | async function parse(message) {
let txt = message.content.split(' ').slice(1).join(' ');
function mentions() {
if (message.mentions) {
return message.mentions.users.map((usr) => usr.avatarURL);
}
return [];
} ... | [
"refreshMentions()\n {\n this.mentions = this.messageRaw.match(/<@(?:\\d){13}>/g) === null ? [] : new Array(...this.messageRaw.match(/<@(?:\\d){13}>/g));\n if (this.mentions.includes(`<@${thisUser.id}>`) && !this.msg.classList.contains('mention'))\n {\n $(this.msg).addClass('menti... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sets the value of |option| to |value|. Returns a Promise that will be resolved when the updated information has been written to persistent storage. | setOption(option, value) {
this.options_[option] = value;
return this.store();
} | [
"function setConfigOption(key, value){\n chrome.storage.sync.get(null, (result) =>{\n let config = result[\"config\"];\n if(!config)\n config = {};\n if(value)\n config[key] = value;\n else\n delete config[key];\n chrome.storage.sync.set({config: config});\n });\n}",
"select(option... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function to update the shot clock on the board | function updateShotClock () {
var printShotClockTime = '';
if (CURRENT_SHOT_CLOCK_TIME === 0) {
document.getElementById('buzzer').play();
stopClock();
}
if (CURRENT_SHOT_CLOCK_TIME < SHOT_CLOCK_TIME_CUTOFF) {
$('#shotclocktimer').css('color', 'red');
}
var formattedShotClockTime = msToTime(CURRENT_SHOT_CLOC... | [
"function updateTime() {\n const datetime = tizen.time.getCurrentDateTime();\n const hour = datetime.getHours();\n const minute = datetime.getMinutes();\n const second = datetime.getSeconds();\n\n const separator = second % 2 === 0 ? \":\" : \" \";\n\n $(\"#time-text\").htm... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Generates a contact with all his data | function createContact() {
var contact = {
id: shortid.generate(),
firstname: faker.name.firstName(),
lastname: faker.name.lastName()
};
/** professional data */
// defines a company name (2/3)
if (rnd(2)) {
contact.company = faker... | [
"function createContact() {\n var contacts = new Appworks.AWContacts();\n\n // Gather properties from your form\n var name = document.getElementById(\"contact-name\").value;\n var number = document.getElementById(\"contact-number\").value;\n\n // Create a new contacts object\n var contact = new Contact();\n\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns whether the model is currently simulating elections for FPTP, Condorcet, Borda, and IRV electoral systems | function getIsSimulating() {
return isSimulating;
} // getIsSimulating | [
"function isValidTransportationMode(options) {\n let status = true;\n try {\n let co2Factor = constants[options.transportation]\n if (co2Factor === undefined)\n status = false;\n } catch (error) {\n status = false;\n }\n return status;\n}",
"function isGameAgainstCom... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the ... | function captureStdio(expected, fn, opts) {
var buf = [];
var _errwrite = process.stderr.write;
var _outwrite = process.stdout.write;
process.stdout.write = outwrite;
process.stderr.write = errwrite;
fn();
process.stdout.write = _outwrite;
process.stderr.write = _errwrite;
if (op... | [
"function logMatch (firstParameter, secondParameter) {\n console.log(firstParameter + \" does match \" + secondParameter + \"!\");\n}",
"function CreateTraceListenerThread() {\n var tracingThread = new System.Threading.Thread(new System.Threading.ThreadStart(function () {\n var traceBuffer = System.Arr... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
get current tasks customized with project name and label name | function todoist_current_tasks_pull_custom() {
current_tasks_base = todoist_current_tasks_pull()
current_tasks = current_tasks_base.items
labels_dictionary = current_tasks_base.labels
labels_dictionary = array_to_dictionary(labels_dictionary)
projects_dictionary = current_tasks_base.projects
cur... | [
"function newTaskLabel(taskText) {\n\tvar taskLabel = $(document.createElement(\"LABEL\"));\n\tvar text = $(document.createTextNode(taskText));\n\ttaskLabel.append(text);\n\treturn taskLabel;\n}",
"function sub_project_from_task(item) {\n item_name = item.content\n sub_project = item_name.split(\":\")[0].tr... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Retrieve top 10 scores from server | function getTopTenScores() {
var url = host + "TopPlayers.php?type="+gameType;
getPlayerData(url);
} | [
"function getTopCrimePlayers() {\r\n\t\t$.get('http://nflarrest.com/api/v1/player', function(data) {\r\n\t\t\t//console.log(data)\r\n\t\t\t// compare function of array object properties to sort by arrest_count\r\n\t\t\tfunction compare(a,b) {\r\n\t\t\t\tif (a.arrest_count < b.arrest_count) {\r\n\t\t\t\t\treturn 1;\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Queries the Covid19 metrics dataset for a specific country. Currently we only support countrywide metrics. If you want to add search by other location types, you can look into province_state field of bigquerypublicdata.covid19_jhu_csse tables for possible values. You can also find more detailed statistics for USA in th... | function queryCovid19dataset(tableName, country) {
if (!['confirmed_cases', 'deaths', 'recovered_cases'].includes(tableName)) {
return Promise.reject(new Error('Invalid table name ' + tableName));
}
// We convert some of the countries names to match those in the dataset.
// Those countries are r... | [
"function casesByCountry (){\n\n let today = dateToday();\n let endPoint = 'https://api.covid19tracking.narrativa.com/api/' \n let queryCountriesUrl = endPoint + today; \n let URL = {\n url: queryCountriesUrl,\n method: \"GET\" \n } \n\n // making request to pull all Covid... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Lightbox Campaign Dates, Content, and Cookie | function lightbox(launchDate,stopDate,lightBoxContent, cookieName, cookieExpires){
/* Today's Date */
var todaysDate = new Date();
/* Date of launch */
var launchDate;
var stopDate;
var lightBoxContent; /* the html of the lightbox */
var cookieName; /* Name of the cookie */
var campaignStarte... | [
"function displayNewSiteAnnouncement() {\n\tconst NewSiteCookie = 'newSiteAnnouncementShown';\n\tconst NewSiteAnnouncement = 'New Site Announcement';\n\tconst MaxDisplays = 3;\n\n\n\ttry {\n\n\t\t// check if the lightbox has been shown once already this _session_ (ie visit to the website)\n\t\tif (!session.getItem(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Loads VisageFaceRecognition gallery from IndexedDB. Loads the gallery to be displayed in the samples GUI gallery. | function loadGallery()
{
if (recogInitialized)
{
m_Recog.loadGallery(galleryFileName, function(name, status)
{
var names = [];
//If gallery is empty sends an empty array, otherwise adds the name from gallery in the array.
//If there is more then one descriptor per name the name is added only onc... | [
"function loadGalleries() {\n //console.log('loading galleries');\n $('#gallerySpinner').show();\n loadGalleryType('type', 0)\n loadGalleryType('specimen', 0)\n loadGalleryType('other', 0)\n loadGalleryType('uncertain',0)\n}",
"function trackRecognition()\n{\n\tif (recogInitialized && !galleryFr... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns true if flags prevent parent injector from being searched for tokens | function shouldSearchParent(flags, isFirstHostTNode) {
return !(flags & InjectFlags.Self) && !(flags & InjectFlags.Host && isFirstHostTNode);
} | [
"hasUntouchableTokens(){ return false; }",
"visitAllow_or_disallow(ctx) {\n\t return this.visitChildren(ctx);\n\t}",
"enterPreprocessorNot(ctx) {\n\t}",
"function shouldDisableSSO () {\n\n if (!FLAG_DISABLE_SSO) return false;\n\n if (\n // Dev mode with saved API key\n process.env.NODE_ENV !== 'produ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Method to edit Description and Image of Product | static editSubscriptionAndImageProduct(productName, descriptionAndImageData) {
const subscriptionDetailsA = Navigator.goToSubscription(productName);
subscriptionDetailsA.editDescriptionAndImageInfo(descriptionAndImageData);
} | [
"function showProduct() {\n var url = $(this).children('img').attr(\"src\");\n $(this).children('.overlay').hide();\n $(this).parents('.featured-outfit').find('.outfit-pic').children('.image-preview').children('img').attr('src',url);\n $(this).parents('.featured-outfit').find('.outfit-pic').children('.i... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This is a function for deleteV3ProjectsIdRepositoryFiles | deleteV3ProjectsIdRepositoryFiles(incomingOptions, cb) {
const Gitlab = require('./dist');
let defaultClient = Gitlab.ApiClient.instance;
// Configure API key authorization: private_token_header
let private_token_header = defaultClient.authentications['private_token_header'];
private_token_header.apiKey = '... | [
"deleteFiles(id) {\r\n return this.drive.files.delete({ fileId: id });\r\n }",
"function deleteFileInfo(postId){\n connection.execQuery(\n `DELETE FROM zoz7184.NB_ATCH_FILE \n WHERE POST_ID = ? \n `\n ,[postId]\n ,function (err,results){\n if(err) throw... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
3. Coursework: When the game is in play, the player's nickname will appear at the top of the screen. Create a function `nickChanged` which updates the content of the `playername` field to match the content of the 'nick' input field. Attach an appropriate event listener to the `nick` field such that `playername` is upda... | function nickChanged(e) {
let nickName = document.getElementById("nick").value;
document.getElementById("playername").innerHTML = nickName;
} | [
"function changeNickname(name){\r\n\tthisUser.nick=name;\r\n\tsocket.emit('setNickname',thisUser, name);\r\n\t$(\"#NicknameField\").val(name); // sets the change nickname input to requested nickname\r\n}",
"function updatePlayerName() {\n var $currentPlayerName = $playerInputs.item(currentPlayer);\n var pla... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Reads in the XML in D Print the distance for the first Distance node found | function parseXML(xml) {
console.log("display xml");
var d = $('distance', xml).get();
$.each(d, function( index, value ) {
console.log( index + ": " + value.textContent );
$('#r_distance').append("<b>Distance in miles: </b>" + value.textContent);
return false;
});
} | [
"function calcDistance(node1, node2) {\n //could use Math.hypot if it's compliant w/their specs; check\n // return Math.hypot(node1.x-node2.x,node1.y,node2.y)\n var x = node1.x - node2.x;\n var y = node1.y - node2.y;\n return Math.sqrt(x * x + y * y)\n} //calcDistance",
"dist... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Depthfirst traversal for NSViews. | function walkViewTree(rootView, fn) {
let visit_ = view => {
fn(view);
let nsArray = view.subviews();
let count = nsArray.count();
for (let i = 0; i < count; i++) {
visit_(nsArray.objectAtIndex(i));
}
};
visit_(rootView);
} | [
"function traverseVisualTree(obj, parent) {\n obj.vtkey = visualNodeDataArray.length;\n visualNodeDataArray.push(obj);\n if (parent) {\n obj.parentKey = parent.vtkey;\n }\n if (obj instanceof go.Diagram) {\n var lit = obj.layers;\n while (lit.next()) traverseVisualTree(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
initializes the page to store any previous Users | function init() {
var storedUsers = JSON.parse(localStorage.getItem("Users"));
if (storedUsers !== null) {
users = storedUsers;
//renderUsers();
}
} | [
"function init() {\n currUser = sessionStorage.getItem(cUserId);\n getTopScores();\n getCurrentUserRank();\n}",
"function init() {\n var loggedinUser = playlistService.getData(\"currentUser\");\n if (loggedinUser.hasOwnProperty(\"email\")) {\n $scope.currentUser = loggedinUser;\n $scope.u... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Does the script have an UI? Needed by service in xml file for button Run Button Function This runs your button when it is clicked Add any functions or calls you wish to make before or after the primary "RunApps" function | function RunBtn1( AppName, ButtonNum, Computername, CurrentUser, sCmd ){
RunApps( AppName, ButtonNum, Computername, CurrentUser, sCmd ); //This function executes your script. Do not edit this line
} | [
"function send_ADE_SWF_ButtonPush()\r\n{\r\n\t// you can add Script code here to call out to \r\n\t// other parts of your script to take action\r\n\t// Default is call to this stub API that you can move around where needed\r\n\t// and leave this JS file intact\r\n\tADE_SWF_ButtonPush_action();\r\n}",
"function ma... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Configure an EasyMDE editor for the given element, allowing markdown editing of the notes field. | function setupNotesField(element, url, options={}) {
var editable = options.editable || false;
// Read initial notes value from the URL
var initial = null;
inventreeGet(url, {}, {
async: false,
success: function(response) {
initial = response[options.notes_field || 'notes'... | [
"setupEditor() {\r\n this.fancyEditor = CodeMirror.fromTextArea(this.source.get(0), {\r\n mode: 'python',\r\n theme: this.theme,\r\n lineWrapping: true,\r\n lineNumbers: this.lineNumbers,\r\n tabSize: 2,\r\n autofocus: true,\r\n aut... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
+++++++++++++++++ save states on start and shutter change ++++++++++++++++++++++++++++ | async function saveCurrentStates(onStart) {
if (onStart) {
await shutterConfigCheck();
}
let currentStates = {};
let shutterName = [];
let num = 0;
const _currentStates = await adapter.getStateAsync('shutters.currentStates').catch((e) => adapter.log.warn(e));
if (_currentStates && ... | [
"async function createShutter() {\n const result = shutterSettings;\n if (result) {\n for (const i in result) {\n let objectName;\n\n if (result[i].shutterName !== '') {\n objectName = result[i].shutterName.replace(/[.;, ]/g, '_');\n } else if (result[i].... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Save users to 'users.json'. | saveUsers(users) {
Jsonfile.spaces = 4;
Jsonfile.writeFileSync(usersFile, users);
} | [
"function saveAllUsers() {\n\tfs.writeFile(\n\t\t\"./users.json\",\n\t\tJSON.stringify(usersArr),\n\t\tfunction(err) {\n\t\t\tif (err) {\n\t\t\t\tconsole.log(err);\n\t\t\t}\n\t\t}\n\t);\n}",
"function saveUsers() {\n localStorage.setItem(\"trivia-users\", JSON.stringify(users));\n}",
"function addUser(user) {\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
print mssg to console out only if debuging is set to true | function consOut( mssg ) {
if (window.debug) {
console.log(mssg);
}
} | [
"function printDevMessage(msg, args) {\n\t// Check if developer mode is on\n\tif(dev) {\n\t\t// Print the message\n\t\tserver.print(util.format(msg, args));\n\t}\n}",
"debug(entry) {\n this.write(entry, 'DEBUG');\n }",
"function setupDebug(){\n debug = new DEBUGTOOL(false,null,[8,8,16]);\n}",
"function d... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
List of named slots to initialize. | get slots() {
return {};
} | [
"addSlotKeys() {\n\t\t\tthis.$slots.default.forEach((item, index) => {\n\t\t\t\titem.key = item.key!=null?item.key:index;\n\t\t\t});\n\t\t}",
"function Window_SlotMachine() {\n this.initialize.apply(this, arguments);\n}",
"function Scene_SlotMachine() {\n this.initialize.apply(this, arguments);\n}",
"fu... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
3. CONFIRM EDIT Plan | function ConfirmEditPlan(buttonConfirm, type = 'create') {
editForm = buttonConfirm.parentNode.parentNode;
setData = {}
setData['function'] = 'set_plan';
setData['disc'] = editForm.querySelector('#edit-text-disc').value;
var editId = editForm.querySelector('#edit-id').value;
var idPlan... | [
"function showConfirmMessage(request, response, form, stVB)\n{\n\tform = nlapiCreateForm('Confirm Vendor Bill Approval', true);\n\t\n\tvar fldStage = form.addField('custpage_stage', 'text', 'Stage');\n\tfldStage.setDefaultValue('showConfirmMessage');\n\tfldStage.setDisplayType('hidden');\n\t\n\tvar fldVB = form.add... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
The event for dropping into a skill paragraph. | function dropSkill(e) {
let span= O(e.dataTransfer.getData("span"));
let skill= O(e.dataTransfer.getData("skill"));
let id = skill.id;
let dot1 = id.indexOf('.');
let dot2 = id.indexOf('.',dot1+1);
let fromRating = parseInt(id.substring(dot1+1,dot2));
//Also get the fromIndex.
let fromIndex = parseIn... | [
"function drop(event) {\n event.preventDefault();\n const data = event.dataTransfer.getData(\"Text\");\n\n // If droped on top of a player, then put player to corresponding team\n if (event.target.nodeName == \"P\") {\n event.target.parentNode.appendChild(document.querySelector(`#${data}`));\n\n // Drop i... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Builds the jurisdictions and sets things up properly... | function build_jurisdictions ()
{
// TODO: The following is not working in internet explorer on wine
// THIS fixes the generic being the default selection...
var current_jurisdiction = '';
try {
if ( $F('jurisdiction') )
current_jurisdiction =... | [
"static init() {\n\n JuspayEnvironment.DEVELOPMENT_BASE_URL = \"https://localapi.juspay.in\";\n JuspayEnvironment.SANDBOX_BASE_URL = \"https://sandbox.juspay.in\";\n JuspayEnvironment.PRODUCTION_BASE_URL = \"https://api.juspay.in\";\n\n if (JuspayEnvironment.thisObj != undefined) {\n return JuspayE... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Turns the scanning off | function scanOff() {
clearTimeout(scanTime);
oneSwitchGoing = false;
} | [
"onScanFinished_() {\n this.scanner_ = null;\n }",
"function turnOffCaptureSelection() {\n\txkeys.setBacklight(capture+64, false, true); // Capture key, Off, Red\n\tcapture = -1;\n\tturnOffCameraSourceKeys();\n\tclearTimeout(captureTimeout);\n}",
"turnOff() {\n\t\tthis.lightMap.makeDarkness();\n\t}",
"fun... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Functions for highlighting, called by updateHighlights. x in each case is the selected object or the object being treated as such. Some have return values for use by each other or for tooltips. if the link connects to this node, highlight it | function linksTo(x, i) {
if (x instanceof go.Node) {
x.findLinksInto().each(function (link) {
link.highlight = i;
});
}
} | [
"function linksAll(x, i) {\n if (x instanceof go.Node) {\n x.linksConnected.each(function (link) {\n link.highlight = i;\n });\n }\n}",
"highlightSelected() {\n\n this.highlighter.setPosition(this.xStart + this.selected * this.distance, this.yPosition + this.highlighterOffset... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Helper function to get history of an asset from ledger | static async getAssetHistory(ctx, assetKey) {
//Return iterator of asset history for the key provided
return await ctx.stub.getHistoryForKey(assetKey);
} | [
"function getHistory() {\n var db = getDatabase();\n var respath=\"\";\n db.transaction(function(tx) {\n var rs = tx.executeSql('SELECT * FROM history ORDER BY history.uid DESC;');\n for (var i = 0; i < rs.rows.length; i++) {\n historyModel.append({\"url\" : rs.rows.item(i).url});... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Deep search an object for a certain key > returns array of objects containing key | function findKey (obj, key) {
if (has(obj, key)) return [obj]
return flatten(
map(obj, function (v) {
return typeof v === 'object' ? findKey(v, key) : []
}),
true
)
} | [
"function searchObject(obj, name)\n{\n\t\n var k;\n if (_.isObject(obj) || _.isArray(obj)) {\n \tif (obj.hasOwnProperty(name)) {\n \t\treturn obj[name];\n \t} \n for (k in obj) {\n \tvar result = searchObject(obj[k], name);\n \tif (result) return result;\n }\n } \n}",... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
showGameOver() called when the player's lives run out shows the game over text, removes objects from stage | function showGameOver()
{
stage.removeChild(character.image);
stage.removeChild(coin.image);
stage.removeChild(bullet.image);
if(game_difficulty === MEDIUM_MODE || game_difficulty === HARD_MODE)
{
stage.removeChild(balloon.image);
stage.removeChild(balloon.bomb.image);
}
i... | [
"function runGameOver(){\n\n // overwrite ball position\n ball.x=width/2;\n ball.y=width/2;\n\n // draw new background to hide the regular game screen\n background(0);\n // show score so we can keep in mind who won\n displayScore();\n\n // now load cat\n moveCat();\n drawCatHead();\n\n // display paddles... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Click handler for selecting manuals/cheat sheets (both mobile and non) | function makeClickHander(lnk, isMobileOpt)
{
return function()
{
disappear();
var menuDiv = $('<div>').addClass('popup disappear');
menuDiv.click(function() { preventDisappear++; });
if (isMobileOpt)
{
... | [
"selectDessert3() {\n I.waitForElementLeaveDom(settings.config.helpers.Appium.platform, commonObjects.progressBar);\n //I.downScroller(foodObjects.hersheysBrownie);\n I.tap(foodObjects.hersheysBrownie);\n I.waitForElementLeaveDom(settings.config.helpers.Appium.platform, commonObjects.progressBar);\n }"... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
OPEN TEMPLATE LIBRARY FOR VC | function VCopenTemplateLibrary(params) {
jQuery('.wpb-element-edit-modal').hide(); //hide the normal VC window and use own (old vc version)
jQuery('#vc_properties-panel').hide(); //hide the normal VC window and use own (new vc version)
RVS.SC.BLOCK = RVS.SC.scToBlock(convertVCParamsToSC(params));
RVS.SC... | [
"template() {\n return this.use(2, (file) => {\n const layout = LayoutResolver(file);\n\n const ext = Path.extname(layout);\n switch (ext) {\n case '.njk':\n fn_nunjucks.apply(file, layout);\n break;\n default:\n throw new Error(\"Unknown template engine.\"... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Creates a Fader. A Fader fades between a set of panels (the children of a specific DOM node), initially showing the first panel. The parameters are: node either the DOM node containing the panels or the ID of the node duration the duration of fades, in seconds; this optional parameter defaults to 0.5 | function Fader(node, duration){
// fetch the DOM node if a string was supplied
if (typeof node == 'string') node = document.getElementById(node);
// store the rate
this.rate = 0.05 / (duration ? duration : 0.5);
// style the node so that panels can be positioned on top of each other
... | [
"function mFade() {\n\tgetId('t' + currTact).classList.add(\"faded\");\n}",
"function FadeInTransition() {}",
"function animateShow(el, script) {\n if ( isString(el) ) {\n el = document.getElementById(el);\n }\n var animId; // id from setInterval()\n var dt = 10; // time interval for animation in ms\n v... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Filters the knowntheorem list for facts which could ground the given work (i.e.e., a call to ground(work, fact) would succeed). For each fact, callsback with the work and the grounding fact. Currently, this will be slow if there are many known facts; in the future we hope to do some fancy indexing. | function forEachGroundableFact(work, cb) {
allKnownFacts.forEach(function(f) {
if (f.Core[Fact.CORE_HYPS].length == 0) {
try {
if (work.Core[Fact.CORE_HYPS][0] !== 1) {
//XXX TODO: infinite recurse bug here, not trying.
... | [
"function ground(work, dirtFact) {\n // verify that the hyp is an instance of the dirt\n var varMap = getMandHyps(work, [], dirtFact, []);\n if (DEBUG) {console.log(\"# ground MandHyps: \"+JSON.stringify(varMap));}\n work.Core[Fact.CORE_HYPS].shift();\n var newSteps = [];\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Draws a string (str) centered on (x,y) with an optional rotation | function drawLabel(str, x, y, angle) {
if(angle == undefined || angle == 0) {
c.fillText(str, x-c.measureText(str).width/2, y+fontSize/4);
}
else {
c.translate(x,y);
c.rotate(angle);
c.fillText(str,0,fontSize/4);
c.rotate(-1*angle);
c.translate(-1*x,-1*y);
}
} | [
"function label(str, x, y, dx, dy) {\n fill(0);\n noStroke();\n if (textRotation) {\n text(str, x + dx, y + dy);\n } else {\n // get screen coordinates for where the text should go\n var x0 = m.screenX(x, y);\n var y0 = m.screenY(x, y);\n m.push();\n // set current transform to the default mat... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Selects a random square to be the "active" square for loop1 | function randomSquare1() {
selected1 = squares[randomNum()]
} | [
"function randomSquare2() {\n selected2 = squares[randomNum()]\n }",
"function randomSquare3() {\n selected3 = squares[randomNum()]\n }",
"function randomSquare4() {\n selected4 = squares[randomNum()]\n }",
"function randomize() {\n var x;\n var y;\n var randNum; //only allow 30% of the grid to... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Checks if there is a Favorites variable in localstorage otherwise it creates it | function checkFavorites() {
if (localStorage.getItem("favorites") == null) {
favoritesArray = [];
localStorage.setItem("favorites", JSON.stringify(favoritesArray));
} else {
favoritesArray = JSON.parse(localStorage.getItem("favorites"));
}
} | [
"function addToFavorites(event) {\n event.preventDefault()\n let favorites = JSON.parse(localStorage.getItem(\"favorites\"))\n let id = getId(this)\n if (favorites.indexOf(id) < 0) {\n favorites.push(id)\n }\n localStorage.setItem(\"favorites\", JSON.stringify(favorites))\n changeTextIfFavorite(this)\n a... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get the first parent of a node that isn't an IcuContainer TNode | function getFirstParentNative(tNode) {
var parent = tNode.parent;
while (parent && parent.type === 5 /* IcuContainer */) {
parent = parent.parent;
}
return parent;
} | [
"function tocGetParent(element) {\n\tif(!element) {\n\t console.error('element to get parent of is null');\n\t return null;\n\t}\n\n\tconst elemParent = element.parentNode;\n\n\tif (!elemParent) {\n\t return null;\n\t}\n\n\tif (elemParent.tagName === 'UL') {\n\t return elemParent;\n\t} else {\n\t ret... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Delete Entry Distribution by id. | static deleteAction(id){
let kparams = {};
kparams.id = id;
return new kaltura.RequestBuilder('contentdistribution_entrydistribution', 'delete', kparams);
} | [
"static deleteAction(id){\n\t\tlet kparams = {};\n\t\tkparams.id = id;\n\t\treturn new kaltura.RequestBuilder('contentdistribution_distributionprofile', 'delete', kparams);\n\t}",
"static deleteAction(id){\n\t\tlet kparams = {};\n\t\tkparams.id = id;\n\t\treturn new kaltura.RequestBuilder('contentdistribution_gen... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Handler for when an issue in the issue summary table is clicked. This will expand the review entry that contains the comment for the issue, and navigate to the comment. Args: params (object): Parameters passed to the event handler. | _onIssueClicked(params) {
const prefix = commentTypeToIDPrefix[params.commentType];
const selector = `#${prefix}comment${params.commentID}`;
this._entryViews.forEach(entryView => {
if (entryView.$el.find(selector).length > 0) {
entryView.expand();
}
... | [
"function TKR_openIssueUpdateForm() {\n TKR_showHidden($('makechangesarea'));\n TKR_goToAnchor('makechanges');\n TKR_forceProperTableWidth();\n window.setTimeout(\n function () { document.getElementById('addCommentTextArea').focus(); },\n 100);\n}",
"function openForReview(event) {\n var revision... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Checks that the batch proof is welldefined | function isBatchProofCompleteAndSane(bp, chkM, chkZ) {
// Check commitments are present
let G = bp.P.G;
let H = bp.P.H;
if (!G || !H) {
console.error(NO_COMMITMENTS_ERR);
return false;
}
// Check that point sets are present and correct
let lenM = bp.M.length;
let lenZ = b... | [
"function PunishmentCheck() {\r\n // We check if a restraint is invalid\r\n for (let i = cursedConfig.punishmentRestraints.length - 1; i >= 0; i--) {\r\n if (!Asset.find(A => A.Name === cursedConfig.punishmentRestraints[i].name && A.Group.Name === cursedConfig.punishmentRestraints[i].group)) {\r\n delete ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Whether this portal is attached to a host. | get isAttached() {
return this._attachedHost != null;
} | [
"get dedicatedHostsSupported() {\n return this.getBooleanAttribute('dedicated_hosts_supported');\n }",
"isDetached() {\n return !this.isAttached();\n }",
"static isDetached() {\n return !this.isAttached();\n }",
"function isLocalhost(){\n return window.location.origin.includes... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Called when no organization was found | function noOrganizationFound() {
var param = retrieveParam();
if (param) {
$("#searchResultContainer").append("<h1> Fant ikke noen bedrift med organisasjonsnummer: " + param[1] + "</h1>");
} else {
$("#searchResultContainer").append("<h1> Fant ikke noen bedrift med organisasjonsnummeret </h1... | [
"fetchOrgs() {\n this.orgsSerivce.find({query: this.defaultQuery})\n .then(message => {\n this.setState({orgs: message.data, orgsLoaded: true});\n })\n .catch(err => {\n printToConsole(err);\n displayErrorMessages('fetch', 'organizers', err, this.updateMessagePanel, 'reload');... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Update the regions on canvas as they move around when zooming | function redraw_regions(){
Object.keys(wavesurfer.regions.list).forEach(function (key) {
wavesurfer.regions.list[key].updateRender();
});
} | [
"function redraw() {\n updateMapUnits();\n calcFog();\n updateMap();\n updateControlPanel();\n}",
"initializeZoomer() {\n this.canvasRect = this.canvas.getBoundingClientRect();\n this.originX = 0; // the X origin of the canvas\n this.originY = 0; // the Y origi... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
===================================================================== Parses through all rows and uses SetRowColor to set the color ===================================================================== | function SetAllRowColors()
{
var rows = iDoc.getElementById("dataTable").rows;
for (var i = 1; i < rows.length; i++)
{
SetRowColor(rows[i]);
}
} | [
"function SetRowColor(row)\r\n{\r\n if (row.getAttribute(\"selected\") == 1)\r\n {\r\n StyleSetAttributes(row, \"background-color: yellow;\");\r\n }\r\n else if (row.rowIndex % 2 == 1)\r\n {\r\n //StyleSetAttributes(row, \"background-color: lightgoldenrodyellow;\");\r\n StyleSetA... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Recursively walk the tree of module dependencies to find one matching moduleName and return its canonicalDir | function findCanonicalDir(dependencies, moduleName) {
var module = dependencies[moduleName];
if (module) {
return module.canonicalDir;
} else {
// slightly awkward recursion mechanism that returns the
// canonicalDir of the first matching module
var foundDir;
Object.k... | [
"function getEntryPointSubpath(moduleName) {\n return moduleName.slice(`${metadata.npmPackageName}/`.length);\n }",
"function lookupPackage(currDir) {\n // ideally we stop once we're outside root and this can be a simple child\n // dir check. However, we have to support modules that was sy... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
resume the previously paused audio track | function resumeTrack() {
if (current_track_id !== null) {
audioTracks[current_track_id].play();
}
} | [
"resume() {\n this.paused_ = false;\n this.resetAutoAdvance_();\n }",
"pauseSong() {\n this.paused = true;\n pauseSpin();\n currAudio.pause();\n }",
"function resumeAudioVideo() {\n var audioConfig = onHold() ? 4 /* NO_ACTIVE_MEDIA */ : 3 /* BOTH */;\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Connects to Firebase with the appID and key. If no key is provided, it simply uses anonymous authentication. | function startFirebase() {
console.log('[startFirebase]');
if (fbRef) {
stopFirebase();
}
var fbURL = 'https://' + settings.appID + '.firebaseio.com/';
fbRef = new Firebase(fbURL);
fbRef.authAnonymously(onFirebaseConnected);
} | [
"function firebaseAuth() {\n var firebaseAuth = require(\"firebase\");\n var config = {\n apiKey: \"AIzaSyCf8FWItY_h43oS9KfJdvcDrvULZ3xLx0E\",\n authDomain: \"waterleveldetector-db2b3.firebaseapp.com\",\n databaseURL: \"https://waterleveldetector-db2b3.firebaseio.com\",\n storageBucket: \"waterlevelde... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Loads master timetable json into variable | function loadTimetable(data) {
timetable = JSON.parse(data);
updateDate();
updateTime();
} | [
"function LoadJson(){}",
"load(){\n const file_name = \"hashdumpyard.json\"\n const fs = require('fs')\n const dumped = fs.readFileSync(file_name)\n this.primary_table = JSON.parse(dumped).primary_table\n this.slot_size = this.primary_table.length\n this.processed = true\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
nlNL validation function (Burgerservicenummer (BSN) or Rechtspersonen Samenwerkingsverbanden Informatie Nummer (RSIN), persons/entities respectively) Verify TIN validity by calculating check (last) digit (variant of MOD 11) | function nlNlCheck(tin) {
return algorithms.reverseMultiplyAndSum(tin.split('').slice(0, 8).map(function (a) {
return parseInt(a, 10);
}), 9) % 11 === parseInt(tin[8], 10);
} | [
"function validar_RUC_2(ruc) {\n //Valida dimension\n if (ruc.length != 13) {\n return 0;\n } else {\n let dos_primeros_digitos = parseInt(ruc.slice(0, 2));\n //Valida dos primeros digitos\n if (dos_primeros_digitos < 1 && dos_primeros_digitos > 22) {\n return 0;\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
deregister clears the client's websocket registration. We keep the client around until after a timeout, so that users roaming between networks can seamlessly reconnect. | deregister(clientID, ws) {
var c = this.clients.get(clientID);
if (c && c.registeredOf(ws)) {
c.deregister();
c.setTimer(setTimeout(() => this.removeIfUnregistered(c), this.registerTimeout));
debug("Deregistered client %s from room %s", clientID, this.id);
}
} | [
"deregister() {\n if (this.ws) {\n this.ws.close();\n this.ws = null;\n }\n }",
"teardownWebsocket() {\n if (this.websocket !== undefined) {\n this.websocket.removeAllListeners('open');\n this.websocket.removeAllListeners('close');\n this.websocket.removeAl... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
show tooltip of vertices | function verticesTooltipShow(d)
{
vis.verticesTooltip.style("opacity", 0.9) .style("position", "absolute")
.html("<strong>Value</strong>: " + d + "<br />" +
"<strong>Description</strong>: " + d + "<br />")
.style("left", (d3.event.pageX) + "px")
.style("top", (d3.... | [
"function verticesTooltipHide() {\n vis.verticesTooltip.style(\"opacity\", 0);\n }",
"function showTooltip(content, event) {\n tt.style('opacity', 1.0)\n .style('pointer-events', 'all')\n .html(content);\n\n updatePosition(event);\n }",
"function ToolTips(){\n\t\n\t// connector divs\n\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Binds .showParts to display a qtip element | function bindPartsTooltip(){
$('.showParts').each(function(){
var parts = $(this).next('.parts')[0];
if(parts){
var button = this;
$(button).click(function(){
$(parts).toggle();
});
}
});
} | [
"function showPart(questions) {\n var questionNumber = $questionsSelect.find(':selected').text();\n if (questions) {\n var numParts = questions[questionNumber - 1];\n $partsSelect.html(optionsTemplate({length: numParts}));\n }\n getPagesForQuestionPart();\n }",
"function showTooltip(e, opti... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
handle profile section visibility on profilebtn click | _onProfileBtnClick() {
// toggle the visibility of authedUser component
this._componenets.authedUser.hidden = !this._componenets.authedUser.hidden
} | [
"function toggleProfileView() {\n var profileContainer = _$('.profile-container')\n var profileEditor = _$('.profile-editor')\n profileContainer.classList.toggle('d-none')\n profileContainer.classList.toggle('d-inline')\n profileEditor.classList.toggle('d-none')\n profileEditor.classList.toggle('d-inline')\n}... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Adds default parameters like page count/number. | addDefaultParameters() {
// for (let parameterData of[{ name: 'page_count', type: Parameter.type.number, eval: false, editable: false, showOnlyNameType: true }, { name: 'page_number', type: Parameter.type.number, eval: false, editable: false, showOnlyNameType: true }]) {
// let parameter = new Param... | [
"static get defaultParameters () {\n return {\n paginate: true,\n limit: 10,\n offset: 0,\n orderDirection: 'ASC',\n multipleOrderColumns: false\n };\n }",
"page(n = 1) {\n return this.addOption('page', n);\n }",
"getPagingParams... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
send a room invite code to a list of recipients | function sendRoomInvite(recipients, roomID, invitationCode) {
// create link
const link = `${process.env.DOMAIN}/join-room/${invitationCode}/${roomID}`;
// set mail options
const mailOptions = {
from: 'hi@klourly.com', // sender address
to: recipients, // list of receivers
subj... | [
"function sendInvites(json, statusText) {\n\t$(\"table.team tr:last\").after(json.members_html);\n for (i = 0; i < json.members_ids.length; i++) {\n\t\t$(\"#member_\"+ json.members_ids[i]).highlightFade({start: '#FFFF99', speed: 2000});\n\t $(\"#member_\"+ json.members_ids[i] +\" a.tip\").link_tips();\n\t};\n\t$(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Types: i is integer, j is integer, hostname is string, port is integer, ssl is boolean, result is HTMLElement. Pure function. | function createServerRow(i, j, hostname, port, ssl) {
var li = document.createElement("li");
var input = document.createElement("input");
input.type = "text";
input.value = hostname;
input.placeholder = "hostname.irc.example.com";
li.appendChild(input);
li.appendChild(textNode(" "));
input = document.cr... | [
"function displayConnections() {\n console.log(\"\\nid:\\tIP Address\\t\\tPort No.\");\n for (i = 0; i < clientSockets.length; i++) {\n var ip = clientSockets[i].request.connection._peername.address;\n\n if (ip == '127.0.0.1') {\n ip = clientIP;\n }\n var port = clientSo... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This function will make change to timeStampData, eliminating negative Points value . Combine Index holding negative Points value to the smaller Index that hold the same payer . | function removeNegativePoints(transactionObj) {
let negativePoints = transactionObj.points
// Find the Negative Points position
for(let i = 0; i < timeStampData.length; i++) {
if (timeStampData[i].points == transactionObj.points) {
var tempPosition = i
timeStampData... | [
"function spendPoint(point) {\r\n let spendList = []\r\n // Assuming point is larger than 0\r\n while (timeStampData.length > 0 && point > 0) {\r\n if ( (point - timeStampData[0].points) >= 0) {\r\n point = point - timeStampData[0].points;\r\n updateData(timeStampData[0], timeS... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
search for node check if current val equal val if so, delete val else search(val) edge case: delete a root if its a root else set relationship from parent L, R case 1: check if its leaf, if so delete if which pointer do we swap if the parent's left = val, then set that one parent['right] = null case 2: has 1 node check... | delete(val) {
debugger
let currentNode = this.root;
let found = false;
let nodeToRemove;
let parent = null;
// find the node we want to remove
while (!found) {
if (currentNode === null || currentNode.val === null) {
return 'the node was not found'
}
if (val === cur... | [
"function solution_1 (root, key) {\n if (!root) return null; // EDGE CASE: empty input\n \n // `find` UTILITY FUNCTION - recursively searches input tree for a node with value matching `key`.\n // if such a node exists, returns an array containing (1) the node, and (2)... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
function : Job_partial_page_setup parameter : what does this function do : Job partial page constructor | function Job_partial_page_setup() {
$("#show_msg_btn").click(function () {
show_message(1, $('#fixed_info_tab').data('process_name'));
});
$("#job_load_more").bind("click", { curPage: more_info_accumulate_page }, function (event) {
show_job((event.data.curPage + 1), $('#fixed_info_tab').data... | [
"function Msg_partial_page_setup() {\n $(\"#show_jobs_btn\").click(function () {\n show_job(1, $('#fixed_info_tab').data('process_name'));\n });\n $(\"#msg_load_more\").bind(\"click\", { curPage: more_info_accumulate_page }, function (event) {\n show_message((event.data.curPage + 1), $('#fixe... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
films is an array of film objects genre is a string indie_reel_rating is an integer imdb rating is a double start and end years are integers | function filterFilms(films, genre, indie_reel_rating, imdb_rating, start_year, end_year) {
const genre_match = function (movie) {
return movie.type === genre;
};
const falls_within_year_range = function (movie) {
const movie_year = parseInt(movie.year)... | [
"function genreMatch(genre) {\n\n\t\t\t\t\tvar g = data\n\t\t\t\t\t\t.filter(function(el) { return el.genre_main === genre; })\n\t\t\t\t\t\t.map(function(elt) { return elt.movie; });\n\n\t\t\t\t\treturn g;\n\t\t\t\t\n\t\t\t\t} // genreMatch()",
"function Film(title,plot,year){\n this.title = title\n this.pl... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Load properties from the Item base object, then load the typespecific properties. | function loadProps() {
var item = Office.context.mailbox.item;
$('#dateTimeCreated').text(item.dateTimeCreated.toLocaleString());
$('#dateTimeModified').text(item.dateTimeModified.toLocaleString());
$('#itemClass').text(item.itemClass);
$('#itemId').text(item.itemId);
$(... | [
"function loadMessageProps(item) {\n $('#message-props').show();\n\n $('#attachments').html(buildAttachmentsString(item.attachments));\n $('#cc').html(buildEmailAddressesString(item.cc));\n $('#conversationId').text(item.conversationId);\n $('#from').html(buildEmailAddressString(i... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Backtrack from the last checked node to find the path | function backtrackPath(last_node){
var path = [];
var temp = last_node;
path.push(temp);
while(temp.previous){
path.push(temp.previous);
temp = temp.previous;
}
return path;
} | [
"get nextPath() { return this.next && this.next.path }",
"previous() {\n let tmp = this.currentNode.previous();\n if (!tmp.done) {\n this.currentNode = tmp.value;\n this.currentNode.clearChildren();\n //this.currentNode.children.forEach((child) => child.clearChildren());\n console.log(\"... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
The bill received calling getBill only gives us the url of its sponsor. We want his/her name and party | function getSponsor(proposedByUrl, callback) {
var path = proposedByUrl.slice(0, -1);
makeRequest(path, function(err, politician){
if(err){
callback(err);
}
else{
var proposedBy = politician.name;
var partyOfSponsor = politician.memberships[0].party.short_name.en;
callback(null... | [
"GiveAccessToAllEntriesOfTheBill(billId) {\n let url = `/me/bill/${billId}/details`;\n return this.client.request('GET', url);\n }",
"function buildSponsorHeader(sponsor){\n return ' <h5 class=\"chapter-name\"> \\\n <strong>' + sponsor + '</strong> \\\n</h5> \\\n';\n}",
"payeeName(id) {\n l... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Complete the miniMaxSum function below. | function miniMaxSum(arr) {
const results = arr.reduce((acc, curr, i, arr) => {
if (acc.min >= curr) {
acc.min = curr
}
if (acc.max <= curr) {
acc.max = curr
}
acc.sum += curr
return acc
}, {
min: 1000000000,
max: 0,
sum: 0
})
console.log(results.sum - results.max,... | [
"function sumMinMax(arr) {\n let max = maxArray(arr);\n let min = arr[0];\n for (let i = 1; i < arr.length; i++) {\n if (arr[i] < min) {\n min = arr[i];\n }\n }\n return min + max;\n}",
"function maxSum(arrOfIMW){\n// \twill be strings, make nums\n\tlet toNums = convertToInts(arrOfIMW)\n\n cons... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
remove platformsdirectory and add the platforms from scratch | function refreshPlatforms(platforms) {
if(platforms === undefined) return;
deleteDirSync("platforms");
if(platforms.indexOf("a") !== -1)
runShell("npx ionic cordova platform add android");
if(platforms.indexOf("i") !== -1)
if (OS.platform() === "darwin") runShell("npx ionic cordova pla... | [
"function deletePlatform(){\r\n var platforms = svgdoc.getElementById(\"platforms\");\r\n \r\n for (var i = 0; i < platforms.childNodes.length; i++) {\r\n var platform = platforms.childNodes.item(i);\r\n\r\n if(platform.getAttribute(\"delete\") == \"true\") {\r\n platforms.removeCh... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Make a matrix zero | function makeZero() {
var m = arguments[0];
var rows = m.length;
var cols = m[0].length;
for(var r = 0; r < rows; r++) {
for(var c = 0; c < cols; c++) {
m[r][c] = 0;
}
}
} | [
"function createZeroMatrix() {\n\t\tvar rows = arguments[0];\n\t\tvar cols = arguments[1];\n\t\tvar m = [];\n\t\tfor(var r = 0; r < rows; r++) {\n\t\t\tvar row = [];\n\t\t\tfor(var c = 0; c < cols; c++) {\n\t\t\t\tvar col = 0;\n\t\t\t\trow.push(col);\n\t\t\t}\n\t\t\tm.push(row);\n\t\t}\n\t\treturn m;\n\t}",
"load... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
exportSettings defines the output configuration for the exported mp4 file | function exportSettings() {
// bitrate in MB/sec
let bitrate = 1.25
return {
video: {
averageBitRate: bitrate * 1000 * 1000 * 8, // convert to bits per second
profileLevel: "H264High41"
},
audio: {
numberOfChannels: 2,
sampleRate: 4410... | [
"function createFileExportConfig(filepathFormatString, pinID, selectedConfig) {\n\t// map viewModel to plain object\n\tvar config = JSON.parse(JSON.stringify(configFileExportTemplate)); // configFileExportTemplate is loaded in OutputDataRecorder with command \"<script type=\"text/javascript\" src=\"js/OutputDataRec... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
function : pub_publish() Params : pub_msg > publish message Channel : 'publish_device_status' Description : Publishes the bulb status to the nodejs server | function pub_publish(pub_msg){
pubnub.publish({
message: pub_msg,
channel: 'publish_device_status',
storeInHistory: true, //override default storage options
});
console.log(pub_msg)
} | [
"publishAvailability(isAvailable) {\n if(this.client.deviceConfig.availability_topic) {\n if(isAvailable)\n this.client.publish(this.client.deviceConfig.availability_topic, this.client.deviceConfig.payload_available, { \"retain\": true } ); \n else\n this... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Insert task into database params: owner,content of task and if task is completed | insert(user,content,completed,callback){
this.connection.query("insert into task (userTask,taskText,completed) values ('"+user+"','"+content+"','"+completed+"')", function(err,task){
if(err){
callback(err);
}else{
callback(null,task);
}
});
} | [
"insert(task, date, process) {\n let sql = `\n INSERT INTO tasks(task, date, process)\n VALUES (?, ?, ?)\n `;\n return this.dao.run(sql, [task, date, process]);\n }",
"async function postTask(req, res){\n\n let task = new Task()\n\n task.project = req.body.project\n task.name = req.bo... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
color_map loops over the data points in the JSON string (passed as an argument). For each country (i.e., for each data point), the correct ID is obtained (see get_country_id), and this ID is used to locate the appropriate path. The fill style of a path is adjusted to reflect the data (i.e., population) by color coding. | function color_map(json) {
data_points = json.points;
for(var i = 0; i < data_points.length; i++) {
var data_point = data_points[i];
var country = data_point[0];
var country_id = get_country_id(country);
if(!country_id) {
console.log("No id found for: " + country);
} else {
var population = Number(... | [
"function assignStyle(geojson) {\n for (let e in geojson.features) {\n let d = geojson.features[e].properties['DIST'];\n let color;\n switch(parseInt(d)) {\n case 1:\n color = \"#800000\";\n break;\n case 2:\n color = \"#8080... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
function to load [Divisions] drop down options | function loadDivDDOptions(ddID, selectedOption, parentDDID, incInactive, loadAll, postTo) {
parentDDID = parentDDID || '';
loadAll = loadAll || -1;
incInactive = incInactive || -1;
postTo = postTo || '/api/divisionsdropdown';
var parentDDVal = $('#'+parentDDID).val();
//console.log('parentDDVal... | [
"function loadSolutionSelectData() {\n \"use strict\";\n createS_Option();\n}",
"function load_drives_dropdown(){\n\tif ( $(\".assembly_constituency_dropdown\").val() != '' )\n\t{\n\t\tif (typeof(loadMyDrives) === 'function') {\n\t\tloadMyDrives()\n\t\t}\n\t}\n\t}",
"function loadHRPeopleOptions(ddID, se... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Search and Replace version in entry file | _searchAndReplaceEntry(callback) {
/**
* Checks the entry html file for relative script, or link Paths.
* If a match is found, it will prepend the version to the beginning
* of the path.
*/
replace({
files: `${this.buildPath}/${this.options.entryHtml}`,
replace: /(src="|href=")(... | [
"function update_package_file_version() {\r\n\tconst package_file_path = library_base_directory + 'package.json';\r\n\tlet package_file_content = CeL.read_file(package_file_path).toString()\r\n\t\t// version stamp\r\n\t\t.replace(/(\"version\"[\\s\\n]*:[\\s\\n]*\")[^\"]*(\")/, function (all, header, footer) {\r\n\t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Find and run all script tags with type="text/jsx". | function runScripts() {
var scripts = document.getElementsByTagName('script');
// Array.prototype.slice cannot be used on NodeList on IE8
var jsxScripts = [];
for (var i = 0; i < scripts.length; i++) {
if (/^text\/jsx(;|$)/.test(scripts.item(i).type)) {
jsxScripts.push(scripts.item(i));
}
}
... | [
"function getJsxTokens(acorn) {\n acorn = acorn.Parser.acorn || acorn;\n let acornJsx = acornJsxMap.get(acorn);\n\n if (!acornJsx) {\n const tt = acorn.tokTypes;\n const TokContext = acorn.TokContext;\n const TokenType = acorn.TokenType;\n const tc_oTag = new TokContext('<tag', false);\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Generic function to load the conttent into the modal. Get the product name, the button pressed, and load the image into the modal. | function loadCustomLightbox(product, button) {
var imgLocation;
if (button === "example") {
imgLocation = window.LightboxRoot + product + '-examples.jpg'
} else if (button === "moreInfo") {
imgLocation = window.LightboxRoot + product + '-box.jpg'
} else if( button... | [
"function registerViewImage() {\n $('.viewImage').click(function ($event) {\n $event.preventDefault();\n var $modal = $('#viewImageModal');\n $('#viewImageModalImage').attr('src', $(this).data('url'));\n $modal.modal('show');\n });\n}//E# registerViewImage() function",
"function ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Definition Created and returns a three.js mesh object of the given color and size specified as inputs. This cube represents the visual part of a piece object. The mesh object has a box geomerty and mesh phong material Input size: Integer, color: String (RGB value ex: 'rgb(211,211,211)') Output mesh: THREE.Mesh() | CreateCube(size, color) {
let geometry = new THREE.BoxGeometry(size,size,size);
let material = new THREE.MeshPhongMaterial({ color: color });
let mesh = new THREE.Mesh(geometry, material);
mesh.castShadow = true;
this.PaintPiece(mesh, color);
return mesh;
} | [
"static createMaterial (scene, type, color = null) {\n const material = new BABYLON.PBRMaterial('material', scene)\n material.sideOrientation = 0\n\n if (color) {\n material.albedoColor = BABYLON.Color3.FromHexString(color).toLinearSpace() \n }\n \n switch (type) {\n case 'metalic':\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
our prestep is to process inputs that are "currently pressed" during the game step | preStep() {
if (this.controls) {
if (this.controls.activeInput.up) {
this.sendInput('up', { movement: true })
}
if (this.controls.activeInput.left) {
this.sendInput('left', { movement: true })
}
if (this.controls.activeInput.right) {
this.sendInput('right', { ... | [
"function processInput() {\r\n\t\r\n\tvar time = 500;\r\n\tif (isAnswer()) {\r\n\t\tconsole.log('isAnswer');\r\n\t\r\n\t} else if(isRepeat()){\r\n\t\tconsole.log('isRepeat');\r\n\t\t\r\n\t} else if (isTrigger()) {\r\n\t\tconsole.log('isTrigger');\r\n\t\t\r\n\t} else if (includeKey()) {\r\n\t\tconsole.log('includeKe... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
added captured_piece_id for enpassant case | function capture(capturing_piece_id,square,type=""){
const draggableElement = document.getElementById(capturing_piece_id);
let sqtarget_id = square.id
let sqtarget_letter = sqtarget_id.slice(0,1);
let sqtarget_letter_digit = getCodeFromLetter(sqtarget_letter);
let sqtarget_num = parseInt(sqtar... | [
"function performEnPassant(piece, target) {\n if(piece.getId()[0] != 'P')\n return false;\n var currentSpace = piece.getLocation(),\n y1 = currentSpace[1],\n y2 = target.id[1],\n x1 = currentSpace[0].charCodeAt(),\n x2 = target.id[0].charCodeAt(),\n spaceInFrontOfTarg... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Enter a parse tree produced by KotlinParsertypeTest. | enterTypeTest(ctx) {
} | [
"consoleParsePtypes(input) { return Parser.parse(input, { startRule: 'PTYPES' }); }",
"enterParenthesizedType(ctx) {\n\t}",
"consoleParseTypes(input) { return Parser.parse(input, { startRule: 'TYPES' }); }",
"static parseNode(ASTNode) {\n\n // To see all available types:\n // http://esprima.read... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sends a message to the server via sockets | function sendMessageToServer(message) {
socket.send(message);
} | [
"function emit(message) { // ...arguments\n\n if (!message) { console.warn(\"SocketHandler.emit\", \"Invalid message\"); return; }\n if (!ws) { console.warn(\"SocketHandler.emit\", \"No ws object\" ); return; }\n if (ws.readyState !== WebSocket.OPEN) {... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
returns a copy of the network | clone() {
var newNetwork = new Network();
newNetwork.nodeNumber = this.nodeNumber;
for (let layer = 0; layer < this.nodes.length; layer++) {
newNetwork.nodes.push([]);
for (let node = 0; node < this.nodes[layer].length; node++) {
newNetwork.nodes[layer].push(this.nodes[layer][node].cl... | [
"static get network()\n\t{\n\t\treturn network;\n\t}",
"clone() {\n var clone = new Player();\n clone.brain = this.brain.clone();\n clone.fitness = this.fitness;\n clone.brain.generateNetwork();\n clone.gen = this.gen;\n clone.bestScore = this.score;\n return clone;\n }",
"copy() {\n co... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
function to create table for Resort Name, with columns Run and difficulty within | function createResortTable(resort) {
let table = document.createElement('table');
table.setAttribute('class', 'table table-bordered');
let row = table.insertRow(0);
let nameColumn = document.createElement('th');
let difficultyColumn = document.createElement('th');
nameColumn.innerHTML = "Run Nam... | [
"function createResortRow (resort, table, run) {\n let row = table.insertRow(2);\n row.insertCell(0).innerHTML = run.name;\n row.insertCell(1).innerHTML = run.difficulty;\n let actions = row.insertCell(2);\n actions.appendChild(createDeleteRowButton(resort, run))\n}",
"function createRCWTable(){\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
//////// ROOMS //////////// /////////////////////////// this function is called from go() when the player enters a room. It updates the currentRoom, and displays its information to the user. If the player entered the treasure room, it deems the game as won. if the player enters the shack, it ends the game. | enterRoom(roomName) {
console.log("Player moved from " + this.world.rooms[this.currentRoom].id + " to " + roomName + '\n');
// updates currentRoom
this.currentRoom = this.roomIndex(roomName);
if (this.world.rooms[this.currentRoom].status == "won") {
// if they won the ga... | [
"function goToRoom(newRoom)\n{\n\t// As soon as it's entered, the new room's description is printed.\n\tlookAtRoom(newRoom);\n\t// The current room is set to the newly entered room.\n\tcurrentRoom = newRoom;\n}",
"actionDoor(sprite, door) {\n this.lastZoneMove = this.game.time.now;\n var nextRoomId ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
calls the function set from outside to take care of importing from CMS, if one was set | importFromCMS() {
if (window.iotDB.onLoadConfig) {
window.iotDB.onLoadConfig();
}
} | [
"mark () {\n\t\tthis.module.importedByBundle[ this.originalName ] = true;\n\t\tthis.modifierStatements.forEach( stmt => stmt.mark() );\n\t}",
"importing() { if (this.isSearchUI()) { MySearchUI.importing(); } }",
"[dataImportHandler]() {\n this.refreshProjects();\n if (super[dataImportHandler]) {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
hide tooltip of vertices | function verticesTooltipHide() {
vis.verticesTooltip.style("opacity", 0);
} | [
"function verticesTooltipShow(d) \n {\n \n\n vis.verticesTooltip.style(\"opacity\", 0.9) .style(\"position\", \"absolute\")\t\n .html(\"<strong>Value</strong>: \" + d + \"<br />\" +\n \"<strong>Description</strong>: \" + d + \"<br />\")\n .style(\"left\", (d3.event.pageX) + \"p... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Stringify table. Creates a fenced table. The table has aligned delimiters by default, but not in `tablePipeAlign: false`: ```markdown | Header 1 | Header 2 | | :: | | | Alpha | Bravo | ``` The table is spaced by default, but not in `tableCellPadding: false`: ```markdown |Foo|Bar| |::|| |Baz|Qux| ``` | function table(node) {
var self = this
var options = self.options
var padding = options.tableCellPadding
var alignDelimiters = options.tablePipeAlign
var stringLength = options.stringLength
var rows = node.children
var index = rows.length
var exit = self.enterTable()
var result = []
while (index--)... | [
"function printTable(options, data) {\n// Calculate widths for each column\n let fieldMax = []\n options.fields.forEach((field, i) => {\n fieldMax[i] = Math.max.apply(Math,data.map(function(item) {\n return item[field].toString().length\n }))\n })\n const leftLength = Math.max(fieldMax[0], options.he... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns a single guild's achievements by name and realm. | getGuildAchievements(realmSlug, guildName) {
return __awaiter(this, void 0, void 0, function* () {
return yield this._handleApiCall(`/data/wow/guild/${realmSlug}/${guildName}/achievements`, 'Error fetching guild achievements.');
});
} | [
"async function fetchGameAchievements(accountId, gameId) {\n const achievementData = await getClient()\n .getGlobalAchievements(gameId)\n .then((result) => {\n return result.data.achievements\n })\n const game = await getClient()\n .getOwnedGames(accountId, [gameId], true)\n .then((result) => ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Process the reviews and put the content in the target element If there are no reviews a message is displayed | function parseReviews(data, target) {
var reviews;
$(target).empty();
reviews = $(data).find("review");
if(reviews.length === 0){
$(target).append("<p>No reviews for this movie.</p>");
}else {
$(data).find("review").each(functio... | [
"function fillReviewsHTML(reviews = self.restaurant.reviews) {\n const container = document.getElementById('reviews-container');\n const title = document.createElement('h2');\n title.innerHTML = 'Reviews';\n title.tabIndex = 0;\n container.appendChild(title);\n\n if (!reviews) {\n const noReviews = documen... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Move ruler to new position p. | function moveRuler(ctx, p) {
const oldpos = {x: ruler.x, y: ruler.y};
clear(ctx, ruler);
ruler.x = p.x;
ruler.y = p.y;
getRulerCorners();
draw(ruler, rulerCanvas);
} | [
"function rotateRuler(ctx, p, leftHandle = true) {\n const oldpos = { x: triangle.x, y: triangle.y };\n const oldAngle = ruler.angle;\n clear(ctx, ruler);\n\n // Compute rotation center p0 and baseline angle diff.\n const p0 = leftHandle ? ruler.ne : ruler.nw;\n const baseA... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return the Tracker for a particular sheet. | function getTrackerForSheet(sheet) {
var sheetId = sheet.getSheetId();
if (sheetId in TRACKERS_BY_SHEET) {
return TRACKERS_BY_SHEET[sheetId];
}
var properties = loadSheetProperties(sheetId);
if (properties == null) {
return null;
}
var newTracker = new Tracker(sheet, properties);
TRACKERS_BY_SHE... | [
"async function getInfoAboutSpreadSheet() {\n try {\n return googleSheetsDocument.getInfoAsync();\n } catch (error) {\n console.log(\"Get information error\", error);\n }\n}",
"function articleSheet(){\n if(!articleSheetInstance) articleSheetInstance = sheet(\"articles\")\n return articleSheetInstance\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
function to create matrix column option | function createMatrixColumnOption() {
var asseturl = document.getElementById('asseturl').value;
$('<li style="border:none; margin: 0px; padding-bottom: 5px;" id="matrix_column_' + matrixColumnCounter + '"><input name="matrix_column_' + matrixColumnCounter + '" type="text" value="" style="width: 95%;"><div class... | [
"setMatrixSelectValues() {\n // generate the matrix names based on the number of matrix inputs, e.g. A, B, C...\n const names = this.matrixInputs.map((_, i) => String.fromCharCode('A'.charCodeAt(0) + i));\n let options = \"\";\n names.forEach((name, i) => options += `<option value=${i}>${name}</... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Wrap a function in debouncing trigger function. A requestAnimationFrame() is scheduled after the first schedule() call, and subsequent schedule() calls will be ignored until the animation callback executes. | function debouncedAnimationFrame(cb) {
return buildScheduler(function (cb) { return requestAnimationFrame(cb); }, cb);
} | [
"function debounceFunction(fn, delay) {\n let timeoutID;\n\n return function(...args){\n if (timeoutID) {\n clearTimeout(timeoutID)\n }\n timeoutID = setTimeout(() => fn(...args), delay)\n }\n}",
"function debounce() {\n var date = Date.now();\n return function(timeT... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
stores stuff in the frozen directory | function store(scriptname, parsetree, callback){
if(path.extname(scriptname) === '.js'){
scriptname = path.basename(scriptname, '.js')
scriptname += '.json'
fs.writeFile(path.join(__dirname,'../icebox/frozen/',scriptname), JSON.stringify(parsetree,null,4), function(err){
if(err){callback(false); throw err... | [
"static persist() {\n let questionsJson = JSON.stringify(questions);\n fs.writeFileSync(storagePath, questionsJson, 'utf-8');\n }",
"storeState(){\n if(this.storePath()){\n storeLocal(this.storePath(), this.state)\n }\n }",
"function saveState(){\n writeToFile(use... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Network with timeout loading strategy, and update logic. Attempts to load from the network, with a timeout. If the timeout happens, it loads from cache immediately, or waits for network if the resource isn't in the cache. In parallel, it caches the new network response (if successful). | function networkWithTimeoutAndUpdate(event) {
const cached = fromCache(event.request);
const network = fetch(event.request);
const networkClone = network.then(response => response.clone());
event.respondWith(promiseAny([
networkClone.catch(() => cached),
wait(TIMEOUT).then(() => cached)
]));
event.... | [
"async function fetchNetworkResource(request) {\n try {\n // Try to load from the network by default\n const networkResponse = await fetch(request);\n\n // If the response was good, clone it and store it in the cache.\n if (networkResponse.status === 200 || networkResponse.status === 0) {\n const ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Append service specific keys in meta | _appendSpecificMetaData(meta) {
return meta;
} | [
"addFormMetadata() {\n if (this.evidence.metadata) {\n for (let key in this.metadata) {\n let idx = this.evidence.metadata.findIndex(obj => obj.name === key);\n if (idx >= 0) {\n this.evidence.metadata[idx].value += this.metadata.key;\n } else {\n this.evidence.metadat... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Helper function to make an API request to generate a tracer payload from a tracer string. | function generateTracerPayload(tracerString) {
return fetch(
`http://127.0.0.1:8081/tracers/generate?tracer_string=${tracerString}&url=${
document.location
}`,
{
headers: {
Hoot: "!",
"X-TRACY": "NOTOUCHY"
}
}
);
} | [
"function eventToSentryRequest(event, api) {\n // since JS has no Object.prototype.pop()\n var _a = event.tags || {}, samplingMethod = _a.__sentry_samplingMethod, sampleRate = _a.__sentry_sampleRate, otherTags = Object(tslib__WEBPACK_IMPORTED_MODULE_0__[\"__rest\"])(_a, [\"__sentry_samplingMethod\", \"__sentr... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |