query
stringlengths
9
34k
document
stringlengths
8
5.39M
negatives
listlengths
19
20
metadata
dict
This should only be called once on the instance of chrome where the app is first installed for this user. It need not be called every time the Push Messaging Client App starts.
function firstTimePushSetup() { // Start fetching the channel ID (it will arrive in the callback). chrome.pushMessaging.getChannelId(true, channelIdCallback); // chrome.app.window.create('index.html', { "bounds": { "width": 1024, "height": 768 } }); console.log("getChannelId returned. Awaiting callback..."); ...
[ "function onMessageReceivedSubscribe() {\n /*\n If you're integrating amp-web-push with an existing service worker, use your\n existing subscription code. The subscribe() call below is only present to\n demonstrate its proper location. The 'fake-demo-key' value will not work.\n If you're setting up you...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
var url = require('url'); A simple duplex loopback stream implementation: everything written to a bat_stream gets emitted by bat_stream.pair. A BatStream can connect to a BatServer: var srv1 = new BatServer('srv1'); var in_stream = new BatStream.connect('bat:srv1'); srv1 emits 'connection', in_stream.pair is an arg.
function BatStream (pair) { stream.Duplex.call(this); if (pair) { this._pair(pair); pair._pair(this); } else { this.pair = new BatStream(this); } this.out_str = ''; }
[ "function startStream (response) {\n\n\tchild.send('start'); \n\n\tresponse.writeHead(200, {\"Content-Type\": \"text/json\"});\n\tresponse.end('{\"status\":\"ok\"}');\n}", "createPipe(addr) {\n const pipeProps = {\n onNotified: (action) => {\n if (__IS_SERVER__ && action.type === SOCKET_CONNECT_TO_...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Update the footer to show correct percentage and proper messages on the next button
function updateFollowSubjectsModalFooter(){ var nextButton = $('#onboarding-follow-subjects__next'); var numFollows = $("#onboarding-follow-subjects-modal").find('.tagboard__tag.active').length; var percentage = numFollows*100/5; $("#onboarding-follow-subjects-modal .meter__bar").width(...
[ "function updateFollowInstitutionsModalFooter(){\n var nextButton = $('#onboarding-follow-institutions__next');\n var numFollows = $(\"#onboarding-follow-institutions-modal\").find('.tagboard__tag.active').length;\n\n var percentage = numFollows*100/5;\n $(\"#onboarding-follow-institutio...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Reload the jobs table from the server user A structure defining the user onloaded Call `onloaded(joblist)` upon success.
function reloadJobsTable(user, onloaded) { var req = new XMLHttpRequest(); req.onreadystatechange = function() { if (req.readyState == 4 && req.status == 200) // NoContent, got an identity { var data = JSON.parse(req.responseText); data.sort(function(a,b) { return a.Age <...
[ "function loadJobs(){\n API.getJob()\n .then(res =>\n setJobs(res.data)\n )\n .catch(err => console.log(err));\n }", "getJobs() {\n if (localStorage.getItem('User') != null || localStorage.getItem('User') != undefined) {\n return JSON.par...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This function calculates the sum of disease ratios (function above)
getSumOfDssRatios() { let sum = 0; for (let disease of this.diseases) { sum += this.getDssRatio(disease); } return sum; }
[ "getSumOfAgeRatios() {\n let sum = 0;\n for (let ageGroup of this.ageGroups) {\n sum += this.getAgeRatio(ageGroup);\n }\n return sum;\n }", "function promedioDeEdad(a,b,c,d,e){\r\n let suma = a+b+c+d+e;\r\n let promedio = suma/5\r\n return promedio\r\n}", "function ratioRevenue() {\n\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Remove all markers from the markerGroup layer
removeAllMarkers() { if (this.markerGroup) this.markerGroup.clearLayers(); }
[ "function clearMarkers() {\n let initialCitiesLength = Object.keys(INITIALCITIES).length;\n for (let i = MARKERS.length - 1; i >= initialCitiesLength; i--) {\n MARKERS[i].setMap(null);\n MARKERS.splice(i, 1);\n }\n }", "function clean_map() {\n map.eachLayer(function (layer) {\n if (la...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
The constructor for the Node class. Params: id the unique id that the graph will use to represent this node. name the name that the use will visually see representing this node. imageName the imageName that will be loaded to represent this node as an icon.
function Node(id, name, imageName) { //TODO: handle undefined variables this.id = id; this.name = name; // keep track of incident edges. this.inEdges = new Array(); this.outEdges = new Array(); this.vnode = new VisualNode(imageName); }
[ "function ImageNode(src, gl, renderGraph, currentTime) {\n var preloadTime = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 4;\n var attributes = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : {};\n\n _classCallCheck(this, ImageNode);\n\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
DropDownList Change event handler.
_listBoxChangeHandler(event) { const that = this; if ((that.dropDownAppendTo && that.dropDownAppendTo.length > 0) || that.enableShadowDOM) { that.$.fireEvent('change', event.detail); } that._applySelection(that.selectionMode, event.detail); }
[ "function ChangeHandler() {\n PreviousSelectIndex = SelectIndex; \n /* Contains the Previously Selected Index */\n\n SelectIndex = document.forms[0].lstDropDown.options.selectedIndex;\n /* Contains the Currently Selected Index */\n\n if ((PreviousSelectIndex == (document.forms[0].lst...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
takes in the operand of the $elemMatch operator returns the parts that operand parses to, and the implicitField value
function parseElemMatch(operand) { if(fieldOperand(operand)) { var parts = [] for(var operator in operand) { var innerOperand = operand[operator] parts.push(parseFieldOperator(undefined, operator, innerOperand)) } return {parts: parts, implicitField: true} ...
[ "findListByCondition(arr, comparisonField, value, resultFieldValue) {\n var tempArr = [];\n\n for (var index = 0; index < arr.length; ++index) {\n\n if (arr[index][comparisonField] === value) {\n\n if (!this.isExist(tempArr, arr[index][resultFieldValue])) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Cleanup form data from server when lightbox window is closed
function cleanupClosedLightboxForms() { if (jQuery('#formKey').length) { // get the formKey of the lightbox (fancybox) var context = getContext(); var formKey = context('iframe.fancybox-iframe').contents().find('input#formKey').val(); clearServerSideForm(formKey); } }
[ "disconnectedCallback() {\n if (this._form) {\n this._form.removeEventListener('formdata', this._handleFormData);\n this._form = null;\n }\n }", "function closeLightboxReloadPage() {\n closeLightbox();\n top.window.location.reload(true);\n}", "function closeDataWarning() {\n $.facybox....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
set the referenceCount for the given index
function setReferenceCount(index,value){ referenceCount.set(index,value); return referenceCount.get(index); }
[ "static useIndex(index){\n\t\t//if the index is not yet in use\n\t\tif(typeof getReferenceCount(index) === 'undefined'){\n\t\t\tsetReferenceCount(index,1);\n\t\t\treturn;\n\t\t}\n\t\t//if the index is already in use, increase reference count\n\t\tsetReferenceCount(index,getReferenceCount(index)++);\n\t\t\n\t}", "...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
resize same position tasks width in timeline when task position or task height is changed.
resizeTaskWidth() { this.props.onUpdateTask(this.getWidthResizedTaskList(this.props.taskList)) }
[ "function _calculateSizes(){\n _dimensions.viewportWidth = $(\".cs-job-tasks\").width();\n _dimensions.defaultActiveTaskWidth = 240;\n _dimensions.workflows = {};\n\n // Break out calculations by workflow id\n $('.cs-workflow').each(function(i){\n var id = $(this).data(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Detects the Opera version
function operaVersion() { agent = navigator.userAgent; idx = agent.indexOf("opera"); if (idx>-1) { return parseInt(agent.subString(idx+6,idx+7)); } }
[ "function verificarBrowser(){\n // Verificando Browser\n if(Is.appID==\"IE\" && Is.appVersion<6 ){\n var msg = \"Este sistema possui recursos não suportados pelo seu Navegador atual.\\n\";\n msg += \"É necessário fazer uma atualização do browser atual para a versão 6 ou superior,\\n\";\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
"specs" is a list of kind of map designators. All the designators are used to create layers, but only the first layer (with index zero) is directly installed in the map. All the layers are used to create a "layer control" that is installed at the top left of the map and thatthe user will use to select among several map...
function addBaseLayers(specs) { var controls = {}; for(var i in specs) controls[capitalize(specs[i])] = makeLayerMapBox(specs[i], "mapbox." + specs[i]); controls[capitalize(specs[0])].addTo(map); L.control.scale({maxWidth: 150, metric: true, imperial: false}) .setPosition("topleft").addTo(map); L.cont...
[ "function drawShapes(overlay_specs, showForm){\n\t\tclearMap(true,false);\n\t\toverlay_specs.forEach(function(overlay_spec, idx){\n\t\t\t\tvar id = roadShapes.length+1;\n\t\t\t\taddRoad(id, overlay_spec.shape, showForm,false);\n\n\t\t\t\tdocument.getElementById(\"op-\"+id).value = overlay_spec.op;\n\t\t\t\toperatio...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Destroy all capture data
capture_destroy() { this.show_spinner(); this.hide_alert(); $.getJSON("/api/v1/capture/destroy", (data) => { this.hide_spinner(); this.show_alert('All capture data has been removed', 2000); }); }
[ "detach() {\n this.surface = null;\n this.dom = null;\n }", "Destroy()\n {\n const gl = device.gl;\n\n if (this.texture)\n {\n gl.deleteTexture(this.texture.texture);\n this.texture = null;\n }\n\n if (this._renderBuffer)\n {\n g...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
poseVector1 and poseVector2 are 52float vectors composed of: Values 033: are x,y coordinates for 17 body parts in alphabetical order Values 3451: are confidence values for each of the 17 body parts in alphabetical order Value 51: A sum of all the confidence values Again the lower the number, the closer the distance
function weightedDistanceMatching(poseVector1, poseVector2) { const partsEnd = parts.length * 2; const scoresEnd = partsEnd + parts.length; let vector1PoseXY = poseVector1.slice(0, partsEnd); let vector1Confidences = poseVector1.slice(partsEnd, scoresEnd); let vector1ConfidenceSum = poseVector1.slice(scoresEn...
[ "function getVector(pt1, pt2) {\n\n return {\n x: pt2.x - pt1.x,\n y: pt2.y - pt1.y\n }\n}", "function gotPoses(poses) {\n //We only need index 0 of the object pose.\n if (poses.length > 0) {\n pose = poses[0].pose;\n }\n}", "function classifyPose() {\n if (pose) {\n let inputs = [];\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get GCODE string when file is uploaded Not technically communication, but linked with send_gcode
static get_gcode() { this.fileInput = document.getElementById('gcode_uploader') this.fileInput.onchange = () => { if (this.fileInput.files.length > 0) { this.send_gcode(this.fileInput) } else { bulmaToast.toast({ message: "No fi...
[ "function getRegCode()\n{\n\t// TODO: Remove this hard coded registration code\n\t//regCode = \"66fb4d8ef9ccd0cd2d3dc8107199380d470b7c32250bb0b93922c7efbef074ae\";\n\ttry\n\t{\n\t\t// Get the registration code from the current account \n\t\tvar params = {};\n\t\tawsIot.getRegistrationCode(params, function(err, data...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Same as always, always pass valid block here. And note that you can update block only if that block currently is on the main branch. If you are trying to update a nonexistent block or that block is not on the main branch, nothing will happen.
async updateBlock(block) { if (this.onMainBranchSync(block.hash)) { await this.store.writeBlock(block); } this.emit('update', block, this.getHeadBlockIdSync()); // resolve nothing when success // reject with error when error }
[ "async function mineAndSubmitBlock(){\n //PROCESS DATA\n let obj = dataPool.pop()\n const encryptedData = await encryptData(pubKey, obj.data)\n const d = await new Data(encryptedData, address, obj.meta)\n \n //MINE NEW BLOCK\n let lastBlock = await storage.getItem(nonce.toString());\n newBlo...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
draw moving walls on either side of the canvas
function drawWall(){ push() rectMode(CORNERS) noStroke() fill(0) rect(0, 0, leftWallStart, height) fill(0) rect(width, 0, width-rightWallStart, height) if(leftWallStart<width/2 || rightWallStart<width/2){ leftWallStart += wallIncreaseSpeed rightWallStart += wallIncreaseSpeed } pop() }
[ "function detectWalls() {\n // if character horizontal postion is at 0 then set it zero\n if (character.x < 0) {\n character.x = 0;\n }\n // if character horizontal postion along with its width is greater than \n // canvas width then set it's postion by substracting character width by canvas w...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates babel helpers chunk based on used helpers, and rewrites imports to the babel helpers chunk using the hashed babel helpers filename.
generateBundle(_, bundle) { if (totalHelpers.length === 0) { return; } const helperModule = createHelperModule(totalHelpers, format, minify); const helperId = this.emitFile({ name: 'babel-helpers.js', type: 'asset', source: helperModule, }); const hel...
[ "async function buildShims() {\n // Install a package.json file in BUILD_DIR to tell node.js that the\n // .js files therein are ESM not CJS, so we can import the\n // entrypoints to enumerate their exported names.\n const TMP_PACKAGE_JSON = path.join(BUILD_DIR, 'package.json');\n await fsPromises.writeFile(TM...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
AWS config AWS region
get awsRegion() { return this.env.AWS_REGION }
[ "async function configAWS(){\n aws.config.update({\n region: 'us-east-1', // Put your aws region here\n accessKeyId: config.AWSAccessKeyId,\n secretAccessKey: config.AWSSecretKey\n })\n}", "getRegion(regionName) {\n var regions = this._regions || {};\n return regions[regionName];\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
finish subPipeline span for algorithm
_finishSubPipelineSpan(subPipelineId, status, error) { const topSpan = tracer.topSpan(subPipelineId); if (topSpan) { topSpan.addTag({ status }); if (status === pipelineStatuses.STOPPED) { topSpan.addTag({ reason: error }); topSpan.finish(); ...
[ "async stopAllSubPipelines({ reason }) {\n if (this._stoppingSubpipelines || this._jobId2InternalIdMap.size === 0) {\n return;\n }\n this._stoppingSubpipelines = true;\n try {\n log.info('starting to stop sub-pipelines', { component });\n await Promise.al...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
get column value by index
getColumnValue(index) { const column = this.getColumn(index); return column && column.getValue(); }
[ "function INDEX2COL(index) {\n return index - INDEX2ROW(index) * MaxCols;\n}", "function getValueAtIndex(chart, index) {\n return chart.data()[0].values[index].value;\n }", "get(index) {\n let foundNode = this._find(index);\n return foundNode ? foundNode.value : undefined;\n }", "getAt(idx...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
overwrite the default makePlayer so it makes a ScavengerHuntPlayer instead.
makePlayer(user) { return new ScavengerHuntPlayer(user, this); }
[ "setup() {\n this.player.setup();\n }", "function resetPlayer(player, opts) {\n var new_player = initPlayer(player.id, player.type);\n var key;\n\n // reset player\n for (key in new_player) {\n player[key] = new_player[key];\n }\n\n // override what necessary\n for (key in opts) {\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Hides the editor and shows the file tabs and editor helper placeholders.
hideEditor() { if (this._editor.active) { this._editor.active = false; $('#monaco').hide(); $('#file-tabs-placeholder').show(); $('#editor-placeholder').show(); } }
[ "onHideEditorPanel()\n\t{\n\t\tthis.#postInternalCommand('onHideEditorPanel');\n\t}", "function openUserEditor(){\n\n\t$('.content-panel').hide();\n\n\t$('#editUserPanel').show();\n\n}", "function closeEditingWindow() {\n document.getElementById(\"fileEditing\").style.display = \"none\";\n document.getElement...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Make modifications on any existing attrs Add if they don't exist Update if the nextVal differs
function addAndUpdate () { for (let key in nextAttrs) { let nextVal = nextAttrs[key]; let currVal = currAttrs[key]; if (nextVal instanceof Function) { nextVal = nextVal(); } if (key === 'value' && isFormEl(dom)) { dom.va...
[ "_updateAttributes() {\n const attributeManager = this.getAttributeManager();\n\n if (!attributeManager) {\n return;\n }\n\n const props = this.props; // Figure out data length\n\n const numInstances = this.getNumInstances();\n const startIndices = this.getStartIndices();\n attributeManage...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Properties: isFixedInPlace (boolean) name (string) desc (string) inspected (boolean)
constructor(name, desc=null) { this.name = name this.desc = desc this.inspected = false this.isFixedInPlace = false }
[ "function inspectBehavior(enteredStr) {\n var i;\n var argArray = extractArgs(enteredStr);\n\n if (argArray.length == 4) { //first arg is fn name, so ignore that\n document.theForm.URL.value = unescape(argArray[1]);\n document.theForm.winName.value = argArray[2];\n var featuresStr = argArray[3];\n v...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
calls .endPeriod for all agents in the Pool
endPeriod(){ for(let i=0,l=this.agents.length;i<l;i++) this.agents[i].endPeriod(); }
[ "theEnd() {\n\t\t// quest end phases\n\t\tfor(let quest of this.prioritizedQuestList) {\n\t\t\ttry {\n\t\t\t\tquest.questEnd();\n\t\t\t} catch(e) {\n\t\t\t\tLogger.errorLog(\"error caught in quest end phase, colony:\" + this.name + \", quest:\" + quest.nameId, ERR_TIRED, 5);\n\t\t\t\tLogger.log(e.stack, 5);\n\t\t\t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
use this to set events to play etc at certain times, maybe you just want to change backgrounds or characters
function newEvent() { //console.log('here'+i); //use the value i to set when a background &/or character should change if (i >= 0 && i < 4) { changeBackground('url("./images/bgs/clockbg.png")'); } if (i == 0) { changeCharacter('url("")'); //emtpy playAudio('"./audio/effect/clock.m4a"', false); ...
[ "function soundBg(){\n\t\tif (typeof MainTheme.loop == 'boolean')\n\t\t{\n\t\t\tMainTheme.loop = true;\n\t\t}\n\t\telse\n\t\t{\n\t\t\t// play main theme song in case loop is not supported\n\t\t\tMainTheme.addEventListener('ended', function() {\n\t\t\t\tthis.currentTime = 0;\n\t\t\t\tthis.play();\n\t\t\t}, false);\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns true if resource provided is an internal (not user specified) resource.
function isInternal(resource) { return resource.id[0] === '_'; }
[ "function hasResourceLink(req) {\n\t\tvar link = req.get('Link')\n\t\t// look for links like\n\t\t//\t <http://www.w3.org/ns/ldp#Resource>; rel=\"type\"\n\t\t// these are also valid\n\t\t//\t <http://www.w3.org/ns/ldp#Resource>;rel=type\n\t\t//\t <http://www.w3.org/ns/ldp#Resource>; rel=\"type http://example.net/re...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Prints id of games clicked to the console Used for error checking
function get_details(id){ console.log("You clicked Game ID: " + id); fetch_by_id(id); }
[ "function cellClick(id) {\n\n\tplayerMove = id.split(\",\");\n\tif (playerMove[0] == currentCell[0] && playerMove[1] == currentCell[1]) {\n\n\t\tvar cellClicked = document.getElementById(id);\n\t\tcellClicked.style.backgroundColor = getRandomColor();\n\t\tscoreCounter++;\n\t\tmoveMade = true;\n\t\t$(cellClicked).te...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Prints current permutation to console
function printPerm(subarr1, subarr2) { perm_i++; perm = subarr1.concat(subarr2); if (perm_i == end_perm_i) { console.log(perm_i + ": " + perm.join("")); } }
[ "print() { \n let str = \"\"; \n for (var i = 0; i < this.size(); i++) \n str += this.stack[i] + \" \"; \n console.log(str); \n }", "printConsole() {\n for (let layer = 0; layer < this.nodes.length; layer++) {\n for (let node = 0; node < this.nodes[layer].length; node++)...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
_renderFeauture adds a feauture to vector source of visited spots
_renderFeauture(coordinates){ _logger.info(_self._fileName, '_renderFeauture() coordinates()',{'coordinates':coordinates}); try{ if(_self.options.visited_spots_layer){ if(typeof ol=="undefined" || !ol) return false; let newFeature = new ol.Feature(), featureGeom = null; if(...
[ "_renderOfflineVisitSpots(){\n _logger.info(_self._fileName, `_renderOfflineVisitSpots()`);\n if(_self.options.visited_spots_layer){\n if(offlineVisitSpotsSource){\n offlineVisitSpotsSource.clear();\n }\n var ofVisits_spots = _self.getVisitedSpots(_self.options.project_id);\n if(ofV...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
run the game of life algorithm returning a new world grid
function updateWorld(grid){ let next = make3DArray(worldHeight, worldLength, worldWidth); let sum; for(let i = 0; i < world.length; i++){ for(let j = 0; j < world[i].length; j++){ for(let k = 0; k < world[i][j].length; k++){ sum = countNeighbors(grid, i, j, k); if(grid[i][j][k][0] == 1)...
[ "function createGameGrid() {\n var grid = new Array(Constants.numberOfRows);\n for (var row = 0; row < Constants.numberOfRows; row++) {\n grid[row] = new Array(Constants.numberOfColumns);\n for (var col = 0; col < Constants.numberOfColumns; col++) {\n grid[row][col] = {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Adds the slidedown animation to the modal
slideUp() { this.modalOnUI.style.removeProperty("top"); this.modalOnUI.style.removeProperty("opacity"); this.modalOnUI.style.setProperty("top", "0%"); this.modalOnUI.style.setProperty("opacity", "0"); }
[ "slideDown() {\n setTimeout(() => {\n // this.modalOnUI.style.removeProperty(\"top\");\n this.modalOnUI.style.removeProperty(\"opacity\");\n this.modalOnUI.style.setProperty(\"top\", \"5%\");\n this.modalOnUI.style.setProperty(\"opacity\", \"1\");\n }, 200);...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
bonus challenge: countStack write the standalone function countStack given a slStack, count the nodes return the count you may use one stack or array as additional storage the given stack must be returned back to it's original order you may only use public stack methods push pop peek isempty
function countStack(stack) { let newStack = new slStack(); let count = 0; while(!stack.isEmpty()) { newStack.push(stack.pop()); count++; } // let newNStack = stack; // while(!newNStack.isEmpty()) { // newNStack.pop(); // count++; // } }
[ "save_stack(s){\n var v = [];\n for(var i=0; i<s; i++){\n v[i] = this.stack[i];\n }\n return { stack: v, last_refer: this.last_refer, call_stack: [...this.call_stack], tco_counter: [...this.tco_counter] };\n }", "function tasks_stack() {\r\n let stackdata = new Stack(1);\r\n stackdata.push...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
opens dialog with a list of all projects in the local storage after selection and confirmation by the user the selected projects are deleted from the local storage by use of the PersistenceController
deleteProject(event) { const controller = event.data.controller; ListDialog.type = 'deleteProject'; const dialog = new ListDialog(() => { if (dialog.selectedItems.length != 0) { dialog.selectedItems .forEach((value) => { control...
[ "openProject(event) {\n const controller = event.data.controller;\n ListDialog.type = 'openProject';\n const warning = new WarningDialog(() => {\n const dialog = new ListDialog(() => {\n if (dialog.selectedItems.length != 0) {\n dialog.selectedItems\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Trade offer was successfully sent, we have received the trade offer ID.
function onTradeOfferSent (tradeofferid) { TradeOfferID = tradeofferid; showModal(); checkTradeOffer(); }
[ "_succeed () {\n const message = domain.chains.isMockChain(this.chain)\n ? domain.i18n.getText('success', 'mocknet')\n : domain.i18n.getText('success', 'blockchain');\n log(message);\n return this._setFinalStep({ status: VERIFICATION_STATUSES.SUCCESS, message });\n }", "function _rsvpSuccess()...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Filter array items based on search criteria (query)
function filterItems(arr, query) { return arr.filter(function(el) { return el.toLowerCase().indexOf(query.toLowerCase()) !== -1 }) }
[ "function filterItems() {\n //console.log(inspections)\n return inspections.filter(function(inspection) {\n return inspection.address.toLowerCase().indexOf(search.toLowerCase()) !== -1 || inspection.permit_id.toLowerCase().indexOf(search.toLowerCase()) !== -1\n })\n }", "function filt...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Select previous tab in tabset.
selectPrevious () { // if current tab is the first tab if (this.currentTab === 0) { // select last this.currentTab = (this.tabs.length - 1); } else { // select previous this.currentTab -= 1; } this.tabs[this.currentTab].focus(); ...
[ "_focusPreviousTab () {\n this.tabs[this.previousTabIndex]\n ? this.tabs[this.previousTabIndex].focus()\n : this.tabs[this.tabs.length - 1].focus()\n }", "selectPrevious() {\n\n // select the previous, or if it is the first entry select the last again\n if (this.selecte...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
get Arguments from the AST tree.
function getArguments(node) { if (node && node.arguments && node.arguments.length > 0) { return node.arguments; } return []; }
[ "visitVarargslist(ctx) {\r\n console.log(\"visitVarargslist\");\r\n // TODO: support *args, **kwargs\r\n let length = ctx.getChildCount();\r\n let returnlist = [];\r\n let comma = [];\r\n let current = -1;\r\n if (ctx.STAR() === null && ctx.POWER() === null) {\r\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
adds 5 (5 is arbitrary) views at a time to the target viewContainer, then queues up another add.
function executeDeferredAdd(viewContainer){ var currentOpperation = viewContainer._deferredViews.splice(0,5); if(!currentOpperation.length){ return; } for (var i = 0; i < currentOpperation.length; i++) { viewContainer.add(currentOpperation[i][0], currentOpperation[i][1]); }; re...
[ "addViews(views) {\n for (let i = 0; i < views.length; i++)\n this.addView(views[i]);\n }", "function seqRender(views, done) {\n // Once all views have been rendered invoke the sequence render\n // callback\n if (!views.leng...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Captures the instrumentation and pushes the metrics.
captureInstrumentation() { setInterval(() => { this.instrumentation.pushMetrics(); setMetrics(); }, config.instrumentationTimer); }
[ "function addMetricsObserver() {\n window.addEventListener('load', () => {\n captureMetrics();\n });\n}", "function captureMetrics(endpoint, interval, metadata) {\n console.log('Streaming metrics to: ' + endpoint + ' every ' + interval + ' ms'); //eslint-disable-line no-console\n\n const endpoint_client = ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
keyPressed(): screenshots on pressing the X key
function keyPressed() { if (key == 'x') { save("screenshotART_151_" + saveCount + ".png"); saveCount++; } }
[ "function hitKey(e){\n\tswitch(e.key){\n\t\tcase 's':\n\t\t\tstartButton.click();\n\t\t\tbreak;\n\t\tcase 'r':\n\t\t\tresetButton.click();\n\t\t\tbreak;\n\t\tcase 't':\n\t\t\trecordButton.click();\n\t\t\tbreak;\t\t\n\t}\n}", "function keyPressed() {\n if (keyCode === DELETE) {\n background(0);\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Removes all loaders from any resource identifiers found in a string
function stripLoaderPrefix(str) { if (typeof str==='string') { return str.replace(/(^|\b|@)(\.\/~|\.{0,2}\/[^\s]+\/node_modules)\/\w+-loader(\/[^?!]+)?(\?\?[\w_.-]+|\?({[\s\S]*?})?)?!/g, ''); } return str; }
[ "distinctStyleAssetsBase() {\n let assets = [];\n const clean = [];\n // CSS\n if (this.css.length > 0) {\n this.css.forEach((file, index, arr) => {\n assets = assets.concat(file.assets);\n });\n const group = helper.groupBy(assets, b => b....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
========================================================= Get Nearest URA Carpark =========================================================
function getnearestURACarpark(latinput, longinput) { var getlatfromuser = latinput; var getlongfromuser = longinput; var token = "6hf2NfWWja4j12bn3H4z8g62287rha485Fu7ff1F8gVC0R-AbBC-38YT3c856fV3HCZmet2j54+gbCP40u3@Q184ccRQGzcbXefE"; var options = { url: 'https://www.ura.gov.sg/uraDataService/invok...
[ "function getnearestURACarparkInformation(carparknoinput)\n{\n //var geturacarparkfromuser = \"K0087\";\n //var getlatfromuser = 1.332401;\n //var getlongfromuser = 103.848438;\n\n //To get new token everyday\n var token = \"6hf2NfWWja4j12bn3H4z8g62287rha485Fu7ff1F8gVC0R-AbBC-38YT3c856fV3HCZmet2j54...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function to get value of selected brand
function brand() { selBrand= def.options[def.selectedIndex].text; }
[ "function getValue(comboid) {\n return $('#' + comboid + ' option:selected').val();\n}", "function getUserBreed() {\n let breed = $(\"#dog-breed\").val();\n return breed;\n}", "function showcolor(){\n let getColorSelected = document.querySelector(\"#colors-selection\").value; //get c...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
updateMouse Assigns mouseX and mouse Y to more easily kept values
function updateMouse(e) { mouseX = e.pageX; mouseY = e.pageY; }
[ "function save_mouse_position() {\n mouse_position_x = mouseX\n mouse_position_y = mouseY\n}", "function updateMouseVector() {\n mouse = createVector(myMouseX * inverseScaleUp, myMouseY * inverseScaleUp);\n}", "function mousePressed() {\n covid20.x = mouseX;\n covid20.y = mouseY;\n}", "function adjus...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Called to turn off shadows from a specific light during the render loop. We need to quickly disable the renderer's auto update status, clear the shadow map generated by the light, then restore the shadowMapAutoUpdate status.
function disableShadowsForLight(light) { renderer.shadowMapAutoUpdate = false; renderer.clearTarget(light.shadowMap); renderer.shadowMapAutoUpdate = true; }
[ "turnOff() {\n\t\tthis.lightMap.makeDarkness();\n\t}", "static disable() {\n LightObjects.lightObjects = [];\n }", "function removeAllLights(){\r\n\r\n\tscene.remove(ambientLight);\r\n\tscene.remove(directionalLight);\r\n\tscene.remove(pointLight);\r\n\r\n}", "lightsOff() {\n console.log('[johnny...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
get a flight object and display flight on map and flight details card.
function showFlightHelper(flight) { if (flight) { let latLng = getLatLng(flight.latitude, flight.longitude); setAndDisplayFlightCard(flight); displayCurrentFlightOnMap(latLng); } }
[ "static get flightList() {\n return FlightList;\n }", "static get flightOnly() {\n return FlightList;\n }", "function displayRoute() {\r\n clearOverlays();\r\n var start\r\n var end\r\n if (inputLocation == \"\") { start = currentLocation; end = currentCafeLocation; }\r\n else { start = i...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Post a new property advert
static async postNewProperty(req, res) { const { price, state, city, address, type } = req.body; let { rows } = await queryExecutor(selectUserByEmail, [req.user.userEmail]) const owner = rows[0].id; if (!req.files.image) { return res.status(400).json({ status: res.statusCode, error: 'No image file se...
[ "PutPublisherProperty(string, Variant) {\n\n }", "addProperty(property, value) {\n this.properties.set(property, value);\n }", "saveGoal(data) {\n let goal = this.get('store').createRecord('goal', data);\n goal.save()\n }", "PutSubscriberProperty(string, Variant) {\n\n }", "asyn...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Draws every path in "paths"
function drawPaths(canvas) { var ctx = canvas.getContext("2d"); for (var i = 0; i < paths.length; i++) { if (paths[i].length <= 1) { continue; } var last, cur; for (var j = 0; j < paths[i].length - 1; j++) { last = paths[i][j]; cur = paths[i][j + 1]; ctx.beginPath(); ctx.moveTo...
[ "function drawPath(pathList, allNodes){\n\n\tvar path = pathList;\n\tvar start = 0;\n\n\t// Draw path with delay\n\tdrawPathWithDelay(path, allNodes, start, path.length, 150);\t\n}", "function animatePaths(){\n // Creating a shallow copy of the gamePath and move it forward by two.\n const tempPath = gamePath.sl...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Represents an XML text value.
function XmlText(value) { this.value = value; }
[ "get text() {\n return (this._textElement || this._element).textContent;\n }", "function createTextElement(text) {\n return new VirtualElement(0 /* Text */, text, emptyObject, emptyArray);\n }", "function setTextContent(node, value) {\n if (predicates_1.isCommentNo...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
2.6 optimizes templatecompiled scoped slots and skips updates if child only uses scoped slots. We need to patch the scoped slots resolving helper to temporarily mark all scoped slots as unstable in order to force child updates.
function patchScopedSlots (instance) { if (!instance._u) { return } // https://github.com/vuejs/vue/blob/dev/src/core/instance/render-helpers/resolve-scoped-slots.js var original = instance._u instance._u = function (slots) { try { // 2.6.4 ~ 2.6.6 return original(slots, true) } catch (e) { ...
[ "function transformOldSlotSyntax(node) {\n if (!node.children) {\n return;\n }\n\n node.children.forEach((child) => {\n if (_.has(child.attribs, 'slot')) {\n const vslotShorthandName = `#${child.attribs.slot}`;\n child.attribs[vslotShorthandName] = '';\n delete child.attribs.slot;\n }\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Raise a snackbar with the "warn" colour.
function _warn( message ) { _showSnackbar.bind( this, "warning" )( message ); }
[ "function flashWarn( warning ){\n indicator.innerHTML += '<br>' + warning + '!';\n indicator.classList.add('indicator-red');\n window.setTimeout( function(){ indicator.classList.remove('indicator-red'); } , 250);\n window.setTimeout( function(){ indicator.classList.add('indicator-red'); } , 500);\n window.setT...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Compile a language mode, optionally with a parent.
function compileMode(mode, parent) { var compiledKeywords = {}; var terminators; if (mode.compiled) { return; } mode.compiled = true; mode.keywords = mode.keywords || mode.beginKeywords; if (mode.keywords) { if (typeof mode.keywords === 'string') { flatten('keyword', ...
[ "function compileLang(lang) {\n //for each language generate a unique JSON file name to output and execute twine command\n var outputFile = tmp.tmpNameSync();\n var command = [twine, 'generate-localization-file', tmpFile.name, outputFile, \n '-l', lang, '-f', 'jquery', '-i', 'all'];\n\n childProces...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns the id of a item object. matching the raw items data
function getId(item) { // gets the id of an item return item.enchantment == 0 ? item.item_id : item.item_id + "@" + item.enchantment; }
[ "function findItemKey (itemId) {\n for (var key = 0; key < items.length; key++) {\n if (items[key].id == itemId) {\n return key;\n }\n }\n}", "function getIDofARandomItem () {\r\n\trandomNumber = \tMath.floor((Math.random() * 10) + 1);\r\n\trandomItem = db.itemCollection.findOne({ \"Item_Code\" : \"I...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Create function to list the numbers up to user input loop through numbers 0"Value" If not divisible by 3 or 5 then log the number If divisibile by 3 then log "fizz" If divisible by 5 then log "buzz" If divisible by 3 & 5 then log "fizbuzz"
function ListFizzBuzz(Value) { for (var i = 0; i < Value; i++) { if(i%3 != 0 && i%5 != 0){ $("body").append('<li>' + i + '</li>'); }; if(i%3 == 0) { $("body").append('<li>' + "fizz" + '</li>'); }; if(i%5 == 0) { $("body").append('<li>' + "buzz" + '</li>'); }; if(i%3 == 0 && i%5 == 0) { ...
[ "function doFizzBuzz(incomingNumber) {\n// find out if it's a multiple of 5\n\n\tif(incomingNumber % 5 === 0 ) {\n\t\tconsole.log(\"fizz\");\n\t}\n\t// find out if its a multiple of 3\n\telse(incomingNumber % 3 === 0) {\n\t\tconsole.log(\"buzz\");\n\t}\n}", "function fizzBuzz() {\r\n for (let i = 0; i <= 100; ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
OPTIONS background: canvas background windForce: force of wind windDir: right/left (1|1) flakes: number of flakes floatRange: angle of snow float range radiusRange: sizing of snow [min,max] color: color of particles speedMult: speed mutliplier (otherwise based purely on radius)
constructor(elem, options) { var self = this; this.elem = elem; this.bg = options.background || 'transparent'; this.canvas = document.createElement('canvas'); this.ctx = this.canvas.getContext('2d'); window.addEventListener('resize', function() {self.resize();}); this.elem.appendChild(this.canvas); this...
[ "function createFireEngine( ) {\n createEngineBlock( );\n\n // piston\n piston = []; // reset the parts\n if ( $('#showPiston').prop('checked') ) {\n for ( let step = -0.1; step < 0.4; step += 0.1) {\n makeHorizontalCircle( piston, 0, 0, -engineSize*step, engineSize/4, 'green' );\n }\n }\n\n // pi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Checks for variable in theArray.
function in_array(variable, theArray) { for (var i in theArray) if (theArray[i] == variable) return true; return false; }
[ "static #checkIfObjectIsFound(array) {\n\n\t\t// Check if input is defined.\n\t\tif (!array) {\n\t\t\treturn console.log(`${array} is undefined or null.`)\n\t\t}\n\n\t\treturn array.length !== 0;\n\t}", "function in_array(val, array) {\n\t\tfor(var i = 0, l = array.length; i < l; i++) {\n\t\t\tif(array[i] == val)...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Multipy a Color4 value by another and push the result in a reference value
multiplyToRef(color, result) { result.r = this.r * color.r; result.g = this.g * color.g; result.b = this.b * color.b; result.a = this.a * color.a; return result; }
[ "multiply(color) {\n return new Color4(this.r * color.r, this.g * color.g, this.b * color.b, this.a * color.a);\n }", "addToRef(otherColor, result) {\n result.r = this.r + otherColor.r;\n result.g = this.g + otherColor.g;\n result.b = this.b + otherColor.b;\n retu...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
creates thumbnail and appends it to DOM
function appendThumbnail(img, type) { var thumbnail = createThumbnail(img, type), link = document.createElement('a'); link.target = '_blank'; link.href = img.src; link.appendChild(thumbnail); // append to DOM $preview.appendChild(link); }
[ "function append_thumbnail(options) {\n 'use strict';\n //\n // adds only one item to the list\n //\n // compile the output item template\n\n options = $.extend({\n data: null,\n template: null,\n colorbox_params: {},\n animate: false,\n container: null\n }, o...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Visit a parse tree produced by PlSqlParserrow_movement_clause.
visitRow_movement_clause(ctx) { return this.visitChildren(ctx); }
[ "visitPipe_row_statement(ctx) {\n\t return this.visitChildren(ctx);\n\t}", "visitMove_mv_log_clause(ctx) {\n\t return this.visitChildren(ctx);\n\t}", "visitCursor_manipulation_statements(ctx) {\n\t return this.visitChildren(ctx);\n\t}", "visitReturn_rows_clause(ctx) {\n\t return this.visitChildren(ctx);\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Throws an exception when attempting to detach a portal that is not attached.
function throwNoPortalAttachedError() { throw Error('Attempting to detach a portal that is not attached to a host'); }
[ "function detachVideo() {\n const self = this;\n\n this.janusVideoPlugin &&\n this.janusVideoPlugin.detach({\n success: function() {\n self.janusInstance.destroy();\n },\n error: function() {\n LOGGER.log(\n `Failed to properly detach our Video plugin from Janus, hoping fo...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Name:register Author:Kony Purpose:To register the user as an audience member on the KMS.
function register(){ function asyncCallback(status, result){ kony.print("\n------status------>"+status); if(status==400){ kony.print("\n------result------>"+JSON.stringify(result)); if(result["opstatus"]==8009) { if(result["message"]!=undefined) updateMessaageAlert(result["me...
[ "function registerAudience(){\n \taudienceFirstName=frmRegistration.txtBoxFirstName.text;\n \tif(audienceFirstName==null||audienceFirstName==\"\"){\n \talert(\"please enter first name\");\n \treturn;\n \t}\n \taudienceLastName=frmRegistration.txtBoxLastName.text;\n \tif(audienceLastName==null||audienceLast...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Navigates to the messages page and creates a new conversation with the specified tenant.
function composeMessageToTenant(tenant) { router.navigate('#messages/' + tenant.Id()); }
[ "function createConversation(options) {\n assert(isVoid(options) || isDictionary(options));\n options = options || {};\n var conversation = createConversationModel({\n isConference: getOption(options, 'is...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Calibrate our scanner by using three steps. 1) Generate a test div that does NOT trigger our scanner (fast computation). 2) Measure the timing for this setup and change the div to trigger the sidechannel. 3) Measure the timing again and compute an appropriate threshold.
function calibrate_threshold(calibration_resolve) { // Deactivate the target div for now. target_div.style.display = "none"; // Increase the number of scanning steps to make the calibration more precise. animate_repetitions = 2; // Set our scanning stack to detect any co...
[ "function update() {\n // populate the analyser buffer with frequency bytes\n analyser.getByteFrequencyData(buffer);\n // look for trigger signal\n for (var i = 0; i < analyser.frequencyBinCount; i++) {\n var percent = buffer[i] / 256;\n // TODO very basic / naive implementation where we only look\n //...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
All the money from the pay goes to pay off the loan
function payLoan() { totalOutstandingLoan -= totalPay; totalPay = 0; updateTotalOutstandingLoan(); updateTotalPay(); }
[ "function loan() {\n\tvar cn = document.getElementById(\"mortgageSimulator\").getElementsByTagName(\n\t\t\t\"input\");\n\tvar a = cn[0].value;\n\tvar b = cn[1].value;\n\tvar c = cn[2].value;\n\tvar n = c * 12;\n\tvar r = b / (12 * 100);\n\tvar p = (a * r * Math.pow((1 + r), n)) / (Math.pow((1 + r), n) - 1);\n\tvar ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
True delete. To place a document in the archive, update the archived property (for a piece) or move it to be a child of the archive (for a page). True delete cannot be undone. This operation ignores the locale and mode of `req` in favor of the actual document's locale and mode.
async delete(req, doc, options = {}) { options = options || {}; const m = self.getManager(doc.type); await m.emit('beforeDelete', req, doc, options); await self.deleteBody(req, doc, options); await m.emit('afterDelete', req, doc, options); }
[ "deleteDoc(doc) {\n this.docs.delete(doc.getIdentifier());\n }", "static deleteAction(entryId){\n\t\tlet kparams = {};\n\t\tkparams.entryId = entryId;\n\t\treturn new kaltura.RequestBuilder('document_documents', 'delete', kparams);\n\t}", "async discardDraft(doc) {\n const isPublished = !!doc.las...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Decides on a style for cells in an array according to whether the given environment name starts with the letter 'd'.
function dCellStyle(envName) { if (envName.substr(0, 1) === "d") { return "display"; } else { return "text"; } }
[ "function colorSituation(d,i){ \n if(mod.IsProvince && mod.IsCity==false){\n return provinceColor(d,i);\n }else if(mod.IsProvince==false && mod.IsCity){\n if(i<34 && d.properties.id != 82 && d.properties.id != 81 && d.properties.id != 31 &&\n d.properties.id !...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get user by phone number
function getUserByPhoneNumber(phoneNumber, callBack) { // Select by phone number query const query = `select * from transporter where phone_number = ?`; pool.query(query, [phoneNumber], (error, results) => { if (error) { callBack(error); } return callBack(null, results[0]); } ); }
[ "function readPerson(req, res, next) {\n let stmt = new PS({name: 'read-person', text: \"SELECT * FROM Person WHERE emailPrefix = $1\", values: [req.params.id]})\n db.oneOrNone(stmt)\n .then(data => {\n res.send(data);\n })\n .catch(err => {\n next(err);\n });...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Filter the CSI tree dynamically as the user types in the Filter Text
function filterCSI(tobj) { var tlow = tobj.value.toLowerCase(); var eobj = findTable(); // Go through all the rows in the table (nodes in the tree) for (var i = 0; i < eobj.rows.length; ++i) { // If the text entered by the user appears in the row. var tt = eobj.rows[i]; va...
[ "function normalizeFilter(text) {\n if (!text)\n return text;\n\n // Remove line breaks and such\n text = text.replace(/[^\\S ]/g, \"\");\n\n if (/^\\s*!/.test(text)) {\n // Don't remove spaces inside comments\n return text.replace(/^\\s+/, \"\").replace(/\\s+$/, \"\");\n }\n else if (Filter.elemhide...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Create new Business License Application record
function create(req, res, next) { const payload = req.body; payload.applicantId = _.get(req, 'authentication.jwt.payload.sub', null); validateCreatePayload(payload, (validationErr) => { if (validationErr) { const e = new Error(validationErr); e.status = httpStatus.BAD_REQUES...
[ "function CreateRecord() {\n try {\n var entityName = \"new_organization\"; //Entity Logical Name\n //Data used to Create record\n var data = {\n \"new_organizationname\": \"Tata Consultancy Services\",\n \"new_description\": \"This is the description of Tata Consultanc...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Find the outermost matching node before a given position.
function findNodeBefore(node, pos, test, base, state) { test = makeTest(test) if (!base) base = exports.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 < node.end) && test(type, 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" ] ] } }
push seedaid to project model
function pushSeedAid(projectId,seedAid){ Project.findById(projectId,function(err,proj){ proj.seedAid.push(seedAid) proj.save(); }) }
[ "function pushBusinessDev(projectId,businessDevelopment){\n Project.findById(projectId,function(err,proj){\n proj.businessDevelopment.push(businessDevelopment)\n proj.save();\n })\n}", "function generateProject() {\n const user = faker.random.arrayElement(user_data);\n const project = {\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
search for parenthesized expression in array return the arry with the evaluated subexpression
function evalNextParenthesizedExpression(expr){ //find first and last index of subexpression let subexprStart = expr.indexOf(expr.find(element => (/^-?\($/).test(element))); let subexprEnd; let bracketCount = 1; for (let index = subexprStart+1; index < expr.length; index++) { if ((/\(/).test...
[ "function findAllBrackets(arr) {\n let indexArray = [];\n let bracketType = [];\n\n for (let i = 0; i < arr.length; i++) {\n if (arr[i] == \"(\" || arr[i] == ')') {\n indexArray.push(i);\n bracketType.push(arr[i]);\n }\n }\n\n return {\n indexArray: indexArr...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Applies the operation list on the given text
function applyTransformation(operations, text) { var finaltext = ""; for (var i = 0; i < operations.length; i++) { // we sent multiple flushes, since each flush resets our // operation array, a new range starting with 0 denotes // it is part of a later flush. if ( i > 0 && operations[i][0] == 0 && op...
[ "exec(text) {\n\t\tif (text.length === 0) return;\n\t\tthis.prog = text.split(/\\s+/).reverse();\n\t\tthis.prog = this.prog.map((el) => { return el.toLowerCase(); });\n\t\twhile (this.prog.length) {\n\t\t\tlet tok = this.next_cmd(true);\n\t\t\tthis.operate(tok);\n\t\t}\n\t\t//console.log(this.stack);\n\t}", "isTe...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Clears the grid and clear browser circles (make the cirles white) Also resets the player turn to 1 and sets gameOver to false
function resetGrid(){ for (var col = 0; col < width; col++){ var drop = document.getElementById('drop-'+col); drop.setAttribute('style',''); drop.setAttribute('fill-opacity','0'); } document.getElementById('game_end').style.display = 'none'; playerTurn = 1; moveNumber = 1; document.getElementByI...
[ "function clearGrid() {\n initializeColorGrid();\n draw();\n }", "function clearGrid() {\n score = 0\n mode = null\n firstMove = false\n moves = 10\n timer = 60\n interval = null\n grid.innerHTML = ''\n }", "function resetGameOfLife()\n{\n // RESET ALL THE DATA STRUCTUR...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Given a current view, finds the nearest component's host (LElement).
function findComponentHost(lView) { var viewRootLNode = lView.node; while (viewRootLNode.type === 2 /* View */) { ngDevMode && assertNotNull(lView.parent, 'lView.parent'); lView = (lView.parent); viewRootLNode = lView.node; } ngDevMode && assertNodeType(viewRootLNode, 3 /* Elemen...
[ "function findNearestNodeEl(el) {\n while (el !== document.body && !el.classList.contains('blocks-node')) {\n el = el.parentNode;\n }\n return el === document.body? null : el;\n}", "get focusedPane() {\n let panes = [\"threadTree\", \"folderTree\", \"messagepanebox\"].map(id =>\n document.getElement...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Name: skipGlossary Called by: "mouseup" function on "textdisplay" Parameters: event Event information. Returns: True if no glossary lookup necessary. False otherwise. Explanation: Checks to see if the clicked element is either a note or media element. If it is either, then no glossary lookup is necessary. Media element...
function skipGlossary(event) { var target_class = $(event.target).attr("class"); if (target_class) { if (target_class.indexOf("note") > -1) { var note = $(event.target).attr("note"); if (note) { displayNote(note); return true; } } if (target_class.indexOf("media") > -1) return true; ...
[ "function glossbutton_ontap(evt){\n evt=evt||window.event;\n var target=fdjtUI.T(evt);\n var passage=getTarget(target);\n if ((Codex.mode===\"addgloss\")&&\n (Codex.glosstarget===passage)) {\n fdjtUI.cancel(evt);\n Codex.setMode(true);}\n else if (...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Internal Utility Methods This function sets the module bus address lines to to the appropriate values depending upon the desired module address
function _moduleAddr(addr) { if (addr < 16) { switch (addr) { case 0: rpio.open(16, rpio.OUTPUT, rpio.HIGH); rpio.open(18, rpio.OUTPUT, rpio.HIGH); rpio.open(29, rpio.OUTPUT, rpio.HIGH); rpio.open(...
[ "constructor(){\n // Map pin numbers to simulated pin indexes\n for (let i = 0 ; i < 50 ; ++i){\n this.pinMapping[i + \"\"] = i;\n }\n\n // Map analog pin names to simulated pin indexes\n for (let i = 0 ; i < 8 ; ++i){\n this.pinMapping[\"A\" + i] = 24 + i;\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
function to set te spped of ball in HTML file
function setSpeed(s) { ballSpeed = s; }
[ "function resetBall() {\n console.log(\"ball being set\");\n if (currentRod == rod2) {\n ball.style.top =\n container.clientHeight -\n currentRod.offsetHeight -\n ball.offsetHeight +\n \"px\";\n ball.style.left =\n currentRod.offsetLeft +\n currentRod.offsetWidth / 2 -\n b...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Make sure sentences have proper tone data values. Mutates _rankedSentences
function _cleanSentences() { // look for empty tone_categories and set tone_categories to 0 values _rankedSentences.forEach(function(item) { if (item.tone_categories.length === 0) item.tone_categories = TONE_CATEGORIES_RESET.slice(0); }); }
[ "order(words){cov_25grm4ggn6.f[7]++;cov_25grm4ggn6.s[40]++;if(!words){cov_25grm4ggn6.b[15][0]++;cov_25grm4ggn6.s[41]++;return[];}else{cov_25grm4ggn6.b[15][1]++;}//ensure we have a list of individual words, not phrases, no punctuation, etc.\nlet list=(cov_25grm4ggn6.s[42]++,words.toString().match(/\\w+/g));cov_25grm...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Helper Function for set the amount of Image to being fetch
function setCountOfImageToBeFetch(countOfImage) { apiUrl = `https://api.unsplash.com/photos/random/?client_id=${apiKey}&count=${countOfImage}`; }
[ "function imageLoaded() {\n noOfImageLoaded++;\n if (noOfImageLoaded == 10) {\n onLoadFinish();\n }\n}", "function getMoreImages() {\n\t\t// Return 0 if fetched all images, 1 if enough to fill screen and >1 otherwise\n\t\tvar uncovered_px = $box.height()+$box.offset().top - ($(document).scrollTop()+window.i...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
define a setter for `a`
set a(val) { this._a_ = val; }
[ "set(x, y) {\n this.a = x; // indirectly accessing private members\n this.b = y;\n }", "set value(_) {\n throw \"Cannot set computed property\";\n }", "set(target, property, value, receiver) {\n const updateWasSuccessful = trap.set(target, property, value, receiver);\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Log the current kernel status.
function logKernelStatus(kernel) { if (kernel.status == ikernel_1.KernelStatus.Idle || kernel.status === ikernel_1.KernelStatus.Busy || kernel.status === ikernel_1.KernelStatus.Unknown) { return; } var status = ''; switch (kernel.status) { case ikernel_1.KernelStatus.Star...
[ "function logStatus() {\n if (logging) {\n console.log(\"Elevator \" + index + \" | Queue: \" + floorButtonsQueue + \" | Current Floor: \" + elevator.currentFloor() + \" | Direction: \" + elevator.travelDirection + \" | Current Load: \" + elevator.loadFactor() + \" | Capacity: \" + elevator.maxPasse...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Renders the AWS CloudFormation properties of an `AWS::AppMesh::GatewayRoute` resource
function cfnGatewayRoutePropsToCloudFormation(properties) { if (!cdk.canInspect(properties)) { return properties; } CfnGatewayRoutePropsValidator(properties).assertSuccess(); return { MeshName: cdk.stringToCloudFormation(properties.meshName), Spec: cfnGatewayRouteGatewayRouteSpec...
[ "function cfnGatewayRouteGrpcGatewayRoutePropertyToCloudFormation(properties) {\n if (!cdk.canInspect(properties)) {\n return properties;\n }\n CfnGatewayRoute_GrpcGatewayRoutePropertyValidator(properties).assertSuccess();\n return {\n Action: cfnGatewayRouteGrpcGatewayRouteActionPropertyT...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Dislike a shop and update the list
[SHOP_DISLIKE] (context, payload) { return FavoriteService .dislike(payload) .then(({ data }) => { context.commit( UPDATE_SHOP_IN_LIST, data.shop, { root: true } ) }) }
[ "function itemDislike(e) {\n\te.preventDefault();\n\tvar itemId = $(e.target).attr(\"id\");\n\tif($.cookie(\"dislike_\" + itemId) == \"1\") {\n\t\tundislike(itemId);\n\t} else if($.cookie(\"like_\" + itemId) == \"1\") {\n\t\tunlike(itemId);\n\t\tdislike(itemId);\n\t\thide(itemId);\n\t} else {\n\t\tdislike(itemId);\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
voice recog function recturn the controlles for start/stop/changlang of the speach recognition
function makeSpeachRecog ( onres, onend ) { // is restart required let restart = false // default current language currentLang = 'English' // initiate speacg recognition var SpeechRecognition = SpeechRecognition || webkitSpeechRecognition; var SpeechGrammarList = SpeechGrammarList || w...
[ "function handleListeningState() {\n //recogTimer(20);\n restartRecognition();\n}", "function speechStarted() {\n}", "function createVoice(time){\n //alert(\")\n\n if(reverbs.length > maxVerbs){\n killAVerb();\n }\n \n mic = new p5.AudioIn();\n //mic.start();\n \n myVerb = new p5.Reverb();\n m...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Synchronizes the markup with the model.
syncMarkupWithModel() { this.#syncLabel() this.#syncWidget() }
[ "sync() {\n each(this.models, method(\"sync\"));\n }", "function _updateElement() {\n\t\tself.observer.disconnect();\n\t\tself.element.innerHTML = self.history[self.index];\n\t\tself.observer.observe(self.element, OBSERVER_CFG);\n\t}", "_updateDomElementContent() {\n const {\n dataId, keyword,...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
1. Input Functions / Get the reminder string the user typed in.
function getReminderInput() { return $('#reminder-input').val(); }
[ "function userInput() {\n return document.getElementById('delayInMinutes').value;\n }", "function journalEntry() {\r\n let journalEntry = prompt(` Okay ${userName} , Reflect on why you chose what you did. Describe how that rating makes you feel,why you chose that, how it makes you feel to have that rating,...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
pulls the pop_up template and runs the callback params requires sub_partial. e.g params.sub_partial
function get_pop_up_and_do(options, params, callback) { var params = params || {} params.partial = params.partial || '/shared/pop_up'; $.get('/ajax/get_multipartial', params, function(response) { var pop_up = $(response).dialog({ title: options.title, width: options.width || 785, height: opti...
[ "function Msg_partial_page_setup() {\n $(\"#show_jobs_btn\").click(function () {\n show_job(1, $('#fixed_info_tab').data('process_name'));\n });\n $(\"#msg_load_more\").bind(\"click\", { curPage: more_info_accumulate_page }, function (event) {\n show_message((event.data.curPage + 1), $('#fixe...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
=================================================================================== =================================================================================== Save Selections in Slot This method saves the selection into a slot. ===================================================================================
function saveSelectionsInSlot() { // $log.log(preDebugMsg + "saveSelectionsInSlot"); var result = {}; result.selections = []; for(var sel = 0; sel < selections.length; sel++) { result.selections.push({'minX':selections[sel][0], 'maxX':selections[sel][1]}); } internalSelectionsInternallySetTo = result; ...
[ "function setSelectionsFromSlotValue() {\n\t\t// $log.log(preDebugMsg + \"setSelectionsFromSlotValue\");\n\t\tvar slotSelections = $scope.gimme(\"InternalSelections\");\n\t\tif(typeof slotSelections === 'string') {\n\t\t\tslotSelections = JSON.parse(slotSelections);\n\t\t}\n\n\t\tif(JSON.stringify(slotSelections) =...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Private helper function to check if the principal is allowed to use the feature.
static #isPrincipalAllowed(permission) { // Check if input is defined. if (!permission) { return console.log(`${permission} is undefined or null.`) } return !!permission.some(p => p.enabled === true); }
[ "hasPrivilege (privilege) {\n let user = this.get('currentUser');\n if (user) {\n return (user.privileges.indexOf(privilege) > -1);\n } else {\n return false;\n }\n }", "static #isFeatureEnabled(feature){\n\t\t// Check if input is defined.\n\t\tif (!feature){\n\t\t\treturn console.log(`${fe...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Utility method to convert the form values to a valid document format
function formDataToDocument(formData) { if (formData.year && !isNaN(formData.year)) { formData.year = parseInt(formData.year, 10); } if (formData.authors) { formData.authors = personsStringToArray(formData.authors); } if (formData.editors) { formData.editors = personsStringT...
[ "function validPdfForm() {\r\n return true;\r\n}", "function transformXMLToForm(xmlData) {\r\n\tvar jsObj = parser.parse(xmlData, parserOptions)\r\n\tvar form = new SDCForm()\r\n\r\n\tvar traversalStack = []\r\n\tvar getSection = () => {\r\n\t\tvar section = traversalStack.indexOf(\"Section\")\r\n\t\tif(sectio...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
when a server is created, no more collections can be spawned
function ensureNoMoreCollections(args) { if (DBS_WITH_SERVER.has(args.database)) { var err = newRxError('S1', { collection: args.name, database: args.database.name }); throw err; } }
[ "add(server) {\n let spec = server.spec;\n if (spec in this.collection) {\n // TODO Add error message area on page.\n console.error(sprintf(\"server '%s' already exists\", spec));\n return;\n }\n this.collection[spec] = server;\n }", "createNewCollec...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Create a single tile for the grid.
function createOneTile(row, col, initialColor) { // Use longer dimension so it fits in our [0..1] space. const maxLevelDim = tileConfig.maxLevelDim; const levelRows = tileConfig.levelShape[0]; const levelCols = tileConfig.levelShape[1]; const tileSize = tileConfig.tileSize; const posLevel = [ row * tileSize...
[ "function createTiles(){\n // figure out what tile specific information you need to add\n \n // can add all of the tiles here dynamically (which is useful if you are going to make the number of rows and columns adjustable, however you can also just specify them fixed in the HTML)\n}", "spawnNew() {\r\n\t\tif (...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Releases the first Ghost in the vector from Pen
releaseGhostFromPen() { let ghost = this.inPen[0]; ghost.setPath("exitPen"); ghost.activateElroy(); this.inPen = this.inPen.slice(1); }
[ "stopGC() {\n if (this.currentParams.pointList.length > 1) {\n this.drawTurtle.CreateExtrudeShape(\"tube\" + (this.drawTurtle.graphicElems.length + 1).toString(), { shape: this.currentParams.shapeSection, path: this.currentParams.pointList, sideOrientation: BABYLON.Mesh.DOUBLESIDE, radius: 0.075 }...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
functions to filip the cards
function fillipingCards(newDeck) { if (newDeck.length === 0) { for (var i = frontPile.length; i > 0; i--) { newDeck.unshift(frontPile.shift()); }}; }
[ "function flip() {\r\n if (stopFlip) return;\r\n //add the flip style to a clicked card\r\n this.classList.add(\"flip\");\r\n moveCount();\r\n pickedCards.push(this);\r\n // card 1 selected\r\n if (cardSelected === false) {\r\n cardSelected = true;\r\n cardOne = this;\r\n return;\r\n //card 2 sel...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Example 6: / Now create a constructor function. Declare a `Sandwich` constructor function that takes three parameters: 1. `bread` (string) the type of bread for the sandwich (e.g. "Wheat") 2. `meat` (array) the meats to put on the sandwich (e.g. `[]` for a vegetarian sandwich!) 3. `vegetables` (array) the vegetables to...
function Sandwich(bread, meat, vegetables) { this.bread = bread; this.meat = meat; this.vegetables = vegetables; }
[ "function makeSandwich(meat, cheese, bread) {\r\n //pleace to define the work\r\n var sandwich = 'Here is a ' + meat + \" and \" + cheese + \" sandwich on\" + bread + \" bread. It is delicious! Enjoy!\"\r\n // a pleace to say what the input should be\r\n return sandwich;\r\n}", "constructor(name, weight, eyeC...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }