query
stringlengths
9
34k
document
stringlengths
8
5.39M
negatives
listlengths
19
20
metadata
dict
sendQueued the queued messages to the other client.
sendQueued(otherClient) { if (this.id === otherClient.id || !otherClient.ws) { throw Error("Invalid client"); } for (var m of this.msgs) sendServerMsg(otherClient.ws, m); this.msgs = []; debug("Sent queued messages from %s to %s", this.id, otherClient.id); }
[ "sendQueuedRequests() {\n this._startTimer();\n }", "_sendRequestFromQueue () {\n while (this[ _requestQueue ].length > 0) {\n const request = this[ _requestQueue ].shift()\n this._sendRequest(request)\n }\n }", "function jsonq_send()\n\t{\n\t\tif (jsonq_uid > 0 && typeof jsonq_queue['u'+(j...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Adapted from Mojo2: app/models/formatter_service.js:Formatter.getAlarmStrings() It differs in behavior primarily in that it only processes one alarm value at a time. Params: alarmValue A string that specifies an RFC5545 duration. Example: PT5M Returns: String description of alarm. Example: 5 minutes before (Processed p...
function getAlarmString(alarmValue) { DEBUG && console.log("===:===: in getAlarmString:" + alarmValue); // we are hardcoding static options to avoid // having to parse the period unnecessarily every time. var val; switch (alarmValue) { // TODO: Implement a regex or something to ...
[ "function listAlarms(){\n\tchrome.alarms.getAll(function (alarms){\n\t\t$.each(alarms, function(index, alarm){\n\t\t\tconsole.log(\"[ALARM LIST]\"+alarm.name);\n\t\t});\n\t});\n}", "_toPartialFormat(value) {\n const parts = value.split(\":\");\n const newParts = [];\n if (!this.hideHours) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Definimos el constructor de la subclase ClassB
function ClassB(primerNombre, asunto){ // LLamamos al constructor de la superclase ClassA.call(this, primerNombre); // Inicializamos las propiedades específicas de la subclase this.asunto=asunto; }
[ "function objj_initialize(aClass) {\n\t// need to initialize top-down\n\tlet chain = [];\n\tfor (let targetClass = aClass; targetClass !== Object.getPrototypeOf(_CPObject2.default); targetClass = Object.getPrototypeOf(targetClass)) {\n\t\tif (!targetClass.initialized) chain.unshift(targetClass);\n\t}\n\n\tfor (let ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Read a manifest (creating a new one dynamically as applicable) and emit it, returning its contents.
function readManifest(compilation, manifest, opts) { let data; let files = []; if (typeof manifest === 'string') { if (fs.existsSync(manifest)) { if (opts.symlinks) manifest = fs.realpathSync(manifest); data = fs.readFileSync(manifest, {encoding: 'utf8'}); if (data) { files = JSON.parse(data).files ||...
[ "get manifest(){\n if(fs.existsSync(path.join(this.root, 'package.json'))){\n return JSON.parse(fs.readFileSync(path.join(this.root, 'package.json')))\n }\n }", "function readManifest() {\n if (manifestExists()){\n var manifestString = fs.readFileSync(testManifestPath, 'utf8');\n var manifestJS...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Create alert event for an assignment.
function createAlertForAssignment(axios$$1, token, payload) { return restAuthPost(axios$$1, 'assignments/' + token + '/alerts', payload); }
[ "function _assignEmployeeAfterWarning(event) {\r\n var empPk = $(this).data(\"employee-pk\");\r\n var schPk = $(this).data(\"schedule-pk\");\r\n var strCalDate = calDate.format(DATE_FORMAT);\r\n $.post(\"add_employee_to_schedule\",\r\n {employee_pk: empPk, schedule_pk: schPk, cal_date: strCalD...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This method gets called when one of the termination events the plugin listens for is emitted. If stops the server, deletes the instance and exits the process.
_terminate() { if (this._instance) { this._instance.close(); this._instance = null; this._stopListeningForTermination(); this._options.onStop(this); } process.exit(); }
[ "_stopListeningForTermination() {\n this._terminationEvents.forEach((eventName) => {\n process.removeListener(eventName, this._terminate);\n });\n }", "_startListeningForTermination() {\n this._terminationEvents.forEach((eventName) => {\n process.on(eventName, this._terminate);\n });\n }",...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
gets all selected toppings/addons
function getaddons(table, astext){ if(!table){ var addons = new Array; for(var i=0; i < tables.length; i++){ addons.push( getaddons(tables[i], true) ); } return addons.join(", ").trim().trimright(","); } if(isUndefined(astext)){astext = false;} var qualifiers ...
[ "function listAllSuites() {\n var allSuites = Object.keys(objekt);\n\n allSuites.forEach(suite => {\n document.querySelector('#suites').innerHTML += `<div class=\"custom-control custom-checkbox\">\n <input type=\"checkbox\" class=\"custom-control-input\" id=\"${su...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Helper function to get the given `normalizedLocale` from `LOCALE_DATA` or from the global `ng.common.locale`.
function getLocaleData(normalizedLocale) { if (!(normalizedLocale in LOCALE_DATA)) { LOCALE_DATA[normalizedLocale] = _global.ng && _global.ng.common && _global.ng.common.locales && _global.ng.common.locales[normalizedLocale]; } return LOCALE_DATA[normalizedLocale]; }
[ "function getLocale () {\n return locale\n}", "function getLocale() {\n try {\n if (Services.prefs.getBoolPref(PREF_MATCH_OS_LOCALE))\n return Services.locale.getLocaleComponentForUserAgent();\n }\n catch (e) { }\n\n try {\n let locale = Services.prefs.getComplexValue(PREF_SELECTED_LOCALE,\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Accepts either empty object or preexisting task descruptor (object with 'name' and 'args') and enhances it with id, promise and resolvers for the promise.
function createTask(task = {}) { if (task.promise) return task task.promise = new Promise((resolve, reject) => { task.resolvers = {resolve, reject}; }); task.id = `${Date.now()}-${Math.floor(Math.random() * 100000)}`; return task }
[ "function updateTaskById(id, { description, done }) {\n\tconst task = getTaskById(id);\n\tif (done !== undefined) {\n\t\ttask.done = !!done;\n\t}\n\tif (description) {\n\t\ttask.description = description;\n\t}\n\treturn task; //注:这里的思路与拆分前的有差异,这里是直接更改原task的属性,拆分前的版本是新建task再替换。\n}", "constructor() { \n \n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Return the Julian Day of the most recent sunrise starting from the given day at the given location on earth in degrees
function findRecentSunrise(jd, latitude, longitude) { var julianday = jd; var time = calcSunriseUTC(julianday, latitude, longitude); while(!isNumber(time)) { julianday -= 1.0; time = calcSunriseUTC(julianday, latitude, longitude); } return julianday; }
[ "function findNextSunrise(jd, latitude, longitude) {\n var julianday = jd;\n var time = calcSunriseUTC(julianday, latitude, longitude);\n while(!isNumber(time)) {\n julianday += 1.0;\n time = calcSunriseUTC(julianday, latitude, longitude);\n }\n return julianday;\n}", "function calcSu...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Maps tile ids to shape ids (both are nonnegative integers). Supports onetomany mapping (a tile may belong to multiple shapes) Also maps shape ids to tile ids. A shape may contain multiple tiles Also supports 'flattening' removing onetomany tileshape mappings by removing all but one shape from a tile. Supports onetomany...
function TileShapeIndex(mosaic, opts) { // indexes for mapping tile ids to shape ids var singleIndex = new Int32Array(mosaic.length); utils.initializeArray(singleIndex, -1); var multipleIndex = []; // index that maps shape ids to tile ids var shapeIndex = []; this.getTileIdsByShapeId = function(shapeId) ...
[ "function refactorShape(id){\r\n\tsciMonk.viewStack.pop();\r\n\tsciMonk.placementType = \"shape\";\r\n\tsciMonk.currentShape.shape = sciMonk.currentModel.shapes[id].shape;\r\n\tsciMonk.currentShape.scaledShape = sciMonk.currentModel.shapes[id].shape;\r\n\tsciMonk.currentShape.originalShape = sciMonk.currentModel.sh...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Determines if my user is connected in a conversation
function isMyUserConnected(conversation) { let isConnected = false; // Participant : "id", "address", "startTime", "connectedTime", "endTime", "state": "disconnected", // "direction": "disconnectType", "held", "user", "queue", "attributes","recordingState": "none",... // Participant.purpose: "age...
[ "showUserLoggedConversation(){\n let loggedId = this.props.loggedUser && this.props.loggedUser.id;\n let membersId = false;\n this.props.conversation.members.forEach(msg => {\n if (msg === loggedId) {\n membersId = true;\n }\n });\n\n if(member...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
get matches result for a given session and two faces
async function getMatches(sessionId, referenceFaceId, candidateFaceId) { return new Promise(((resolve, reject) => { const xhttp = new window.XMLHttpRequest(); xhttp.open('GET', `${basePath}/bio-session/${sessionId}/faces/${referenceFaceId}/matches/${candidateFaceId}`, true); xhttp.responseType = 'json'; ...
[ "chatResultFace(faces) {\n let output = \"\";\n let src = \"\";\n let path = \"modules/ffg-roller/images/\";\n let imgTag = '<img src=\"fPath\" width=\"36\" height=\"36\"/>';\n //ability dice\n for (let i = 0; i < faces.abil.length; i++) {\n if (faces.abil[i] > 0...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
============================================================================= JOINGAME TIMER LISTENER ============================================================================= Triggered every five seconds when the game room is full
function joinTimerListener (e) { hud.setStatus("Joining game..."); room.join(); }
[ "function timeAttack() {\n ui.setText(\"EnemyCounter\", \"\");\n if (game.enemiesAlive == 0 && !game.waveActive) {\n ui.setText(\"Timer\", Math.floor(game.countDown));\n waveCooldown();\n } else if (game.waveActive) {\n game.countDown = game.countDown - (1 / 60);\n ui.setText(\"Timer\", Math.floor(ga...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Renders the paths legend and color key. Labels should not be "shown" in the legend if they are not in the actual topology being displayed.
function drawLegend() { var shown = buildLabels(); var idx = 0; var legend = svgPath.selectAll(".legend").data(colorPath.domain()).enter() .append("g").attr("class", "legend").attr("transform", function(d) { // Use our enumerated idx for labels, not all-color index i ...
[ "function drawLegend() {\n var legend = $(\"#legend\");\n legend.empty();\n\n var legendContainer = $(\"<div>\");\n legendContainer.addClass(\"legendContainer\");\n\n // Nur die Labels, die wir auch anzeigen!\n for(var lbl of usedLabels.entries()) {\n var catId = lbl[0];\n var catego...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
User.isResumable is true if user is gone but can be resumed
get isResumable() { return [GONE_COOLDOWN].includes(this.goneStatus); }
[ "hasRemainingUsers() {\n return this.remainingUsers !== 0\n }", "function _canPromote() {\n return (remainingSeconds <= 0);\n }", "function suspendUser() {\n return confirm(\"Are you sure you want to suspend this user?\");\n}", "isResume() {\n return !this.isPaused();\n }", "isPer...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
firstSlide display the first slide
function firstSlide() { var h; h = document.body.firstChild; while (h && !isStartOfSlide(h)) h = h.nextSibling; if (h != null) makeCurrent(h); }
[ "function showSlide(int) {\n\tvar slide = document.getElementsByClassName(\"slides\");\n\tif (int > slide.length) {\n\t\tslideIndex = 1;\n\t} else if (int < 1) {\n\t\tslideIndex = slide.length;\n\t}\n\tfor (var i = 0; i < slide.length; i++){\n\t\tslide[i].style.display = \"none\";\n\t}\n\tslide[slideIndex - 1].styl...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
PART 1: Function Syntax EXAMPLE: Write a function below that, when called will log "Severus Snape" to the console
function printName() { console.log("Severus Snape"); }
[ "function logShout(string) {\n console.log(string.toUpperCase());\n}", "function myName(name) {\n console.log(\"Hello I am \" + name);\n}", "function massage() {\n console.log(\"****************************************************************\")\n console.log(\"Sorry honey, that service isn't digi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
linePointVector is the line point (Vector3 object) u is a constant dVector is the vector for the line (Vector3 object) planePointVector is a point on the triangluar plane (Vector3 object) nVector is the plane normal vecor (Vector3 object)
function getIntersection(linePointVector, dVector, planePointVector, nVector){ //calculate the cross product vector of the line vector and the //plane normal. var crossProduct = vector3CrossProduct(dVector, nVector); //calculate the magnitude of that vector var magnitude = vector3Magnitude(crossProduct); /...
[ "function linePlaneIntersection(p, q, n, c) {\n var v = [q.x - p.x, q.y - p.y, q.z - p.z]\n var w = [c.x - p.x, c.y - p.y, c.z - p.z]\n var t = (n[0]*w[0] + n[1]*w[1] + n[2]*w[2]) /\n (n[0]*v[0] + n[1]*v[1] + n[2]*v[2])\n if (t < 0 || t > 1)\n return null\n return {x: p.x + t*v[0], y: p.y + t*v[1],...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Computes the output shape given the strided slice params.
function computeOutShape(begin, end, strides) { const size = []; for (let axis = 0; axis < begin.length; axis++) { size[axis] = Math.ceil((end[axis] - begin[axis]) / strides[axis]); } return size; }
[ "function calcSlicedPart() {\n return slicedPart = innerBoxWidth % containerWidth;\n }", "function getStrides(dims) {\n 'use strict';\n if (dims.length == 1) {\n\treturn [1];\n }\n var reversed = dims.slice(0).reverse();\n var strides = [];\n _us.each(reversed, function(val, idx, arr) {\n\ti...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
copy provisional state to published and run optional callback
handlePublish(cb) { const { provisional, progress } = this.state this.setState({ lastPublish: new Date(), published: provisional }) this.setProgress({ provisional: 0, published: progress.provisional + progress.published }) typeof cb === 'function' && cb() }
[ "commit(prop, data) {\n // this line is overwriting the [prop] in state (hard save) with the data after Service has edited.\n _state[prop] = data\n // 6. This line basically invokes every function that was passed through. -step 7 in Inv controller -\n _subscribers[prop].forEach(fn => fn());\n console...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
AddThis On Ready The API is fully loaded only fire this the first time we load the AddThis API even when using ajax
function addthisReady() { if (globalDebug) { console.log("AddThis Ready"); } addThisInit(); }
[ "function loadAddThisScript() {\n\tif (window.addthis) {\n\t\tif (globalDebug) {\n\t\t\tconsole.log(\"AddThis Load Script\");\n\t\t}\n\t\t// Listen for the ready event\n\t\taddthis.addEventListener('addthis.ready', addthisReady);\n\t\taddthis.init();\n\t}\n}", "function initializeAddLive() {\n ADLT.initializeA...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Removes all players from the room.
clear() { this._players = []; }
[ "destroy() {\n\t\tif (this.timer) {\n\t\t\tclearTimeout(this.timer);\n\t\t}\n\t\tfor (const i in this.playerTable) {\n\t\t\tthis.playerTable[i].destroy();\n\t\t}\n\t\t// destroy this game\n\t\tthis.room.game = null;\n\t}", "function removeAll() {\n\t\tfor (var i = 0; i <= vm.totalGameTypes; i++) {\n\t\t\tremove(i...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
add a configuration listener for the given request
add_configuration_listener(house_id, args, wait_for_it) { // just wrap add_listener var topic = this.add_listener(house_id, "controller/config", "*/*", "CONF", args, wait_for_it) // if the config is not retained on the gateway, notify controller/config if (this.__module.gateway_versi...
[ "function createRequestListener(path) {\n\treturn function(request, response) {\n\t\tvar httpRequest;\n\t\t\n\t\t// Create the right request for the HTTP method. Works similar\n\t\t// to Factory Pattern.\n\t\tswitch (request.method) {\n\t\tcase 'HEAD':\n\t\t\twinston.info('Process HEAD request with url: ' + request...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Calculate checksums for all projects in the workspace based on last git commit to project directory uncommitted changes resolved dependencies from yarn.lock referenced by project package.json
async function getAllChecksums(osd, log, yarnLock) { const projects = osd.getAllProjects(); const changesByProject = await getChangesForProjects(projects, osd, log); /** map of [project.name, cacheKey] */ const cacheKeys = new Map(); await Promise.all(Array.from(projects.values()).map(async project => { ...
[ "async function getChecksum(project, changes, yarnLock, osd, log) {\n const sha = await getLatestSha(project, osd);\n\n if (sha) {\n log.verbose(`[${project.name}] local sha:`, sha);\n }\n\n if (!changes || Array.from(changes.values()).includes('invalid')) {\n log.warning(`[${project.name}] unable to dete...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
given the seed (in hex) and key number or string, returns the private key (in hex)
function seed2key(pk, c){ return hex2hexKey(hash256(pk+c)); }
[ "generatePrivateKey() {\n // Generates 64 hexadecimal values then concatenates all 64 values\n let r = [];\n for (let i = 0; i < 64; i++) {\n r.push(this.random.integer(0, 15).toString(16));\n }\n return r.join('');\n }", "function privateKeyFromSubseed(subSeed, se...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
function that validates that all edit form input is correctly filled out, and if it is, sends a PUT request using jquery to the server with the id of the dog being updated SOURCE (of PUT request) Title: updateperson.js Authors: Justin Wolford, Samarendra Hedao Initial Publish Date: 10/25/2017 Code version: Availability...
function updateDog(id) { var x = document.forms["editdogform"]["name"].value; var y = document.forms["editdogform"]["birthdate"].value; var z = document.forms["editdogform"]["breed"].value; if (x == "") { alert("Name must be filled out"); return false; } else if (y == "") { ...
[ "function put() {\n\n // Create a url for the ajax request.\n $.each(editObject, function(index, value) {\n if(index == 'id') {\n url += index+\"=\"+value;\n } else {\n url += \"&\"+index+\"=\"+value;\n }\n });\n\n $.ajax({\n url: 'api/?'+url,\n m...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gibt die Konfigurationsdaten einer Option zurueck opt: Config und Value der Option defConfig: Rueckgabewert, falls Config nicht zu finden return Konfigurationsdaten der Option
function getOptConfig(opt, defConfig = { }) { return getValue(getOpt(opt).Config, defConfig); }
[ "defaultOptions() {\n console.error('.defaultOptions() is deprecated, use .DEFAULT_OPTIONS instead.');\n return DEFAULT_CONFIG;\n }", "mergeSetOptionDefualtOption(option) {\r\n let options = (option && _.isObject(option)) ? _.pick(option, _.keys(this.defaultOptions)) : {};\r\n\r\n options = _.extend(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Pulls Carma data, adds data to geo info object and calls drawChart
function successfulCarmaPull(data) { geo_info_object.fossil = parseFloat(data[0].fossil.present); geo_info_object.hydro = parseFloat(data[0].hydro.present); geo_info_object.nuclear = parseFloat(data[0].nuclear.present); geo_info_object.renewable = parseFloat(data[0].renewable.present); google.charts...
[ "function drawChinaMap() {\n const data = google.visualization.arrayToDataTable(CHINA_MAP_TABLE);\n\n const options = {\n region: CHINA_REGION,\n width: 500,\n height: 310,\n colorAxis: {colors: ['#4374e0', '#4374e0']}\n };\n\n const chart = new google.visualization.GeoChart(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
A DFA state represents a set of possible ATN configurations. As Aho, Sethi, Ullman p. 117 says "The DFA uses its state to keep track of all possible states the ATN can be in after reading each input symbol. That is to say, after reading input a1a2..an, the DFA is in a state that represents the subset T of the states of...
function DFAState(stateNumber, configs) { if (stateNumber === null) { stateNumber = -1; } if (configs === null) { configs = new ATNConfigSet(); } this.stateNumber = stateNumber; this.configs = configs; // {@code edges[symbol]} points to target of symbol. Shift up by 1 so (-1)...
[ "function State(charSpec) {\n this.charSpec = charSpec;\n this.nextStates = [];\n this.regex = undefined;\n this.handlers = undefined;\n this.specificity = undefined;\n }", "function epsClosure(inpFA,stateQ){\r\n\t\r\n\tvar visited = new Array(inpFA.nStates).fill(0);\r\n\tvar epsSet = ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Return a new ``int256`` type for %%v%%.
static int256(v) { return n(v, -256); }
[ "static uint256(v) { return n(v, 256); }", "static uint(v) { return n(v, 256); }", "static uint240(v) { return n(v, 240); }", "static uint208(v) { return n(v, 208); }", "static uint32(v) { return n(v, 32); }", "static uint192(v) { return n(v, 192); }", "static uint112(v) { return n(v, 112); }", "stati...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
call_create_query save the query in the active mapResult.html or queryResult.html page for later viewing
function call_create_query() { // list every node with class saveQuery: var values = ''; var nodes = dojo.query(".saveQuery"); for( var x = 0; x < nodes.length; x++ ) { var k, v; k = nodes[x].id; v = nodes[x].value; if( k == 'name' ) { v = encodeURIComponent(v); // make sure the name is encoded. } ...
[ "runSoqlQuery()\n {\n this.setSelectedMapping();\n this.setSelectedAction();\n this.callRetrieveRecordsUsingWrapperApex();\n }", "function submitCustomQuery(text){\r\n\t\tvar endpoint=\"http://data.uni-muenster.de:8080/openrdf-sesame/repositories/bt\";\r\n\t\t//sent request over jsonp p...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get whether the graph currently has a selection region. Default value is false. If true, it would be valid to filter the data points to return a subset within the selection region, although this region may be empty! If false the graph is not considered to have a selection region. Note that even if has_selection is true...
function hasSelection() { return has_selection; }
[ "function is_selection_coordinates(x, y)\n{\n\tif(selection_coordinates == null)\n\t{\n\t\treturn false;\n\t}\n\telse\n\t{\n\t\treturn x == selection_coordinates.x && y == selection_coordinates.y;\n\t}\n}", "isComplete() {\n return this.selection != null;\n }", "function extPart_getIsSelectionRel(part...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Change to the given quote. index An Integer describing the index of a particular quote, or falsy for a random quote.
function changeQuote(index) { // Prevent switching quote and color if event is triggered by text selection if (getSelection().toString()) return; rotate(colors, setBackground); if (index) { setQuote(window.quotes[index]); } else { rotate(quotes, setQuote); } }
[ "generateQuoteIndex() {\n if (!this.state.quotes.length) {\n return undefined;\n }\n return random(0, this.state.quotes.length - 1);\n }", "function updateQuote() {\n\t\tvm.quotesAdded.splice(vm.quoteCurrentIndex, 1, {\n\t\t\tbody: vm.quoteCurrent.body,\n\t\t\tauthor: vm.quoteCurrent.author,\n\t\t\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns whether the CL is labeled 'work in progress'.
isWorkInProgress() { return this.json_.work_in_progress === true; }
[ "checkIfCurrentJob() {\n return (this.jobId === DiffDrawer.currentJobId);\n }", "isCompletedRunCurrent () {\n return this.runCurrent?.RunDigest && Mdf.isRunCompleted(this.runCurrent)\n }", "isBusy() {\n return this.totalTasks() >= this.options.maxPoolSize;\n }", "function checkState() {\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Helper Functions Create a HTML element specified by parameter 'p_type'
function createSimpleElement(p_type,p_id,p_class) { element = document.createElement(p_type); if (p_id!=undefined) element.id = p_id; if (p_class!=undefined) element.className = p_class; return element; }
[ "function elt(type) {\n var node = document.createElement(type);\n for (var i = 1; i < arguments.length; i++) {\n var child = arguments[i];\n if (typeof child == \"string\")\n child = document.createTextNode(child);\n node.appendChild(child);\n }\n return node;\n}", "fu...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
META ((export list>string) (arity t) (peephole (hole 1 "new sc_String(sc_list2jsstring(" l "))")))
function sc_list2string(l) { return new sc_String(sc_list2jsstring(l)); }
[ "function sc_string2list(s) {\n return sc_jsstring2list(s.val);\n}", "function dumplist(l) { \n var i, rv = []; \n \n rv.push(\"has \"+l.length+\" elements:\"); \n for (i=0; i<l.length; i++) { \n rv.push(\" \"+i+\"\\t\"+l[i].toSpecifier()+ \n \"\\t\"+l[i].markupTag.nam...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
saveAudio takes in an audio file encoded in base64, converts it to binary, and then converts it to webm, finally it saves it to disk. this surprisngly works synchronously... pretty sure I'm gonna have to make sure this works asynchronously later params: base64Audio audio file encoded in base64, this file will be conver...
saveAudio(base64Audio, fileName) { console.log('Attempting to save ' + fileName + ' to disk...'); var newFileName = rootDir + '/' + directory + fileName + originalAudioType; var mkdir = fileName.substring(0,fileName.indexOf('/')); mkdir = rootDir + '/' +directory + mkdir shell.mkdir('-p', mkdir); cons...
[ "convertAudio(fileName) {\n\t\tconsole.log('in convertAudio => ');\n\t\tconsole.log('ffmpeg path: ' + ffmpegPath);\n\t\tconsole.log('audio dir path: ' + rootDir);\n\t\tvar oldAudioFile = rootDir + '/' + directory + fileName + originalAudioType;\n\t\tvar newAudioFile = rootDir + '/' + directory + fileName + converte...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
FUNCTION: extPart.queueDocEdit() DESCRIPTION: This is a small wrapper for DocEdits_queue() that performs some partspecific logic. ARGUMENTS: See DocEdits_queue(). RETURNS: nothing
function extPart_queueDocEdit(partName, text, priorNodeSegment, weight, relativeNode, optionFlags) { var obj = new DocEdit(text, priorNodeSegment, weight, relativeNode, optionFlags); if (obj.priorNode) { var offsets = dwscripts.getNodeOffsets(obj.priorNode); obj.insertPos = offsets[0]; offsets = ext...
[ "function dwscripts_queueDocEditsForParticipant(partName, paramObj)\n{\n extPart.queueDocEdits(\"\", partName, paramObj, null); // no group name or sbObj\n}", "function docEdits_queue(text, priorNodeSegment, weight, relativeNode, optionFlags)\n{\n try\n {\n var obj = new DocEdit(text, priorNodeSegment, wei...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Updates this user custom action with the supplied properties
async update(props) { const data = await spPostMerge(this, request_builders_body(props)); return { data, action: this, }; }
[ "async update(properties) {\n return spPostMerge(this, request_builders_body(properties));\n }", "async update(properties) {\n const s = [\"BasePermissions\"];\n if (hOP(properties, s[0]) !== undefined) {\n const bpObj = properties[s[0]];\n bpObj.High = bpObj.High.toS...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns the underlying value of a wrapped value. Returns the given `value` when it is not wrapped.
static unwrap(value) { return WrappedValue.isWrapped(value) ? value.wrapped : value; }
[ "getRawValue() {\n return this.value;\n }", "function _wrapInPromise(value) {\n\t\t\treturn $q.when(value);\n\t\t}", "function wrapElementaryValue(value, definition) {\n let dataType = types_1.Types.definitionToType(definition, null); //force location to undefined\n switch (dataType.type...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Check if a given value lies within the defined bounds, i.e. between the minimum and maximum value returns the boolean result
function isWithin(value, min, max) { return ((value <= min) && (value >= max)); }
[ "function checkRange(value, lowerBounds, upperBounds) {\n if (value >= lowerBounds && value <= upperBounds)\n return value;\n else\n return !value;\n}", "function valueInBounds(v, [min, max]) {\n return v >= min && (max === undefined || v <= max);\n }", "function check(min, max, target) ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Format err in json, inline string.
function format(err) { return JSON.stringify(asResponse(err)); }
[ "function jsonError(msg) {\r\n console.log(`${RED}**** Error **** ${RESET}${msg}`);\r\n return (\"{\\\"error\\\":\\\"\" + msg + \"\\\"}\");\r\n}", "errors() {\n return ys(this.rawErrors, (e) => e.join(`\n`));\n }", "function buildError(code,message){\n return {\n \"status\" : \"error\",\n \"...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
lvLV validation function (Personas kods (PK), persons only) Check validity of birth date and calculate check (last) digit Support only for old format numbers (not starting with '32', issued before 2017/07/01) Material not in DG TAXUD document sourced from: `
function lvLvCheck(tin) { tin = tin.replace(/\W/, ''); // Extract date from TIN var day = tin.slice(0, 2); if (day !== '32') { // No date/checksum check if new format var month = tin.slice(2, 4); if (month !== '00') { // No date check if unknown month var full_year = tin.slice(4, 6); ...
[ "function validateModified(cb_err) {\n if (typeof this.modified !== 'undefined') {\n if (!validator.isDate(this.modified)) {\n cb_err();\n }\n }\n }", "function validateStandardDate(due){\n var mess = \"\";\n if (due == \"\") {\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
makes recursive public checks, and maps object
_mapData (root, data, entities) { if (!entities) entities = this.privateSchema Object.keys(entities).map(function (objectKey, index) { let entity = entities[objectKey] let item = data[entities[objectKey]._privateName] if (!this._isUndefined(entity._decorator)) { let decorator = entit...
[ "function PuplishMap(){}", "function _internals() {\n return {\n a: acc\n , b: brs\n , c: cnt\n , m: m\n , r: r\n , g: gnt\n };\n }", "function initHardcodedValidators() {\n // MemverExpression.property can either be an expression or an identifier\n // Th...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Check if two courses share days with each other (for calculating conflicts)
function shareDays(course1, course2){ var days1 = parseDays(course1.meeting_days); var days2 = parseDays(course2.meeting_days); for (var i=0; i < days1.length; i++){ for (var j=0; j < days2.length; j++){ if (days1[i] == days2[j]){ return true; // Return true if a shared day exists } } ...
[ "function conflicted(course1, course2){\n \treturn (shareDays(course1, course2) && (course1.start_time <= course2.end_time && course1.start_time >= course2.start_time ||\n\t course2.start_time <= course1.end_time && course2.start_time >= course1.start_time ||\n\t course1.start_time <= course2.start_time && c...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
endregion dateArray region Insert New Route Row
function insertRow(dateArr) { for (let rowIndex = 0; rowIndex < dateArr.length; rowIndex++) { window[newRow + rowIndex] = tbody.insertRow(table.length); for (let cellIndex = 0; cellIndex < table.rows[0].cells.length; cellIndex++) { window[column + cellIndex] = window[newRow + rowIndex].i...
[ "function addVisitedRestaurant(name, date, cuisine, city) {\n // add to front of array so keep in date order\n // for (var i = 0; i < visitedRestaurants.length; i++) {\n // console.log(\"Before \" + i + \" \" + JSON.stringify(visitedRestaurants[i]));\n // }\n visitedRestaurants.unshift({\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Record usage for the metered plan attached to this subscription. Returns the total usage for this billing period. This method requires: numRequests: the number of requests included in this usage record
async recordUsage(numRequests) { try { // JavaScript's timestamps are in milliseconds, but Stripe's API uses seconds const timestamp = Math.floor(new Date().getTime() / 1000); // Stripe: Update the usage for the metered subscription await stripe.subscriptionItems.createUsageRecord( t...
[ "function UsagePlan(props) {\n return __assign({ Type: 'AWS::ApiGateway::UsagePlan' }, props);\n }", "async update(plan) {\n try {\n // Fetch a matching plan\n const monthlyPlan = await Plan.getByNickname(plan);\n const meteredPlan = await Plan.getByNickname(plan + '_requests')...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
prevent sending "completed" email more than once. GenerateBuildReport() // // Produce the build completion email with elapsed time and // duplicate file reports. // // This function checks to ensure it only sends this email // one time.
function GenerateBuildReport() { if (!g_AlreadyCompleted && !PrivateData.objConfig.Options.fRestart) { var strTitle; var strMsg; var strDuplicated = ""; var strElapsed = GetElapsedReport(); if (!PrivateData.fIsStandalone) strDuplicated = GetDuplicat...
[ "function reportBuildStatus() {\n console.info('----\\n==> ✅ Building production completed (%dms).', (Date.now() - global.BUILD_STARTED));\n process.exit(0);\n}", "function _daily_report_(ListName,Destination)\n{\n var listId = _list_by_name_(ListName);\n if (!listId) {\n Logger.log(\"No such list\");...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
setCurBlockName() sets the current block label IF it is not already in use amoung any of the procedures defined at the top level; returns false if the name could not be set
function setCurBlockName(name) { if (topBlock.forEachChild(function(child){ if (child.getLabel() == name) return false; return true; })) { currentBlock.setLabel(name); drawScreen(); return true; } re...
[ "function underLevel(name) {\n for (var blo of blockStack) {\n if (blo.getLabel() == name)\n return true;\n }\n return currentBlock.getLabel() == name;\n }", "partName(part) {\n return this.blocks[part].getName('New Block', true);\n }", "function analyze_blo...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns true if format of Mail is wrong. If correct or empty, returns false
function formatMail() { var thereIsDot = mail.value.indexOf("."); var atpos = mail.value.indexOf("@"); var dotpos = mail.value.lastIndexOf("."); if(!checkMail){ return false } else if (atpos < 1 || dotpos < atpos+2 || dotpos+2 >= mail.value.length || atpos === -1 || thereIsDot === -1){ wrongFiel...
[ "function checkMail(){\r\n\tif (mail.value == null || mail.value == \"\"){\r\n\t\temptyFieldsArray.push(\" Email\");\r\n\t\tborderRed(mail);\r\n\t\treturn true;\r\n\t}\r\n\telse{\r\n\t\treturn false;\r\n\t}\r\n}", "function validateMail() {\n \n var mail = document.querySelector(\"#mail\").value;\n var r...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns a color for the current user. If the user does not have a color, one will be assigned and sent along to the other participants in the wave. It is posible that this color will change later, if there is a conflict with another user.
function getMyColor() { if (!gapi.hangout.data) return '#dddddd'; var state = gapi.hangout.data.getState(); if (!state) return '#dddddd'; // This is what we think our color is. // It's possible that someone else has stolen it from us. var my_color = Globals.my_color; // This is the user's Google+ ID, e...
[ "function currentColor() {\n\treturn new Color({red: color.red, green: color.green, blue: color.blue})\n}", "function setUserColor() {\r\n\tif (typeof(Storage) !== \"undefined\") {\r\n\t\tif (localStorage.color) {\r\n\t\t\t//botdata.characters.user.avatar = localStorage.avatar;\r\n\t\t\tbotdata.characters.user.co...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Decorator: Defines a platform custom element based on `FASTElement`.
function customElement(nameOrDef) { /* eslint-disable-next-line @typescript-eslint/explicit-function-return-type */ return function (type) { new _fast_definitions__WEBPACK_IMPORTED_MODULE_1__.FASTElementDefinition(type, nameOrDef).define(); }; }
[ "function BAElement() { }", "elem(arg) {\n switch (_Util_main_js__WEBPACK_IMPORTED_MODULE_1__.default.getType(arg)) {\n // Applies view to every modifier function, if there are no modifer functions elem is returned:\n case \"undefined\":\n return this._fns.reduce((view, fn) => {\n re...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
return the first day of the week from the locale data. Defaults to 'world' territory if no territory is derivable from CLDR. Failing to use CLDR supplemental (not loaded?), revert to the original method of getting first day of week.
function firstOfWeek(culture) { try { var days = ['sun', 'mon', 'tue', 'wed', 'thu', 'fri', 'sat']; var cldr = locale(culture).cldr; var territory = cldr.attributes.territory; var weekData = cldr.get('supplemental').weekData; var firstDay = weekData.firstDay[territory || '001']; ...
[ "function GetWeekDayString(day) {\n switch (day) {\n case 0:\n return 'Sunday';\n break;\n case 1:\n return 'Monday';\n break;\n case 2:\n return 'Tuesday';\n break;\n case 3:...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
TODO saveFrameworkPublish define and implement This function doesn't really do anything at the moment Just a place holder for future functionality
function saveFrameworkPublish() { hideModalError(FWK_PUBLISH_MODAL); if (isValidPublishDataFromFrameworkPublish()) { showModalBusy(FWK_PUBLISH_MODAL,"Publishing framework..."); setTimeout(function() { hideModalBusy(FWK_PUBLISH_MODAL); enableModalInputsAndButtons()...
[ "exportToCMS() {\n if (window.iotDB.onSaveConfig) {\n window.iotDB.onSaveConfig();\n }\n }", "function respecPost(respecConfig) \n{\n console.log(\"Start PostProcessor\");\n\n changeDocTitle();\n changeURLs();\n changeSOTD();\n changeCopyRight();\n removeGhPages();\n changePV()...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sends the local rumble and lightbar state to the controller. This function is called automatically in most cases. Currently broken over Bluetooth, doesn't do anything
async sendLocalState () { if (!this.device) throw new Error('Controller not initialized. You must call .init() first!') if (this.state.interface === 'usb') { const report = new Uint8Array(16); // Report ID report[0] = 0x05; // Enable Rumble (0x01), Lightbar (0x02) report[1]...
[ "function enableMarbles() {\n\tgameObject.BroadcastMessage(\"enableMarble\");\n}", "function sendIdle() {\r\n sendStatus(status = \"idle\");\r\n}", "function flushLEDs()\r\n{\r\n\t// changedCount contains number of lights changed\r\n var changedCount = 0;\r\n\r\n // count the number of LEDs that are goin...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Monotone chain algorithm for find the convex hull of a set of boxes
function convexHullBox(boxes) { //Get all corners of the boxes var points = []; for (var i = 0; i < boxes.length; i++) { points = points.concat(getCorner(boxes[i], 'all')); } //Sort them on x and then on y coordinate points.sort(function(a, b) { return a.x == b.x ? a.y - b.y : a.x - b.x; }); //R...
[ "function cullIntersections() {\n function toLines(pts) {\n let lns = [];\n for (let i=0, il=pts.length; i<il; i += 2) {\n lns.push({a: pts[i], b: pts[i+1], l: pts[i].distTo2D(pts[i+1])});\n }\n return lns;\n }\n let aOa = [...arguments].filter(t => t);\n if (aOa.l...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Event handler set in view to list all static shortcuts
function listStaticShortcuts() { if (!appShortcuts) { return alert('This device does not support Force Touch'); } log.args('Ti.UI.iOS.ApplicationShortcuts.listStaticShortcuts', appShortcuts.listStaticShortcuts()); }
[ "function listDynamicShortcuts() {\n\n\tif (!appShortcuts) {\n\t\treturn alert('This device does not support Force Touch');\n\t}\n\n\tvar res = appShortcuts.listDynamicShortcuts();\n\n\tlog.args('Ti.UI.iOS.ApplicationShortcuts.listDynamicShortcuts', res);\n\n\t// If don't have any, explain how to create it\n\tif (r...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates player sprite and sets HP, fuel, cars passed
function initializePlayer(){ let scale = scalePlayer(mode); playerHP = 100; playerFuel = 100; carsPassed = 0; //Player start position player = createSprite(playerX,playerY, carW / scale, carH / scale); player.addImage('start', p00); player.addImage('dmg01', p01...
[ "function setupPlayer() {\n playerX = 4*width/5;\n playerY = height/2;\n playerHealth = playerMaxHealth;\n}", "function createPlayer() {\n player = new PIXI.AnimatedSprite(playerSheet.walkSouth);\n player.anchor.set(0.5);\n player.animationSpeed = 0.18;\n player.loop = false;\n player.x = app.view.width /...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Set random bot status(includes random game as well as random streaming url)
function setRandomStatus() { bot.shards.forEach(shard => { shard.editStatus({ name: playing[~~(Math.random() * (playing.length))], type: 1, url: urls[~~(Math.random() * (urls.length))] }); }) }
[ "function setNewPresence() {\n // Select a random activity\n const settings = names[Math.floor(Math.random()*names.length)];\n\n // Set the status\n client.user.setPresence(settings);\n }", "function generateBotChoice () {\n return Math.floor(Math.random() * 3) + 1\n }", "function getRandomSta...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
projectChanged() is called when the project is changed.
projectChanged() { const oldSI = this.getSimulationInterface(); this.checkForDepositLibrary(); this.treeController.reloadTree(); this.workspaceController.resetEditors(); const newSI = this.getSimulationInterface(); oldSI.transferCallbacks(newSI); }
[ "async [notifyProject]() {\n this.dispatchEvent(new CustomEvent('projectschange'));\n await this.requestUpdate();\n // @ts-ignore\n if (this.notifyResize) {\n // @ts-ignore\n this.notifyResize();\n }\n }", "changed() {\n ++this.revision_;\n this.dispatchEvent(Even...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Callback for submitting the 'Book room' form. The second stage of the booking is for the guest to enter their name and choose a room. Once this is done, the new (pending) booking is saved in a cookie.
function submitBookRoom() { var newBooking = {}, localBookings = []; newBooking.number = $("#roomSelection").val(); newBooking.checkin = $("#checkinDate").val(); newBooking.checkout = $("#checkoutDate").val(); newBooking.name = $.trim($("#bookingName").val()); ...
[ "function submitFindRoom() {\n var isValid, checkin, checkout;\n isValid = true;\n\n // Validate checkin date\n checkin = getDateFromForm(\"#checkinday\", \"#checkinmonth\", \"#checkinyear\");\n\n\n // Validate checkout date\n checkout = getDateFromForm(\"#checkoutday\", \"...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
cache.length returns n define a recursive helper function
function recursiveHelper(n) { // try to access the answer from the cache let answer = cache(n); if (!answer) { answer = naiveNthFib(n); // save this answer in our cache cache(n) = answer; } return answer; }
[ "function recursiveNthFib(n) {\n // initialization a cache array with a lenght of n\n const cache = Array(n); // cache.length returns n\n\n // define a recursive helper function\n function recursiveHelper(n) {\n // try to access the answer from the cache\n let answer = cache(n);\n\n if (!answer) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
return new, unset BigInteger
function nbi() { return new BigInteger(null); }
[ "function createBigInt(num){if(typeof BigInteger==='undefined'){BigInteger=getBigIntConstructor();}if(BigInteger===null){throw new Error('BigInt is not supported!');}return BigInteger(num);}", "function bigInt2ECKey(i){ return new Bitcoin.ECKey(bigInt2bigIntKey(i)); }", "function bigInt2bigIntKey(i){ return i.m...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Stores information about the local user in the cache. Will return a Promise that will be resolved with the current instance when the operation is complete.
store() { return new Promise(resolve => { if (!this.isIdentified()) { delete localStorage['userInfo']; return resolve(this); } localStorage['userInfo'] = JSON.stringify({ name: this.name_, token: this.token_, ...
[ "load() {\n return new Promise(resolve => {\n const serializedInfo = localStorage['userInfo'];\n if (serializedInfo === undefined)\n return resolve(null);\n\n let userInfo = null;\n try {\n userInfo = JSON.parse(serializedInfo);\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Validate that input number is less than a max. If the value is undefined or not capable of being parsed into an integer pass validation
function validateMax(field_value, max) { if (field_value === undefined || field_value === null) { return true; } var int = parseInt(field_value); if (isNaN(int)) { return true; } return int <= max; }
[ "function chkIntegerMaxValue(str,val)\r\n{\r\n\tif(typeof(val) != \"string\")\r\n\t\tval = val + \"\";\r\n\tif(chkIsInteger(str) == true)\r\n\t{\r\n\t\tif(parseInt(str,10)<=parseInt(val,10))\r\n\t\t\treturn true;\r\n\t\telse\r\n\t\t\treturn false;\r\n\t}\r\n\telse\r\n\t\treturn false;\r\n}", "function validateInt...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Ohm's Formula Section Solving for Volts
function getVoltsAO(amp,ohm) { const volts = amp*ohm document.querySelector('#ohm-answer').textContent = volts + 'V' }
[ "function calculateSolar() {\n \n var dailyUseKw = addMonths('mpc'); // assign first function to a variable\n// console.log(dailyUseKw);\n \n var sunHoursPerDay = sunHours(); // assign second function to a variable\n// console.log(sunHoursPerDay);\n \n var minKwNeeds = dailyUseKw / sunHoursP...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Write the trits for the value.
function writeTrits(input, trits, index) { switch (input) { case 0: return 0; default: // eslint-disable-next-line no-case-declarations var abs = Math.floor(input / RADIX); // eslint-disable-next-line no-case-declarat...
[ "function valueToTrits(input, trits) {\r\n var endWrite = writeTrits(input, trits, 0);\r\n if (input >= 0) {\r\n return endWrite;\r\n }\r\n for (var i = 0; i < trits.length; i++) {\r\n trits[i] = -trits[i];\r\n }\r\n return endWrite;\r\n }", "writ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
returns the list of existing posns adjacent to the given posn, in this world (no out of bounds posns)
getExistingAdjacentPosns(posn) { var theWorld = this; return posn.getAdjacentPosnsWithWraparound(theWorld).filter(function(p) { return !!theWorld.get(p); }) }
[ "closestOpenPosn(posn) {\n\t\t//bfs starting from posn\n\t\tvar searchQueue = [posn];\n\t\tvar blacklist = [];\n\t\twhile (searchQueue.length > 0) {\n\t\t\tvar searching = searchQueue.pop();\n\t\t\tvar searchingSquare = this.get(searching);\n\t\t\t//is it a posn we're looking for?\n\t\t\tif (searchingSquare && (!se...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
hideControls hides the video controls when not in use if the video is paused, the controls must remain visible
function hideControls() { if (video.paused) { return; } if (!videoControls.classList.contains("hidden")) { videoControls.classList.add('hidden'); videoControls.classList.add('hide'); videoContainer.classList.add('hidden-controls'); refe...
[ "function showControls() {\n if (videoControls.classList.contains(\"hidden\")) {\n videoControls.classList.remove('hidden');\n videoControls.classList.remove('hide');\n videoContainer.classList.remove('hidden-controls');\n referrer.that.invokeMethodAsync(\"onContro...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Deletes the procesed assets directory.
function clean_assets() { return del(["./assets"]); }
[ "function CleanUpHerokuDistFolder(){\n del.sync(`${deploymentPaths.HEROKU_DIST_FOLDER}/**`);\n}", "function deleteManifest() {\n if (manifestExists()){\n fs.unlinkSync(testManifestPath);\n }\n}", "clearTemps() {\n fs.rmdirSync(this.temps, { recursive: true });\n }", "static delete (targetPat...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
author: Ali El Zoheiry description: displays the popover of the wordLabel params: success: the popover is displayed successfuly failure:
function wordLablelToolTip(){ $('#wordLabel').popover(); setTimeout(function(){ $('.label-div').expose(); }, 300); setTimeout(function(){ $('#wordLabel').popover('show'); $('.popover').css('z-index', '9999999'); }, 400); }
[ "function wordsListToolTip(){\n\t$('#wordsList').popover();\n\tsetTimeout(function(){\n\t\t$('#list-div').expose();\n\t}, 100);\n\tsetTimeout(function(){\n\t\t$('#wordsList').popover('show');\n\t\t$('.popover').css('z-index', '9999999');\n\t}, 200);\n\t\n}", "show (contentTemplate, contentData, anchorEl, placemen...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
submitCmd() Parses and interprets command line. SEE `cmd.js` for commands.
submitCmd(){ this.cmdText += `> ${this.cmd}\n` let parsed = this.cmd.replace(/^\s+/, '').split(/\s+/) if(parsed[0]){ let query = parsed[0].toLowerCase() if(cmds[query]){ cmds[query](this, parsed.slice(1), mrp, db) } else { this.cmdText += `Command '...
[ "function printCommand(cmd) {\r\n\r\n\t// Get the command to show\r\n\tvar command = cmd || submit.value;\r\n\r\n\t// Pull from the global namespace\r\n\tterminal.innerHTML += Filesystem.user + '@' + Filesystem.host + ':' + Filesystem.path + '$ ' + command + '\\n';\r\n\r\n}", "function postCommand(obj) {\n\n /...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Pre: Art menu is dropped Post: Grid is filtered to the desired type of art Purpose: To filter the grid, using nothing but the text in the link to decide which items to keep and which ones to hide
function filterGrid() { //use text to filter so we can easily switch text and maintain functionality if ( $(this).text() == "ART" ) { $('.grid').isotope({ filter: "*" }); setDataLightbox( "grid-item" ); } else { var filterValue = "." + $(this).text().toLowerC...
[ "function filterByCollections(divId, selectId) {\n var collection = $(selectId).val();\n if (collection != \"all\") {\n $(divId).find('.item-preview:visible').each(function () {\n var collections = $(this).attr('data-collections');\n if (collections.indexOf(collection) == -1) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Accepts the props : dogs Renders the list of dogs with image and name App > DogList > view(list of dogs)
function DogList(props) { const { dogs } = props function getDogsList() { return (<> {dogs.map(dog => <div> <div className="DogList-name"> <Link key={dog.id} to={`/dogs/${dog.name}`}> {dog.name} </Link> </di...
[ "function renderDogs() {\n fetchDogs()\n .then((dogs) => dogs.forEach(dog => {\n renderDog(dog);\n }));\n}", "function DogDetails({ dogs }) {\n const { name } = useParams();\n const dog = dogs.find(d => d.name.toLowerCase() === name.toLowerCase())\n\n if (!dog) return <Redirect to=\"/dogs\" />\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
If this item is a proxy or overridden item, parentItem will point upwards to our parent. Otherwise, it will point to this. parentItem can thus always be used for modifyItem() calls to providers. attribute calIItemBase parentItem;
get parentItem() { //dump("get parentItem: title:"+this.title); if ((!this._parentItem) && (!this._newParentItem)) { this._parenItem = this; this._calEvent.parentItem = this; } return this._calEvent.parentItem; }
[ "getItemParent(item) {\n return this.composer.getItemParent(item);\n }", "isItemParent(item) {\n return this.composer.isItemParent(item);\n }", "getParentProduct() {\n return this.parent;\n }", "get parent() {\n return tag.configure(ContentType(this, \"pare...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Add balance corresponding to quanity of associated Hire item
function hireaddbal() { sum = 0; master.hireitems.forEach(function (item) { sum += Math.floor(item.multi * item.quan * master.imp.balmulti); }); addbal(sum); }
[ "addItem(itemId, quntity){\n if (itemId in this.items){\n this.items[itemId].quntity += quntity;\n return true;\n }else if (itemId in productList){\n var itemInfo = productList[itemId];\n this.items[itemId] = {unitPrice: itemInfo.unitPrice,\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Build the next link for pagings
function _buildNextLink(options, tp){ if (options.cp == tp) return ''; var optionsPaging = {}; dicUtilObj.deepCopyProperty(options, optionsPaging); optionsPaging.cp = parseInt(optionsPaging.cp) + 1; return '<a id="dic-edi-mailbox-next" href="'+dicUtilUrl.buildUrlObjQuery(null, optionsPaging)+'" aria-l...
[ "function callNextPage()\n{\n\tvar pageHref;\n\t\t\n\t// If there is a href\n\tif (arguments.length > 0)\n\t{\n\t\t// Get the href from the arguments\n\t\tpageHref = arguments[0];\n\t\t\n\t\t// If there are more results\n\t\tif (arguments.length > 1)\n\t\t{\n\t\t\t// Add the results to the results array\n\t\t\tfor ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
limpia los campos del modal de la tabla de usuarios.
function limpiarCampos() { // info order $("#edit_origen").attr("value", ""); $("#edit_depto_origen").attr("value", ""); $("#edit_destino").attr("value", ""); $("#edit_depto_destino").attr("value", ""); $("#edit_tipo").attr("value", ""); $("#edit_destinatario").attr("value", ""); $("#edit_descripcion")....
[ "function limparDados() {\n $('#nome').val('');\n $('#ativo').val('N');\n $('#modelo-cadastro').modal('toggle')\n }", "function mostrarDetalles (usuario) {\n $(\"#id\").html(usuario.id);\n $(\"#nombre\").html(usuario.nombre);\n $(\"#username\").html(usuario.username);\n $(\"#na...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Given the document as it existed _before_ the changes, return a change set that represents the inverse of this set, which could be used to go from the document created by the changes back to the document as it existed before the changes.
invert(doc) { let sections = this.sections.slice(), inserted = [] for (let i = 0, pos = 0; i < sections.length; i += 2) { let len = sections[i], ins = sections[i + 1] if (ins >= 0) { sections[i] = ins sections[i + 1] = len let...
[ "invert(doc) {\n let sections = this.sections.slice(), inserted = [];\n for (let i = 0, pos = 0; i < sections.length; i += 2) {\n let len = sections[i], ins = sections[i + 1];\n if (ins >= 0) {\n sections[i] = ins;\n sections[i + 1] = len...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Description: Write a function called sumIntervals that accepts an array of intervals, and returns the sum of all the interval lengths. Overlapping intervals should only be counted once. Intervals: Intervals are represented by a pair of integers in the form of an array. The first value of the interval will always be les...
function sumIntervals(intervals){ intervals.sort(function(a, b) { return a[0] > b[0] ? 1 : -1; }); var curMin = intervals[0][0]; var curMax = intervals[0][1]; var result = 0; for (let value of intervals) { if (value[0] > curMax) { result += curMax - curMin; curMin = value[0]; cur...
[ "function mergeOverlapping(intervals) {\n\tconst merged = [];\n\tconst overlaps = (int1, int2) => {\n\t\tconst [x1, y1] = int1;\n\t\tconst [x2, y2] = int2;\n\t\treturn (x1 >= x2 && x1 <= y2) || (y1 <= y2 && y1 >= x2) || (x2 >= x1 && x2 <= y1) || (y2 <= y1 && y2 >= x1);\n\t}\n\n\tfor (let interval of intervals) {\n\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Deletes the currently visible visit. Will just close the modal view if the visit has not been saved yet.
deleteVisit() { if (!this.visitId) { this.hideVisit(); return; } this.deleteVisitRequest.send({ visit_id: this.visitId }); }
[ "hideVisit() {\n\t\tthis.modalContainer.classList.remove(\"visible\");\n\t}", "deletedVisit(responseData) {\n\t\t//Refresh the visit list. Yes, I am lazy.\n\t\tthis.loadVisits();\n\t\tthis.hideVisit();\n\t}", "function deleteModal() {\n modal = document.getElementById(\"FactCheck_Modal\");\n modal.remove(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
CODING CHALLENGE 721 Create a function that takes in two arrays and returns true if the second array follows the first array by one element, and false otherwise. In other words, determine if the second array is the first array shifted to the right by 1.
function simonSays(arr1, arr2) { for (let i = 1; i < arr2.length; i++) { if (arr2[i] !== arr1[i - 1]) { return false; } } return true; }
[ "function isRotation(arrA, arrB) {\n let pB = 0,\n shiftedElems = [];\n\n if (arrA.length !== arrB.length) // arrays aren't of same length\n return false;\n\n // look for first matching element in arrB\n while (arrB[pB] !== arrA[0] && pB < arrB.length) {\n shiftedElems.push(arrB[pB]);\n pB++;\n }...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Name: add_search_query Descr: Add a search query to indexedDB Returns a promise to the search_query that was added to update the list
function add_search_query(search_query, $q) { var q = $q.defer(); try { var transaction = twitter_search_queries_db.transaction(["twitter_search_queries"],"readwrite"); var store = transaction.objectStore("twitter_search_queries"); // Perform the add // data, key var addRequest = store.put(searc...
[ "queryRemoteContent() {\n var query = this.get('query'),\n lastSearch = this.get('lastSearch') || {};\n query = query.trim();\n if (query === lastSearch.query) {\n return lastSearch.promise;\n }\n lastSearch.query = query;\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
17 Using Reduce Create a function called luckyNumbers that accept an array of number and turns an array of arrays into an object var array= [ 30, 48, 11, 5, 32 ] Ex: luckyNumbers(array) => 'Your lucky numbers are: 30, 48, 11, 5, and 32';
function luckyNumbers(arr){ var arr1={}; var array1=[]; var a= arr[0]+", "+arr.reduce((x,y)=>{; array1.push(y); return array1; },) arr1["Your lucky numbers are"]=a; return arr1; }
[ "function classifyingNumbers() {\n let array = [1, 2, 3, 4, 5];\n let object = {...[1, 2, 3, 4, 5]};\n return object;\n}", "function sumOfNumbers(arr) {\n function sum(total, num) {\n return total + num;\n }\n return arr.reduce(sum);\n}", "function voterResults (arr){\n let result = ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
The payload string from Test raw event.
get payload(): ?string { return this._rawEvent.payload || null; }
[ "get rawEvent(): TestRawEvent {\n return this._rawEvent;\n }", "function pullEventReceived(event) {\n\n //store information about this event\n let thisEvent = JSON.stringify(event);\n\n console.log(\"Pull event received. \");\n console.log(thisEvent);\n}", "function format (e, data) {\n retur...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Mutatemode. Further transformers run on the nlcst tree.
function mutate(parser) { return transformer function transformer(node, file) { return hast2nlcst(node, file, parser) } }
[ "function setTransform(func, n) {\n if (n === undefined) { n = 1; }\n _func = func;\n _n = n;\n _apply();\n }", "visitData_manipulation_language_statements(ctx) {\n\t return this.visitChildren(ctx);\n\t}", "transform() {\n var iter = 0;\n while(true) {\n var resu...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
AUTHOR: nakul DATE : 4/28/2019 BRIEF : Deletes a given itinerary object
function jnParseDeleteItineraryObj(itObj) { if (typeof itObj._days === undefined) { if (itObj._days.length > 0) { for (jnDayObj in itObj._days) { jnParseDeleteDayObj(jnDayObj); } clearArray(itObj._days); } } delete itObj; }
[ "function deleteObject(array,index){\n delete(array[index]);\n array.splice(index, 1);\n}", "function realestateobject_delete(req, res, next) {\n console.log('Real estate object delete');\n\n RealEstateObjects.findByIdAndDelete(req.params.id)\n .then(realestateobject => {\n res.send(`realestateobject ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns the path segment of the language as a string, like 'fr/' or '' if not found.
function language_segment_from_url() { var path = window.location.pathname; var language_regexp = '/((?:' + Object.keys( all_languages ).join( "|" ) + ')/)' var match = path.match( language_regexp ); if ( match !== null ) return match[ 1 ]; return ''; }
[ "function version_segment_from_url() {\n var path = window.location.pathname;\n var language_segment = language_segment_from_url();\n var version_segment = '(?:(?:' + version_regexs.join( '|' ) + ')/)';\n var version_regexp = language_segment + '(' + version_segment + ')';\n var match = path.match( v...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This function plays bottle breaking sound and displays a comment.
function bottle1(){ document.getElementById("displayComment").innerHTML = "Oooooopppsssss..Sorry."; bottle.play(); }
[ "function baby1(){\n document.getElementById(\"displayComment\").innerHTML = \"Go! change baby's diapers.\";\n baby.play();\n}", "function horse1(){\n document.getElementById(\"displayComment\").innerHTML = \"Your horse has been set lose.\";\n horse.play();\n}", "function bombShot() {\n playS...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
. END utility /rmVendorDirsFn/ BEGIN utility /copyVendorFilesFn
function copyVendorFilesFn () { var asset_group_table = pkgMatrix.xhiVendorAssetGroupTable || [], dev_dependency_map = pkgMatrix.devDependencies || {}, asset_group_count = asset_group_table.length, promise_list = [], idx, asset_group_map, asset_list, asset_count, ...
[ "cleanUpSDKFiles() {\n this.fileOpsUtil.deleteFile(\n path.join(\n this.dispatcherConfigPath,\n Constants.CONF_D,\n Constants.AVAILABLE_VHOSTS,\n \"default.vhost\"\n )\n );\n this.fileOpsUtil.deleteFile(\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Refreshes the subscription on kafka. To ensure that the consumer doesn't generate excessive load trying to refresh subscriptions immediately after a failure, a truncated exponential backoff with random delta is implemented.
refreshSubscriptions() { // just schedule if does not have a previous timer scheduled and if // the consumer is ready if ((!this.isWaitingForRefreshSubscriptions) && (this.isReady)) { this.isWaitingForRefreshSubscriptions = true; const subscriptionProcedure = (retries = 0) => { logger.d...
[ "function renewSubscriptions() {\n udpPort.send({\n address: '/batchsubscribe',\n args: [\n // First defines the local endpoint that the X32 will send this subscription data to.\n { type: 's', value: '/chMutes' },\n { type: 's', value: '/mix/on' },\n { ty...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Recursively test the query operator(s) against an entry, checking against any logic operators provided.
_validate (entry = [], queries = {}) { return this.getLogicalOperator(queries.operator).fn.call(queries.list, (_query) => { if (this.isLogicalOperator(queries.operator)) { return this._validate(entry, _query); } else { return this.getQueryOperator...
[ "function getLogicalOperators(query) {\n var logicaloperators = query.split(\" \");\n for (var i in logicaloperators) {\n if (logicaloperators[i] == ('or')) {\n var logop = \" \" + logicaloperators[i];\n console.log(logop);\n }\n else if (logicaloperators[i] == ('and...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
helper function to reattach the .fadein class to all the menus' list items.
function reattachFadeIn() { for (var i = 1; i <= 3; i++) { for (var j = 0; j < 16; j++) { var menu_item = "#" + i + "_" + j; $(menu_item).addClass("fadein"); $(menu_item + "copy").addClass("fadein"); } } }
[ "function setOpacity() {\n for (var i = 0; i < menuItems.length; i++) {\n console.log(\"opacity\");\n menuItems[i].style.opacity = \"0\";\n }\n}", "function sf_list_up(){\n\t\n\tjQuery( 'body' ).find( '.studio-container .menu-item' ).each( function( ind ){\n\t\tjQuery( this ).get( 0 ).style.setProperty( '...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
avgLatency() runs a query on latencies table geting a average of proxy, kong and requests and groups it by each service then it calls a helper function to generate a csv with the query data
function avgLatency() { const queryString = `SELECT fk_service_id AS service, AVG(proxy) as proxyAvg, AVG(kong) as kongTimeAvg, AVG(request) as requestAvg FROM latencies GROUP BY fk_service_id`; db.que...
[ "async function requestsPerService() {\n const queryString = `SELECT fk_service_id AS service,\n COUNT (fk_service_id)\n FROM requests\n GROUP BY fk_service_id`;\n await db.query(queryString, (err, res) => {\n if (err) {\n throw err;\n }...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
startOver() lets the user clear shopping cart and input fields rerenders the cart
function startOver() { cart = { name: null, address1: null, address2: null, zip: null, phone: null, items: [] //empty array }; //cart data renderCart(cart, $('.template-cart'), $('.cart-container')); }
[ "function updateCart() {\n\tsaveFormChanges();\n\trenderCart();\n}", "function continueShopping() {\n getProducts();\n }", "render() {\n\t\tif (orinoco.cart.products.length !== 0) {\n\t\t\tthis.domTarget.innerHTML = this.templateCartList();\n\t\t\tnew Form({ name: \"form\" }, document.querySelector(\"#order...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get the options needed for the Auth request to twitter.
function getTimelineRequestOptions(user, access_token) { var options = { hostname: 'api.twitter.com', path: '/1.1/statuses/user_timeline.json?screen_name=' + user + '&exclude_replies=true', headers: { Authorization: 'Bearer ' + access_token } }; ...
[ "function getTwitterAuth() {\n\n // Settings for requesting OAuth.\n var twitterCredentials = config.twitterCredentials;\n var key = twitterCredentials.key;\n var secret = twitterCredentials.secret;\n var reqUrl = 'https://api.twitter.com/';\n var reqPath ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
palindrome words: kayak mom racecar cvbnmmnbvc write a function that returns true if a given word is a palindrome, false otherwise don't use .reverse()
function isPalindrome(word) { return reversed(word) === word }
[ "function isPalindrome() {\n\n}", "function arePalindromes(a, b) {\n const sortedA = a\n .split(\" \")\n .join(\"\")\n .split(\"\")\n .sort()\n .join(\"\");\n const sortedB = a\n .split(\" \")\n .join(\"\")\n .split(\"\")\n .sort()\n .join(\"\");\n\n return sortedA === sortedB;\n}...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function that places a pin at the selected trail location
function showTrailAndPin(trailName, clickedId) { let trailLat = 0; let trailLng = 0; // Check whether to display info for trails or spots if(clickedId === "trailSelect") { showTrailInfo(trailName, trailCircleArray); } else if(clickedId === "spotSelect") { showSpotInfo(trail...
[ "function pinDrop()\r\n{\r\n currentRoute.routeMarker.setPosition(currentRoute.map.getCenter());\r\n}", "function makePin(x, y, type) {\n var indicator,\n height,\n width,\n symbolPath;\n\n indicator = document.createElementNS('http://www.w3.org/2000/svg', 'path');\n\n $(indicator...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Parse 'lastupd' string property sent by vlille api to an iso date lastupd is in 'x secondes' format, ie: '36 secondes'
function parseLastUp(lastupd) { var re = /(\d+) secondes/; var result = re.exec(lastupd); var numberOfSeconds = result[1]; return getDateXSecondsFromNow(numberOfSeconds); }
[ "getUpdateTimestamp() {\n if (this.updated_ === null) {\n this.updated_ = new Date(this.json_.updated);\n }\n return this.updated_;\n }", "get latestDelta() {\n return new Date(this.latestDeltaMs);\n }", "function parseJSON(string) {\n function dateReviver(key, value) {\n va...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }