query
stringlengths
9
34k
document
stringlengths
8
5.39M
negatives
listlengths
19
20
metadata
dict
Calls the willTransitionTo hook of all handlers in the given matches serially with the transition object and any params that apply to that handler. Calls callback(error) when finished.
function runTransitionToHooks(matches, transition, query, callback) { var hooks = matches.map(function (match) { return function () { var handler = match.route.props.handler; if (!transition.isAborted && handler.willTransitionTo) handler.willTransitionTo(transition, match.params, query);...
[ "function runTransitionFromHooks(matches, transition, callback) {\n\t var hooks = reversedArray(matches).map(function (match) {\n\t return function () {\n\t var handler = match.route.props.handler;\n\n\t if (!transition.isAborted && handler.willTransitionFrom)\n\t return handler.willTransitionF...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Check if localStorage was last time updated today or not.
function isLastUpdateToday() { if (localStorage.getItem('catalogLastUpdate') === null) { return false; } else if (new Date().getDate() !== new Date(localStorage.getItem('catalogLastUpdate')).getDate()) { return false; } return true; }
[ "function time_since_last_update()\r\n{\r\n var last_update = localStorage.getItem(\"last_update\"); // Last update time\r\n last_update = last_update ? last_update : 0; // 0 if not yet stored\r\n\r\n return current_time() - last_update;\r\n}", "function checkRecentlyWatched() {\n if (localStorage...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
game object storing stores current control and tool object selected by user and include array of stamps selected by user.
function gameObject(){ this.stamps = new Array(); var currentControl= null; var currentTool = null; var stampcount = 0; this.addStamp = function(stampobj){ this.stamps[stampcount] = new stamp(); this.stamps[stampcount].shape = stampobj.shape; this.stamps[stampcount].size = stampobj.size; this.stamps[stampc...
[ "function saveToolRemember(toolname) {\n //var tool = getTool();\n //Number(sizemodifier.querySelector(\"[data-selected]\").id.replace(\"size\",\"\"));\n globals.toolRemember[toolname] = {\n \"sizemodifier\" : document.getElementById(\"sizemodifier\").querySelector(\"[data-selected]\").id,\n \"si...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Method used to remove trailing zeros after decimal point.
removeTrailingZeros(amount) { amount = amount.toString(); //console.log("Actual amount=>> ", amount); let regEx1 = /^[0]+/; // remove zeros from start. let regEx2 = /[0]+$/; // to check zeros after decimal point let regEx3 = /[.]$/; // remove decimal point. if (amou...
[ "function removeLeadingZeros(value) {\n var i = 0;\n var lastLeadingZeroPos = -1;\n for (i = 0; i < value.length; i++) {\n if (value.charAt(i) === '0') {\n\tlastLeadingZeroPos = i;\n } else {\n\tbreak;\n }\n }\n var result = value.substring(lastLeadingZeroPos + 1);\n // Add zero bef...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
add products to available product lists
function addProductLists(product){ productLists.push(product); }
[ "addProducts() {\n document.querySelector('#product-list').innerHTML = '';\n document.querySelector('#update').innerHTML = '';\n Product.all.forEach(\n product => (document.querySelector('#product-list').innerHTML += product.renderProduct())\n );\n }", "function appendProduct(product) {\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Ideate .findKey() [my solution]: testFunction added outside of _ object (above)
findKeyIdea (object, testFunction) { let returnValue = '' for (const key in object) { if (testFunction(object[key])) { returnValue = key } else { returnValue = undefined } } return returnValue }
[ "function keyLookup(key) {\n if (key == 'i') {\n return 73\n } else if (key == 'o') {\n return 79\n } else if (key == 'p') {\n return 80\n } else {\n return 'Error(keyLookup): No key match!'\n }\n}", "function inputElem_add_byKey(e) {\n\t\n}", "function findKey(record, predicate) {\n for (co...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Set event handlers for autocomplete list
function setAutocompleteListHandlers(list){ // Handle clicking on an autocomplete list option $(list).find('button').on('click', function(event){ selectAutocompleteOption(this); }); // Handle clicking outside of time picker/field $(document).on('mousedow...
[ "function setAutoComplete(arr) {\n searchInput.autocomplete({source: arr});\n}", "function init() {\n var elementsArray = getAllElementsFromSelectos(inputAutocompleteSelector);\n //addEventsToElements(elementsArray, \"keydown\", disableChatOnPressReturn);\n\n for (v...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Replaces the placeholders a given format with the given parameters.
function replace(format, params) { /*jslint unparam: true */ return format.replace(/\{([a-zA-Z]+)\}/g, function (s, key) { return (typeof params[key] === 'undefined') ? '' : params[key]; }); }
[ "function ReplaceParams() {\n var result = arguments[0];\n for (var iArg = 1; iArg < arguments.length; iArg++) { // Start at second arg (first arg is the pattern)\n var pattern = new RegExp('%' + iArg + '\\\\w*%');\n result = result.replace(pattern, arguments[iArg]);\n }\n return res...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Extracts all components. label_struct is the result of running labelComponents and is reused if possible
function splitConnectedComponents(volume, label_struct) { if(!label_struct) { label_struct = labelConnectedComponents(volume); } var count = label_struct.count , labels = label_struct.labels , components = new Array(count); for(var i=0; i<count; ++i) { components[i] = new core.Dynami...
[ "labeled() {\n return getLabels(this.grid);\n }", "generateLabels() {\n var filteredInstructions = [];\n var filteredIndex = 0;\n for (var i = 0; i < this.insns.length; ++i) {\n var lineNo = i + 1;\n var insn = this.insns[i];\n if (insn.indexOf('#') != -1)...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Updates the home score.
function setHomeScore(score) { if(score >= 0) { // teams may not have a score below zero snapshotState(); scoreBoard.homeScore = score; var update = { homeScore: score }; socket.emit('boardUpdate', update); } }
[ "function updateScore() {\n\n}", "function updateScore() {\n humanScoreSpan.innerHTML = humanScore;\n computerScoreSpan.innerHTML = computerScore;\n return;\n }", "updateScore() {\n this.serverComm.updateScore(this.userId, this);\n }", "set score(newScore) {\r\n score = newScore;\r\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Once Funder selection on homepage is made, run this function Be sure to rename all cta with unique IDs Update each unique ID with call to action text, replacing the text Funder mode is on!
function funderMode() { //If the URL contains the word 'capacity', use these CTAs if (window.location.pathname.match('capacity')) { document.getElementById("capacityOne").innerHTML = '<div class="cta">Funder mode on!</div>'; document.getElementById("capacityTwo").innerHTML = '<div class="cta">Funder mode ...
[ "function fillActions() {\n\tvar actions = pref.getPref(\"actions\");\n\tfor (var id in actions) {\n\t\tactions[id].id = id;\n\t\tcreateAction(actions[id]);\n\t}\n\n\tlog.info(\"opt-action:\",\n\t\t\"Preferences page is filled with actions.\"\n\t);\n}", "function iglooActions () {\n\t//we should have things like ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Name: Jainam Shah Purpose: To get service user background data for a client Params: client_id
async getUserBackground(clientId) { try { const client = await Client.query() .select( 'id', 'slug', 'service_user_weight', 'service_user_height', 'service_user_lastname', 'service_user_diet', 'service_user_physical_ability', ...
[ "function getClientById(id){\n var count = users.length;\n var client = null;\n for(var i=0;i<count;i++){\n \n if(users[i].userId==id){\n client = users[i];\n break;\n }\n }\n return client;\n}", "function getClient(id) {\n for (var i = 0; i < clients.l...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
function for removeProductLocalStorage > remove from the local storage
function removeProductLocalStorage(productId) { //get the local storage data let productsInStorage = getProductsFromStorage(); //loop through the array to find the index to remove productsInStorage.map(function (productInStorage, index) { if (productInStorage.productId === productId) { productsInStor...
[ "vaciarLocalStorage() {\n localStorage.clear();\n }", "function removeCurrentUserIDFromLocalStorage() \r\n{\r\n localStorage.removeItem(\"currentUserID\");\r\n}", "removeFromLocalStorage() {\n const artistsInStorage = localStorage.getItem(\"Artists\");\n let currentArray = [];\n if (artistsInSto...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Listen to server calls on the appropriate port number add a ride to the database under all rides and ride queue
function addRide(req, res){ var body = ''; req.on('data', function (data) { body += data; if (body.length > 1e6) { req.connection.destroy(); } }); req.on('end', function () { //parse and get all the information for the ride var post = qs.parse(body); var accom = post.accomodations; var addr = pos...
[ "function start() {\n test();\n var httpService = http.createServer(serve);\n httpService.listen(ports[0], '0.0.0.0');\n\n var options = {\n key: key,\n cert: cert\n };\n var httpsService = https.createServer(options, serve);\n httpsService.listen(ports[1], '0.0.0.0');\n\n var ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
check to see if all values are below or equal the limit if they are return true example [1,2,3],3 return true
function smallEnough(a, limit){ // const isBelowThreshold = (currentValue) => currentValue < limit; return a.every(currentValue => currentValue <= limit) }
[ "hasReachedMaxLimit (list, maxLimit) {\n\t\treturn list && list.length === maxLimit;\n\t}", "function check(min, max, target) {\n if (target > min && target < max) {\n return true;\n \n } else {\n \n return false;\n }\n}", "function checkFieldEnumLength(field, limit)\n{\n\tsequen...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
return node at given index return node at given index
getNodeAtIndex(index) { //if index is not within list return null if (index >= this.length || index < 0) return null; //iterate through nodes until finding the one at index let currentNode = this.head; let currentIndex = 0; while (currentIndex !== index) { currentNode = currentNode.next; ...
[ "getNode(index){\n\t\t//check in hidden nodes\n\t\tfor (var i = 0; i < this.hiddenNodes.length; i++){\n\t\t\tif (this.hiddenNodes[i].index == index){\n\t\t\t\treturn this.hiddenNodes[i]\n\t\t\t}\n\t\t}\n\n\t\t//check input nodes\n\t\tfor (var i = 0; i < this.inputNodes.length; i++){\n\t\t\tif (this.inputNodes[i].in...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
get exist of end
getIsExistEnd() { return this.state.schedule.find((item) => item.status == "end") ? true : false; }
[ "eof() {\n return this.index >= this.tokens.length;\n }", "function MarkerExist (dStart) : boolean {\n var fmarkerEnum = new Enumerator(Vegas.Project.Markers);\n while (!fmarkerEnum.atEnd()) {\n var fMyMarker = fmarkerEnum.item();\n var fMarkerStart = fMyMarker.Position.ToMilliseconds();\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Upload ssh to github
async function uploadGitHubSSH(config) { // Get root user path let rootPath = Constants.rootUserPath(); // Log uploading public ssh key to github Log.spacer(); Log.info('Uploading public SSH key to GitHub...'); // Get public key from file let key = await Files.load(`${rootPath}.ssh/jarvis-github-${config.user...
[ "async function migrate() {\n\n github.authenticate({\n type: \"token\",\n token: settings.github.token\n });\n\n //\n // Sequentially transfer repo things\n //\n\n // transfer GitLab milestones to GitHub\n if (program.milestone) {\n await transferMilestones(settings.gitlab.projectId);\n }\n\n // ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function: setBranchComplete Sets a branch's isComplete property to true Parameters: branchInfo Object, with properties id, trigger, and isComplete Dependencies: , Returns: none Change Log: 2013.01.27ALP Initial version
function setBranchComplete(branchInfo) { branchInfo.isComplete = true; }
[ "function allBranchesComplete(bsp) {\n\tvar isComplete = true;\n\t// If all branches are required\n\tif (shell.branchStartPages.BSPReqArray[bsp]) {\n\t\tif (shell.branchStartPages.BSPArray[bsp] != undefined) {\n\t\t\tfor (var i=0, j = shell.branchStartPages.BSPArray[bsp].length; i<j; i++) {\n\t\t\t\t//console.log(\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Fetch input and store Username to local storage for personalizer + user validator
function storeName() { const formWrapper = document.getElementById("personalizer"); const username = document .querySelector('[name="username"]') .value.trim() .toUpperCase(); if (username === "") { validationError('[name="username"]', formWrapper); } else { validationError('[name="username"...
[ "function userData() {\n\n userName = $('#username').val()\n sessionStorage.setItem(\"userName\", userName)\n if ((fillUserName = null) || (fillUserName = \"\")) { //if player doesn't enter any username or saves username without entering anything\n sessionStorage.setItem(\"\", userName);\n }\n}", "function...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
End of the "lgServerListLoad" Get server list with ajax
function lgServerListLoadAjax(URL, curIndex) { $.ajax({ url: URL, dataType: 'json', success: function (data) { hostFromURL() localStorage.setItem("server_js", JSON.stringify(data)); lgServerListLoad(data["Servers"], svConfigComparisor(default_server_config["ServerConfig"], data["ServerCo...
[ "function getNodes() {\n \n $.ajax({\n url : window.helper.getAPIUrl(\"servers\"),\n method: \"GET\",\n crossDomain: true,\n success : function(list) {\n window.nodes = createMarkers(list, \"Node\");\n showMarkers(window.nodes);\n getClients(list);\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
======================================================================== 6. makeRunAdviseJob Create the modelXML and executes the Analytics Case job in the station. Unless a user selects a particular station from 'Configure And Run', priority is given to the secure local station. Else no affinity is set. If a secure st...
function makeRunAdviseJob(adviseLaunchInfo) { var resourceCredentials = adviseLaunchInfo.resourceCredentials, eedURL = adviseLaunchInfo.eedURL, eedTicket = adviseLaunchInfo.eedTicket, decodeJobXML = htmlUnescape(adviseLaunchInfo.encodedJobXML), runInfo = adviseLaunchInfo.runInfo...
[ "onModelRunClick () {\n const dgst = (this.useBaseRun && this.isCompletedRunCurrent) ? this.runCurrent?.RunDigest || '' : ''\n const wsName = (this.useWorkset && this.isReadonlyWorksetCurrent) ? this.worksetCurrent?.Name || '' : ''\n\n if (!dgst && !this.runOpts.csvDir) {\n if (!wsName) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates a graph of all walkable boxes that are connected to each other
function createBoxGraph() { var graph = new Graph(); for (var y = 0; y < map.length; ++y) { for (var x = 0; x < map[y].length; ++x) { if (map[y][x] !== WALL) { graph.addNode(keyFromCoordinates(x, y), [x, y]); } } } ...
[ "function drawNodesAndEdges(sourceTurns, canvas, ctx, dotAlpha, glyphMap) {\n var i,\n conVats = {}, // storing last turn in proc order, [vat name] = sourceturns index\n conx, cony, //stores previous draw position for turn\n src, //source file from prev vat\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Public function `function`. Returns true if `data` is a function, false otherwise.
function isFunction (data) { return typeof data === 'function'; }
[ "function ISFUNCTION(value) {\n return value && Object.prototype.toString.call(value) == '[object Function]';\n}", "function isValidFunctionExpression(node) {\n if (node && node.type === 'FunctionExpression' && node.body) {\n return true;\n }\n return false;\n}", "function isCallback(node) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Replaces the prompt() function. Takes a string of text to inform the user, a function to execute when the user submits it, and an optional regex for form input validation.
function modalPrompt(text, func, regEx) { $("#custom-modal-header").text("Prompt"); $("#custom-modal-text").text(text); var customContent = $("#custom-modal-content"); var form = $("<form>", { class: "modal-form", id: "custom-modal-form", method: "POST" }); // Input will only add a regex for validation if it'...
[ "function promptUsername() {\n setInputFlow(submitUsername, true);\n\n print('Please enter your username in the box below');\n}", "function TestInput() {\n //get text user provided for regex\n const regexText = RegExp(document.getElementById(\"regexText\").value);\n\n //get text user provided to te...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Copy this `HttpHeaderResponse`, overriding its contents with the given parameter hash.
clone(update = {}) { // Perform a straightforward initialization of the new HttpHeaderResponse, // overriding the current parameters with new ones if given. return new HttpHeaderResponse({ headers: update.headers || this.headers, status: update.status !== undefined ? upda...
[ "copyHeaders(clientRes, serverRes) {\n Object.entries(clientRes.headers.raw()).forEach(([key, value]) => {\n if (key.toLowerCase() === \"location\") {\n //handle location redirects to hide microservice\n let newLocation = new URL(value[0]);\n newLocatio...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
connectes to a server with this IP (creates it in the list if it doesnt Exist)
function gameServerConnectForIP(serverIP, autoClickPlay = false) { console.log("connecting to server of IP: " + serverIP); //find if it exists var serverObj = findGameServerObjForIP(serverIP); //console.log("server for ip " + serverIP + " is " + findGameServerObjForIP(serverIP).name); /*//create server DEF i...
[ "function addNewClient(socket) {\n //pushing each new client connection's id into an array of clientIDs -JT\n if (clientSockets.length < 1) {\n clientSockets.push(socket);\n clientCount++;\n } else {\n // Make sure not to store multiple clients with the same id\n var isMatch = f...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Replace multiple constraints which upper bound or lower bound a param type with the lub or glb, respectively, of the concrete bound.
mergeConcreteBounds() { let idmap = {}; let lower = {}; let upper = {}; let other = []; for (let c of this.constraints.constraints) { let a = c.lower; let b = c.upper; if (a.isParam()) idmap[a.id] = a; if (b.isParam()) idmap[b.id]...
[ "function geneBaseBounds(gn, min, max) {\n var gd = genedefs[gn];\n var gg = guigenes[gn];\n if (gd === undefined) return;\n if (gd.basemin === gd.min) {\n gd.min = min;\n gg.minEle.value = min;\n gg.sliderEle.min = min;\n }\n gd.basemin = min;\n if (gd.basemax === gd.max) ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
When taskId changed we should update the input
updateTaskIdInput() { this.setState({taskIdInput: this.state.taskId}); }
[ "onTaskUpdated(task, updatedData) {\n const tasks = this.tasks.slice();\n const oldTask = tasks.splice(tasks.indexOf(task), 1, Object.assign({}, task, updatedData))[0];\n this.tasksUpdated.next(tasks);\n // Creating an activity log for the updated task\n this.activityService.logActivity(\n this....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Load purchase price history for the given part
function loadPurchasePriceHistoryTable(options={}) { var part = options.part; if (!part) { console.error('No part provided to loadPurchasePriceHistoryTable'); return; } var table = options.table || $('#part-purchase-history-table'); var chartElement = options.chart || $('#part-pur...
[ "function loadBomPricingChart(options={}) {\n\n var part = options.part;\n\n if (!part) {\n console.error('No part provided to loadBomPricingChart');\n return;\n }\n\n var table = options.table || $('#bom-pricing-table');\n var chartElement = options.table || $('#bom-pricing-chart');\n\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
count 'movestart' event registered in the map
function count_movestart_event(mIDX, e) { var movestartEvents = app[mIDX].map._events["movestart"]; if (e) movestartEvents = e.target._events["movestart"]; if (!movestartEvents) return 0; var count = 0; $.each(movestartEvents, function(idx, row) { var ctx = row['ctx']; //console.log(mIDX, idx, ctx, e); ...
[ "function count_moveend_event(mIDX, e) {\r\n\tvar moveendEvents = app[mIDX].map._events[\"moveend\"];\r\n\tif (e) moveendEvents = e.target._events[\"moveend\"];\r\n\tif (!moveendEvents) return 0;\r\n\tvar count = 0;\r\n\t$.each(moveendEvents, function(idx, row) {\r\n\t\tvar ctx = row['ctx'];\r\n\t\t//console.log(ge...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
The database SQL request parameters for the request DELETE /categories/:id
function getDatabaseParameterDeleteCategory (params, query, body){ var parameters = { where: { category_id: params.id }, }; return parameters; }
[ "function checkRequestDeleteCategory (req, res, next) {\r\n\tvar params = {};\r\n\tif (!req.params.hasOwnProperty('id')) {\r\n\t\treturn next(apiErrors.GENERIC_ERROR_REQUEST_FORMAT_ERROR, req, res);\r\n\t}\r\n\tparams.id = req.params.id;\r\n\treturn {params: params, query: null, body: null};\r\n}", "async Delete(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Stops attacking the current entity.
stop() { this.target = undefined; // @ts-expect-error const pathfinder = this.bot.pathfinder; pathfinder.setGoal(null); // @ts-expect-error this.bot.emit('stoppedAttacking'); }
[ "stopShooting() {\n this.shooting = false;\n this.sentAddShooterPacket = false;\n\n var msg = {\n type: \"RemoveShooter\",\n entityType: \"Player\",\n };\n\n game.getNetwork.sendMessage(JSON.stringify(msg));\n }", "break(){\n\t\tif(this.attackdelay > 0 |...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Add resource to bundle as BundleEntry
addEntry(method, resource) { let id = this.generateId(); // create entry array if still undefined if (typeof this.entry === 'undefined') { this.entry = []; } // check if id of resource is already set if (typeof resource.id !== 'undefined') { id = r...
[ "static addContent(entryId, resource){\n\t\tlet kparams = {};\n\t\tkparams.entryId = entryId;\n\t\tkparams.resource = resource;\n\t\treturn new kaltura.RequestBuilder('baseentry', 'addContent', kparams);\n\t}", "idAlreadyExistsInBundle(id) {\n for (let e of this.entry) {\n let resource = e.resou...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Update to data dict
function updateData(){ dataDict.clear(); dataDict.setparse("NAMESPACES", JSON.stringify(namespaces)); dataDict.setparse("TRACKS", tracksDict.stringify()); updateDef(); }
[ "update ( data ) {\n if ( !this.deepEqual(data, this.data) ) {\n Object.assign(this.data, data);\n this.notify();\n }\n }", "function updateData(){\n //Re draw the data\n drawDataOptions();\n\n //Fill in data element values when clicking on a data element in selec...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Abhaengigkeiten: ================ initOptions (PreInit): restoreMemoryByOpt: PreInit oldStorage getStoredCmds: restoreMemoryByOpt runStoredCmds: getStoredCmds loadOptions: PreInit startMemoryByOpt: storage oldStorage initScriptDB: startMemoryByOpt initOptions (Rest): PreInit __MYTEAM (initTeam): initOptions getMyTeam c...
function startOptions(optConfig, optSet = undefined, classification = undefined) { optSet = initOptions(optConfig, optSet, true); // PreInit // Memory Storage fuer vorherige Speicherung... myOptMem = restoreMemoryByOpt(optSet.oldStorage); // Zwischengespeicherte Befehle auslesen... const __STORED...
[ "function initOptions(optConfig, optSet = undefined, preInit = undefined) {\n let value;\n\n if (optSet === undefined) {\n optSet = { };\n }\n\n for (let opt in optConfig) {\n const __OPTCONFIG = optConfig[opt];\n const __PREINIT = getValue(__OPTCONFIG.PreInit, false);\n\n if...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
tslint:enable Create a management canister actor.
function getManagementCanister(config) { function transform(methodName, args, callConfig) { const first = args[0]; let effectiveCanisterId = Principal.fromHex(''); if (first && typeof first === 'object' && first.canister_id) { effectiveCanisterId = Principal.from(first.canister_i...
[ "async createManager() {\r\n let newManager = new Managers ({\r\n username: this.username,\r\n production: config.powerplant_production,\r\n powerPlantStatus: \"Running\"\r\n })\r\n\r\n await newManager.save(function(error){\r\n if (error) {\r\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
hideMouseReset event handler for mousemove to reset the hideMouse timer
function hideMouseReset() { if (hideMouseID === 0) { // Timer has fired and hid the cursor. Unhide it. document.body.style.cursor = null; hideMouseID = null; // null = cursor is visible } else if (hideMouseID !== null) { // Timer hasn't fired yet. Remove it. clearTimeout(hideMouseID); hideMous...
[ "function initHideMouse()\n{\n if (hideMouseTime === null) return;\n\n /* Add handler to restart the timer when the mouse moves. */\n document.addEventListener('mousemove', hideMouseReset);\n\n /* Remove old timer, unhide cursor if hidden, start new timer. */\n hideMouseReset();\n}", "function hideMouse()\n{...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Clone left side, delete last child, and then copy to the right side
function deleteLast (theLeftSide) { var theRightSide = document.getElementById("rightSide"); var leftSideImages = theLeftSide.cloneNode(true); leftSideImages.removeChild(leftSideImages.lastChild); theRightSide.appendChild(leftSideImages); }
[ "function delete_all_children() {\n var theRightSide = document.getElementById(\"rightSide\");\n var theLeftSide = document.getElementById(\"leftSide\");\n\n while (theRightSide.firstChild) {\n theRightSide.removeChild(theRightSide.firstChild)\n }\n while (theLeftSide.firstChild) {\n th...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Submits login request to Internt Archive
static login() { const doc = navigationDocument.documents[navigationDocument.documents.length - 1] const e = doc.getElementsByTagName('textField').item(0) const user = encodeURIComponent(e.getAttribute('data-username')) const pass = encodeURIComponent(e.getFeature('Keyboard').text) const dataString...
[ "login(username, password) {\r\n return this._call(\"post\", \"login\", { username, password });\r\n }", "function signin(){\n var payload = {\n \"username\": username.value,\n \"password\": password.value\n };\n\n send_post_request(window.location.origin + '/api/rest-auth/login/', payl...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Find by keyword & category
function findByKeywordAndCategory() { getCateCacheByCategory() .then(catecaches => { // Check pagination _findQuery = _pageNumber === undefined ? Dictionary.find({ 'keyword': { $regex: new RegExp(_keyword, "i") }, 'categoryid': { $in: catecaches } }).sort('keyword').l...
[ "function searchObject(text) {\n allObjects.forEach((item) => {\n if (item.title.toLowerCase().includes(text)) {\n relatedObjects.push(item);\n } else if (item.keywords.toLowerCase().includes(text)) {\n relatedObjects.push(item);\n }\n })\n}", "static findByCategor...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
associates row metadata from the supplied message with this query object metadata used when parsing row results
handleRowDescription(msg) { this._checkForMultirow() this._result.addFields(msg.fields) this._accumulateRows = this.callback || !this.listeners('row').length }
[ "function insightFromRow (row) {\n return {\n id: row.iid,\n title: row.title,\n url: row.url,\n author: row.author,\n creator_id: row.creator_id,\n type: row.type,\n date: row.date,\n active: row.active,\n tags: row.tid ? [tagFromRow(row)] : []\n };\n}", "getRowObject(i) {\n const...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
promise used for popups and resolutions via ohledger messages.
function setupNewPromise(){console.assert(!resolve,'oh-popup promise being set but already set when calling setupNewPromise(..)');return new Promise(function(rs,rj){resolve=rs;reject=rj;});}// make popup visible to be hidden with makePopupHidden
[ "function showpopup(msg_id, process_name, top_value) {\n GetFullDetailMessage(msg_id, process_name);\n}", "function popup (message) {\n $('.pop').show().css('display', 'flex')\n $('.message').html(message)\n }", "function popupPVAsWindow_onload(e)\n{\n\t// set flag\n\tasPopupWindow = true;\n\n\t// ini...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
["a", 1, 2, 3] 9. Oddities The oddities function takes an array as an argument and returns a new array containing every other element from the input array. The values in the returned array are the first (index 0), third, fifth, and so on, elements of the input array. The program below uses the array returned by odditie...
function oddities(array) { var oddElements = []; var i; for (i = 0; i < array.length; i += 2) { oddElements.push(array[i]); } return oddElements; }
[ "function odds(arr) {\n oddArr = [];\n each(arr, function(element) {\n if (element % 2 !==0) {\n oddArr.push(element);\n };\n });\n return oddArr;\n}", "function evenIndexedOddNumbers(arr) {\n var output = [];\n each(arr, function(e, i) {\n if ((e % 2 !== 0) && (i...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
PLANS Load spatialized plan into the scene.
function load3DPlan(obj) { if(plans.getByName(obj.info.content)) return; var plan = new DV3D.Plan('data/' + obj.file.path + obj.file.content, 'data/' + obj.info.materialMapPath + obj.info.materialMap, obj.info.scale); plan.onComplete = function () { animate(); }; scene.add(plan); plan.name = obj...
[ "function loadTasksMatrix() {\n loadAllTasks();\n loadMatrixArea();\n assignTaskToBox();\n}", "function loadPlanet ( planetData, scene, progressCallback, resolve, reject ) {\n\n texLoader.load( planetData.path, function ( texture ) {\n\n console.log('in texLoader, typeof planet.geometry...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
init grid size horizontal get height param
function initSizeParamsHor(){ var arrThumbs = g_objInner.children(".ug-thumb-wrapper"); var firstThumb = jQuery(arrThumbs[0]); var thumbsRealHeight = firstThumb.outerHeight(); //set grid size var gridWidth = g_temp.gridWidth; var gridHeight = g_options.grid_num_rows * thumbsRealHeight + (g_options.grid_...
[ "function makeGrid() {\n\n\tcreateGrid($('#inputHeight').val(),$('#inputWidth').val());\n}", "gridCellSize() {\n return (gridCellSizePercent * canvasWidth) / 100;\n }", "function makeGrid() {\n\tlet cellSize = 0;\n\tif ($(window).width() < $(window).height()) {\n\t\tcellSize = $(window).width()*0.8*(1/(leve...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Find the foldable region containing the given line, if one exists
function foldableContainer(view, lineBlock) { // Look backwards through line blocks until we find a foldable region that // intersects with the line for (let line = lineBlock; ; ) { let foldableRegion = foldable(view.state, line.from, line.to) if (foldableRegion && foldableRegion.to > ...
[ "function _foldLine(cm, line) {\n var marks = cm.findMarksAt(CodeMirror.Pos(line + 1, 0)), i;\n if (marks && marks.some(function (m) { return m.__isFold; })) {\n return;\n } else {\n foldFunc(cm, line);\n }\n }", "function foldable(state, lineStart, lineEnd) {\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Callback function for the IAM creation which should have 3 params coming in.
function finishedCreatingCallback(err, usersForCloudFormation, IAMuserPassword, groupName) { if(err) { cloudformationsender.sendResponse(theEvent, theContext, "FAILED", {}); } else { cloudformationsender.sendResponse(theEvent, theContext, "SUCCESS", { "IamPassword": IAMuserPassword, ...
[ "async createApiKey (obj, args, context) {\n try {\n return {\n key: await WIKI.models.apiKeys.createNewKey(args),\n responseResult: graphHelper.generateSuccess('API Key created successfully')\n }\n } catch (err) {\n return graphHelper.generateError(err)\n }\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Initializes the range of an animation
function AnimationRange(/**The name of the animation range**/name,/**The starting frame of the animation */from,/**The ending frame of the animation*/to){this.name=name;this.from=from;this.to=to;}
[ "setRanges() {\r\n\t\tthis.ranges.x = d3.scaleTime()\r\n\t\t\t.range([0, this.dimensions.width - this.margins.x]);\r\n\r\n\t\tthis.ranges.y = d3.scaleLinear()\r\n\t\t\t.range([this.dimensions.height - (2 * this.margins.y), 0]);\r\n\t}", "init() {\n\t\tconst agents = this.m.getAgents();\n\t\tfor (let i = 0; i < ag...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Mobile Menu End Mobile Admin Dashboard Open
function openAdminDashboard() { var oad1 = document.getElementById("mob-admin-dash"); oad1.classList.add("in"); var oad2 = document.getElementById("close-admin-overlay"); oad2.classList.add("in"); }
[ "listenAdminHomeLink() {\n editor.clearMenus();\n editor.showPrimaryMenu();\n event.preventDefault();\n }", "function sgny_mobil_menu(){\n\t$('#mobil_menu').slimmenu({\n\t\tresizeWidth: '800',\n\t\tcollapserTitle: '',\n\t\tanimSpeed: 'medium',\n\t\teasingEffect: null,\n\t\tindentChildren: false,...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Given a tonic and a chord list expressed with roman numeral notation returns the progression expressed with leadsheet chords symbols notation
function fromRomanNumerals(tonic, chords) { const romanNumerals = chords.map(romanNumeral); return romanNumerals.map(rn => transpose(tonic, interval(rn)) + rn.chordType); }
[ "function toRomanNumerals(tonic, chords) {\n return chords.map(chord => {\n const [note, chordType] = tokenize(chord);\n const intervalName = distance(tonic, note);\n const roman = romanNumeral(interval(intervalName));\n return roman.name + chordType;\n });\n}", "function immedia...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
return a numeric value from a string containing a rank
function getValueOfRank(rank) { let value = ranks[rank.toLowerCase()]; if (value) { return value; } return -1; }
[ "function getRankingFromIntent(intent) {\n\n var rankingSlot = intent.slots.Ranking;\n\n if (!rankingSlot || !rankingSlot.value) {\n return 0;\n } else {\n\n return rankingSlot.value;\n }\n}", "function parseNum(){\n var pattern = /[0-9]+/;\n //If the we have set text to be the gam...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This function sends backupdata chunk to Queue
function sendBackupDataToQueue(data,params){ var sqs = new AWS.SQS(); var boxParams = { MessageBody: JSON.stringify(data), QueueUrl: semusiConfig.DataBackupQueueList[backupQueueIndex], DelaySeconds: 0 }; sqs.sendMessage(boxParams, function (err, data) { if (err) { ...
[ "_wipeChunkedMessageQueue ( ) {\n\n this.chunkedPutMessagesAwaitingCompletion = [];\n }", "function onQueue(data) {\n\tif (\"Error\" in data) {\n\t\tonError(data.Error);\n\t} else if (\"Value\" in data) {\n\t\tqueueSize = data.Value.length;\n\t\t$(\"#current-queue>tbody\").empty();\n\t\tfor (i = current...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns true if the two numbers are within the given tolerance of each other. This is useful to correct for floating point precision issues, less useful for integers.
function approxEqual(a, b, tolerance) { if (tolerance === void 0) { tolerance = 0.00001; } return Math.abs(a - b) <= tolerance; }
[ "function testTolerance(value, test, tolerance) {\n if (Math.abs(value - test) < tolerance) {\n return true;\n } else {\n return false;\n }\n }", "static WithinEpsilon(a, b, epsilon = 1.401298e-45) {\n const num = a - b;\n return -epsilon <= num && n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Find the outermost matching node before a given position.
function findNodeBefore(node, pos, test, baseVisitor, state) { test = makeTest(test); if (!baseVisitor) { baseVisitor = base; } var max ;(function c(node, st, override) { if (node.start > pos) { return } var type = override || node.type; if (node.end <= pos && (!max || max.node.end < n...
[ "matchBefore(expr) {\n let line = this.state.doc.lineAt(this.pos)\n let start = Math.max(line.from, this.pos - 250)\n let str = line.text.slice(start - line.from, this.pos - line.from)\n let found = str.search(ensureAnchor(expr, false))\n return found < 0\n ? null\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
getOutputActivations Gets output activations of an image label as onehot Float32Array
function getOutputActivations(mnistData, sampleId) { const l = getImageLabel(mnistData, sampleId); const oa = new Float32Array(10); oa[l] = 1.0; return oa; }
[ "function getInputActivations({ imageWidth, imageHeight, imagesBuffer }, sampleId) {\n // size of input\n const sizeOfInput = imageWidth * imageHeight;\n // our result array\n const inputActivations = new Float32Array(sizeOfInput);\n // for each pixel in the image\n for (le...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sets dynamic load balancer.
_setLoadBalancer () { if (!this[ _options ] || !this[ _options ].loadbalancer) { return } this[ _loadBalancer ] = _loadDynamicComponent(this[ _options ].loadbalancer) }
[ "function LoadBalancer(props) {\n return __assign({ Type: 'AWS::ElasticLoadBalancing::LoadBalancer' }, props);\n }", "function updateLoadBalRouting(configid, proxyport){\n\n\tvar query = {'configid' : configid};\n\tvar update ={ $set : { 'proxyurl': \"localhost:\" + proxyport, 'status':true } };...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Create a SigningRequest instance configured for this link.
async createRequest(args, transport) { const t = transport || this.transport; // generate unique callback url let request = await esr.SigningRequest.create({ ...args, chainId: this.chainId, broadcast: false, callback: { url: this.cr...
[ "function newRequest(data){\n var request = createNewRequestContainer(data.requestId);\n createNewRequestInfo(request, data);\n }", "async function makeRequest(web3, req, defaultRequest, chainId, forwarderInstance) {\n var _a;\n const filledRequest = {\n request: Object.assign(Object.assign({}...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sort the linked list using bubble sort algorithm in ascending order
bubbleSort() { let firstNode, secondNode; firstNode = this.head; while (firstNode !== null) { secondNode = this.head; while (secondNode !== null) { if (firstNode.value < secondNode.value) { let temp = secondNode.value; secondNode.value = firstNode.value; f...
[ "function bubbleSort(arr) {\n\n}", "function nodeArraySort(to_sort) \n{\n var sorted = false; \n while (!sorted) \n {\n\t sorted = true;\n for (var i=0; i<to_sort.length-1; i++) \n {\n if (compareNode(to_sort[i], to_sort[i+1])) \n {\n \tsorted = false;\n tm...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
this function is called when "Add New Sticky" button is clicked (see index.html) create a new Note object, set id, timestamp, position, and zindex properties; insert into database using saveAsNew() defined in its prototype
function newNote () { var note = new Note(); note.id = ++highestId; note.timestamp = new Date().getTime(); note.left = Math.round(Math.random() * 400) + 'px'; note.top = Math.round(Math.random() * 500) + 'px'; note.zIndex = ++highestZ; note.saveAsNew(); }
[ "function Note() {\n\tvar self = this;\n\t\n\t// create main div for the sticky\n\tvar stickyDiv = document.createElement('div');\n\tstickyDiv.className = 'note';\n\t\n\t// see prototype definition\n\tstickyDiv.addEventListener('mousedown', function(e) { \n\t\treturn self.onMouseDown(e)\n\t}, false\t);\n\t\n\t// se...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
checks the message display to see who's turn it is and changes it to the other player. changes the color of the message to make it clearer which player's turn it is. is called in the checkAnswer function to execute when the user submits and answer.
function switchTurn() { if (turn === "player 2") { turn = "player 1"; setMessage(turn + "'s turn"); document.getElementById("playerTurn").style.color ="hotpink"; } else { turn = "player 2"; setMessage(turn + "'s turn"); document.getElementById("playerTurn").style.color ="gold...
[ "function setMessage(){\n message.textContent = `${tempInput.value} is equal to ` + result + ` Degrees ` + type;\n message.style.color = 'initial';\n}", "function check() {\n // Determine milliseconds elapsed since the color was loaded\n var milliseconds_taken = Date.now() - time_at_load;\n\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Awake(): Called by Unity when the script has loaded. We use this function to initialise our link to the Lerpz GameObject.
function Awake() { //levelGoal.GetComponent(MeshCollider).isTrigger = false; playerLink = GameObject.FindGameObjectWithTag("Player"); if(!playerLink) Debug.Log("Could not get link to Lerpz"); }
[ "function init() {\n \"use strict\";\n \n var game = new Phaser.Game(384, 640, Phaser.AUTO);\n game.state.add('splashscreen', splashScreen);\n game.state.add('screen1', screen1);\n game.state.add('detailscreen1', detailScreen1);\n game.state.add('detailscreen2', detailScreen2);\n game.state....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Delete Flavor Params by ID.
static deleteAction(id){ let kparams = {}; kparams.id = id; return new kaltura.RequestBuilder('flavorparams', 'delete', kparams); }
[ "static deleteAction(id){\n\t\tlet kparams = {};\n\t\tkparams.id = id;\n\t\treturn new kaltura.RequestBuilder('flavorasset', 'delete', kparams);\n\t}", "static deleteAction(id){\n\t\tlet kparams = {};\n\t\tkparams.id = id;\n\t\treturn new kaltura.RequestBuilder('thumbparams', 'delete', kparams);\n\t}", "static ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This function returns a json object containing the heart rate data of all users There is an optional parameter range that specifies a range of data wanted: EX: 1d, 1w, 1m
async function heartRateAllPeriod(req, res) { if(userList.length === 0) { return res.status(400).send("There are not any available Users. Please add a user") } try{ const tableData = await heartRateFetch.fetchAllHeartRatesPeriod(userList, req.query.range) res.json(tableData) } ca...
[ "async function heartRateAllDate(req, res) {\n const startDate = req.query.start\n const endDate = req.query.end\n\n // See if any parts of the body are undefined\n if(startDate === undefined || endDate === undefined) {\n return res.status(400).json({ status: \"error\", msg: \"The start, end date...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
helper to check if filepath refers to a file that userland is not allowed to edit directly
function assertUnprotectedFilePath (filepath) { if (filepath === '/' + DAT_MANIFEST_FILENAME) { throw new ProtectedFileNotWritableError() } }
[ "validateFilePath(file) {\n try {\n if (fs.existsSync(file)) {\n return;\n } else {\n // File wasn't found, but we didn't get an error\n console.error('Provided file path was not valid or not found. Please try again.');\n proce...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function to active on corbeil icon delete action one product Parameters: dataMemory => storage interface that contains the data from the browser cache in which all the products added to the cart are located dataParse => parsed data corresponding to a product of products list from the listproductorder function level => ...
function activeFunctionDelete(dataMemory,dataParse,level) { let deleteObject = document.getElementsByClassName(deleteProductCartTarget); deleteObject[level].setAttribute("id",""+dataParse._id+""); deleteObject[level].addEventListener("click", function() { removeProduct(dataMemory,deleteObject[level]...
[ "function listProductOrder(dataMemory) {\n const tab = [\"imageUrl\",\"name\",\"lenses\",\"price\",\"delete\"];\n var cost = 0;\n for (let i = 0 ; i < dataMemory.length; i++) {\n let memoryDataParse = JSON.parse(dataMemory.getItem(dataMemory.key(i)));\n createObject(listProductOrderTarget,\"t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Adapted from Shdr Validator class Creates and validates a shader from a text source based on type (src, type) > false || [ok, line, error] src: glsl text to be validated type: 0 for vertex shader, 1 for fragment shader, else return false ok: boolean for whether the shader is ok or not line: which line number throws err...
function validate(src, type) { // uniforms don't get validated by glsl if (type !== 0 && type !== 1) { return false; } if (!src) { return [false, 0, "Shader cannot be empty"]; } if (!context) { console.warn("No WebGL context."); ...
[ "function getShader(filepath, type)\n {\n var shaderScriptType = type;\n var shaderPath = filepath;\n \n if (!shaderPath || shaderPath.length == 0)\n return 0;\n \n var shader = Gles.createShader(type);\n \n if (shader == 0) return 0;\n \n //added method\n Gle...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Extended Resource Settings storeOffline: true, resourceName: openmrs.patient usesEncryption: true, primaryKey : "uuid" queryFields : all (for now)
function getResource(){ var v = "custom:(uuid,identifiers:ref,person:(uuid,gender,birthdate,dead,deathDate,preferredName:(givenName,middleName,familyName)," + "attributes:(uuid,value,attributeType:ref)))"; r = $resource(OpenmrsSettings.getContext() + "/ws/rest/v1/patient/:uuid", {uuid: '@uui...
[ "function getResource() {\n r = $resource(OpenmrsSettings.getContext() + \"/ws/rest/v1/provider/:uuid\",\n {uuid: '@uuid', v: v},\n {query: {method: \"GET\", isArray: false}}\n );\n return new dataMgr.ExtendedResource(r,true,resourceName,false,\"uuid\",null);\n }", "function getRes...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Fetch documents with new permissions
fetchNowAccessibleDocuments(previous) { const permissions = this.getAllPermissions().filter((permission) => { const found = previous.getAllPermissions().find((previousPermission) => { return permission.isSame(previousPermission) }) return !found }).map((permission) => { ...
[ "async editable(req) {\n if (!req.user) {\n throw self.apos.error('notfound');\n }\n const ids = self.apos.launder.ids(req.body.ids);\n if (!ids.length) {\n return {\n editable: []\n };\n }\n const found = await self...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Create nodes for all the existing activities and connect them
function loadActivities() { clearCanvas(); nodesArray = []; loadedStory.activities.forEach((a) => { addActivityNode(a); }); //After we created all nodes we create all outputs and make the connections loadedStory.activities.forEach((a, index) => { setNodeOutputs(a, nodesArray...
[ "function addActivityNode(activity) {\n let n = new Node(activity.name, activity.position, {\n onCopy: () => {\n copiedActivity = JSON.stringify(activity);\n $(\"#activity-paste\").prop(\"disabled\", false);\n }, \n \n onDelete: () => {\n editorDirty ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
notify when new orders are made
function newOrder() { db.collection("currentOrders").where("notify", "==", 1).onSnapshot((snapshot) => { console.log("New order invoked!"); // console.log(snapshot.docChanges()); snapshot.docChanges().forEach(change => { console.log("change: ",change.doc.data()); showNotification('top', 'right', ...
[ "function notifySuccess() {\n successes++;\n if (successes >= orderItems.length) {\n console.log(\"order added for table \" + order.tableNum + \", party \" + party + \" with orderID \...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Renews subscriptions with the X32 (they expire every 10s).
function renewSubscriptions() { udpPort.send({ address: '/batchsubscribe', args: [ // First defines the local endpoint that the X32 will send this subscription data to. { type: 's', value: '/chMutes' }, { type: 's', value: '/mix/on' }, { type: 'i', val...
[ "refreshSubscriptions() {\n // just schedule if does not have a previous timer scheduled and if\n // the consumer is ready\n if ((!this.isWaitingForRefreshSubscriptions) && (this.isReady)) {\n this.isWaitingForRefreshSubscriptions = true;\n\n const subscriptionProcedure = (retries = 0) => {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Given a string, if the string "del" appears starting at index 1, return a string where that "del" has been deleted. Otherwise, return the string unchanged.
function delDel(str) { if ((str.length >= 4) && (str.substring(1, 4).localeCompare("del") == 0)) { return str.slice(0, 1) + str.slice(4); } else { return str; } }
[ "function remove(string, number) {\n // A place to store the number of times we're going to remove an !\n let timesWeRemove = number;\n\n // A Place to store our new string.\n let newString = \"\";\n\n // Iterate over string, and every time we find an ! and the number of !'s we're going to remove isn't 0, remo...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Control cursor position for phone field
function setPhoneCursor(field, event){ let cursorPosition = field.selectionStart; let charAfter = $(field).val().substr(cursorPosition, 1); // If cursor is directly before a non-number... if(charAfter.match(/[^0-9]/)){ // If key pressed is left arrow, move cursor directly...
[ "function setCursorPosition(field, position){\n \n // If not focused, set focus on field\n \n if(!$(field).is(':focus')){\n \n $(field).focus();\n \n }\n \n // Set cursor position for field\n \n field.selectionStart = position;\n field.selectionEnd = position;\n}",...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
reading what we have in list.json
function readListFS(){ console.log("welcome to listFS line 54 in auth.js"); //userName = getLoggedIn(cookies); var data = fs.readFileSync('db/'+ userName +'/lists/list.json', "utf8"); //it's more fast for write and will return null lists = JSON.parse(data); //an Object console.log("line 54 auth "+ ++i); }
[ "function readStartingData(){\n readUser = JSON.parse(fs.readFileSync('data/user.json'));\n listDoc = JSON.parse(fs.readFileSync('data/documents.json'));\n}", "function list() {\n\tfs.readFile(\n\t\tpath.resolve(__dirname, \"../\", \"main.json\"),\n\t\t\"utf8\",\n\t\tfunction readFileCallback(err, data) {\n\t\t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
chanllenge 4 3 essentials modules loadModule : add a module to the modules array Param index: where the module is in the availableModules array
function loadModule(index) { //add in the challenge #8 if(!availableModules[index].essential){ availableModules[index].essential = true;//change essential property to true } ship.modules.push(availableModules[index]); }
[ "function findLifeSupportModule(){\n \n for(var i = 0; i < availableModules.length; i++){\n if(availableModules[i].name == \"life-support\") {\n availableModules[i].enabled = true; //enable the module first\n loadModule(i); //load module into modules array\n }\n }\n}", "function loaded() {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates a backdrop element and returns it
function createBackdropElement(isVisible) { var backdrop = div(); backdrop.className = BACKDROP_CLASS; backdrop.setAttribute('data-state', isVisible ? 'visible' : 'hidden'); return backdrop; }
[ "createContainer() {\n const existingContainer = document.querySelector('#bitski-dialog-container');\n if (existingContainer) {\n return existingContainer;\n }\n const container = document.createElement('div');\n container.id = 'bitski-dialog-container';\n docume...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
For example: if arr is [1, 2, 4, 6, 4, 3, 1] then your program should return 3 because 6 is the last point in the array where the numbers were increasing and the next number begins a decreasing sequence. The array will contain at least 3 numbers and it may contains only a single sequence, increasing or decreasing. If t...
function ChangingSequence(arr) { //loop through each number in array for(var i = 1; i < arr.length - 1; i++){ //if current number is greater than previous number and also greater than next number, return index of number if(arr[i] > arr[i-1] && arr[i] > arr[i+1]){ return i; } //else if current num...
[ "function largestGapConsecutiveElements (arr){\n var gap = 0;\n for(var i = 0; i < arr.length; i++){\n var diff = arr[i] - (arr[i+1])\n if (diff > gap){\n gap = diff;\n }\n }\n return gap;\n}", "function findMissing(array){\n\t// edge cases\n\tif(array[0] != 1) return 1;\n\tif(array[array....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Removes the extended splash screen if it is currently visible.
function remove() { if (isVisible()) { var extendedSplashScreen = document.getElementById("extendedSplashScreen"); WinJS.Utilities.addClass(extendedSplashScreen, "hidden"); } }
[ "async hideSplashScreen() {\n\t\ttry {\n\t\t\tif (!this.splashScreenWindow) return;\n\t\t\tthis.splashScreenWindow.close();\n\t\t\tthis.splashScreenWindow = null;\n\t\t} catch (err) {\n\t\t\tlogger.error(`Unable to hide splash screen ${err.message}`);\n\t\t\tconst error = new Error('Error hiding splash screen.');\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Validate the response received after sending a speech request that is too long
function validateSpeechFailTooLongResponse(response) { notEqual(response["requestError"], undefined, "requestError"); var re = response["requestError"]; if (re != null) { notEqual(re["serviceException"], undefined, "serviceException"); var se = re["serviceException"]; if (se != null)...
[ "function validateSpeechFailTMSResponse(response) {\n notEqual(response[\"requestError\"], undefined, \"requestError\");\n var re = response[\"requestError\"];\n if (re != null) {\n notEqual(re[\"serviceException\"], undefined, \"serviceException\");\n var se = re[\"serviceException\"];\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Convert BN to 0xprefixed hex string.
function bnToHex(value) { return "0x" + value.toString(16); }
[ "function Hex(n) {\n n=Math.round(n);\n if (n < 0) {\n n = 0xFFFFFFFF + n + 1;\n }\n return n.toString(16).toUpperCase();\n}", "function hex2base58(s){ return Bitcoin.Base58.encode(hex2bytes(s))}", "function bigInt2hex(i){ return i.toString(16); }", "function hex2hexKey(s){ return bigInt2he...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Value of the toggle group.
get value() { const selected = this._selectionModel ? this._selectionModel.selected : []; if (this.multiple) { return selected.map(toggle => toggle.value); } return selected[0] ? selected[0].value : undefined; }
[ "getValue() {\n return this.node.value;\n }", "handleGetValueClick() {\n const value = this.refs.cbTestGetValue.getValue();\n alert('Checkbox value: ' + value);\n }", "function getRadioGroupVal(name) {\n return $('input:radio[name=\"' + name + '\"]:checked').val();\n }", "...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Walk the Collada tree and flatten the bones into a list, extract the position, quat and scale from the matrix
function flattenSkeleton(skeleton) { var list = []; var walk = function(parentid, node, list) { var bone = {}; bone.name = node.sid; bone.parent = parentid; bone.matrix = node.matrix; var data = [new THREE.Vector3(),new THREE.Quaternion(),new THREE.Vector3()]; bone.matrix.decompose(data[0],data[...
[ "function Bone(/**\n * defines the bone name\n */name,skeleton,parentBone,localMatrix,restPose,baseMatrix,index){if(parentBone===void 0){parentBone=null;}if(localMatrix===void 0){localMatrix=null;}if(restPose===void 0){restPose=null;}if(baseMatrix===void 0){baseMatrix=null;}if(index===void 0){index=...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Show a `:double` in exponential (scientific) notation. The optional `precision` (= `17`) specifies the precision. If `>=0` it specifies the number of digits behind the dot (up to `17` max). If negative, then at most the absolute value of `precision` digits behind the dot are used.
function show_exp(d, precision) /* (d : double, precision : ?int) -> string */ { var _precision_17864 = (precision !== undefined) ? precision : -17; return show_expx(d, $std_core._int_to_int32(_precision_17864)); }
[ "function show_fixed(d, precision) /* (d : double, precision : ?int) -> string */ {\n var _precision_17876 = (precision !== undefined) ? precision : -2;\n var dabs = Math.abs(d);\n var _x27 = (((dabs < (1.0e-15))) || ((dabs > (1.0e21))));\n if (_x27) {\n return show_exp(d, _precision_17876);\n }\n else {\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This function returns an array of integers created by parsing a stringinput.
function createIntArray(input) { let inputStringArray = input.split(","); let inputArray = []; inputStringArray.forEach((num) => { inputArray.push(BigInt(num)); }); return inputArray; }
[ "function extractIntegers(srcstr) {\n return srcstr.split(\" \").map((substr) => parseInt(substr));\n}", "function getNumberArraysFromString(string) {\r\n\t let array = [];\r\n\t let re = /\\[(.*?)(?=\\])/g;\r\n\t let matches;\r\n\t do {\r\n\t matches = re.exec(string);\r\n\t if(matches)\r\n\t arr...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
FUNCTION: returns formatted url to a single country's JSON
function getCountryJSON(){ countryNameFormatted = countryName.replace(/ /g, "_"); var countryURL = "https://galvanize-cors-proxy.herokuapp.com/https://travelbriefing.org/"+countryNameFormatted+"?format=json"; return countryURL }
[ "function flagUrl (country) {\n country = country.split(' ').join('-')\n return \"https://www.countries-ofthe-world.com/flags-normal/flag-of-\"+(country)+\".png\"\n }", "function getCountryName(place) {\n for (var i = 0; i < place.address_components.length; i++) {\n var addressType = place....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns code of given department (full name, code, or alias). Insensitive to capitalization and padding. Returns empty string if no department matches input.
function toDepartmentCode(name) { var name = trim(name).toUpperCase(); for (var i = 0; i < departments.length; i++) { var deptObj = departments[i]; if (name === deptObj.full || name === deptObj.code || deptObj.aliases.indexOf(name) != -1) { return deptObj.code; } } return ""; }
[ "function findCoursesByDepartment(code) {\n var courseIds = [];\n var courses = coursesByDepartments[code];\n for (var i = 0; i < courses.length; i++) {\n courseIds.push(code + '.' + courses[i].cnum);\n }\n return courseIds;\n}", "function getDepartmentId(departments, departmentName) {\n for (let i=0...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Update the array of transmitters.
function updateTransmitters(sample) { for(var transmitterTemp in sample) { if(!(transmitterTemp in $scope.transmitters) && ($scope.numTransmitters < $scope.maxNumberOfTransmitters)) { $scope.transmitters[transmitterTemp]; // Adding new transmitters as they come. $scope.transmit...
[ "update() {\n for (let device of this.devices) {\n device.update();\n }\n }", "function updateRssiArray(sample) {\n for(var receiverTemp in $scope.receivers) {\n var updated = false;\n var seconds = $scope.rssiSeconds;\n \n // Try to update the rssi corresponding to...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Return ID and ZIP blob for integration/widget to save in API.
async saveFiles ({ commit, state }) { commit(t.PROJECT_SAVE) try { const { id } = state const blob = await Zip.getBlob() return { id, blob } } catch (e) { throw e } }
[ "function store_zip(zip,callback) {\n var postURL = \"/\";\n var postRequest = new XMLHttpRequest();\n\n postRequest.open('POST',postURL);\n postRequest.setRequestHeader('Content-Type','application/json');\n\n postRequest.addEventListener('load', function(event){\n var error;\n if(event.target.status !==...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns an array of all queues.
get queues() { return Object.keys(this._queues).map(name => this._queues[name]); }
[ "getQueueNames() {\n return Object.keys(this.queues);\n }", "async purgeQueues() {\n this.notify.debug('Clear all queues');\n const promises = this.queues.map(queue => queue.purgeQueue());\n await Promise.all(promises);\n }", "getQueueAsArr(roomId){\n if(!this.isValidRoomId(roomId)){\n ret...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
generates an empty line in the console via a console log optional `number` can be specified for the number of lines required
function emptyLines(number) { if (typeof number !== 'undefined') { for (i = 1; i <= number; i++) { console.log(' '); } } else { console.log(' '); } }
[ "function printNewLines(numberOfLines) {\r\n\tfor (var i = 0; i < numberOfLines; i++) { \r\n\t\tdocument.write('<br>');\r\n\t}\r\n}", "function logNumber(num = 0) {\n console.log(num);\n}", "function writeLog(message, rowNumber)\n{\n Logger.log( \"Row: \" + rowNumber + \" : \" + message);\n}", "function pri...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Objects Queue Abstract Datatype implementation
function Queue() { var array = new Array(); /** * Check inf the given data already exist in the queue * @param {type} data input data * @returns {Boolean} result */ this.isDuplicate = function(data) { return array.indexOf(data) > -1 ? true : false; }; /** ...
[ "function ArrayQueue() {}", "function Queue(){\nvar _1=[],_2=0;\nthis.getLength=function(){ return (_1.length-_2); };\nthis.isEmpty=function() { return (_1.length==0); };\nthis.peek=function() { return (_1.length>0?_1[_2]:undefined); };\nthis.enqueue=function(_3){ _1.push(_3); };\nthis.dequeue=function(){\ni...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Visit a parse tree produced by PlSqlParsertype_body_elements.
visitType_body_elements(ctx) { return this.visitChildren(ctx); }
[ "visitType_body(ctx) {\n\t return this.visitChildren(ctx);\n\t}", "visitProcedure_body(ctx) {\n\t return this.visitChildren(ctx);\n\t}", "visitCreate_procedure_body(ctx) {\n\t return this.visitChildren(ctx);\n\t}", "visitPackage_obj_body(ctx) {\n\t return this.visitChildren(ctx);\n\t}", "visitType_defin...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get Count of Closed Door
function ClosedDoors() { var CountClosedDoors = CloseDoor.counterIncrement = 'inherit'; }
[ "function OpenedDoors() {\n\t\tvar CountOpenedDoors = OpenDoor.counterIncrement = 'inherit';\n\t}", "function getAliveCount() {\n\tvar count = 0;\n\tcells.map(function(alive) {\n\t\tif (alive) count++;\n\t});\n\treturn count;\n}", "count() {\n const values = utils.removeMissingValuesFromArray(this.values);\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Replace the given link element with an embed. If the given link element is a link to an embeddable media and if its link text is the same as its href then it will be replaced in the DOM with an embed (e.g. an or html5 element) of the same media. If the link text is different from the href, then the link will be left un...
function replaceLinkWithEmbed(link) { if (link.href !== link.textContent) { return; } var embed = embedForLink(link); if (embed){ link.parentElement.replaceChild(embed, link); } }
[ "function showembed(){\n document.getElementById('hideembed').style.visibility=\"hidden\";\n document.getElementById('hideembed').style.display=\"none\";\n document.getElementById('showembed').style.display=\"block\";\n document.getElementById('showembed').style.visibility=\"visible\";\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
private function, makes element invisible (display:none cannot be used with transition/amimation). By setting the right attribute to large negative number, the element will be placed far off screen to the right and this will be where it starts when it is next made visible (for the "zoom in from right" animation).
function hide(ele) { ele.style.right = hiddenRight; ele.style.visibility = "hidden"; }
[ "function hidejsaccessiblehideObject() {\n\tvar jsaccessiblehidevar = getElementsByClass(\"jsaccessiblehide\");\n\t\t\n\tfor ( j=0;j<jsaccessiblehidevar.length;j++ ) {\n\t\tjsaccessiblehidevar[j].style.position = 'absolute';\n\t\tjsaccessiblehidevar[j].style.left = '-5000px';\n\t}\n}", "function hideHelper(event,...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Helper function to run tests to check if we can successfully set and evaluate breakpoints on an instrumentation pause.
async function runSetBreakpointOnInstrumentationTest(condition) { const builder = new WasmModuleBuilder(); const start_fn = builder.addFunction('start', kSig_v_v).addBody([kExprNop]); builder.addStart(start_fn.index); await Protocol.Runtime.enable(); await Protocol.Debugger.enable(); InspectorTest.log('Set...
[ "function runPauseResumeStopTests() {\n //run all tests without an instance running\n try {\n ap.stopAllSounds();\n assert.ok(true, \"stopAllSounds(): no instance running\");\n }\n catch (e) {\n assert.ok(false, \"stopAllSounds(): no instance running\");\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
check if user already exists
static checkUserExists(req, res, next) { User.getUserByEmail(req.body.email) .then(newUser =>{ if (newUser.rows[0]) return errHandle(409, 'user already exists', res); return next(); }) }
[ "userExists(id) {\n /** find index of user with that id */\n let index = this.data.users.findIndex((user) => {\n return user.id === id\n })\n /** check if index is valid */\n if (index > -1) {\n return true\n } else {\n return false\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
util functions for client.js empty the messages div
function emptyMessagesDiv() { setInterval(function() { $('#messages').html(""); $('#messages').removeClass(); }, 4000); }
[ "function clearSomeMessages(){\n for(var i=0;i<10;i++){\n $(DOMelements.botBody+\" div:first-child\").remove();\n }\n messagesNum=0;\n }", "function clear() {\n messages = [];\n }", "clearStatusMessages() {\n const status_div = document.querySelector('...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Compares two values while ignoring undefined values.
function compare (a, b) { return (a === b) ? (typeof a === 'undefined' ? a : true) : (typeof a === 'undefined' || typeof b === 'undefined'); }
[ "function compareValues(val1, val2){\r\n\tif (val1 > val2) {\r\n\t\treturn -1;\r\n\t} else if(val2 > val1) {\r\n\t\treturn 1;\r\n\t} else {\r\n\t\treturn 0;\r\n\t}\r\n}", "function sameValueExact(a, b) { // flag for exaxt? which ignores eg 0\n var type = a.type\n\n if (type === \"Dimension\") {\n if (a.val =...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }