query
stringlengths
9
34k
document
stringlengths
8
5.39M
negatives
listlengths
19
20
metadata
dict
When queue proc is started, tell all clients
@on('qps') queueProcessStart(ticks) { for (const p of this.players.filter(x => x.client)) { p.client.send('qps', ticks); } }
[ "async start() {\n if (this.status == QueueStatus.running)\n return;\n this.status = QueueStatus.running;\n let msg = '';\n do {\n try {\n msg = await this.bzpopmin(this.qName, 0); // Monitor queue forever\n // Proceed only on incoming ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns the navigation urls for "prev/next page" links. Requires that readPageNum has already been set to a valid odd.
function getNavPageUrls(pageNum, lastPageNum, bookId) { let prevPageUrl, nextPageUrl; if (pageNum > 1) { prevPageUrl = '/read/' + bookId + '/page/' + (pageNum - 2); } else { prevPageUrl = undefined; }...
[ "previousPages()\n {\n let res = [];\n for (let i = Math.max(1, this.current - this.maxIndexesRange); i < this.current; i++)\n res.push(this.createLink(i));\n return res;\n }", "function pageNavigation(linkInfo) {\n if (linkInfo == null) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets the formatted google maps static image url for the given latitude and longitude
getGoogleMapsImageUrl(latitude, longitude){ let zoomLevel = 3; let size = "175x150"; let mapType = "roadmap"; let googleMapAPIKey = "AIzaSyDvYQZRLnesuRRp07bu9qlbL7XJ_TkBYNU"; return `https://maps.googleapis.com/maps/api/staticmap?zoom=${zoomLevel}&size=${size}&maptype=${mapType}...
[ "function generateMapImageLink(locLat, locLng, imgWidth, imgHeight, zoom){\n\tvar url = \"https://maps.googleapis.com/maps/api/staticmap?\";\n\turl += (\"center=\" + locLat + \",\" + locLng);\n\turl += (\"&size=\" + imgWidth + \"x\" + imgHeight);\n\turl += (\"&zoom=\" + zoom);\n\turl += (\"&markers=\" + locLat + \"...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets if the provided structure is a JsxAttributedNodeStructure.
static isJsxAttributed(structure) { return structure.kind === StructureKind_1.StructureKind.JsxSelfClosingElement; }
[ "static isJsxAttributedNode(node) {\r\n switch (node.getKind()) {\r\n case typescript_1.SyntaxKind.JsxOpeningElement:\r\n case typescript_1.SyntaxKind.JsxSelfClosingElement:\r\n return true;\r\n default:\r\n return false;\r\n }\r\n }", ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates a hidden container to which inlined content will be appended.
_createHiddenDiv() { const hidden = dom5.constructors.element('div'); dom5.setAttribute(hidden, 'hidden', ''); dom5.setAttribute(hidden, 'by-polymer-bundler', ''); return hidden; }
[ "function insertHiddenLayer() {\n var contentLayer = document.createElement('div');\n contentLayer.setAttribute(\"id\", \"extracted_content\");\n contentLayer.setAttribute(\"style\", \"display : none;\");\n var contentNodeClone = currSelected[0].cloneNode(true);\n contentLayer.appendChild(contentNode...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Calculate headline size based on window width
function headlineResize(windowWidth) { var maxHeadlineSize = 100; var minHeadlineSize = 40; var headlineOffset; var headlineAdjust; if(windowWidth<1000){ headlineOffset = (1000-windowWidth)*0.13; headlineAdjust = maxHeadlineSize-headlineOffset; if(headlineAdjust>=minHeadlineSize){ $("h1").css("font-siz...
[ "findSize() {\n var height = window.innerHeight - 180;\n var width = window.innerWidth;\n this.csize = height/width > 1 ? Math.floor(0.9 * width / 4) : Math.floor(0.9 * height / 4);\n }", "function snowfallSize() {\n\n\n snowfallheader.width = window.innerWidth;\n snowfallheader.heig...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Registers an icon config by name in the specified namespace.
_addSvgIconConfig(namespace, iconName, config) { this._svgIconConfigs.set(iconKey(namespace, iconName), config); return this; }
[ "_addSvgIconConfig(namespace, iconName, config) {\n this._svgIconConfigs.set(iconKey(namespace, iconName), config);\n return this;\n }", "_addSvgIconSetConfig(namespace, config) {\n const configNamespace = this._iconSetConfigs.get(namespace);\n if (configNamespac...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
END SALES PERSON / populateAccountPersons
function populateAccountPersons(response) { /*Populate Account person*/ var accountPersonsDetails = response.accountpersonsdetails; $("#account_contact_no").val(accountPersonsDetails[0].account_contact_no); $("#account_email_id").val(accountPersonsDetails[0].account_person_email); ...
[ "function getPersonsFull() {\n\t//TODO\n}", "static retrieveAllData() {\n console.log( \"Person data retrieval entered.\" );\n\n let allPersonsString = \"{}\", allPersons, keys, i, slots;\n try {\n allPersonsString = localStorage.getItem( \"persons\" );\n } catch (e) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Fake closing the windows (hide and fade back in), for demo purposes
function fake_closing($window) { $window.on("close", (event) => { event.preventDefault(); $window.triggerHandler("closed"); $window.closed = true; $window.hide(); setTimeout(() => { // Restore position const $positioning_el = $windows_and_$positioners.find(([$other_window]) => $window === $othe...
[ "hideWindow() {\n\t\tfin.desktop.Window.getCurrent().hide();\n\t}", "function close(){\n\t\tresizePopin();\n\t\toptions.hide(domElement);\n\t}", "function doOnClose() {\r\n\t\t\tif (fullscreen) {\r\n\t\t\t\tdoOnToggleFullscreen().promise().done(function () {\r\n\t\t\t\t\t$root.trigger(\"closeSlider\");\r\n\t\t\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Handle enrollment updates when a plan is added or updated, with specific conditions to prevent changes propagated from the validations happening on keyup as the user updates enrollments within plans (ie, not on )
function manageEnrollmentsOnUpdateOrAdd(vm, params) { if (params.isRider) { //copy medical riders enrollments from category enrollments //the enrollments may be split among plans, but the totals should be the same if (params.isDenPlan && params.dualPlanPrimaryAlreadySelected) { mapCategoryEnrollmen...
[ "approvePlanUpdate() {\n $('#modal-confirm-plan-update').modal('hide');\n\n this.updateSubscription(this.confirmingPlan);\n }", "function updateLoyaltyFields(event){\n console.info('updateLoyaltyFields()');\n console.debug('which merchant: '+ retailerSelectBoxElement.value);\n cons...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
When get out pen of board and stop
function stopPressPen() { isDrawning = false // need to stop the line, so I need to restart the line context.beginPath() }
[ "function checkOffscreen(){\n if(celeb.x >= width){\n state = `winEnding`;\n }\n}", "function stop () {\n window.cancelAnimationFrame(frameID)\n drawBoard()\n}", "function stop() {\n if (shape.some(index => cells[position + index + WIDTH].classList.contains('end'))) {\n shape.forEach(cell => {\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
4) Define our first enclosing circle as the one which seperates these three furthest points
function circleOfThreePoints(p1, p2, p3) { let x1 = p1.x; let y1 = p1.y; let x2 = p2.x; let y2 = p2.y; let x3 = p3.x; let y3 = p3.y; let denom = x1 * (y2 - y3) - y1 ...
[ "static ClosestPointToArc() {}", "xcircle(r) {\n }", "function outerCircleIn() {\n ctx.beginPath();\n ctx.arc(canvas.width / 2, canvas.height / 2, canvas.width / 2 - 14, 0, Math.PI * 2);\n ctx.lineWidth = 2;\n ctx.stroke();\n }", "constructor(start_x, start_y, opp_x, opp_y, angle, acw) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Fetch list of page variants from API
async function fetchPageVariants() { const variants = await fetch("https://cfw-takehome.developers.workers.dev/api/variants") .then(response => response.json()) .then(data => { return data["variants"] }) return variants }
[ "async function getVariantsURL() {\n let variantsResp = await fetch(VARIANTS_API_URL.href, { cf: { cacheTtl: 300 } })\n let variantsJson = await variantsResp.json()\n return variantsJson.variants\n}", "async function getUrls(url) {\n let resp = await fetch(url)\n let respJson = await resp.json()\n ret...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Applies default options to the snackbar config.
function _applyConfigDefaults(config) { return __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_6__core_util_object_extend__["a" /* extendObject */])(new __WEBPACK_IMPORTED_MODULE_2__snack_bar_config__["a" /* MdSnackBarConfig */](), config); }
[ "function _applyConfigDefaults(config) {\n\t return extendObject(new MdSnackBarConfig(), config);\n\t}", "function _applyConfigDefaults(config) {\n return extendObject(new __WEBPACK_IMPORTED_MODULE_4__snack_bar_config__[\"a\" /* SnackBarConfig */](), config);\n}", "function configureToasts (newOptions = {...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Execute git command with passed arguments. is expected to be an array of strings. Example: ['fetch', 'pv']
function execGit(args) { return new Promise((resolve, reject) => { const gitResponse = spawn('git', args, { cwd: process.cwd(), silent: true, }); var retVal = ''; gitResponse.stdout.on('data', data => { retVal += data.toString(); }); gitResponse.stdout.on('close', () => { ...
[ "function git(cmd, args = \"\") {\n execSync(\"git \" + cmd + \" \" + args);\n}", "function git(...args) {\n\treturn run('git', ...args);\n}", "function git(args) {\n const [ a, b, ...rest] = process.argv;\n execa.command(`git ${[...rest].join(' ')}`, { stdio: [\"inherit\", \"inherit\", \"inherit\"] });\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Starts or stops a workout based on the button press.
function toggleWorkout() { var buttonElement = $("#startbutton"); if (buttonElement.text() === "Start") { buttonElement.text("Stop"); startWorkout(); } else { //disable since stopping may take a few seconds. the callback in stopWorkout should re-enable` ...
[ "function doRunButton(e) {\n if (state !== 'running') {\n state = 'running';\n this.innerHTML = \"Stop\";\n if (algorithm === 'metro') {\n timer = setInterval(runMetro, 30);\n }\n else if (algorithm === 'glauber') {\n timer = setInterval(runGlauber, 30);\n }\n }\n else {\n state = ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
this function is called by the background script in order to return a properly formatted citation download link
function formatCitationLink(metaData, link) { let returnString = metaData["citation_download"]; //if download link found, use it. Otherwise, make an educated guess for aps if (metaData["query_summary"]["citation_download"] == 1) { returnString = metaData["citation_url_nopath"] + returnString + '?type=ris&downl...
[ "function formatCitationLink(metaData, link) {\n\n\t\tlet doi = metaData[\"citation_download\"];\n\t\tmetaData[\"citation_download_method\"] = \"POST\";\n\t\tif (doi != \"\") return (metaData[\"citation_url_nopath\"] + \"/action/exportCiteProcCitation?dois=\" + encodeURIComponent(doi) + \"&targetFile=custom-endNote...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Updates the equity splits (percentages) on the Equity sheet based on a given deposit/withdrawal
function updateEquitySplits(currentFundValue, investorID, dwAmount){ var ss = SpreadsheetApp.getActiveSpreadsheet(); var ui = SpreadsheetApp.getUi(); var numUsers = parseInt(ss.getRangeByName("MD_NUM_INVESTORS").getValue()); var sheet = "Equity" var equityRange = ss.getRangeByName("E_TABLE"); var newFundVa...
[ "function updateSpending(){\n var totalPercent = 0;\n for(var i = 1; i < calc.splits.length; i ++){\n totalPercent+=parseInt(calc.splits[i].percent,10);\n }\n var newValue = 100 - totalPercent;\n calc.splits[0].percent = newValue;\n if(newValue < 0){\n calc.splits[0].name = \"Debt\";...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
/ ajax_toggle_linkage() / toggle whether a schema is linked to / a form or not
function ajax_toggle_linkage(action){ var form_list = document.getElementById('form_list'); var list1; var list2; var ajax_action; if(action == "link"){ /* going from unlinked to linked */ list1 = document.getElementById('unlinked_schema_list'); list2 = document.getElementById('linked_schema_list'); ajax_act...
[ "function handler_ajax_populate_schemas(){\n\tif(xmlHttp.readyState == 4 && xmlHttp.status == 200){\n\t\t// populate 'linked' select list\n\t\tpopulate_list_from_xml(xmlHttp.responseText, 'linked_schema_list');\n\t\t// now that this request is complete,\n\t\t// send another request to get unlinked schemas\n\t\tcrea...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
httpGet fileName, function(err,data:string) if err and no data, data=err.toString(); data = data.replace('\r',''); // remove CR from windowsedited files CompareOrig_ed.setValue(data); CompareOrig_ed.clearSelection(); CompareOrig_ed.scrollToLine(0); if callback, callback(err,data); function mkEditor(divName) returns ace...
function mkEditor(divName){ var editor = ace.edit(divName); editor.setTheme("ace/theme/monokai"); editor.setShowPrintMargin(false); editor.setFontSize(16); var session = editor.getSession(); session.setUseWorker(false); session.setMode("ace/mode/javascript"); re...
[ "function addHdlFileToEditor(file) {\n var rawFile = new XMLHttpRequest();\n rawFile.open(\"GET\", file, false);\n rawFile.onreadystatechange = function () {\n if(rawFile.readyState === 4) {\n if(rawFile.status === 200 || rawFile.status === 0) {\n var allText = rawFile.responseText;\n\n // ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This function generates default username and password to the employee and sets it to the fields username and password fields.
function setUsername() { let name = document.getElementById("name").value.toLocaleLowerCase(); let firstFour = ""; if (name.length >= 4) { firstFour = name.substr(0, 4); } else { let length = 4 - name.length; while (length) { firstFour = firstFour + "a"; length = length - 1; } firstFour = name + fir...
[ "function populateLogin()\n{\n\t// populate username field\n\tpopulateUsername();\n\t// populate password field\n\tpopulatePassword();\n}", "function resetExistingUserField() {\r\n self.existingUser.username('');\r\n self.existingUser.password('');\r\n }", "function createPortalAdmin(username, ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Changes a snake segment/body/part position
function changeSnakePart( seg, pos ) { seg.pos = pos; grid[pos.x][pos.y] = GridState.SNAKE; pos = pos.toWorldVector(); seg.position.set( pos.x, pos.y, pos.z ); }
[ "function resetPositions(snakePart) {\n snakeParts++;\n\n if (snakeHead == snakeTail) {\n snakeTail = snakePart;\n snakePart.position = snakeParts;\n } else {\n snakePart.position = snakeHead.position + 1;\n snakeNewPart = snakePart;\n }\n var snakePartsArray = stage.get('...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Tries to remove all VT control characters. Use to estimate displayed string width. May be buggy due to not running a real state machine
function stripVTControlCharacters (str) { str = str.replace(new RegExp(functionKeyCodeReAnywhere.source, 'g'), ''); return str.replace(new RegExp(metaKeyCodeReAnywhere.source, 'g'), ''); }
[ "function stripVTControlCharacters(str) {\n return str.replace(ansi, '');\n}", "function stripVTControlCharacters(str) {\n str = str.replace(new RegExp(functionKeyCodeReAnywhere.source, 'g'), '');\n return str.replace(new RegExp(metaKeyCodeReAnywhere.source, 'g'), '');\n}", "function autoEdUnicodeControlChar...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
keeps all pairs of fives or sixes /checks the length of the fives and sixes arrays /if the length is two, it keeps all of that dice
keepPairs(dices, fives, sixes) { if (fives.length === 2) { this.keepAll(5, dices); } else if (sixes.length === 2) { this.keepAll(6, dices); } }
[ "function forFullHouse(arr) {\n var counted = countDice(arr);\n var keep = [];\n var reroll = 0;\n var final = [];\n if (Number(counted[0][0]) > 2) {\n for (var i = 0; i < 3; i++) {\n keep.push(Number(counted[0][2]));\n }\n } else {\n for (var j = 0; j < Number(counted[0][0]); j++) {\n keep...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This is the IoMap Handler It should know: the connections. address of the source UUID + port name address of the target UUID + port name relevant source & target connection settings. Connection settings can overlap with port settings. Connection settings take precedence over port settings, althought this is not set in ...
function IoMapHandler() { this.CHI = new CHI(); // todo: create maps from each of these and wrap them in a connections map // so all there wil be is this.connections. // connections.byTarget, connections.bySource etc. this.targetMap = {}; this.connections = {}; this.sourceMap = {}; this.syncedTargetMap ...
[ "function IoMapHandler() {\n\n this.CHI = new CHI();\n\n // todo: create maps from each of these and wrap them in a connections map\n // so all there wil be is this.connections.\n // connections.byTarget, connections.bySource etc.\n this.targetMap = {};\n this.connections = {};\n this.sourceMap ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Adds image to document.
function addImage(src, type, doc, page, x, y, width, height, link, func) { let img = new Image(); img.src = baseURL + src; img.addEventListener('load', function(event) { let url = getDataUrl(img, type); height = height? height: width * img.height / img...
[ "addImage() {\n }", "function insertNewImage(img_width, img_height) {\r\n var newImage = svgCanvas.addSvgElementFromJson({\r\n \"element\": \"image\",\r\n \"attr\": {\r\n \"x\": 0,\r\n \"y\": 0,\r\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
LIBRARY MinecraftButton(int textSize, bool enableSound, string customTextColor) set an argument null if you want to use the default value
function MinecraftButton(textSize, enableSound, customTextColor) { if(textSize == null) textSize = MinecraftButtonLibrary.defaultButtonTextSize; if(enableSound == null) enableSound = true; if(customTextColor == null) customTextColor = MinecraftButtonLibrary.defaultButtonTextColor; var button = new android.wi...
[ "textButton(name, callback, params) {\n let button = new BABYLON.GUI.Button.CreateImageButton(name.toLowerCase(), name, VRSPACEUI.contentBase+\"/content/icons/play.png\");\n button.widthInPixels = this.heightInPixels/2*name.length+10;\n this.setupButton(button, callback, params);\n return button;\n }",...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Copies the current selection to the Atom clipboard.
copySelection() { let selectedText = window.getSelection().toString(); let preparedText = this._prepareTextForClipboard(selectedText); atom.clipboard.write(preparedText); }
[ "copySelection() {\n const selectedText = this.xterm.getSelection();\n atom.clipboard.write(selectedText);\n }", "function copySelection() {\n\tcopiedEndX = endX;\n\tcopiedEndY = endY;\n\n\tcopiedStartX = startX;\n\tcopiedStartY = startY;\n\t// Getting the selected pixels\n\tclipboardData = currentLayer.co...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
this function replaces the bracket statements in the query that will be displayed on data tabs using code mirrors.
function processCodeMirrorQuery(sparqlObject) { var tempQueryString = sparqlObject.queryWithNewlineCharacters; tempQueryString = removeBracketStatementsFromQueryString(tempQueryString, sparqlObject); sparqlObject.codeMirrorQuery = tempQueryString; }
[ "replacement() {\n return [...this.statements.map(s => s.text), this.change].join('\\n');\n }", "static highlightSql(sql) {\n return sql;\n }", "function m4Over(obj)\n{\n obj.innerHTML=\"Structured Query Language (SQL) \"\n}", "function jsql_replace_conditionals(query) {\n query = query.replace(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns the time of the last mined block in seconds
function latestTime () { return web3.eth.getBlock('latest').timestamp }
[ "function next_block_time(){\n return _next_block_time;\n}", "async function currentBlockTimestamp() {\n const blockNumber = await sendRPC(web3, \"eth_blockNumber\", []);\n const block = await sendRPC(web3, \"eth_getBlockByNumber\", [ blockNumber.result, false]);\n return block.result.timestamp;\n }", ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Method 'getDBPool' is an Singleton Pattern implementation, where an singleton 'INSTANCE' object of connectionpool is created.
function getDBPool(){ var INSTANCE = undefined; if(INSTANCE === undefined){ INSTANCE = oracledb.createPool(dbConfig); } return{ getInstance : function(){ return INSTANCE; } } }
[ "function getPool() {\r\n if (!pool) {\r\n pool = mysql.createPool(config);\r\n }\r\n return pool;\r\n}", "function getConnection() {\n\n return pool\n}", "function getConnection () {\n \n return pool\n }", "function getConnection(){\n return pool \n}", "function createPool(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
shadeToggle function: run when button is clicked//
function shadeToggle() { var S = makeObject(); drawFnormz = S.norm; normColor = S.normCo; vert = S.vertex; flatColor = S.fcolor; smoothColor = S.scolor; ind = S.index; if (flatShaded === true) { flatShaded = false; gl = main(); if (buttonE){drawOb...
[ "function shadeToggle() {\r\n var S = makeObject();\r\n drawFnormz = S.norm;\r\n normColor = S.normCo;\r\n vert = S.vertex;\r\n flatColor = S.fcolor;\r\n smoothColor = S.scolor;\r\n ind = S.index;\r\n save = false;\r\n \r\n if (flatShaded === true) {\r\n flatShaded = false;\r\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
simple function to set range ring interval
function setRingInterval(val) { localStorage['SiteCirclesInterval'] = val; setRangeRings(); createSiteCircleFeatures(); }
[ "SetRange() {\n\n }", "function Range() {}", "function adjustRange() {\n var kslider = grapher.getSlider();\n kslider.adjustRange();\n grapher.paint();\n}", "setRange(range) {\n this.range = range;\n }", "setRange(min, max){\n this.min = min;\n this.max = max;\n\t}", "increaseInterva...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
this function creates UI controls from the lights data returned by the hub
function createControl(thisLight, thisDiv) { var state = thisLight.state; // state of this light var myLabel; // each control will get a label var myInput; // and input var x = 0; // and an x-y position var y = 10; var xIndent = 100; // distanc...
[ "addLightsGUI(){\n var keyNames=Object.keys(this.scene.graph.lights);\n\n var lightsFolder=this.gui.addFolder('Lights');\n\n lightsFolder.open();\n\n for(let i= 0; i<keyNames.length;i++)\n lightsFolder.add(this.scene.lights[i],'enabled').name(keyNames[i]); \n }", "addLigh...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
hit method for a splash aka rain hits ground
hit() { //if 1 splash occurs add a splash if(splash = 1) { splash++; } //if it reaches 10 splashes reset to 0, and add blue color into the ground. if(splash = 10) { splash = 0; this.blue = this.blue + 2; ...
[ "function hit() { /* can be overwritten */ }", "GetGroundHit() {}", "hit() {\r\n }", "function hit() {\n\t\tvar nx = snake_array[0].x;\n \t\tvar ny = snake_array[0].y;\n \t\t//hit border\n\t\tif(nx == -1 || ny == -1 || nx == w/c_sz || ny == h/c_sz) {\n\t\t\tlose();\n\t\t}\n\n\t\t//hit itself\n\t\tfor(var i...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
break content into chunks less than 184 characters
function chunk(text) { //185 characters seems to be longest discord tts reads let ii, lastSpaceIndex; const maxChunkSize = 184; let chunks = []; if (text.length > maxChunkSize) { for (ii = 0; ii < text.length; ii += lastSpaceIndex) { let temp = text.substring(ii, ii + maxChunkSize); lastSpaceI...
[ "function breakInChunks(text, sizeOfChunks) {\r\n const collection = [];\r\n const startingIndex = 0;\r\n let index = sizeOfChunks;\r\n while (text.length > sizeOfChunks) {\r\n if (text[index] === ' ') {\r\n const start = text.slice(startingIndex, index);\r\n collection.push...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
removes all the created players and empties the colliders
function clearOtherPlayers() { if (otherPlayers && allPlayers && opColliders) { for (let i = 0; i < otherPlayers.length; i++) { otherPlayers[i].sprite.destroy(); otherPlayers[i].usernameText.destroy(); } otherPlayers = []; opColliders.children.iterate(function (child) { child.destroy...
[ "cleanUp() {\n // clear activeEnemies\n this.activeEnemies.forEach(function(enemy) {\n enemy.cleanUp();\n });\n // clear active players\n this.activeObjects.forEach(function(object) {\n object.cleanUp();\n });\n // stop game loop\n this.animation.forEach(functio...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
string with 1,000,000 for each to all million takes forever linear = 1,000,000 + 1,000,000 + 1,000,000 +1,000,000 first step is to build an object from each letter in string ask a question as it being built is this key already here? if so, set the value to fale. If not, set the value as a tuple in the tuple = [index, t...
function noRepeat(str){ let arr = str.split(''); let obj = {}; let answer; let minIndex = arr.length; arr.forEach((letter, index) => { if (!obj[letter]) { obj[letter]=false; } else if(obj[letter]){ obj[letter]=false; } ...
[ "function noRepeat(str) {\r\n let arr = str.split('');\r\n let obj = {};\r\n let answer = false;\r\n let minIdex = arr.length;\r\n\r\n arr.forEach((letter, index) => {\r\n if(!obj[letter]) {\r\n obj[letter] = [index, true]\r\n } \r\n else if(obj[letter]) {\r\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
CAT HOTEL BOOKING getting all catHotel booking
getHotelBookings() { return this.hotelBooking; }
[ "static async fetchAllBookings() {\n return api.get('/booking').then((response) => {\n return response.data.map((b) => new Booking(b));\n });\n }", "getHotels() {\n return this.catHotel;\n }", "static getAllBookings() {\n BookingService.fetchAllBookings().then((b) =>...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Loads models into te scene
function ModelsLoad() { loader.load("../Models/sci-fi_lantern/scene.gltf", function (object) { let lantern = object.scene.children[0]; lantern.rotation.x = -0.5*Math.PI; //lantern.position.x = 250; lantern.position.y = 0; lantern.position.z = 170; lantern.scale.set(2...
[ "function loadModels() {\n const gltfLoader = new GLTFLoader();\n gltfLoader.load(\"models/shiba/scene.gltf\", gltf => {\n shiba = gltf.scene;\n shiba.position.z = -5;\n shiba.position.y = 1;\n scene.add(shiba);\n });\n gltfLoader.load(\"models/cow/scene.gltf\", gltf => {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns the masechta (tractate) of the Daf Yomi in Hebrew, It will return &x05D1;&x05E8;&x05DB;&x05D5;&x05EA; for Berachos.
getMasechta() { return Daf.masechtosBavli[this.masechtaNumber]; }
[ "getYerushalmiMasechta() {\n return Daf.masechtosYerushlmi[this.masechtaNumber];\n }", "isHebrewFormat() {\n return this.hebrewFormat;\n }", "extractCode () {\n return ((((this.text.charCodeAt(0)-0xD800)*0x400) + (this.text.charCodeAt(1)-0xDC00) + 0x10000));\n }", "function convertHEB(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
add element to spatialhash
function addItem(item){ var hash = getHashItem(item); spatialhashing[hash]=spatialhashing[hash]||[]; spatialhashing[hash].push(item); }
[ "addHash(word) {\n\t\tconst values = this.getHashValues(word);\n\t\tvalues.forEach(hash => {\n\t\t\tbitVector.setBit(this.store, hash);\n\t\t});\n\t}", "add(key, value) {\n // 1. get the hash\n const hash = this.hash(key);\n // console.log({hash});\n\n // 2. make value entry\n const entry = {[key]:...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Parse embedded image data in FBXTree.Video.Content
function parseImage( videoNode ) { var content = videoNode.Content; var fileName = videoNode.RelativeFilename || videoNode.Filename; var extension = fileName.slice( fileName.lastIndexOf( '.' ) + 1 ).toLowerCase(); var type; switch ( extension ) ...
[ "function parseImages( FBXTree ) {\n \n var images = {};\n var blobs = {};\n \n if ( 'Video' in FBXTree.Objects ) {\n \n var videoNodes = FBXTree.Objects.Video;\n \n for ( var nodeID in videoNodes ) {\n \n var videoNode...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Makes API call to update all the edited rows prior to this call in the database Also, if project status is updated, saveData() makes an API call to update that as well Clears the edited rows so we don't save the same information twice
async saveData() { let data = this.state.rowData; let projectID = this.props.match.params.projectID; let updatedRows = this.updatedRows; // index is the index of a row that has been updated let processData = async function (pair) { let index = pair["rowIndex"]; ...
[ "updateProjectIntakeValues(objectToChange, newValues , extraValues = null, savedonDB = false, SavedLocally = true) {\n \n \n\n\n // ? Set Requirements Definition\n if(objectToChange === 'requirements') {\n\n let requirementsDefinition =...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
this is automatically called each time a yoctopuce device configuration is changed, for instance when a sensor name changes.
async function deviceConfigChanged(m) { try{ var serial=await m.get_serialNumber(); if (serial in YDevices) await YDevices[serial].configChangedCallback(); } catch(e) {console.log(e);} }
[ "function deviceNameChanged(event, value){\n self.deviceName = value;\n }", "_setupDeviceChange() {\n\t\tlet $deviceSelection = this.deviceSelection.render();\n\t\tthis.$control.find( 'device-selection' ).replaceWith( $deviceSelection );\n\n\t\tthis.deviceSelection.$inputs.on( 'change', () => {\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get localized text from a locale. Defaults to 'en' locale if no locale provided or a nonregistered locale is requested
function getText(key, locale) { var labels = locales[locale]; return labels ? labels[key] : locales.en[key]; }
[ "function getText(key, locale) {\n var labels = locales[locale];\n\n return labels ? labels[key] : locales.en[key];\n }", "getLocalizedText (id) {\n try {\n const a = localization[this.languageCode][id]\n if (a) {\n return a\n }\n } catch (e) {\n // continue\n }\n ret...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Detecting data URLs data URI MDN The "data" URL scheme: Valid URL Characters:
function isDataURL(s) { return !!s.match(isDataURL.regex); }
[ "static isDataURL(url) {\nreturn (url.substring(0, 5)) === \"data:\";\n}", "function checkDataUri(obj) {\n // NOTE: checking with parseDataUriRe is slow\n return (typeof obj === 'string' && obj.indexOf('data:') == 0);\n}", "isDataUrl(path2) {\n return /^data:([a-z]+\\/[a-z0-9-+.]+(;[a-z0-9-.!#$%*+.{}|~...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
2. Return a new array with tuples of everyone's name and the name of their best subject /WAY ONE USES INEQUALITIES AND THE EXACT SUBEJECT NAMES IN THE GIVEN OBJECT. ISSUE? CAN ONLY USE THIS CODE ON OBJECTS THAT HAVE THESE AND ONLY THESE KEYS. 18 LINES
function nameAndBestSubjectInequalities(arrObj){ newArr = []; for(var i= 0; i< arrObj.length; i++){ classPlusScores = arrObj[i].classes; //Object!! var mathScore = classPlusScores['math']; var scienceScore = classPlusScores['science']; var socialStudiesScore = classPlusScores['soci...
[ "function highestScore2 (students) {\n // Code disini\n var result = {};\n //get top scorer\n for(var i = 0; i < students.length; i++){\n var thescore = students[i].score\n var thename = students[i].name\n var theclass = students[i].class\n var studentData = {\n name : thename,\n score : t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
on confirm delete user click
function onConfirmDeleteUserClick() { $.ajax({ url: `${G_BASE_URL}/customers/${gCustomerId}`, headers: { Authorization: `Token ${gUserToken}` }, method: `DELETE`, success: () => { $('#modal-confirm-delete').modal('hide'); $('#modal-success').modal('show'); $('#success...
[ "function ConfirmDeleteUser ()\n{\n\t$.ajax ({\n\t\ttype: \"POST\",\n\t\turl: \"edit-users.php\",\n\t\tdata: {\n\t\t\tid_user: $ (\"[name='id_user']\").val (),\n\t\t\tremove: \"Remover\",\n\t\t\tconfirm: 1\n\t\t},\n\t\tsuccess: UserInterfaceAlertCallback\n\t});\t\n}", "function deleteUser() {\r\n populateUsers()...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
binary insert function taken from
function binary_insert(value, array, startVal, endVal){ var length = array.length; var start = typeof(startVal) != 'undefined' ? startVal : 0; var end = typeof(endVal) != 'undefined' ? endVal : length - 1;//!! endVal could be 0 don't use || syntax var m = start + Math.floor((end - start)/2); if(length == 0){ arr...
[ "binary_insert(value, array, startVal, endVal){\n \tvar length = array.length;\n \tvar start = typeof(startVal) != 'undefined' ? startVal : 0;\n \tvar end = typeof(endVal) != 'undefined' ? endVal : length - 1;//!! endVal could be 0 don't use || syntax\n \tvar m = start + Math.floor((end - start)/2);\n \tif(len...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Filter all listings by number of baths (1, 2, 3+)
function filterBaths(bathNum){ for(let i = 0; i < listings.length; i++){ let l = listings[i].val; if(bathNum === 3) { listings[i].visible = l.bathNum >= bathNum && listings[i].visible; } else { listings[i].visible = l.bathNum === bathNum && listings[i].visible; } } }
[ "function filterBeds(bedNum){\r\n for(let i = 0; i < listings.length; i++){\r\n let l = listings[i].val;\r\n if(bedNum === 4) {\r\n listings[i].visible = l.bedNum >= bedNum && listings[i].visible;\r\n } else {\r\n listings[i].visible = l.bedNum === bedNum && listings[i].visible;\r\n }\r\n }\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
= Description Adds an item to the end of the queue. Use to make the given +_function+ with its optional +_arguments+ the last item to flush. = Parameters: +_function+:: An anonymous function. Contains the code to execute. +_arguments+:: _Optional_ arguments to pass on to the +_function+
push(_function, _arguments) { if (typeof _arguments !== 'undefined') { this.commandQueue.push([_function, _arguments]); } else { this.commandQueue.push(_function); } }
[ "unshift(_function, _arguments) {\n if (typeof _arguments !== 'undefined') {\n this.commandQueue.unshift([_function, _arguments]);\n }\n else {\n this.commandQueue.unshift(_function);\n }\n }", "add(fn) {\n this.queue.push(fn);\n this.processQueue();\n }", "enqueue(fn) {\n asser...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Return the extent of a numerical variable from the dataset
function houseDataExtent(x) { var array = []; if (x != "yr_renovated") { rawData.forEach(function(d) { array.push(Number(d[x])); }); } else { rawData.forEach(function(d) { if (Number(d[x]) != 0) array.push(Number(d[x])); }); } return d3.extent(array); }
[ "function getDatasetExtent (dataset) {\n const extent = dataset.attributes.extent;\n return {\n xmin: extent.coordinates[0][0],\n ymin: extent.coordinates[0][1],\n xmax: extent.coordinates[1][0],\n ymax: extent.coordinates[1][1],\n spatialReference: extent.spatialReference\n };\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Fungsi Untuk Memanggil Datatable Master Path
function listMasterPath() { $("#MasterPathDatatables").dataTable({ language: { searchPlaceholder: "Cari Nama Path" }, ajax: { "url": "/MasterPath/ListPath", "dataType": "JSON", "type": "GET" }, columns: [ { data: "Id...
[ "function getMasterPath(type, id) {\n /* Operasi AJAX Memanggil Modal Utility Sesuai Dengan Kebutuhan RUD(Read, Update, Delete) Dari Master Path */\n $.ajax({\n url: \"/MasterPath/GetPath?pathId=\" + id,\n type: \"GET\",\n contentType: \"application/json;charset=UTF-8\",\n dataType...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
It will used to find the Anagram numbers in Prime Numbers
findAnaPrime(ii, jj) { var primes = this.findPrime(ii, jj); var n = primes.length; var anaPrimes = []; var h = 0; for (let i = 0; i < n - 1; i++) { for (let j = i + 1; j < n - 1; j++) { if (this.checkAnagram2(primes[i], primes[j])) { anaPrimes[h++] = primes[i]; anaP...
[ "isAnagramPalimdrome(){\n var arr=[];\n for (let index = 0; index < 1000; index++) \n {\n if (this.isPrime(index)) \n {\n arr.push(index);\n }\n \n }\n for (let i = 0; i < arr.length; i++) \n {\n for (let j = i+1...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
CREAMOS LA TABLA PARA LA INFORMACION DEL VIENTO PARA CUANDO TENGAMOS DATOS DE 12 HORAS EN 12 HORAS
function getVientoDataForTable(viento){ var tableColumns = new Array(); var vientoDirData = new Array(); var vientoVelData = new Array(); for(var i = 0; i < viento.length; i++){ if(viento[i].periodo == "00-24"){ continue; } tableColumns...
[ "function construirTablaMovimientos(arregloMovimientos){\n\tvar resultado=\"\";\n\tarregloMovimientos.forEach(movimiento => {\n\t\tvar fila='<tr>'+\n\t\t'<td>'+movimiento.description+'</td>'+\n\t\t'<td>'+movimiento.type+'</td>'+\n\t\t'<td>'+darFormatoCantidad(movimiento.amount)+'</td>'+\n\t\t'<td>'+new Date(movimie...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Check the current value of isLoading before dispatching the doneloading or loading custom event
notifyLoading(isLoading) { if(isLoading){ const doneloadingEvent = new CustomEvent('doneloading'); this.dispatchEvent(doneloadingEvent); }else{ const doneloadingEvent = new CustomEvent('loading'); this.dispatchEvent(doneloadingEvent); } }
[ "notifyLoading(isLoading) {\n if(isLoading){\n this.dispatchEvent(new CustomEvent('loading'));\n }\n else if(!isLoading){\n this.dispatchEvent(new CustomEvent('doneloading'));\n }\n }", "notifyLoading(isLoading) {\n if (isLoading) {\n this.dispatchEvent(new CustomEvent(\"loading\")...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Test ComputerPlay for number of iterations passed
function loopAssertComputerPlay(iterations){ let i = 0; while(i < iterations){ assertComputerPlay(); i++; } return i; }
[ "waitForUpdatedListingResultsCount () {\n let start;\n let next;\n do {\n start = this.listingTotalCount();\n browser.pause(2000);\n next = this.listingTotalCount();\n } while (start !== next);\n }", "function test() {\n var counter = 0; // iteration counter\n\n // setup performa...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
======================== Search By Product Type ======================== Returns a Promise containing an array of all of the products that matched the specified type. The Promise will resolve in 1000 millisecond after the function is executed.
function searchProductsByType(type){ var promise = new Promise(function(resolve,reject){ var i = 0; var typeArray = []; var possibleTypes = ['Electronics','Book','Clothing','Food']; if(!possibleTypes.includes(type)){ reject("Invalid Type: " + type)...
[ "function searchProductsByType(type) {\n\t\t\tvar promise = new Promise((resolve, reject) => {\n\t\t\t\tlet i = 0;\n\t\t\t\tlet typeArray = [];\n\t\t\t\tlet searchType = type.trim().toLowerCase();\n\t\t\t\tconst possibleTypes = ['electronics', 'book', 'clothing', 'food'];\n\t\t\t\t//Handle invalid type\n\t\t\t\tif ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
trims a long piece of text to a shorter number of words
function trimByWord(sentence) { var numberOfWords = 100; var result = sentence; var resultArray = result.split(" "); if(resultArray.length > numberOfWords){ resultArray = resultArray.slice(0, numberOfWords); result = resultArray.join(" "); var n = result.lastIndexOf(".") result = "truncated...
[ "function trimToWordsLimit(limit, text) {\n if (text == null) {\n return \"\";\n }\n \n var words = text.match(/\\S+/g).length;\n var trimmed = text;\n if (words > limit) {\n // Split the string on first X words and rejoin on spaces\n trimmed = text.split(/\\s+/, limit).join(\" ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
this function allows for the guess to reset once the guess has been reset to 20 and then the process starts all over again
function reset() { guess = 20; }
[ "function guess() {\n pushClasses()\n checkMatch()\n setPegs()\n hintColours()\n selectNextActive()\n blkCounter = 0\n checkGuess.length = 0\n checkSols.length = 0\n activeCounter = 0\n guessBtn.disabled = true\n }", "function reset() {\n guessCount = 15;\n incorrectGuess = []...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
function to remove course
removeCourse(course){ removeObject(this.major1Courses,course); removeObject(this.major2Courses,course); removeObject(this.outsideCourses,course); removeObject(this.allCourses,course); }
[ "removeCourse(course){\n let removedObject = this.courses.filter(value => course.courseCode+course.lp+course.year == value.data.courseCode+value.data.lp+value.data.year ).pop();\n removedObject.unlinkDockingPoints();\n removedObject.setCourseOverlay(null);\n this.courses = this.courses.f...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
ajax for the planets
function ajaxForPlanets(){ //dealing with drop downs make function createDropDown(maxNumberOfPlanets, $dropDownPlanets); hideTheRestDropDowns($dropDownPlanets); $spanInfo.text("Number of Planets"); $divContent.show(); //initial value when link is clicked generatePlanets(initialNumberDisplayed); // get t...
[ "function empirePlanets () {\n const requestData = JSON.parse(this.responseText);\n console.log('requestData: ', requestData.planets);\n let planetArray = requestData.planets;\n //buildEmprire(planetArray);\n DOMEmpire(planetArray);\n}", "function displayPlanets() {\n starwars.getPlanets().then(planets =>...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Retrieve a JSON payload of all workouts done so far
function getWorkouts(){ $.ajax({ method: "GET", url: "/api/workout" }).then( resp => { console.log(resp) allWorkouts = resp; populateWorkouts(); }) }
[ "async function getWorkouts() {\n var workouts = [];\n\n if (goal.goalWorkouts) {\n goal.goalWorkouts.forEach(async w => {\n await WorkoutAPI.GetWorkout(token, w.workoutId)\n .then(response => {\n response.complete = w.complete;\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Parse a .gitignore file and return its glob patterns as an array.
function parse$3(file, options) { var file = file || '.gitignore'; var options = options || {}; options.negate = options.negate || false; var content = fs__default.readFileSync(file).toString(); var patterns = content.split('\n'); patterns = prepare(patterns); var globs = map(patterns); ...
[ "parseGitIgnore() {\n const content = fs.readFileSync(this.path + '.gitignore').toString();\n const rules = content\n .split(/\\n/g)\n .filter(rule => !!rule.trim() && !/^\\s*#/.test(rule))\n .map(rule => new RegExp(rule\n .replace(/\\r/g, '')\n ....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
wraps the apply method on the entire array of bindings
function wrapApplyOnBindings(bindings) { bindings.apply = function(key) { for (var index in bindings) { if (index !== 'apply' && typeof bindings[index].apply === 'function') { if (key) bindings[index].key === key && bindings[index].apply(); else bindings[index].apply(); } } } re...
[ "function bindArray(f, arr) {\n return f.apply.bind(f, null, arr);\n }", "function apply(args,fn){return fn.apply(undefined,args);}", "function apply(args, fn) {\n return fn.apply(undefined, args)\n }", "function applyAll(func) {\n //returning result of function: borro...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Fn for Load and Render Home Template/Partial
function renderHomePage(context) { ctxHandler(context); this.loadPartials({ header: './templates/common/header.hbs', footer: './templates/common/footer.hbs', login: './templates/welcome/login.hbs', register: './templates/welcome/register.hbs', })....
[ "loadHome() {\r\n var _this = this;\r\n this.homeButton.addEventListener(\"click\", function() {\r\n _this.homeSection.classList.add('wed-front');\r\n _this.spa.innerHTML = _this.home.template();\r\n })\r\n }", "function partialRender() {\n\n if (firstLoad) {\n rootDiv.innerHTML = ''...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Add button click handlers for the visualization div
addVisBtnHandlers() { var visualDebuggerViewDivID = 'visual-debugger-view-div'; var graphicViewDivID = 'graphic-view-div'; var closeBtnID = 'vis-close'; $('#' + closeBtnID).on('click', (e) => { e.preventDefault(); $('#' + visualDebuggerViewDivID).remove(); }); }
[ "function addEventHandlersRefreshButtons() {\n\td3.selectAll(\".refresh\").on(\"click\", function() {\n\t\tupdatePreview();\n\t});\n}", "function addButtonEvents(){\n\t// add click listeners to the zoom and pan buttons \n\tdocument.getElementById(\"zoomIn\").onclick = zoomIn; \n\tdocument.getElementById(\"zoomOut...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
get meal by id
async function getMealById(id) { const obj = await fetch(`https://www.themealdb.com/api/json/v1/1/lookup.php?i=${id}`); const data = await obj.json(); const meal = data.meals[0]; // get meal attributes getMealAtt(meal); displayMenuItems(mealArr); }
[ "getMeal(id) {\n const meal = dummyData.meals.find(meal => meal.id == id);\n return meal || {};\n }", "static getMeal(mealID) {\n const meals = this.getMeals();\n let meal;\n meals.forEach((ml) => {\n if (ml.id === mealID) {\n meal = ml;\n }\n });\n return meal;\n }", "as...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Costruisce una nuova istanza di MazeRenderer, legata allo specifico
function MazeRenderer($container){ /** Disegna lo stadio <maze> nell'elemento <$container> e restituisce un oggetto controller. */ this.render = function(maze, stage){ var self = this; $container.empty(); var containerW = $container.width(); var containerH = $container.height(); var av...
[ "function drawMaze(mfields, first, last) {\n console.log(\"startfeld\", first);\n let cvs = document.getElementById('cvs');\n let ctx = cvs.getContext('2d');\n\n ctx.fillStyle = '#000000';\n\n for (let y = 0; y < mfields.length; y++) {\n for (let x = 0; x < mfields[y].length; x++) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
returns a list of all the artLayers in the specified layerSet.
function getAllArtLayers(layers) { var ret = []; for( var i = 0; i < layers.artLayers.length; i++) { ret.push(layers.artLayers[i]); } for( var i = 0; i < layers.layerSets.length; i++) { ret = ret.concat(getAllArtLayers(layers.layerSets[i])); } return ret; }
[ "function showLayers(layerSet, includeRoot) {\r\n if (includeRoot) {\r\n layerSet.visible = true;\r\n }\r\n for (var i = 0; i < layerSet.layers.length; i++) {\r\n layer = layerSet.layers[i];\r\n\r\n if (layer.typename == 'LayerSet') {\r\n showLayers(layer, true);\r\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function to check whether a file extension is a valid markup container
function _isValidMarkupFile(extn){ var valid = false; switch(extn){ case 'html': case 'shtml': case 'htm': valid = true; } return valid; }
[ "function isHTML(file) {\n\treturn path.extname(file) == \".html\";\n}", "function checkFileType() {\n var validFileType = false;\n var regexFileType = /(?:\\.([^.]+))?$/; //whats my extention?\n var checkValidFileType = regexFileType.exec(fileName)[1];\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
DOM functions ///////////////////// Given name of table, find the table Node
function getTableNode (tableName, tableCaption) { tableList = document.getElementsByTagName("table"); tableNode = document.getElementById(tableName); //if table not present, create this table if( tableNode == null){ tableElement = createTable(tableName, tableCaption) ; // type is Element tableNode = tableEl...
[ "function findTableNode (tableName) {\n\ttableList = document.getElementsByTagName(\"table\") ;\n\ttableNode = tableList[tableName] ;\t// type is Node\n\t\n\t// if table not present, create this table\n\tif ( tableNode == null){\n\t\ttableElement = createTable(tableName) ; // type is Element\n\t\ttableNode = tableE...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Check whether the hostname is part of the cross domains or not.
function isCrossDomain(hostname, crossDomains) { /** * jQuery < [cardboard].6.3 bug: $.inArray crushes IE6 and Chrome if second argument is * `null` or `undefined`, http://bugs.jquery.com/ticket/[cardboard][cardboard][cardboard]76, * https://github.com/jquery/jquery/commit/a839af[cardboard]3[cardboard]db[car...
[ "function isCrossDomain(hostname, crossDomains) {\r\n /**\r\n * jQuery < 1.6.3 bug: $.inArray crushes IE6 and Chrome if second argument is\r\n * `null` or `undefined`, http://bugs.jquery.com/ticket/10076,\r\n * https://github.com/jquery/jquery/commit/a839af034db2bd934e4d4fa6758a3fed8de74174\r\n *\r\n * @...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
fetches the source form if it still exists also embedded forms and parent forms are taken into consideration as fallbacks
function resolveSourceForm(internalContext, elem) { let sourceFormId = internalContext.getIf(Const_1.CTX_PARAM_SRC_FRM_ID); let sourceForm = new mona_dish_2.DQ(sourceFormId.isPresent() ? document.forms[sourceFormId.value] : null); sourceForm = sourceForm.orElseLazy(() => elem.firstParent(Const_1.HTML_TAG_FO...
[ "function resolveSourceForm(internalContext, elem) {\n var sourceFormId = internalContext.getIf(Const_1.CTX_PARAM_SRC_FRM_ID);\n var sourceForm = new mona_dish_2.DQ(sourceFormId.isPresent() ? document.forms[sourceFormId.value] : null);\n sourceForm = sourceForm.orElse(elem.parents(Const_1.TAG_FORM))\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
function: openTCaseWindow args: tcase_id: test case id tcversion_id: test case version id show_mode: string used on testcase.show() to manage refresh logic of frames when Edit Test case page is closed. This argument was added to allow automatic referesh of frames when user uses the feature that allows edit a test case ...
function openTCaseWindow(tcase_id,tcversion_id,show_mode) { //@TODO schlundus, what is show_mode? not used in archiveData.php //You are right: problem fixed see documentation added on header (franciscom) // var feature_url = "lib/testcases/archiveData.php"; feature_url +="?allow_edit=0&show_mode="+show_mode+...
[ "function openTCW(tcase_external_id,version_number)\n{\n var __FUNCTION__ = 'openTCW';\n var windowCfg = '';\n var width = getCookie(\"TCEditPopupWidth\");\n var height = getCookie(\"TCEditPopupHeight\");\n var feature_url = \"lib/testcases/archiveData.php\";\n\n feature_url += \"?caller=openTCW&allow_edit=0...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
filters css properties that contain variables
function filterStyleProperties(rule) { rule.declarations = _.filter(rule.declarations, function (dec) { return dec.value && dec.value.indexOf('var(--') > -1; }); if (rule.declarations && rule.declarations.length) { return rule; } }
[ "getCSSVars(){\n var compStyle = getComputedStyle(this.DOM.scope, null)\n\n const getProp = name => compStyle.getPropertyValue('--'+name)\n\n function seprateUnitFromValue(a){\n if( !a ) return {}\n a = a.trim().split(' ')[0]\n var unit = a.split(/\\d+/g).filte...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Checkin to a Foursquare venue. See Foursquare API documentation at
function checkintoFoursquare(vid) { console.log("Checking in at a Foursquare venue."); if (localStorage.foursquare_access_token != '') { var xhr = new XMLHttpRequest({mozSystem: true, responseType: 'json'}); xhr.addEventListener("load", transferComplete, false); xhr.addEventListener("e...
[ "function checkIn(venueId, venueName) {\n\n\t// this requires an authorized call to the checkin endpoint (https://developer.foursquare.com/docs/checkins/add)\n\tvar url = 'https://api.foursquare.com/v2/checkins/add?venueId=' + venueId + '&oauth_token=' + accessToken;\n\n\t$.ajax({\n\t\ttype: 'POST',\n\t\turl: url,\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Updates the wins, losses, and games played display
function updateStats() { document.getElementById('wins').innerHTML = wins; document.getElementById('losses').innerHTML = losses; document.getElementById('gamesplayed').innerHTML = wins + losses; }
[ "function updateDisplays() {\n winPoints.textContent = wins;\n guessesLeft.textContent = guesses;\n losePoints.textContent = losses;\n }", "function updateWinLoss() {\n $(\"#wins-text\").text(wins);\n $(\"#losses-text\").text(losses);\n }", "function update() {\n\t// wins\n\t// losses...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
part two move the ship and waypoint
function moveWaypoint(commands) { //ship and waypoint starting position const ship = { x: 0, y: 0 }; let waypoint = { x: 10, y: -1 }; commands.forEach((command) => { switch (command.action) { //move the ship to the waypoint case 'F': ship.x += waypoint.x ...
[ "function moveToWaypoint(times) {\n console.log(waypoint);\n let xDistance = waypoint[0];\n let yDistance = waypoint[1];\n ship[0] += times * xDistance;\n ship[1] += times * yDistance;\n}", "function MoveToWaypoint() : void{ agent.SetDestination(currentWaypoint.transform.position);}", "wayPoint(waypoint, c...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
ModListWidget :: [a] DOM (a > InputWidget) (> InputWidget) Create an addable, deletable, changeable list of objects. Its value is the list of objects in the list at a given time. The constructor takes: the initial list of objects, The DOM to use as the header, an "empty" ect, used as the basis for newlycreated objects,...
function ModListWidget(initObjs,header,widgetFn,addWidgetFn) { Widget.apply(this); var nextId = 0; var eventsE = consumer_e(); var registerDel = function(obj) { eventsE.add_e(obj.widget.events.del.transform_e(function(del) { return {action:'delete', id:obj.id}; })); } var addWidgetB; var additionsE...
[ "function WodUiActionList(skills, actions) {\n\n WodUiWidget.call(this, 'div')\n\n this.setStyleProperty('width', '950px')\n\n this.actions = actions\n\n var _this = this\n\n this.modBox = new WodUiWidget('div')\n this.modBox.setStyleProperty('width', '300px')\n this.modBox.setStyleProperty('pa...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns true if this CompoundWrite is empty and therefore does not modify any nodes.
function compoundWriteIsEmpty(compoundWrite) { return compoundWrite.writeTree_.isEmpty(); }
[ "function compoundWriteIsEmpty(compoundWrite) {\r\n return compoundWrite.writeTree_.isEmpty();\r\n }", "function compoundWriteIsEmpty(compoundWrite) {\r\n return compoundWrite.writeTree_.isEmpty();\r\n}", "get empty() {\n\t\t\tif (this.children.length === 0) {\n\t\t\t\treturn true;\n\t\t\t} else {\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Alarms must be always in the future. This func checks if a time substraction is possible; if so, subtracts!
function checkSubt(time) { if (time === 'm') { if (moment().add(1, 'm').isSameOrBefore(alarmTime)) { alarmTime.subtract(1, 'm'); } } else if (time === 'h') { if (moment().add(1, 'h').isSameOrBefore(alarmTime)) { alarmTime.subtract(1, 'h'); } } }
[ "function checkForAlarm()\n{\n if (remainingSeconds <= 0) {\n // We're there\n if (isTargetReached == false) {\n // Make sure we only get here once\n isTargetReached = true;\n // Call the alarm hook\n if (doAction && zeroAction) {\n try {\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Evaluates a condition agains a context and returns true if it matches
function evaluateCondition(condition, petType, context) { console.info(`Evaluating condition ${JSON.stringify(condition)} over context ${JSON.stringify(context)}`); if (!condition) { console.info(`Evaluating condition - Null condition: always true`); return true; } if (typeof condition =...
[ "enterEvaluateCondition(ctx) {\n\t}", "function testCondition(template, view, condition) {\n return (new Function('return (' + template.root.conditions[condition] + ')')).call(view);\n }", "function evaluateValue(condition, value) {\n const conditions = _.keys(condition);\n const validConditions...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Determines the type of dependency based on fromSide and toSide TODO: Check with vertical orientation
getTypeFromSides(fromSide, toSide, rtl) { const types = DependencyBaseModel.Type, startSide = rtl ? 'right' : 'left', endSide = rtl ? 'left' : 'right'; if (fromSide === startSide) { return toSide === startSide ? types.StartToStart : types.StartToEnd; } return toSide === endSide ? typ...
[ "getTypeFromSides(fromSide, toSide, rtl) {\n const types = DependencyBaseModel.Type,\n startSide = rtl ? 'right' : 'left',\n endSide = rtl ? 'left' : 'right';\n\n if (fromSide === startSide) {\n return toSide === startSide ? types.StartToStart : types.StartToEnd;\n }\n\n return to...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates a jwc.models.jmxbrowser.InfoViewModel suitable for the given object.
function createInfoViewModelFor(model){ const clazzFullName = (model.Class)? model.Class.fullName : model; const viewModel = { data : model, template : null, chartType : null }; switch(clazzFullName){ case 'jwc.models.api.v1.MBeanAttributeModel' : viewModel.template = BASE_PATH+'/views/mBeanAttribut...
[ "function InfoWindowViewModel() {\n var self = this;\n\n self.infoHeader = ko.observable(\"\");\n self.infoSubHeader = ko.observable(\"\");\n self.infoContent = ko.observableArray(\"\");\n\n // Initialize the Info Window instance\n self.init = function () {\n self.infoWindow = new google.ma...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
JS task: concatenates and uglifies JS files to script.js
function jsTask() { return src([ files.jsPath //,'!' + 'includes/js/jquery.min.js', // to exclude any specific files ]) .pipe(uglify()) .pipe(dest("dist/js")); }
[ "function jsTask() {\n return src(files.jsPath)\n .pipe(concat(\"all.js\"))\n .pipe(uglify())\n .pipe(dest(\"dist\"));\n}", "function jsTask(){\n return src(files.jsPath)\n .pipe(concat('application.min.js'))\n .pipe(uglify())\n .pipe(dest('_dist')\n );\n}", "function jsTask() {\n\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
/Called by clicking Cancel button in MapPlanJourneyLocationControl. / Hides MapPlanJourneyLocationControl and displays MapLocation Control in "Default" state. / / ID of parent mapLocationControl
function Plan_Cancel(mapLocationControl) { // Display appropriate row document.getElementById(mapLocationControl+'_headerButtonRow').style.display=''; document.getElementById(mapLocationControl+'_headerTextRow').style.display='none'; // MapLocationControl document.getElementById(mapLocationControl+'_buttonPlanAJo...
[ "function SelectLocation_Cancel(mapLocationControl, outputMap)\n{\n\tSetZoomControlInstructions(mapLocationControl, false);\n\n\t// Display appropriate row\n\tdocument.getElementById(mapLocationControl+'_headerButtonRow').style.display='';\n\tdocument.getElementById(mapLocationControl+'_headerTextRow').style.displa...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Encode packet as 'buffer sequence' by removing blobs, and deconstructing packet into object with placeholders and a list of buffers.
encodeAsBinary(obj) { const deconstruction = binary.deconstructPacket(obj); const pack = this.encodeAsString(deconstruction.packet); const buffers = deconstruction.buffers; buffers.unshift(pack); // add packet info to beginning of data list return buffers; // write all ...
[ "encodeAsBinary(obj) {\n const deconstruction = binary_1.deconstructPacket(obj);\n const pack = this.encodeAsString(deconstruction.packet);\n const buffers = deconstruction.buffers;\n buffers.unshift(pack); // add packet info to beginning of data list\n\n return buffers; // write all the buffers\n }...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
add Input after this input
function addAfter(e){ this.parentElement.insertBefore(createInput(), this.nextSibling); addEventListeners(); }
[ "function addInput() {\n var div = document.createElement('div');\n div.innerHTML = '<label>Option </label><input type=\"text\" name=\"option\">';\n optionsField.insertAdjacentElement('beforeend', div);\n }", "function inANewLineAfterInputField(input, empty) {\r\n\tvar inputName = input.prop(\"name\");\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
call Apex method for updating Transfer Transaction
doTranfer() { this.showLoadingSpinner = true; this.objInputFields.sPerId = this.sSelectedPerId; updateSADetails({ //sPerId: this.sSelectedPerId, listTranferFrom: this.dataTransferFrom, listTranferTo: this.listValidTranferTo, //sReason: this.sReason...
[ "updateWalletTransaction(idTransaction, payload) {\n return this.request.put(`transaction/${idTransaction}`, payload);\n }", "function updateTransaction()\n{\n nlapiLogExecution('DEBUG', 'updateTransaction', 'Begin');\n \n var newRecord = nlapiGetNewRecord();\n var transactionId = newRecord.getFieldValue(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Updates the pagination button content
updatePagination() { let next_page = this.current_page+1; let next_next_page = next_page+1; getComponentElementById(this,"PaginationCurrentItem").html('<span class="page-link">'+this.current_page+'</span>'); getComponentElementById(this,"PaginationNextItem").html('<span class="page-link">'+next_page+'</span>');...
[ "_updatePagination() {\r\n if (!this.pagination || (this.pagination &&\r\n this._paginationSlot.assignedNodes().length !==\r\n this._lastViewIndex + 1)) {\r\n // Remove all the assignedNodes of pagination slot and their ev listeners\r\n this._paginationIndicators.forEa...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
card_onShow_close_siblings: Close all open siblings when card is shown
function card_onShow_close_siblings(){ var $this = $(this); $this.siblings('.show').children('.collapse').collapse('hide'); }
[ "function card_onShown_close_siblings(){\n var $this = $(this);\n if ($this.hasClass('show')){\n $this.addClass('no-transition');\n card_onShow_close_siblings.call(this);\n $this.removeClass('no-transition');\n }\n accordion_onChange($this);\n }", "f...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Refreshes child components in the current view.
function refreshChildComponents(components){if(components!=null){for(var i=0;i<components.length;i++){componentRefresh(components[i]);}}}
[ "function refreshChildComponents(hostLView, components) {\n for (var i = 0; i < components.length; i++) {\n refreshComponent(hostLView, components[i]);\n }\n }", "function refreshChildComponents(hostLView, components) {\n for (var i = 0; i < components.length; i++) {\n refr...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Add store after creating localbody
async addStore(data, req, res, next) { try { const userdata = req.body; await Localbodies.addStore(userdata); res.json({ status: 'success', message: 'Store added.' }); } catch (err) { next(err); } }
[ "function createStore(){}", "addStore(store) {\n this.store = store;\n }", "function addStore(doc) {\n var thisStore = $(\"<li></li>\");\n $(\"#storeList ul\").append(thisStore);\n\n var thisStoreLink = $(\"<a class='store' href='store.html'></a>\");\n $(thisStore).append(thisStoreLink);\n $(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
end var pending_rules Put all functions for this page here
function apply_pending_page_rules () { Behaviour.list = new Array(); Behaviour.register(pending_rules); Behaviour.apply(); }
[ "function displayRules() {\n\treset();\n\tversion = 'extended';\n\tgameState = 'rules';\n\tsetVersion();\n\tsetGameElements();\n}", "function onClickRules () {\n\t\tthis.state.start('rules');\n\t}", "function SetPageIndex_GridRules_Rules(pageIndex) {\n CurrentPageIndex_GridRules_Rules = pageIndex;\n Fill_...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Listen for individual switch event within all child switches within all tables
listenForIndividualSwitchEvents(){ $(function(){ //Individual toggle switch $(".child-switch").change(function() { const portName = $(this).parent('label').parent('.switch').parent('td').prev().prev().find('span').text(); if($(this).is(":checked")) { ...
[ "function observePanelSwitchChildren(){\r\n const panelSwitch = document.querySelector(\"#switch\");\r\n WEB_SWITCH_OBSERVER.observe(panelSwitch, {childList: true});\r\n }", "function observePanelSwitchChildren() {\n const panelSwitch = document.querySelector(\"#switch\");\n WEB_SWITCH_OBSE...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Helper function that replaces all of the children of one node with the children of another node
function replaceChildren(origNode, newNode) { emptyNode(origNode); for (let child of Array.from(newNode.children)) { origNode.appendChild(child); } }
[ "function replaceChildren(node, newChild) {\r\n\t\twhile (node.firstChild) {\r\n\t\t\tnode.removeChild(node.firstChild);\r\n\t\t}\r\n\t\tnode.appendChild(newChild);\r\n\t}", "function moveChildren(fromNode, toNode) {\n while (fromNode.firstChild) {\n if (toNode) {\n toNode.appendChild(fromNod...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Extracts test method name of a suite test function. For example a symbol with name "(testSuite).TestMethod" will return "TestMethod".
function extractInstanceTestName(symbolName) { const match = symbolName.match(testMethodRegex); if (!match || match.length !== 3) { return null; } return match[2]; }
[ "function funcName( func ){\n\treturn func.toString().match(/^function ([^\\s\\(]*)/)[1].trim();\n}", "function parseSuiteName(test_suite) {\n var pattern = /<title>(.*)<\\/title>/gi;\n var suiteName = pattern.exec(test_suite)[1];\n return suiteName;\n}", "function getName(func) {\n\t\t\t\tif (func.nam...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Wraps `obj` in a proxy that calls `callback` whenever `obj` is mutated
observe(obj, callback) { return new Proxy(obj, { set: function (target, prop, value) { target[prop] = value; callback(); return true; } }) }
[ "function ensnare (obj, cb) {\n var proxy = {}\n Object.keys(obj).forEach(function (key) {\n var val = obj[key]\n switch (typeof val) {\n case 'function':\n proxy[key] = function () {\n cb()\n val.apply(obj, arguments)\n }\n return\n default:\n Object....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }