query
stringlengths
9
34k
document
stringlengths
8
5.39M
negatives
listlengths
19
20
metadata
dict
create java variable name
function makeJavaVariableName() { var varName = ''; for (var i = 1; i < gValuesOfRange.length; i++) { /** set common var in column range*/ if (!setCommonVar(i)) { return ''; } if (cPhysicalNameOfColumn == '') { break; } varName += '///...
[ "function createVariable() {\n var id = nextVariableId++;\n var name = '$V';\n\n do {\n name += variableTokens[id % variableTokensLength];\n id = ~~(id / variableTokensLength);\n } while (id !== 0);\n\n return name;\n }", "function createVariable() {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get the currently visible viewport rect in page coordinates.
function clientViewportRect() { var elem = document.documentElement; var x = window.pageXOffset; var y = window.pageYOffset; var width = elem.clientWidth; var height = elem.clientHeight; return { x: x, y: y, width: width, height: height }; }
[ "function clientViewportRect() {\n var elem = document.documentElement;\n var x = window.pageXOffset;\n var y = window.pageYOffset;\n var w = x + elem.clientWidth;\n var h = y + elem.clientHeight;\n return new utility.Rect(x, y, w, h);\n }", ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
retreive the current selected Go from the workspace state
function getSelectedGo() { return stateUtils_1.getFromWorkspaceState('selectedGo'); }
[ "getSelectedProject() {\n if (this.currentCache) {\n return this.currentCache.selectedProject;\n }\n }", "function initSelectedWorkspace() {\n var selectedName = StorageService.get('selectedWorkspaceName');\n\n if (!selectedName) {\n selectedName = defaultWorkspace...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Construct a new KernelFutureHandler.
function KernelFutureHandler(cb, msg, expectShell, disposeOnDone, kernel) { var _this = _super.call(this, cb) || this; _this._status = 0; _this._stdin = Private.noOp; _this._iopub = Private.noOp; _this._reply = Private.noOp; _this._done = new coreutils_1.PromiseDelegate()...
[ "createHandlerFactory() {\n logger.debug('createHandlerFactory()');\n return () => {\n const internal = { handlerId: (0, uuid_1.v4)() };\n const handler = new Handler_1.Handler({\n internal,\n channel: this._channel\n });\n this...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Check whether the browser supports scroll behaviors.
function supportsScrollBehavior() { if (scrollBehaviorSupported == null) { // If we're not in the browser, it can't be supported. if (typeof document !== 'object' || !document) { scrollBehaviorSupported = false; } // If the element can have a `scrollBehavior` style, we ...
[ "function supportsScrollBehavior() {\n return !!(typeof document == 'object' && 'scrollBehavior' in document.documentElement.style);\n }", "function supportsScrollBehavior() {\n return !!(typeof document == 'object' && 'scrollBehavior' in document.documentElement.style);\n}", "function supportsSc...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function to disable breed input if cat is selected.
function disableBreedInput() { const animalInput = this.value; if (animalInput != "dog") { $("#breed").attr("disabled", "disabled"); } else if (animalInput == "dog") { $("#breed").removeAttr("disabled") } }
[ "function disableBreedInput() {\n const animalInput = this.value;\n if (animalInput == \"cat\") {\n $(\"#breed\").attr(\"disabled\", \"disabled\");\n } else if (animalInput == \"dog\") {\n $(\"#breed\").removeAttr(\"disabled\")\n }\n }", "function disableHeartCats() {\n if (!catRadio.check...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Adds a line to the scene (visible and with a hitbox)
function addWall(line) { sceneVisibleLines.push(line); sceneHitboxLines.push(line); }
[ "function addLine() {\n var line = new fabric.Line([250, 125, 250, 175], {\n fill: 'black',\n stroke: 'black',\n strokeWidth: 5\n });\n canvas.add(line);\n}", "function createLine() {\r\n graphEditor.getInteractionHandler().setActiveInteraction(new JSG.graph.interaction.CreateEdge...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns relevant section of custom format specifier.
getRelevantFormatSection(sections, number) { const that = this, compareResult = that.numericProcessor.compare(number, 0, true); if (compareResult === 1) { return sections[0]; } let negativeNumberGroup, zeroGroup; if (sections.length >= 3) { ...
[ "static get Format () {}", "GetFormat() {\n\n }", "function getSpecifierText(specifier) {\n return `${specifier.local.name}${specifier.exported.name !== specifier.local.name\n ? ` as ${specifier.exported.name}`\n : ''}`;\n}", "applyCustomFormat(number, formatSpecifier) {\n const tha...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Draw the lines for the second section below the hero Intro animation system while scrolling landing only
function drawline() { var start_in = win_height * .3; var start_out = win_height; if (scroll_top >= (start_in - 25) && scroll_top <= (start_out * 2)) { var svg_container = document.getElementById("whatwedo"); var svg_paths = svg_container.getElementsByTagNameNS(ns, "pa...
[ "function introAnimation(){\n introTL\n .fromTo(heroImage, {opacity: 0, x: 20, y: -10, scale: 1.4}, {duration: 1, x: 0, y: 0, ease: Power4.easeInOut, opacity:1, scale: 1.3})\n .to(day, .9, {ease: Power4.easeInOut, y: 0}, \"sync-=.9\")\n .to(group1, .9, {y: -15, ease: Power4.easeInOut}, \"sync-=.9\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
get dot style grid path
_getDotPath() { const graph = this.graph; const width = graph.getWidth(); const height = graph.getHeight(); const tl = graph.getPoint({ x: 0, y: 0 }); const br = graph.getPoint({ x: width, y: height }); const cell = this.cell; const flooX = Math.ceil(tl.x / ce...
[ "getPathCell(x, y) {\n return this.pathCells.find(cell => cell.y == y * this.gridSize && cell.x == x * this.gridSize)\n }", "_getLinePath() {\n const graph = this.graph;\n const width = graph.getWidth();\n const height = graph.getHeight();\n const tl = graph.getPoint({\n x: 0,\n y:...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns a JSON structure of the current Layout state. Does not contain any HTML references. Used for local storaging.
getJSONStructure() { return this.getState(true); }
[ "layout(state) {\n return state.layout;\n }", "generateLayoutData() {\n // This class is base class, can be called with this method.\n return {\n id: this.id,\n className: this.constructor.name,\n prop: map2json(this.prop),\n layout: {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Given a protocol and a port, try to guess the other one if it's undefined eslintdisablenextline maxlen
function determineProtocolAndPort(protocol, port) { if (protocol === undefined && port === undefined) { return [undefined, undefined]; } if (protocol === undefined) { protocol = defaultProtocolForPort(port); } if (port === undefined) { port = defaultPortForProtocol(protocol);...
[ "function inferPort(protocol) {\n if (protocol === 'http:') {\n return 80\n }\n\n if (protocol === 'https:') {\n return 443\n }\n}", "function defaultPort(protocol) {\n return {'http:':80, 'https:':443}[protocol];\n }", "function defaultPort(protocol) {\n return { 'http:': 80, ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
test if start and end angles match with radians tolerance. This is equivalent to isAlmostEqualNoPeriodShift. it is present for consistency with other classes It is recommended that all callers use one of he longer names to be clear of their intentions: isAlmostEqualAllowPeriodShift isAlmostEqualRadiansNoPeriodShift
isAlmostEqual(other) { return this.isAlmostEqualNoPeriodShift(other); }
[ "static isAlmostEqualRadiansAllowPeriodShift(radiansA, radiansB) {\n // try to get simple conclusions with un-shifted radians ...\n const delta = Math.abs(radiansA - radiansB);\n if (delta <= Geometry_1.Geometry.smallAngleRadians)\n return true;\n const period = Math.PI * 2.0;...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
waits a second to check if the user is still typing out the graph equation. If not, update the graph.
function requestEquationInput() { graphEquations[curGraphNo] = expressionInput.value; if (!requestingEquationInput) { requestingEquationInput = true; equationInputWait = 0; //the updated expression string let curString = "y=" + expressionInput.value; let interval = win...
[ "function tryDraw() {\n let inputGraph = document.querySelector(\"#inputGraph\");\n if (oldInputGraphValue !== inputGraph.value) {\n oldInputGraphValue = inputGraph.value;\n network.drawNetwork(oldInputGraphValue);\n }\n}", "function graphMoveByInput(e) {\n if (lock) {\n if (faile...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
create a IPv4 subnet mask based on a number of bits
function IPAddress$createIpv4Mask(maskSize) { return -1<<(32-maskSize); }
[ "function bitsToNetmask(bits) {\n var n = 0;\n\n for (var i = 0; i < (32 - bits); i++) {\n n |= 1 << i;\n }\n return numberToAddress(MAX_IP - n);\n}", "function generateMask() {\n var ct = 10; // infinite loop prevention :-)\n while (ct-- > 0) {\n var octs = [255, 255, ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
fill in code that creates the triangles for a sphere with diameter 1 (centered at the origin) with number of slides (longitude) given by slices and the number of stacks (lattitude) given by stacks. For this function, you will implement the tessellation method based on spherical coordinates as described in the video (as...
function makeSphere (slices, stacks) { // fill in your code here. var triangles = []; var origin = [0.0, 0.0, 0.0]; const radius = 0.5; const longi_step = radians(360 / slices); // in radian const lati_step = radians(180 / stacks); // in radian var theta = 0.0; for (var i=0; i<slices; i++){ var phi = ...
[ "function makeSphere (slices, stacks) {\n // fill in your code here.\n var sliceDivision = radians(360) / slices;\n var stackDivision = radians(180) / stacks;\n var radius = 0.5;\n\n for (var longitude = 0; longitude < radians(360); longitude += sliceDivision) {\n for (var latitude = 0; latitu...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Convert world coordinates into local coordinates in respect to your character.
function WorldToLocal(x, y, scale) { var relativeX = (character.real_x - x)*scale * -1; var relativeY = (character.real_y - y)*scale * -1; return {x: relativeX, y: relativeY}; }
[ "worldToLocal(world) {\r\n let m = this.matrix;\r\n let a = m.a, b = m.c, c = m.b, d = m.d;\r\n let invDet = 1 / (a * d - b * c);\r\n let x = world.x - m.tx, y = world.y - m.ty;\r\n world.x = (x * d * invDet - y * b * invDet);\r\n world.y = (y * a * ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
edge detection using Sobel operator in both x and y direction edge intensity is sqrt( |Gx|^2 + |Gy|^2 )
function edge( __src ) { var gx = grayscale( filter(__src, new Filter.hsobel()) ); var gy = grayscale( filter(__src, new Filter.vsobel()) ); // sqrt(gx^2 + gy^2) var h = gx.h, w = gx.w; var g = new RGBAImage(w, h); var data = g.data, data1 = gx.data, data2 = gy.data; ...
[ "edgeDetect(){\n if (this.y + this.radius + this.velocity.y > this.canvas.height) {\n this.velocity.y *= -1\n }\n else if(this.y - this.radius <= 0){\n this.velocity.y *= -1\n }\n\n if (this.x + this.radius + this.velocity.x > this.canvas.width) {\n this.velocity.x *= -1\n }\n el...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This function saves the current project to the server based off of the values that the user entered INNER FUNCTION CALLS: isValidInput_CLOSEOUT()
function saveProject_CLOSEOUT() { console.log('Saving Closeout Information'); var costcoSignoff = $('#closeoutData').find('#costcoSignoff').val(); var punchList = $('#closeoutData').find('#punchList').val(); var alarmHvac = $('#closeoutData').find('#alarmHvac').val(); var verisae = $('#closeoutData').find('#v...
[ "function saveProject_CLOSEOUT()\n{\n console.log(\"Saving Closeout Information\");\n var punchList = $('#closeoutData').find(\"#punchList\").val();\n\tvar alarmHvac = $('#closeoutData').find(\"#alarmHvac\").val();\n\tvar verisae = $('#closeoutData').find(\"#verisae\").val();\n\tvar asBuilts = $('#closeoutDat...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Initialization of the module. This loads `site.json` at the root of the project and calls the follow on functions to generate the pages.
function init() { fse .readJson('./site.json') .then(function(site) { // if the destination dir exists if (fse.pathExistsSync(config.baseDir)) { // clean it out before writing files fse.emptyDirSync(config.baseDir); } else { ...
[ "function init() {\n fse\n .readJson('./site.json')\n .then(function(site) {\n // if the destination dir exists\n if (fse.pathExistsSync(config.baseDir)) {\n // clean it out before writing files\n fse.emptyDirSync(config.baseDir);\n } e...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This will display the warning for low stock clinics
function displayLowStockWarning(clinics) { var alertOutput = "Warning! The Following Clinics are low on stock: \n"; for (var i in clinics) { var nev = clinics[i]["nevirapineStock"]; var sta = clinics[i]["stavudineStock"]; var zid = clinics[i]["zidotabineStock"]; var clinName = cl...
[ "function alert_low_quantity(){\n for(var part of global_table){\n if(part['stock'] <= config_json[\"Low Stock Quantity\"]){\n // TODO: CHange 'value' to a part description/manufacturer ID\n toastr.warning(`Low quantity (${part['stock']}) for ${part['value']}`);\n }\n }\n}"...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Funtion Declarations Function: startScoreboard() This function surrounds runScoreboard() in a try/catch block so it can easily display any error messages to the user through an alert popup.
function startScoreboard(){ try { runScoreboard(); } catch (e){ alert("Error: " + e + "\n"); console.error(e.stack); } }
[ "function init() {\n previousScoreboard();\n }", "function startGame(){\n score = 0;\n timer = time;\n clearScreen();\n fillBoard();\n runTimer();\n }", "function loadFlashmathScoreboard() {\n clearScreen();\n loadCursor();\n\n loadNavBars(\"Flashmath Scoreboard\");\n\n let score...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
xRemoveEventListener, Copyright 20012007 Michael Foster (CrossBrowser.com) Part of X, a CrossBrowser Javascript Library, Distributed under the terms of the GNU LGPL
function xRemoveEventListener(e,eT,eL,cap) { if(!(e=xGetElementById(e)))return; eT=eT.toLowerCase(); if(e.removeEventListener)e.removeEventListener(eT,eL,cap||false); else if(e.detachEvent)e.detachEvent('on'+eT,eL); else e['on'+eT]=null; }
[ "function xRemoveEventListener2(e,eT,eL,cap)\r\n{\r\n if(!(e=xGetElementById(e))) return;\r\n eT=eT.toLowerCase();\r\n if(e==window) {\r\n if(eT=='resize' && e.xREL) {e.xREL=null; return;}\r\n if(eT=='scroll' && e.xSEL) {e.xSEL=null; return;}\r\n }\r\n if(e.removeEventListener) e.removeEventListener(eT,e...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get the name of the repository for this session. Asynchronous. cb callback function to invoke with result scope scope used to invoke the callback function TODO Consolidate repository information into global context for current user.
function getRepositoryName(cb, scope) { function success(response, options) { var repoName = Ext.decode(response.responseText); cb.call(scope, repoName); } Ext.Ajax.request({ url: "application/currentUser/repository", sco...
[ "function getRepositoryInfo(username, repoName, callback) {\n var request = new XMLHttpRequest();\n request.open(\"GET\", \"https://api.github.com/repos/\" + username + \"/\" + repoName + IDSecret, true);\n request.onreadystatechange = function () {\n if (request.readyState === 4 && request.status =...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Starts the HTTPS server with the given Express app
function startHttpsServer(app) { var httpServer; var credentials = loadSslCredentials(); if (!credentials) { console.log('SSL issue'); } try { httpServer = https.createServer(credentials, app); httpServer.on('error', httpError); httpServer.listen(config.httpsPort); console.log('Server ...
[ "function startWebServer() {\n if (sslEnabled) {\n const key = fs.readFileSync(\"cert/server.key\", \"utf8\");\n const cert = fs.readFileSync(\"cert/domain.crt\", \"utf8\");\n const httpsServer = https.createServer({ key, cert }, app);\n app.use(graceful(httpsServer, { logger: console, forceTimeout: 30...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
query a participant of a study
async participant(parent, args, ctx, info) { if (!ctx.request.userId) { throw new Error("You must be logged in to do that!"); } // TODO check authorization (being an admin or a researcher of the study) const participant = await ctx.db.query.profile( { where: { id: args.par...
[ "async participantStudyResults(parent, args, ctx, info) {\n if (!ctx.request.userId) {\n throw new Error(\"You must be logged in to do that!\");\n }\n\n const results = await ctx.db.query.results(\n {\n where: {\n OR: [\n {\n user: {\n id: ar...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
returns password string generated based on options propery
generate() { let password = ''; let characters = this.getAllPossibleCharacters(); let randomValues = new Uint8Array(this.options.length || 16); crypto.getRandomValues(randomValues); for (let i = 0; i < randomValues.length; i++) { password += characters[randomValues[i] % characters.length]; } if (!th...
[ "function generatePassword() {\n password_generated = \"\";\n for (let i = 0; i < pass_length; i++) {\n password_generated = password_generated + password_options[randomGen(string_length)];\n }\n }", "function generatePassword() {\n // Gather inputs from password criteria form\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Handles changes to DocumentManager.getCurrentDocument()
function _onCurrentDocumentChange() { var doc = DocumentManager.getCurrentDocument(), container = _editorHolder.get(0); var perfTimerName = PerfUtils.markStart("EditorManager._onCurrentDocumentChange():\t" + (!doc || doc.file.fullPath)); // Remove scroller-shadow from the c...
[ "function _getCurrentDocument() {\n return DocumentManager.getCurrentDocument();\n }", "_onDocumentChanged() {\n this._updateButton(true)\n\n this.extendState({\n unsavedChanges: true\n })\n }", "function documentEdited() {\n\ttry {\n \t MM.BC.documentEdited();\n\t\t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Toggles the focused pin/card off
function toggleFocusOff() { if (focusedCard) { focusedCard.classList.remove('active-card'); } if (focusedPin) { let iconPath = focusedPin.getIcon(); let iconName = iconPath.split('/')[2].split('.')[0]; focusedPin.setIcon(ICON_PATHS.defaultIcons[iconName]); } focusedCard = null; focusedPin ...
[ "setFocusedFalse () {\n this._isFocused = false\n }", "focus() {\n this.toggle.focus();\n }", "function clickOff() {\n openedCards.forEach(function(card) {\n card.off('click');\n });\n}", "_toggleFocused() {\n let focused = document.activeElement === this.inputNode;\n this.tog...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Triggered when a new buy token is selected and the src input requires an update based on the new expected exchange rate
function updateSrcValue() { destAmount = document.getElementById('dest-amount').value srcAmount = destAmount * (1 / (expectedRate / (10 ** 18))); displaySrcAmount(); }
[ "modifyBuyRate (newValue) {\n console.log('modifyBuyRate triggered with', newValue)\n this.state.buyRate = newValue\n }", "changeBuyRate(card) {\n Service.get(this).changeBuyRate(card);\n }", "rateFieldChanged () {\n const order = this.parseOrder()\n if (order.rate <= 0) {\n this.page.rate...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Pretty Print XML text
static ppXML(theXML, pres = true) { return Pretty.xml(theXML, pres); }
[ "static prettifyXml(xmlDoc) {\n var xsltDoc = new DOMParser().parseFromString([\n // describes how we want to modify the XML - indent everything\n '<xsl:stylesheet xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\">',\n ' <xsl:strip-space elements=\"*\"/>',\n ' <...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
function rotate() Allows to change the source image to the next or last in the list. Options: srcimage defines the image that will be replaced by the others direction 1 forward 1 backward
function rotate(srcimage,direction){ n=n+direction; if (n==allImages) n=0; if (n==-1) n=allImages-1; document.images[srcimage].src=imgObjects[n].src; }
[ "function rotateImages(image){\n\n //available options\n \n \n\n var option = '';\n\n \n img = 'img/' + option + '.png';\n\n $(image).attr('src', img);\n\n\n \n\n\n\n }", "function rotate()\n{\n // get the value of the current image displayed\n var imageSrc = pic.getAt...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
api call to green.js to pull goal total for selected Category
function getGoalAmount(categorySelected) { jQuery.ajaxSetup({async:false}); $.post("/api/getUserGoals", {username:user}, function(data) { amountSet = 0; $(jQuery.parseJSON(JSON.stringify(data))).each(function() { amountSet = this[categorySelected]; }); }); }
[ "calculateTotal() {\n let total = 0;\n for (let category of this.categories) {\n total += category.calculateTotal();\n }\n return total;\n }", "function totalCostPerCat() {\n knexInstance\n .select('*')\n .sum('total')\n .from('shopping-list')\n .groupBy('category')\n .then(res => {\n c...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
run the actual callbacks
function runCallbacks() { callbacks.forEach(function (callback) { callback(); }); running = false; }
[ "function runCallbacks() {\n\n\t callbacks.forEach(function(callback) {\n\t callback();\n\t });\n\n\t running = false;\n\t }", "function runCallbacks() {\n\n callbacks.forEach(function(callback) {\n callback();\n });\n\n running = false;\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
! moment.js locale configuration
function Os(e,t,n){return"m"===n?t?"хвилина":"хвилину":"h"===n?t?"година":"годину":e+" "+ //! moment.js locale configuration function(e,t){var n=e.split("_");return t%10==1&&t%100!=11?n[0]:t%10>=2&&t%10<=4&&(t%100<10||t%100>=20)?n[1]:n[2]}({ss:t?"секунда_секунди_секунд":"секунду_секунди_секунд",mm:t?"хвилина_хвилини_хв...
[ "function za(e,t,o){return\"m\"===o?t?\"хвилина\":\"хвилину\":\"h\"===o?t?\"година\":\"годину\":e+\" \"+\n//! moment.js locale configuration\nfunction(e,t){var o=e.split(\"_\");return t%10==1&&t%100!=11?o[0]:t%10>=2&&t%10<=4&&(t%100<10||t%100>=20)?o[1]:o[2]}({ss:t?\"секунда_секунди_секунд\":\"секунду_секунди_секунд...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Whether the sector's data is invalid. Normally FB is normal and F8 is deleted, but the singledensity version has two other values (F9 and FA), which we also consider deleted, to match xtrs.
isDeleted() { const dam = this.flags & Flags.DAM_MASK; if (this.isDoubleDensity()) { return dam === Flags.DAM_DD_F8; } else { return dam !== Flags.DAM_SD_FB; } }
[ "isDeleted() {\n const dam = this.getByte(this.dataIndex - 1);\n if (dam !== 0xF8 && dam !== 0xFB) {\n console.error(\"Unknown DAM: \" + z80_base_2.toHexByte(dam));\n }\n // Normally, 0xFB, but 0xF8 if sector is considered deleted.\n return dam === 0xF8;\n }", "ver...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns the value at a certain position in the Tic Tac Toe Board
valueAt(x, y){ return this.ticTacToeGameBoard[x][y]; }
[ "function PboardGet(x, y)\n{\n return board[x * 7 + y];\n}", "function getPieceAt(row, col) {\n \n var player = checkerboard[row][col];\n \n return player;\n \n}", "valueAt(row, column){\n if(!this.validPick(row, column)){\n return false;\n }\n return this.gameAr...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
console.log("6. ", findSubmissionByName(submissions)); 7.Declare a function named findLowestScore with parameter array. Return the object in the array with the lowest score. Use forEach method to loop through whole array.
function findLowestScore(array) { let lowest = null; submissions.forEach(function (submissions) { if (lowest === null || lowest.score > submissions.score) { lowest = submissions; } }); return lowest; }
[ "function findLowestScore(array) {\n let lowest = null;\n\n array.forEach(function (submission) {\n\n if (lowest === null || lowest.score > submission.score) {\n lowest = submission; \n }\n });\n return lowest;\n }", "function findLowestScore(array) {\n let lowest = arr...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Moves the character in the argument in the direction desired, if possible. If not, returns false.
moveCharacter(character, direction) { var candidateTile; var currTileX = character.getCurrentTile().getTileX(); var currTileY = character.getCurrentTile().getTileY(); var charState; var result = true; switch (direction) { case 'up': c...
[ "move(direction) {\n if (direction === 'n' && this._confirmDirection(this.y - 1, this.x)) {\n this.prev = [...this.position];\n this.position[0] -= 1;\n return true;\n } else if (direction === 's' && this._confirmDirection(this.y + 1, this.x)) {\n this.prev ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
this should implement the archive view
function archiveView() { const tasklist = $("#tasklist"); const archivelist = $("#archivelist"); // first, update the archive with data from the DOM const archivedList = getIDList("archivelist"); const tasks = $("body").data("tasks"); const archive = tasks["archive"]; const archiveKeys = Object.keys(archi...
[ "_onArchiveClicked(ev) {\n ev.stopPropagation();\n ev.preventDefault();\n\n this.model.updateVisibility('archive');\n }", "function archive() {\n if (this.id == \"archive\") {\n mark_archived(this.dataset.id, true);\n } else {\n mark_archived(this.dataset.id, false);\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Return the award list Return current award Return flag whether todays needs claiming. What the current day is.
function GetLoginAwards() { var DaysLoggedIn = 0; var currentRewardDay = 0; var isNewLogin = false; var profileInfo = server.GetUserAccountInfo({PlayFabId : currentPlayerId}); if(profileInfo.UserInfo.TitleInfo.LastLogin) { var lastLoginDate = profileInfo.UserInfo.TitleInfo.LastLogin; var array...
[ "function AwardCurrentAY(){\n\n\t$(\"#awardAlertDiv\").hide();\n\t\n\tif ($(\"#award_yes\").is(':checked')) {\n\t\t$(\"#add_award_div\").show();\n\t}\n\telse if ($(\"#award_no\").is(':checked')){\n\t\t$('#add_award_div').hide();\n\t\t$(\"#awardsTableAlertDiv\").hide();\n\t}\n\tsetAwardsTableTemplate();\n}", "func...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This sample demonstrates how to Lists all of the outputs under the specified streaming job.
async function listAllOutputsInAStreamingJob() { const subscriptionId = "56b5e0a9-b645-407d-99b0-c64f86013e3d"; const resourceGroupName = "sjrg2157"; const jobName = "sj6458"; const credential = new DefaultAzureCredential(); const client = new StreamAnalyticsManagementClient(credential, subscriptionId); con...
[ "getOutputs(jobId, callback) {\n this.getLogs(jobId, logs => {\n this.getResults(jobId, results => {\n callback(results, logs)\n })\n })\n }", "function getJobOutput(jobId) {\n var options = { method: 'GET',\n url: `${config.RESTAPIEndpoint}/Jobs('${jobId}')/OutputMediaAssets`,\n he...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Display wait message on screen text = message to display force = display even if trace not enabled
function waitMsg (text) { WaitMsg.textContent = text; }
[ "function display_waiting_message() {\n display_overlay_message(MSG_WELCOME, 'waiting');\n}", "function showMonitoringControlWaitingScreen(text) {\n //Set a default text\n if (!text) {\n text = 'Please wait...';\n }\n\n //Show waiti...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns a promise that will be resolved with the numeric fhir version 2 for DSTU2 3 for STU3 4 for R4 0 if the version is not known
getFhirRelease() { return this.getFhirVersion().then(v => { var _a; return (_a = settings_1.fhirVersions[v]) !== null && _a !== void 0 ? _a : 0; }); }
[ "getFhirVersion() {\n return (0, lib_1.fetchConformanceStatement)(this.state.serverUrl).then(metadata => metadata.fhirVersion);\n }", "getVersion() {\n return new Promise(resolve => {\n ffmpeg()\n .addOptions([`-version`])\n .output('./')\n .on('end', (result = '') => {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Market Data Viewer Demo Extract search params. "$location" requires html5 mode which we can't switch to quite yet. Doesn't handle multivalued keys.
function ekGetSearchParams() { var result = {}; var searchParams = window.location.href.split('?'); if (searchParams && searchParams.length > 1) { var vals = searchParams[1].split('&'); for (var i = 0; i < vals.length; i++) { var next = vals[i].split('='); var key = next[0]; ...
[ "function get_location_search() {\n return new URLSearchParams(location.search);\n}", "getQueryValues() {\n var search = this.window_obj.location.search;\n\n if (search.length <= 1) {\n return {};\n }\n\n search = this.window_obj.location.search.substr(1);\n return this.getRawValues(search,...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
gets the score object from the given array of scores which matches the given site (using idx as a hint to its position in the array)
function getScoreForSite(scores, site, idx, suppressWarnings) { var score = (scores.length > idx) && scores[idx]; // <-- attempt to shortcut the full ID search if (!score || (score.site && score.site.id !== site.id)) { // try to find this score the hard way... (may be time consuming for our supported...
[ "function getScoreForTeam(scores) {\n for(var i = 0; i < scores.length; i++) {\n var score = scores[i];\n if(score.team.id === team.id) {\n return score.score;\n }\n }\n return 0;\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Merender node ke trashlistcontainer
function renderTrashHtmlNode(node) { const trashListContainer = document.getElementById("trash-list-container") trashListContainer.appendChild(node) }
[ "addTrash(data){\n this.trashList.firstElementChild.append(data);\n }", "function addTrashIconToCustomMenuNodes(){\n \n var targetElements = $('#toolbar-menu-manager .node-id');\n\n for (var i = 0; i < targetElements.length; ++i) {\n\n var currentItem = targetElements[i];\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
V = velocity O = neighborhoodSize Q1 = cognitionLearningRate Q2 = socialLearningRate
constructor(i, p, o, n, q1, q2, problem) { this._iterations = i; this._problem = problem; this._socialLearningRate = q2; this._cognitionLearningRate = q1; this._maxVelocity = 5;//problem.MAX_VALUE; this._minVelocity = -5;//problem.MIN_VALUE; this._neighborhood = o; this._individuals = []...
[ "function update(){\n r = 5 * (1 - (iterasi / t));\n h = 0.2 * (1 - (iterasi / t));\n //console.log('learning rate & radius updated');\n}", "function Perceptron(input_dimension, learning_rate) {\n this.weights = new Array(input_dimension); \n this.rate = learning_rate;\n\n for(var i = 0, len = ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Set the order for the query. If the provided order template is null, any existing ordering is removed. Otherwise, the order template should be a list of objects, each containing a single inschema attribute key and a value of either "asc" or "desc". The second parameter is reserved for internal use.
order(orderTemplate, _isTemplate=true) { if (!orderTemplate) { // The caller wants to remove any existing order from the query. this.hasOrder = false; // Filter out modifiers with the relevant initial token. return this._mutateEssence(essence => ({ ...
[ "set sortingOrder(value) {}", "function updateSortOrder(order) {\n const newSortedList = employeeTable.list.sort(function (a, b) {\n return a[order] > b[order] ? 1 : -1;\n })\n setList({ ...employeeTable, order, list: newSortedList })\n }", "function initOrder() {\n angular...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
that are less than or equal to num. The first two numbers in the Fibonacci sequence are 1 and 1. Every additional number in the sequence is the sum of the two previous numbers. The first six numbers of the Fibonacci sequence are 1, 1, 2, 3, 5 and 8.
function sumFibs(num) { let add; let fibo = [1,1] // starts the sequence //while the last number in the array is less than the given number, //continue adding the fibonacci sequence while (fibo[fibo.length-2] <= num) { add = fibo[fibo.length-2] + fibo[fibo.length-1]; fibo.push(add); ...
[ "function iFibonacci(num){\n var num1 = 0;\n var num2 = 1;\n var total = 0;\n if(num == 0){return 0};\n if(num == 1){return 1};\n for(var i = 2; i<=num; i++){\n total = num1 + num2;\n num1 = num2;\n num2 = total;\n };\n return total;\n}", "function sumFibs(num) {\n // Perform checks for the va...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Geometric variate; 0 < p < 1, the probability an event will happen
function geomrand(p){ return Math.floor(exprand( -Math.log(1-p) )); }
[ "function geometric(p = 0.5) {\n if (p <= 0 || p > 1)\n return undefined;\n return Math.floor(Math.log(Math.random()) / Math.log(1 - p));\n }", "function geometric(_p) {\n var x = 1;\n var sum = parseFloat(_p);\n var prod = parseFloat(_p);\n var q = 1.0 - pa...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
We also need to update the tool versions to the new versions for the group site id, by getting the first version for each tool in the group site.
function getUpdateToolVersionsPromise(){ var defer = q.defer(); // If the tool mapping contants versions we need to update too if(toolVersions){ var mergeData = {"toolsLocal" : {}, "tools" : {}}; var keys = Object.keys(toolVersions); /* * We now create records that look like this * { *...
[ "function getUpdateToolVersionPromise(){\n\t\t\tvar versionData = { \n\t\t\t\t\t'toolsLocal' : {},\n\t\t\t\t\t'tools' : {}\n\t\t\t};\n\t\t\tversionData.toolsLocal[toolname] = { 'clientContentVersion' : toolSyncResponse.version };\n\t\t\tversionData.tools[toolname] = { \n\t\t\t\t'currentContentVersion' : toolSyncRes...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
sortWords function creates an array of key,value pairs and sorts by value descending and then by key ascending for counts that are the same
function sortWords() { sortedList = Object.entries(counts).sort((a, b) => { // sort values descending if (b[1] > a[1]) return 1; else if (b[1] < a[1]) return -1; //if values are the same sort keys ascending else { if (a[0] > b[0]) return 1; else if (a[0] < b[0]) return ...
[ "function sort(words){\n var finallst = [];\n finallst = Object.keys(words).map(function(key){\n return{\n word: key,\n count: words[key]\n }\n });\n\n finallst.sort(function(a,b){\n return b.count-a.count;\n });\n\n return finallst;\n}", "function sortWords(count) {\n\t\tvar b = [];\n\t\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
update step from user by id
function putstep(req, res){ // let step; let token = req.headers.authorization; let user = getUser(token); // console.log(user.uid); // console.log(req.params.id); // let reqId = req.params.id.split("=")[1]; // console.log(reqId); User.findOne({"_id": user.uid}, {"step": 1}, (err, doc) =...
[ "function putstep3(req, res){\n // let step;\n let token = req.headers.authorization;\n let user = getUser(token);\n // console.log(user.uid);\n // console.log(req.params.id);\n // let reqId = req.params.id.split(\"=\")[1];\n // console.log(reqId);\n User.findOne({\"_id\": user.uid}, {\"step...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
returns true if the agent has navigated the full path at least once
function GetHasCompletedPath() { return hasCompletedPath; }
[ "function hasNavigated() {\n\t\treturn location.href !== lastPageUrl;\n\t}", "function isStartingPath() {\n if(that.iPath === 0) {\n return true;\n }\n var currentCommand = that.currentPath[that.iPath].commandNumber;\n var previousCommand = that.currentPath[that.iPath-1].com...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Updates the progress bar to reflect the current slide.
function updateProgress() { // Update progress if enabled if (config.progress && dom.progress) { var horizontalSlides = toArray(document.querySelectorAll(HORIZONTAL_SLIDES_SELECTOR)); // The number of past and total slides var totalCount = document.querySelectorAll...
[ "function updateProgress() {\n\n\t\t\t// Update progress if enabled\n\t\t\tif( config.progress && dom.progress ) {\n\n\t\t\t\tvar horizontalSlides = toArray( document.querySelectorAll( HORIZONTAL_SLIDES_SELECTOR ) );\n\n\t\t\t\t// The number of past and total slides\n\t\t\t\tvar totalCount = document.querySelectorA...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
turn streaming off (if it's on)
deactivateStreaming() { if (this.socket !== null) { this.socket.disconnect(); this.socket = null; } }
[ "set streaming(value) {\n this._streaming = !!value;\n }", "function disconnectStream() {\n _config2.default.audio.src = \"\";\n _config2.default.audio.load();\n }", "function stop_streaming_txs(){\n this.provider.off(\"block\");\n if(block_interval_poll_interval){\n clearInterval(block_interval...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
A deck of cards implemented as a stack which allows popping cards from its head and tail. Based on a doubly linked list.
function CardDeck() { this.head = null this.tail = null this.size = 0 }
[ "function cardStack(){\n this.cardData = [];\n this.add = push;\n this.draw = pop;\n this.top = 0;\n}", "function CardStack() {\n _classCallCheck(this, CardStack);\n\n this.stack = [];\n }", "stackDeck() {\n\n // // Test Push with blackjacks\n // for (let i = 0; i < 2; i++) {\n /...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Starts the next test cycle or redirects the browser to the results page.
function nextCycleOrResults() { // Call GC twice to cleanup JS heap before starting a new test. if (window.gc) { window.gc(); window.gc(); } var tLag = Date.now() - endTime - TIMEOUT; if (tLag > 0) fudgeTime += tLag; var doc; if (cycle == iterations) { document.cookie = '__pc_done=1; pat...
[ "function runNextTestSuite() {\n if (selectedTestSuiteUrls.length > 0) {\n // Get the next Test Suite\n currentTestSuiteUrl = selectedTestSuiteUrls.shift();\n wndTest.src = currentTestSuiteUrl;\n } else {\n // Finish the report after we iterate through all T...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Adds Station Names to the Loc/Dest Menus
function addStationNames(){ var stations = getWMATAStations(getStationID); }
[ "function setEventsToSpaceUnitNamesOptions () {\n\n let menu = _('spatial-name-options');\n\n // adding for each menu option the invocation of names and the display event for each spatial unit\n Array.from(menu.children).forEach(function(item){\n\n item.addEventListener(CLICK_EVENT, function(e){\n\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Convert the JSON to investment objects
importJson(toImportJson) { if(!("investments" in toImportJson)) return false; // Look for the investments key, put it as investment objects var tempInvestments = {}; var investmentsJson = toImportJson["investments"]; for(var i = 0; i < investmentsJson.length...
[ "static jsonToObject(json) { \n var investment = new Investment(\n json[\"projectId\"],\n json[\"investmentAmount\"],\n json[\"netInterestRate\"],\n MyDate.jsonToObject(json[\"date\"]),\n json[\"repaymentMethod\"],\n json[\"tenure\"],\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
ref string Required. The ref to deploy. This can be a branch, tag, or SHA. task string Specifies a task to execute (e.g., deploy or deploy:migrations). Default: deploy auto_merge boolean Attempts to automatically merge the default branch into the requested ref, if it's behind the default branch. Default: true required_...
createDeployment (context, deploy) { const deployment = ApiGateway.toDeployment(deploy) deployment.environment = deploy.namespace return context.github.repos.createDeployment(deployment) }
[ "async function vercelDeploy({ project_id, env, meta: metaOptions }) {\n if (!project_id) {\n throw new Error('Missing `project_id` in vercelDeploy')\n }\n const meta = {\n // magic meta keys to simulate the vercel github integration\n githubCommitSha: GITHUB_SHA,\n githubDeployment: 1,\n githubOr...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This method takes data from the TIA object and uses it to draw the back buffer.
function prepareBackBuffer() { var zCurrentBuffer = jsvideo.getCurrentFrameBuffer(); var zPrevBuffer = jsvideo.getPreviousFrameBuffer(); if (residualColorBuffer == null) residualColorBuffer = new Array(zCurrentBuffer.length); //maybe a better way to set it var zWidth = Math.m...
[ "function paint_back_buffer()\n {\n canvas_ctx.drawImage(canvas_back_elm, 0, 0);\n }", "function paintBackBufferToCanvas() {\n if (getCanvas() != null) {\n //Tells the canvas to call the paint command...the coordinates are very important...drawing the screen is incredibl...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
changes wizard's fireball color to random one
function onSetupFireballClick() { var fireballColor = getRandomValueFromArray(WIZARD_FIREBALL_COLORS); setupFireball.style.backgroundColor = fireballColor; setupFireball.querySelector('input[name="fireball-color"]').value = fireballColor; }
[ "function change_color() {\n r = random(100, 256);\n g = random(100, 256);\n b = random(100, 256);\n}", "function changeColor(){\n\tvar colorCode = Randomizer.nextInt(0, 2);\n\tvar color;\n\tif(colorCode == 0){\n\t\tcolor = Color.red;\n\t}else if(colorCode == 1){\n\t\tcolor = Color.yellow;\n\t}else{\n\t\tcolor...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets or Sets the selection end
get selectionEnd() { return this.selectionEndIn; }
[ "get selectionEnd() {\n return this.getInput().selectionEnd;\n }", "get selectionEnd() {\n return this.i.selectionEnd;\n }", "get SelectionEnd() { return this.native.SelectionEnd; }", "function getEndSelection()\n{\n return endCell;\n}", "set selectionEnd(value) {\n this.$.textar...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Handle receiving of tracks from server. TODO: enable better error handling.
static receiveTracks(data) { return { type: this.FETCH_TRACKS, status: 'success', tracks: data.tracks || [] }; }
[ "function processTracks(tracks) {\n if (tracks) {\n tracks.status = 'success';\n log.info('sending back search results to ' + socket.id);\n socket.emit('search_results', tracks);\n } else {\n log.info('sending back failure for search results to ' + socket.id);\n socket.e...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
enyo.updateI18NClasses should be called after every setLocale, but there isn't such a callback in current version
function updateI18NClasses () { var li = new LocaleInfo(); // for the current locale var locale = li.getLocale(); var base = 'enyo-locale-'; // Remove old style definitions (hack style becouse enyo.dom doesn't have methods like enyo.dom.getBodyClasses, enyo.dom.removeBodyClass) if (document && documen...
[ "updateLocalizedContent() {\n this.i18nUpdateLocale();\n }", "setCulture() {\n this.intl = new Internationalization();\n }", "function add_i18n()\r\n {\r\n var i18n = {};\r\n\r\n i18n[I18N.LANG.EN] = {};\r\n i18n[I18N.LANG.EN][MODULE_NAME + '_name'] = 'autosync';\r\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Fare.js is part of the BART dashboard widget. (c) 2008 Bret Victor This software is licensed under the terms of the open source MIT license. Automatically generated by make_fare.pl on Mon Jan 13 19:22:15 2014. cents = Fare.getCentsBetween("Del Norte", "Castro Valley")
function Fare () { var fares = [ 555, 350, 185, 360, 185, 395, 275, 185, 320, 330, 185, 405, 390, 410, 245, 425, 330, 430, 185, 385, 320, 295, 185, 185, 480, 330, 190, 410, 235, 460, 220, 355, 330, 280, 185, 895, 450, 240, 350, 425, 395, 340, 410, 185, 350, 555, 350, 185, 390, 185, 465, 400, 495, 185, 415, 335, 57...
[ "function getuRideFare() {\n}", "function calculateFare(){\n\tvar departure = document.getElementById(\"from\").value;\n var arrival = document.getElementById(\"to\").value;\n\tvar price=\"\";\n\t\n\tif(departure==\"Adelaide\"){\n\t\tif (arrival== \"Brisbane\"){\n\t\t\tprice= 130;\n\t\t} else if (arrival== \"Canb...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
=== auto unbox test 0 123 1 "foo" 2 true 3 false === / JSON requires automatic unboxing of the following primitive types: Number, String, Boolean (E5 Section 15.12.3, Str() algorithm, step 4).
function jsonStringifyFastPathAutoUnboxTest() { var values = [ new Number(123), new String('foo'), new Boolean(true), new Boolean(false) ]; values.forEach(function (v, i) { print(i, JSON.stringify(v)); }); }
[ "function coercePrimitiveToObject(obj) {\n\t if(isPrimitiveType(obj)) {\n\t obj = object(obj);\n\t }\n\t if(noKeysInStringObjects && isString(obj)) {\n\t forceStringCoercion(obj);\n\t }\n\t return obj;\n\t }", "function fixObjectValueTypes (o) {\n for (var k in o) {\n v...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
The kixcursor contain a kixcursorname dom, which is only set when it is not the users cursor
function getUserCaretDom() { var carets = document.querySelectorAll(classNames.cursor); for (var i = 0; i < carets.length; i++) { var nameDom = carets[i].querySelectorAll(classNames.cursorName); var name = nameDom[0].innerText; if (!name) return carets[i].querySelectorAll(classNames.cursorCare...
[ "static set defaultCursor(value) {}", "function containsUserCaretDom() {\n var carets = document.querySelectorAll(classNames.cursor);\n for (var i = 0; i < carets.length; i++) {\n var nameDom = carets[i].querySelectorAll(classNames.cursorName);\n var name = nameDom[0].innerText;\n if (!name) ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Fetch all discussions form GitHub API
function fetchDiscussions(callback) { var comments = Comments(conf); comments.get(ret, function(err, comments) { if (err) { return callback(err); } ret.discussions = comments; callback(); }); }
[ "function getDiscussions()\n{\n var url = URL + '/discussion_topics' + ITEMS_PER_PAGE; // Pass global URL to url so we can change it\n \n var apiParameters = [ \"title\",\n \"html_url\",\n \"published\",\n//State\n \"discu...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Maptimize.Proxy.GoogleMapaddEventListener(source, event, object, method) > GEventListener source (Object): source object. event (String): event name. object (Object): object used for calling method. method (Function): function called when event is fired. Registers an invocation of the method on the given object as the ...
function addEventListener(source, event, object, method) { return GEvent.bindDom(source, event, object, method); }
[ "_addEventListener( eventName, listener, method ) {\n // Check for a qualified event name with a ':' separator.\n let idx = eventName.indexOf(':');\n if( idx > 0 ) {\n // Lookup the event source.\n let sourceName = eventName.substring( 0, idx );\n let source = t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sets all the listeners for text input areas. Most importantly, if text area left empty, can't proceed to next section.
function setTextListeners() { for (let i = 1; i < customizationSections.length; i++) { document .getElementById(customizationSections[i] + "_text") .addEventListener("input", function() { updateStoreFromTextArea(customizationSections[i]); if ( this.value.trim() == "" && ...
[ "function setTextAreaCallBack() {\n textAreaElement.keyup(function(e) {\n executeMapCreation(e);\n });\n\n textAreaElement.click(function(e) {\n emphasizeNode(e);\n });\n\n // IME入力中に箱書いたり、テキストボックスを操作されると辛いのでブロック\n textAreaElement.on({\n 'co...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Padding can either be a constant or an object containing any of the attributes (left, right, top, bottom). cleanPadding returns an object with (left, right, top, bottom) attributes.
function cleanPadding(pad) { var padding = { top: 0, left: 0, right: 0, bottom: 0 }; if (typeof pad === 'number') return { top: pad, left: pad, right: pad, bottom: pad }; ['top', 'bottm', 'right', 'left'].forEach(function (d) { if (pad[d]) paddin...
[ "function cleanPadding (pad) {\n const padding = {top: 0, left: 0, right: 0, bottom: 0};\n if (typeof(pad) === 'number') return {top: pad, left: pad, right: pad, bottom: pad};\n ['top', 'bottm', 'right', 'left'].forEach( d => {\n if (pad[d]) padding[d] == pad[d];\n });\n return padding;\n }", ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Selects gList elements by ID. Stops when if finds one.
function selectById(idSel, gList, target) { target[idSel.name] = gList[idSel.name]; }
[ "function _selectItemWithId(id) {\n $log.debug(\"itAutocomplete: select with id \"+id);\n var selected = false;\n self.fields.selectedItem = {};\n if (angular.isDefined(id)) {\n angular.forEach(se...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
enable the buttons for column visibility
function columnButtons() { new $.fn.dataTable.Buttons( table, { name: 'commands', buttons: ['colvis'] } ); table.buttons().container().appendTo($('#columnSelector', panel.content)); }
[ "function setColumnViewButtonOn()\n {\n $(\"#perc-finder-choose-view #perc-finder-choose-columnview\").addClass(\"ui-enabled\");\n $(\"#perc-finder-choose-view #perc-finder-choose-listview\").removeClass(\"ui-enabled\");\n }", "function adaptToolbarVisibility(){\n\t\t\tvar allC...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
A collection of properties for Rigid Body Modeling. ModelE2 implements IFacet required for manipulating a drawable object. Constructs a ModelE2 at the origin and with unity attitude.
function ModelE2(type) { if (type === void 0) { type = 'ModelE2'; } _super.call(this, mustBeString('type', type)); this._position = new G2().zero(); this._attitude = new G2().zero().addScalar(1); /** * Used for exchanging number[] data to achieve ...
[ "function ModelE2() {\n this._position = new Geometric2().zero();\n this._attitude = new Geometric2().zero().addScalar(1);\n this._position.modified = true;\n this._attitude.modified = true;\n }", "function L2DBaseModel() {\n\t this.live2DModel = null; // ALive2DModel\n\t this...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Simulated number of cookies sold (rounded down)
function numberOfCookiesSold(customerNumber, avgCookies){ var cookiesSold = customerNumber * avgCookies; return Math.floor(cookiesSold); }
[ "function numberOfCookiesSold(customerNumber, avgCookies){\r\n // debugger;\r\n var cookiesSold = customerNumber * avgCookies;\r\n return Math.floor(cookiesSold);\r\n}", "function totalByStore(stor){\n stor.cookiesSold.push(numberOfCookiesNeeded(stor.cookiesSold));\n}", "function incrementWithSpace() {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Prepare to start next shipment
function next_shipment() { show('page-home'); reset_image_box(); reset_image_pod(); reset_signature(); action = ''; $('#damage_info').val(''); $('#id-shipment-value').val(''); ship_info.length = 0; instruction.length = 0; dimensions = ''; name = ''; dest_phone = ''; clear_current(); }
[ "function start() {\n var cart = app.getModel('Cart').get();\n var physicalShipments, pageMeta, homeDeliveries;\n\n if (!cart) {\n app.getController('Cart').Show();\n return;\n }\n // Redirects to multishipping scenario if more than one physical shipment is contained in the basket.\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
clear the unreads for all users in the stream, since it was archived
async clearUnreadsForAllUsers () { let memberIds; if (this.stream.get('isTeamStream')) { memberIds = this.team.get('memberIds') || []; } else { memberIds = this.stream.get('memberIds') || []; } await this.clearUnreadsForUsers(memberIds); }
[ "async clearUnreads () {\n\t\tif (this.wasArchived) {\n\t\t\t// the stream was archived, remove lastUnreads for all users in the stream\n\t\t\tawait this.clearUnreadsForAllUsers();\n\t\t}\n\t\telse if (this.transforms.removedUsers && this.transforms.removedUsers.length > 0) {\n\t\t\t// certain users were removed, r...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get the frequency at which to clear the timestamp label. This number will be modded, "%", against the minutes value to determine if the label should be cleared or not.
function get_clear_timestamp_frequency(length) { console.log("Length : " + length); day1 = 1440 / 5; day2 = day1 * 2; day3 = day1 * 3; if (length <= day1) { return 15; } else if (length <= day2) { return 30; } else if (length <= day3) { return 0; } else { return 0; } }
[ "toFrequency() {\n return mtof(this.toMidi());\n }", "function formatFrequency(freq) {\n if (freq == -1) {\n return 'N/A';\n } else if (freq == -2) {\n return 'off';\n } else if (freq > 1000 * 1000) {\n return (freq / 1000 / 1000).toFixed(2) + ' GHz';\n } else {\n return freq / 1000 + ' ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
IE Object Fit Fix.
function ieObjectFitFix() { var userAgent, ieReg, ie; const width = $(window).width(); userAgent = window.navigator.userAgent; ieReg = /msie|Trident.*rv[ :]*11\./gi; ie = ieReg.test(userAgent); // If IE is detected and we're at tablet and above screen widths. if...
[ "function objectFitFallBackForIe() {\n var ua = window.navigator.userAgent;\n var msie = ua.indexOf(\"MSIE \");\n if (\n msie > 0 ||\n (!!navigator.userAgent.match(/Trident.*rv\\:11\\./) &&\n $(\".photo-callout-widget__img\").length)\n ) {\n $(\"img.photo-callout-widget__...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns the current scroll position. Note: This result might be an intermediate scroll position, as there might be an ongoing smooth scroll animation.
getCurrentScrollPosition() { return this._state; }
[ "function getCurrentScroll() {\n return window.pageYOffset || document.documentElement.scrollTop;\n }", "getScrollPosition() {\n if (this.supportsScrolling()) {\n return [this.window.scrollX, this.window.scrollY];\n }\n else {\n return [0, 0];\n }\n }...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
When a user clicks on a card, that employees's individual data (stored in the registrar function) is called and a modal window is created and inserted after the gallery, displaying employee information. After the modal window is created, this function has an eventlistener to get the close button to function.
function createModal(employee){ let modal = `<div class="modal-container"> <div class="modal"> <button type="button" id="modal-close-btn" class="modal-close-btn"><strong>X</strong></button> <div class="modal-info-container"> ...
[ "function modalEmployee(i) {\n let clickedEmployeeModalDisplay =\n `<div class=\"modal-container\">\n <div class=\"modal\">\n <button type=\"button\" id=\"modal-close-btn\" class=\"modal-close-btn\"><strong>X</strong></button>\n <div class=\"modal-info-container\">...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sets page title and input size every time state is updated
componentDidUpdate() { this.setPageTitle(); this.setInputSize(); }
[ "function onPageLoad()\n{\n\t//Set page size\n\tSetSize();\n}", "function titlePageState() {\n checkInstructionOrStart()\n titlePage.displayTitle();\n titlePage.displayInstructions();\n titlePage.displayStartString();\n}", "[MUTATIONS.SET_TITLE_FONT_SIZE] (state, payload) {\n state.currentSlide.title.fon...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns the visible box coordinates of the element as a [ left, top, width, height ]
getVisibleBoxCoords(_id, _noOwnScroll) { const [x, y] = this.getVisiblePosition(_id, _noOwnScroll); const [w, h] = this.getSize(_id); return [x, y, w, h]; }
[ "function tswUtilsGetVisibleRect()\n{\n\tvar width, height, x, y;\n\t\n\t//From http://thewebdevelopmentblog.com/2008/10/tutorial-pop-overs-part-2-centering-the-pop-over/\n if (document.all) \n\t{\n\t\t// IE\n\t\twidth = (document.documentElement.clientWidth) ? \n\t\tdocument.documentElement.clientWidth : \n\t\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
number `n` and converts it to a base `b` number. Assume that `b` will never be greater than 16. Return the new number as a string. If the number is 0, your function should return "0" regardless of the base. The 'base' of a number refers to the amount of possible digits that can occupy one of the places in the number. W...
function baseConverter(num, base) { const bases = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, "a", "b", "c", "d", "e", "f"] const possibleBases = bases.slice(0, base) let result = []; while (num >= base) { result.unshift(possibleBases[num % base]) num = Math.floor(num / base) } result.unshift(num) return res...
[ "function baseConverter(n, b) {\n if ([0, 1].includes(n)) return n.toString()\n\n const digits = [\n '0', '1', '2', '3', '4', '5', '6', '7', '8', '9',\n 'a', 'b', 'c', 'd', 'e', 'f'\n ];\n\n return baseConverter(Math.floor(n / b), b) + digits[n % b];\n}", "function baseConverter(num, b) {\n if (num ===...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
All of the below functions will try to complete an action for the ai and return true if they did, or false if they did nothing Win the game
function aiWin() { var moves = getWinningMoves(data.board, data.player2); if (moves.length > 0) { var move = pickRandomSpace(moves); placeMoveByIndex(move); return true; } return false; }
[ "function checkActions(action, playerAction) {\n\tvar setTimeOut = false;\n\n\tif (actions.length > count) {\n\t\tplayMove = false;\n\t\treturn false;\n\t}\n\n\tif (action === undefined) {\n\t\tplayedFalse = true;\n\t\treturn false;\n\t}\n \n\tvar actionCorrect;\n\tif (action.getColor() == playerAction.getColor())...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns true if the error object indicates the file does not exist (`ENOENT`).
static isFileDoesNotExistError(error) { return FileSystem.isErrnoException(error) && error.code === 'ENOENT'; }
[ "function isENOENT(error) {\n return isExpectedError(error, -ENOENT, 'ENOENT');\n}", "function isFileNotExistfileErr(fileErr) {\n return fileErr.code === \"ENOENT\";\n}", "function fileExists(path) {\n\ttry\t{\n\t\treturn fs.statSync(path);\n\t}\n\tcatch(e) {\n\t\treturn false;\n\t}\n}", "function isIgnor...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Create the Buildings and Draw them to the Screen.
function createBuildings() { for (let i = 0; i < 4; i++) { buildings.push( CreateGameElement( SHIP.width * 1.5, SHIP.height * 1.2, 65 + 175 * i, C_HEIGHT - 130, 0, BUILDING_IMG, 0 ) ); } }
[ "function makeBuildings() {\n buildings.background(60,179,113);\n buildings.noStroke();\n let x,y;\n for (let i = 0; i < 320; i++) {\n if (i < 80) {\n x = random(0,mapSize/2);\n y = random(0,mapSize/2);\n } else if (i < 160) {\n x = random(0,mapSize/2);\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
add more items to the grid. the new items need to appended to the grid. after that call Grid.addItems(theItems);
function addItems($newitems) { $items = $items.add($newitems); $.each($newitems, function (i, v) { var $item = $(v); $item.data({ offsetTop: $item.offset().top, height: $item.height() }); }); initItemsEvents($newitems...
[ "function addGridItems(grid) {}", "_addItems(newItems) {\n let items = newItems;\n // recompute last row before adding new items\n if (this.rows.length > 0) {\n // get last row items\n const lastRowItems = this.rows[this.rows.length - 1].map((item) => this.items[item._view.index]);\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Retrieve all events of specific Aggregate
async getAggregateEvents(aggregateId) { assert.ok(aggregateId, 'aggregateId') const snapshot = this.snapshotsSupported ? await this._snapshotStorage.getAggregateSnapshot(aggregateId) : undefined const events = await this._storage.getAggregateEvents(aggregateId, { snapshot }) retur...
[ "async getAll() {\n const db = await dbPromise;\n return db.transaction('events').objectStore('events').getAll();\n }", "function retrieveAllEvents() {\n dbPromise.then(function (db) {\n var tx = db.transaction(EVENT_OBJECT_STORE, 'readonly');\n var eventOS = tx.objectStore(EVENT...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Loads all trails and sets them to trails
function loadTrails() { API.getTrails() .then(res => { // console.log(res.data.trails); setTrails(res.data.trails); }) .catch(err => console.log(err)); }
[ "function loadTrades() {\n API.getTrades(userId)\n .then((res) => {\n let tradeArr = [];\n\n for (let i = 0; i < res.data.length; i++) {\n for (let j = 0; j < res.data[i].trades.length; j++) {\n let tradeLoop = res.data[i].trades[j];\n // console.log(tradeLoop)\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
manufacturer, model, price quality, hasMicrophone boolean
constructor(manufacturer, model, price, quality, hasMicrophone) { super(manufacturer, model, price); this.quality = quality; //TODO what is this._hasMicrophone = Boolean(hasMicrophone); }
[ "manufacturer() {\n return _.sample(HARDWARE.MANUFACTURERS);\n }", "function DetectSmartphone()\n {\n if (DetectIphoneOrIpod())\n return true;\n if (DetectS60OssBrowser())\n return true;\n if (DetectSymbianOS())\n return true;\n if (DetectWindowsMobile())\n return true;\n if (Det...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Registers the fs storage as plugin.
static register() { __WEBPACK_IMPORTED_MODULE_0__common_plugin__["a" /* PLUGINS */]["FSStorage"] = FSStorage; }
[ "function registerLazyFS(index, files, fs_root, resolver) {\n var device = new LazyFSDevice(index, files, fs_root, resolver);\n jsoo_mount_point.push({path: fs_root, device: device});\n}", "static register() {\n common_plugin[\"a\" /* PLUGINS */][\"IndexedStorage\"] = indexed_storage_IndexedStorage;\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
get_url_zip() is a simple function to retrieve the zip variable from the URL
function get_url_zip() { var zip = ""; var keyvals = window.location.href.slice(window.location.href.indexOf("?") + 1).split("&"); $.each( keyvals , function(i, val) { var parts = val.split("="); if (parts[0] == "zip") { zip = parts[1]; } ...
[ "function zipUrl(zip) {\n return `${API_STEM}q=${zip}%units=imperial&APPID=${WEATHER_API_KEY}`;\n}", "function get_zip_name(url, /*optional*/filename) {\n if (!filename) {\n var extensionID = get_extensionID(url);\n if (extensionID) {\n filename = extensionID;\n } else {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Detects scrollers in the DOM
function detectScrollers() { return $.map($(".horiz-scroll"), function(scroller) { return $(scroller).attr("id"); }); }
[ "function detectScrollers() {\r\n return $.map($(\".horiz-scroll\"), function(scroller) {\r\n return $(scroller).attr(\"id\");\r\n });\r\n}", "_canScroll(el,deltaX,deltaY){return deltaY>0&&el.scrollTop<el.scrollHeight-el.offsetHeight||deltaY<0&&el.scrollTop>0||deltaX>0&&el.scrollLeft<el.scrollWidth-el.offset...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Redirect if not authorized
function redirectIfNotAuthorized() { $.ajax({ url: jsconfig.baseurl + "/api/version", beforeSend: authHeaders, statusCode: { 401: function() { window.location.replace(jsconfig.baseurl + "/app/login.html"); }, 403: function() { ...
[ "function checkNotAuthenticated(req, res, next) {\n if (req.isAuthenticated()) {\n return res.redirect('/home')\n }\n next()\n }", "function validate_access() {\n if (!is_logged_in()) {\n window.location = \"index.html\";\n }\n}", "function redirectpublic_action() {\n if (checkAddress() =...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
calcula e retorna quem ganhou 0Empate;1Jogador;2Computador
function calcularEscolha(jogador, computador){ //pedra if(jogador==1 && computador==1){ return 0; } else if (jogador==1 && computador==2) { return 2; } else if (jogador==1 && computador==3) { return 1; } //papel else if (jogador==2 && computador==1) { return 1; } else if (jogador==2 && computador==2) { return 0; } else...
[ "function calcularEscolha(jogador, computador) {\n if (jogador == 1 && computador ==1) {\n return 0;\n }\n else if (jogador == 1 && computador ==2) {\n return 2;\n }\n else if (jogador == 1 && computador ==3) {\n return 1;\n }\n\n else if (...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
storing VI information to either localStorage or csv file Requires to include functions in: CSVtoArray.js Create a string variable containing VI records in CSV format.
function vi_to_csv(output_file_fields, cds_data, for_localStorage, localStorage_key) { // output_file_fields: VI fields to be stored (from the list defined in prospect.utilities) // cds_data: data from Bokeh CDS containing VI informations // must contain at least "VI_quality_flag", "VI_comment", "VI_issu...
[ "function databasket2csv() {\n var csv = '\"sep=,\"\\nID,text,hearths,paid,place,book,date\\n';\n var itemsArray = JSON.parse(localStorage.getItem('hearthtax_databasket')) ||[];\n $('span#daba_length').html(itemsArray.length);\n var itemsArray = JSON.parse(localStorage.getItem('hearthtax_databasket')) |...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }