query
stringlengths
9
34k
document
stringlengths
8
5.39M
negatives
listlengths
19
20
metadata
dict
BisWebBaseTransformation Functions This is to set the current transformation to identity.
identity() { this.internal.gridTransformationList = []; this.internal.linearTransformation.identity(); }
[ "setTransform(t) {\n this._transform = t.copy();\n this.markTransformed();\n }", "function Transform() {\n stream.Transform.call(this, {objectMode: true});\n }", "resetTransform() {\n _wl_object_reset_translation_rotation(this.objectId);\n _wl_object_reset_scaling(this.objectI...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Ignore all currently pending requests (presumably because there's a newer one).
function ignorePendingRequests() { hasPendingRequest = false; currentPendingQuery = null; loadError = null; }
[ "function cancelHttpRequests(){\t\t\t\r\n\t\t\t$injector.get('$http').pendingRequests.forEach(function(request) {\r\n\t\t\t\t\tif (request.cancel) {\r\n\t\t\t\t\t\trequest.cancel.resolve();\r\n\t\t\t\t\t}\r\n\t\t\t});\r\n\t\t}", "_sendAllPendingRequests() {\n return this._dbPromise.then(db =>\n // Get all...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
gets the values from the input fields in the form alerts keep app from crashing and tells user if too much text is in title or descriptions
function captureFormInput(e) { const value = e.target.value; if (e.target.name === 'title') { if (value.length > 100) { alert('Title is too long. Please enter 100 or fewer characters.'); }; } ; if (e.target.name === 'description') { if (value.length > 1000) { alert('Dec...
[ "function passengersInfoText() {\n passengerInfoText = [];\n $(\".popover-content input\").each(function(i) {\n if(this.value > 0){\n //passengerInfoText.push(typeText[this.id][this.value>1?'plural':'singular'] + ': ' + this.value);\n passengerInfoText.push(thi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
delayedColorChange('red', 1000) .then(() => delayedColorChange('orange', 1000)) .then(() => delayedColorChange('green', 1000)) .then(() => location.reload()) .catch(() => console.log('error'));
async function rainbow() { await delayedColorChange('red', 1000) await delayedColorChange('green', 1000) await delayedColorChange('orange', 1000) return "all done" }
[ "function changeColors() {\n rdmNumber1 = getNumber();\n rdmNumber2 = getNumber();\n\n $div1.css('background-color', colors[rdmNumber1]);\n $div1.css('transition', 'all 0.2s ease');\n $div2.css('background-color', colors[rdmNumber2]);\n $div2.css('transition', 'all 0.2s eas...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This function pulls the install base data for a given GDUN from opsconsole and then provides the resulting json body in a callback to the calling function.
function getIBjson(gdun, callback) { var nineDigitGdun = appendZeros(gdun); // build the URL for the API call var url = "http://pnwreport.bellevuelab.isus.emc.com/api/installs/" + nineDigitGdun; // pull the results from the API call request(url, function (error, response, body) { if (error) { callback(...
[ "function processGDUN(GDUNlist, callback) {\n\tasync.forEachSeries(GDUNlist, function(gdun, callback) {\n\t\tvar jsonBodyToStore;\n\n\t\tasync.series([\n\t\t\t// Pull install base data from ops-console \n\t\t\tfunction(callback) {\n\t\t\t\tgetIBjson(gdun, function(err, jsonBody) {\n\t\t\t\t\tif (err) {\n\t\t\t\t\t\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Stitch[] stitches = new Stitch[0]; let count = 0; CrochetType crochetType;
constructor(newStitches, ct) { this.stitches = newStitches; this.count = newStitches.length; this.crochetType = ct; // this.count = 0; // for (Stitch stitch : newStitches) { // if (stitch.stitchType != StitchTypes.SLST && stitch.stitchType != StitchTypes.SK && stitch...
[ "constructor(bandits) {\n this.name = \"Strategy\";\n\n this.history = bandits.map((bandit) => {\n return {\n bandit,\n attempts: 0,\n totalRewards: 0,\n };\n });\n }", "initSnake() {\n\t\tconst {r, c} = this.getRandomEmptyBoardPiece();\n\t\tthis.snake.push({r, c});\n\t}",...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
UC7D Find First Occurence When Full Time Wage was earned
function findFullTimeWage(dailyWage){ return dailyWage.includes("160"); }
[ "function findFullTimeWage(dailyWage){\n return dailyWage.includes(\"160\");\n}", "function leastOwed(){\n\tvar minPerson = 0;\n\tfor (var person in people){\n\t\tif (people[person].owes < people[minPerson].owes){\n\t\t\tminPerson = person;\n\t\t}\n\t}\n\tif (people[minPerson].owed >= 0){\n\t\treturn FALSEINDEX;...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Set a cookie with some user data put some of the user information in a cookie so that most pages can be personalized with javascript a common strategy for aggressive page caching TODO fix a bug wherein the cookie gets set twice if on an admin page TODO make sure this is the appropriate place for setting this cookie TOD...
function setCookie(req, res, template, block, next) { if (res.statusCode != 302) { if (req.session.user) { if (!req.cookies.userData) { res.cookie('userData', JSON.stringify(req.session.user)); } } else { res.clearCookie('userData'); } } next(); }
[ "function loadUserInfoFromCookie()\n {\n userName = $.cookie(\"perc_userName\");\n isAdmin = $.cookie(\"perc_isAdmin\") == 'true' ? true : false;\n isDesigner = $.cookie(\"perc_isDesigner\") == 'true' ? true : false;\n isAccessibilityUser = $.cookie(\"perc_isAccessibilityUser\") == 'true'...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
build rotated table column 1 from first row of main table
function FlexTable_stacks_in_5677_page22_SetRotHeader() { if (0 != 1) { return; } var table = document.getElementById('FlexTable_stacks_in_5677_page22'); var rtable = document.getElementById('FlexTableRot_stacks_in_5677_page22'); if (!table || !rtable) { return; } for (i=0; i<table.rows[0].cells.length; i++) { ...
[ "function FlexTable_stacks_in_4914_page22_SetRotHeader() {\n\n\tif (0 != 1) { return; }\n\n\tvar table = document.getElementById('FlexTable_stacks_in_4914_page22');\n\tvar rtable = document.getElementById('FlexTableRot_stacks_in_4914_page22');\n\tif (!table || !rtable) { return; }\n\n\tfor (i=0; i<table.rows[0].cel...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets the next data increment after the current. If the current increment is null, then the first increment on screen in generated.
function getNextDataIncrement(min, inc, cur){ if (cur === null){ return Math.floor(min / inc) * inc + inc; } else{ return cur + inc; } }
[ "#nextId() {\n const nextId = \"id_\" + this.#currentId;\n this.#currentId++;\n return nextId;\n }", "function consoleCommon_getNextCustomerNo()\n{\n var settingsObj_customerNoPrefix= Cached_getSettingsByKey(SettingsConstants.SETTINGS_RELATION_KEY_CUSTOMER_NO_PREFIX);\n var settingsObj_customerMax...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Initializes the physics joint
function PhysicsJoint(/** * The type of the physics joint */type,/** * The data for the physics joint */jointData){this.type=type;this.jointData=jointData;jointData.nativeParams=jointData.nativeParams||{};}
[ "function initPoses() {\n let num = 0;\n this.joints = {\n // wrist\n Wrist: new _JointObject.JointObject(\"wrist\", num++, this),\n // thumb\n T_Metacarpal: new _JointObject.JointObject(\"thumb-metacarpal\", num++, this),\n T_Proximal: new _JointObject.JointObject(\"thumb-phalanx-pro...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
I added everthing below this :) make a request to the facebook graph API for photo data call the function to send data to my server
function getPhotosAPI(){ var fb_user_id; // // get user's facebook user id FB.api( '/me/', 'GET', {"fields":"id"}, function(response) { fb_user_id = response.id; } ); // console.log("my fb_user_id: ", fb_user_id); // currently limiting to 50 photos...too much data won't send successfully to my se...
[ "function getFriends() {\n var query = \"SELECT uid, name FROM user WHERE uid IN (Select uid2 from friend where uid1 =me())\";\n\n FB.api(\n {\n method: 'fql.query',\n query: query\n },\n function(response) {\n \n console.log(response);\n\n var h...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This is a function for postV3CiLint
postV3CiLint(incomingOptions, cb) { const Gitlab = require('./dist'); let defaultClient = Gitlab.ApiClient.instance; // Configure API key authorization: private_token_header let private_token_header = defaultClient.authentications['private_token_header']; private_token_header.apiKey = 'YOUR API KEY'; // Unc...
[ "async function commitlint(context) {\n\t// 1. Extract necessary info\n\tconst pull = context.issue();\n\tconst { sha } = context.payload.pull_request.head;\n\tconst repo = context.repo();\n\n\t// GH API\n\tconst { paginate, issues, repos, pullRequests } = context.github;\n\n\t// Hold this PR info\n\tconst statusIn...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
TODO: These exit codes may not behave as expected on the new runtime, due to complexities of async logging and sync exiting. Exit the action as a success.
function success() { process.exit(ExitCode.Success); }
[ "function failure() {\n process.exit(ExitCode.Failure);\n}", "function exit(msg, code = 0) {\n console.log(msg); // eslint-disable-line no-console\n process.exit(code);\n}", "isActionAborted() {}", "function nodeCB(code, stdout, stderr, cb) {\n if (code !== 0) {\n console.log('Program stderr:',...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Zoom to Home Code for Filter
function zoomHome() { view.goTo({ position: { latitude: -1.841491, longitude: -97.651421, //longitude: -96.651421, z: 4700000 }, tilt: 45, ...
[ "function onZoom()\r\n{\r\n\tevaluateLayerVisibility();\r\n\t$(\"#zoomlevel\").val(Math.floor(map.getView().getZoom()));\r\n}", "function onChangeFilter() {\n requestSubMain(0)\n}", "function zoomIntoUnmatchedProfile () {\n zoomIntoProfile();\n appendZoomedChoiceBar();\n}", "function zoom() {\n airbnb...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Break the block we're looking at
function breakBlock (state) { var block = state.player.lookAtBlock if (!block) return var loc = block.location var neighbors = [ state.world.getVox(loc.x + 1, loc.y, loc.z), state.world.getVox(loc.x, loc.y + 1, loc.z), state.world.getVox(loc.x - 1, loc.y, loc.z), state.world.getVox(loc.x, loc.y...
[ "break(){\n\t\tif(this.attackdelay > 0 || this.aimDir.equals(new vec2()))\n\t\t\treturn;\n\t\tthis._breakParticles();\n\t\tthis.attackdelay = 20;\n\t\tsfx_attack.play();\n\t\tvar c = this._getBreakBox();\n\t\tfor (var i = blocks.length - 1; i >= 0; i--) {\n\t\t\tif(box.testOverlap(blocks[i].col, c))\n\t\t\t\tbreakB...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Replace selectors by prefixed one
replace(selector, prefix) { return selector.replace(this.regexp(), `$1${this.prefixed(prefix)}`) }
[ "function escapeSelector(sel) {\n return sel.replace(/[/$]/g, '\\\\$&');\n }", "setSelector(selectorText){\n if (typeof selectorText !== \"string\") throw new TypeError(\"Your selectorText is not a string\");\n let head = super.getHead();\n\n this.patch({\n action: VirtualActions.PATCH_REPLACE,\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
! DOMExceptionpolyfill.js Version 1.0.0
function DOMException(message) { this.message = "" + message; }
[ "function hc_documentinvalidcharacterexceptioncreateelement1() {\n var success;\n var doc;\n var badElement;\n doc = load(\"hc_staff\");\n \n\t{\n\t\tsuccess = false;\n\t\ttry {\n badElement = doc.createElement(\"\");\n }\n\t\tcatch(ex) {\n success = (typeof(ex.code) != 'u...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates a draw function that draws the cells array to a specified canvas
function makeDrawFunction(canvas, w, h, cellSize) { const ctx = canvas.getContext("2d"); return function drawCells(cells) { const img = ctx.createImageData(w * cellSize, h * cellSize); for (let y = 0; y < h * cellSize; y += 1) { for (let x = 0; x < w * cellSize; x += 1) { const xCell = Math.fl...
[ "function drawCells() {\n var canvas = document.getElementById('canvas').getContext('2d')\n canvas.strokeStyle = '#484f5b'\n canvas.fillStyle = '#a9bbd8'\n canvas.clearRect(0, 0, 2000, 2000)\n board.forEach(function(row, x) {\n row.forEach(function(cell, y) {\n canvas.beginPath()\n canvas.rect(x*1...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Observe the DOM element, if defined and different from the currently observed element. Pass `force` argument to skip element checks and always reobserve.
observeElement(force = false) { const element = this.getElement(); if (!(element instanceof Element)) { // stop everything if not defined this.observer.disconnect(); return; } if (element === this.element && !force) { // quit if given same ...
[ "function _updateElement() {\n\t\tself.observer.disconnect();\n\t\tself.element.innerHTML = self.history[self.index];\n\t\tself.observer.observe(self.element, OBSERVER_CFG);\n\t}", "pollForArrowsChanges () {\n let brokenReference = false\n foreach(arrow => {\n if (arrow.hasChanged()) {\n arrow.p...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
decode a packed string (Compactor encoding method) to an array of numbers
function h$decodePacked(s) { function f(o) { var c = s.charCodeAt(o); return c<34?c-32:c<92?c-33:c-34; } var r=[], i=0; while(i < s.length) { var c = s.charCodeAt(i); if(c < 124) r.push(f(i++)); else if(c === 124) { i += 3; r.push(90+90*f(i-2)+f(i-1));...
[ "function _toIntArray(string) {\n var w1\n , w2\n , u\n , r4 = []\n , r = []\n , i = 0\n , s = string + '\\0\\0\\0' // pad string to avoid discarding last chars\n , l = s.length - 1\n ;\n\n while (i < l) {\n w1 = s.charCodeAt(i++);\n w2 =...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Checks to ensure that each instruction in a program String has a valid corresponding Instruction in the Instruction Set.
function krnVerifyInstructions(program) { var splitProgram = program.split(" "); for( var index = 0; index < splitProgram.length; index++) { var opCode = _InstructionSet.get(splitProgram[index]); if(splitProgram[index] === '00') { break; } ...
[ "function validateInstructionChecks() {\n \n hideElements(); \n instructionChecks = $('#instr').serializeArray();\n\n var ok = true;\n for (var i = 0; i < instructionChecks.length; i++) {\n // check for incorrect responses\n if(instructionChecks[i].value != \"correct\") {\n al...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Extend a reducer with an extension function. This will result in a reducer that calls the extension function; if the latter returns null then the original reducer will be called. Any selectors and actions bound to the original reducer will be copied to the new reducer.
function extendReducer(reducer, extension) { return { $$extend: true, $$reducer: reducer, $$extension: extension }; }
[ "function buildReducer(reducer, store, useTag) {\n /**\n * Expects an object or a function as the reducer argument. If an\n * object then it should be tagged as $$combine, $$extend, etc. This\n * is checked below.\n **/\n if (!(0, _lodash.isPlainObject)(reducer) && !(0, _lodash.isFunction)(redu...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
:: (string) By default, schema items inherit the [registered](SchemaItem.register) items from their superclasses. Call this to disable that behavior for the given namespace.
static cleanNamespace(namespace) { this.getNamespace(namespace).__proto__ = null }
[ "constructor() {\r\n super();\r\n this.type = \"NO_ITEM\";\r\n }", "function disableme() {\n\tvar itms = getDisabledItems();\n\tfor(i=0; i< itms.length; i++) \n\t{\n\t\titms[i].readOnly = true;\n }\n}", "function deactivate() {\n global.hadronApp.appRegistry.deregisterRole('Collection.Tab', ROLE);\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Update the FeatureScope with default properties for each Dialect
scope(options) { _.defaults(options, { paths: { files: "./" } }); let scope = new FeatureScope(options); this.dialects.forEach((dialect) => { dialect.scope(scope); }); return scope; }
[ "function updateFeature() {\n $scope.selectedFeature.properties.forEach(function(prop) {\n $scope.selectedFeature.feature.properties[prop.key] = prop.value;\n });\n MapHandler.updateOnlyProperties($scope.selectedFeature);\n }", "addDialect(dialect) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Display Add Brand Text box and button
addBrand(id) { var textBox = document.getElementById("txt_addPhone"); var button = document.getElementById("btn_addPhone"); textBox.style.display = "none"; button.style.display = "none"; document.getElementById("txt_addBrand").style.display = "block"; document.getElementById("btn_addBrand").st...
[ "addPhone() {\n var textBox = document.getElementById(\"txt_addBrand\");\n var button = document.getElementById(\"btn_addBrand\");\n textBox.style.display = \"none\";\n button.style.display = \"none\";\n\n document.getElementById(\"txt_addPhone\").style.display = \"block\";\n document.getElementBy...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
show and hide user settings block on clicking user profiles icon or text
function userSettingsShowHide(){ $('body').delegate(".user--profile-icon , .user-profile-title ","mouseover",function(){ $('.user-settings').show(); $('.user-settings').on("mouseleave",function(){ $('.user-settings').hide(100); }); }); /*$('.user--profile-icon , .user-profile-title , .left-page ....
[ "function showConfigUser() {\n\n\tdocument.getElementById('sel_editor_font_size').value = v_editor_font_size;\n\tdocument.getElementById('sel_editor_theme').value = v_theme_id;\n\n\tdocument.getElementById('txt_confirm_new_pwd').value = '';\n\tdocument.getElementById('txt_new_pwd').value = '';\n\n\t$('#div_config_u...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Middleware to ensure user is loggedout.
function isLoggedOut (req, res, next) { if (req.isUnauthenticated()) { return next() } res.redirect('/') }
[ "logoutUser() {\n this.get('session').invalidate();\n }", "function logoutListener() {\n loggedIn = false;\n }", "function isNOTLoggedIn(req, res, next) {\n if (!req.isAuthenticated())\n return next();\n\n res.redirect('/');\n}", "function logOut() {\n localStorage.removeItem('toke...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This will give the coefficientList corresponding to the milstone level
get coefficientList() { return this.coefficientLists[this.level]; }
[ "function getPlateList(inWeight) {\n let remainingWeight = inWeight / 2;\n const availablePlates = allAvailablePlates.slice().sort((a, b) => {\n return (+a) - (+b) < 0;\n });\n const result = [];\n while(availablePlates.length > 0 && remainingWeight > 0) {\n const thisWeight = available...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
An implementation of MarkupContainer for text node and comment nodes. Allows basic text editing in a textarea.
function MarkupTextContainer(markupView, node) { MarkupContainer.prototype.initialize.call(this, markupView, node, "textcontainer"); if (node.nodeType == Ci.nsIDOMNode.TEXT_NODE) { this.editor = new TextEditor(this, node, "text"); } else if (node.nodeType == Ci.nsIDOMNode.COMMENT_NODE) { this.editor = ne...
[ "render(){\n return(\n <div className=\"container-fluid d:flex\" id=\"main\">\n \n <div id=\"textAreaContainer\">\n <h3 id=\"editor-head\">Markdown Editor</h3>\n <textarea className=\"bg-dark \" id=\"editor\" value={this.state.input} onChange={...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get the collection that will be used for the ideas
get collection() { return this._collection; }
[ "function getCollection(name, options) {\n return start(name).then(function() {\n // db.removeCollection(name);\n var coll = db.getCollection(name);\n if (coll) return coll;\n $log.log(TAG + 'getCollection:' + name + ' options', options);\n coll = db.addCollection(name, optio...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Adds a designator to the composition.
add(d) { if (d == null) { return; } if (d instanceof CompoundDesignator) { for (var j = 0; j < d.elements.length; j++) { this.add(d.elements[j]); } } else { this.elements.push(d); } }
[ "getDesignator() {\n return this.designator;\n }", "addDiner(diner) {\n this.diners.push(diner);\n }", "addInteraction(config) {\n index = getValue('cmi.interactions._count');\n let newInteraction = new Interaction(index, config);\n this.interactions.push(newInteraction);\n }", "static...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Visit a parse tree produced by PlSqlParsersynchronous_or_asynchronous.
visitSynchronous_or_asynchronous(ctx) { return this.visitChildren(ctx); }
[ "function STLangVisitor() {\n STLangParserVisitor.call(this);\n this.result = {\n \"valid\": true,\n \"error\": null,\n \"tree\": {\n \"text\": \"\",\n \"children\": null\n }\n };\n\treturn this;\n}", "function parse_StatementList(){\n\t\n\n\t\n\n\tvar tempDesc = tokenstre...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Cloudinary class with jQuery support
function CloudinaryJQuery(options) { CloudinaryJQuery.__super__.constructor.call(this, options); }
[ "showUploadWidget() {\n cloudinary.openUploadWidget({\n cloudName: 'dvgovtrrs',\n uploadPreset: CLOUDINARY_UPLOAD_PRESET,\n sources: [\n 'local',\n 'url',\n 'camera',\n 'image_search',\n 'facebook',\n 'dropbox',\n 'instagram',\n ],\n googl...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
makeQuarantineAt : String [ASTNode | DOMNode | Cursor] > Quarantine Consumes a String, a Destination, and an event. Hides the original node and inserts a quarantine DOM node at the Destination with the String (or, if false, DOMNode contents), allowing the user to edit.
makeQuarantineAt(text, dest) { this.cm.setOption("readOnly", "nocursor"); // make CM blind while quarantine is visible let quarantine = document.createElement('span'); // if we're editing an existing ASTNode if(dest.type) { text = text || this.cm.getRange(dest.from, dest.to); let parent = de...
[ "editQuarantine(quarantine) {\n quarantine.focus();\n setTimeout(() => {\n let range = document.createRange();\n range.selectNodeContents(quarantine);\n window.getSelection().removeAllRanges();\n window.getSelection().addRange(range);\n if(quarantine.insertion && !this.hasInvalidEdit)...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
the 1st prompt asks the user if I like sports
function askSports() { var sports = prompt(questionsArr[0]).toLowerCase(); if (sports === 'y' || sports === 'yes') { userPoints += 1; alertPrefixString = 'Correct! '; console.log('The user answered question 1 correctly'); } else { alertPrefixString = 'Sorry! '; console.log('The user answered q...
[ "function promptTeamName() {return inquirer.prompt([{name:\"teamName\" ,type:\"input\" ,message:\"TeamInfo: Team's Name?\" }]);}", "function promptAnotherAction() {\n inquirer.prompt([\n // Prompt user for yes or no\n {\n type: \"confirm\",\n message: \"Would you like...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
5. Return the element that is Nfromarray'send. Given ([5,2,3,6,4,9,7],3), return 4. If the array is too short, return null.
function nth(arr,num) { //Check to see if array is not too short if(arr.length <= 2){ //If array is too short, return null return null; } //If array is long enough, return value of the proposed index return arr[arr.length-num] }
[ "function lastEntry (array, n) {\n const lastEntryIndex = array.length;\n\n if (n === undefined){\n return array[lastEntryIndex-1];\n }\n return array.slice(lastEntryIndex - n);\n}", "function lastElement(array){\n if (array.length > 0){\n return array[array.length-1];\n }\n ret...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
FUNCTION: randomPassword Parameters: NA Returns: a randomlygenerated length24 numeric password.
function randomPassword() { var password = new Buffer(24); for (var i = 0; i < 24; i++) { password[i] = Math.floor(Math.random() * 256); } return password.toString('base64'); }
[ "function randomPassword(len){\n\n}", "function passwordRandom()\n{\n var text = \"\";\n var possible = \"0123456789\";\n\n for( var i=0; i < 4; i++ )\n text += possible.charAt(Math.floor(Math.random() * possible.length));\n\n return text;\n}", "function randomPassword(passwordLength){\noutpu...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
function to handle current users in the room
function currentUsers(data) { userContainer.innerHTML = ''; const users = data.users; users.forEach( (user) => { if(user.room === data.room) { const username = `<p>${user.username}</p>`; userContainer.insertAdjacentHTML('beforeend', username); } }) }
[ "function send_current_users (socket) {\n var info = client_info[socket.id];\n var users = [];\n var now_timestamp = moment().local().format('h:mm:ss a');\n\n if (typeof info === 'undefined') {\n return;\n }\n\n Object.keys(client_info).forEach(function (socket_id) {\n var user_info = client_info[socket...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Set default variables types according to metadata
function initTypes() { // Boolean for production/file supplied/online or not var online = false; var json_raw_data = null; var var_types_url = null; if (online) { // Retrieve from dataverse API } else { // Read from local' var_types_url = "../../data/preprocess_4_v1-0.json"; } d3.json(var_...
[ "['@kind']() {\n super['@kind']();\n if (this._value.kind) return;\n\n this._value.kind = 'variable';\n }", "function InferTypes () {\n ASTTransform.call(this);\n this.varDefs = {};\n this.fnSignatures = {};\n this.fnTypeHints = {};\n this.fnRenaming = {};\n this.runAgain = false;\n}", "enterTyp...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Resete todos los elementos input, divs, ademas que para los input remueve la class "req"
function resetCampos(contexto){ $(":input", contexto).each(function(){ $(this).val("").removeClass("req"); }); $("div", contexto).each(function(){ $(this).text(""); }); }
[ "function resetForms(){\r\n $('.user-col form').attr('data-mode', 'working');\r\n // $('.user-col fieldset, .user-col textarea').addClass('untouched');\r\n $('.pairwise-decision, .pairwise-guidelines').addClass('untouched');\r\n // $('.pairwise-reasoning').removeClass('untouched')\r\n $('.user-col input').prop...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Deletes a user via the API and then refetches the list of users and updates it's state.
async function deleteUser(userId) { await fetch(`/api/users/${userId}`, { method: 'DELETE' }); // Re-fetch users after deleting fetchUsers() }
[ "function deleteUser(event) {\n let id = getUserId(event.target);\n fetch(url+\"/api/users/\"+id, {\n method: \"DELETE\",\n headers: {\n \"authorization\": jwt\n }\n }).\n then((response) => {\n if (response.ok) {\n updateStateAndRefresh(\"User \" + id + \" has been deleted.\", true);\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
NO / 1. Write a function that takes two input `amount` and `taxRate` and returns the total amount by `amount + (amount taxRate) ` 2. Write two tests for the above function 3. Make the first test fail and look at the output 4. After making the first test fail do you see the output of the second test?
function taxCalculator(amount, taxrate){ return amount + (amount * taxrate); }
[ "function taxCalculator(num1, state) {\n if (state == \"NY\") {\n num1 = 4 / 100 + 1;\n } else {\n num1 = 6.625 / 100 + 1;\n }\n sum = 100 * num1;\n return sum;\n}", "function calculateTaxes(income) {\n if (income < 10000) {\n return (income * .05);\n } else if (income >10000 <20000) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
binary search lut to find node beginning at pos or as close after pos as possible. null if none
function findNodeFromPos(pos) { var lut = this.begins; assert(is.finitenumber(pos) && pos >= 0); var left = 0; var right = lut.length - 1; while (left < right) { var mid = Math.floor((left + right) / 2); assert(mid >= 0 && mid < lut.length); if (pos > lut[mid].range[0]) { ...
[ "findIndex(pos, end, side = end * Far, startAt = 0) {\n if (pos <= 0)\n return startAt;\n let arr = end < 0 ? this.to : this.from;\n for (let lo = startAt, hi = arr.length;;) {\n if (lo == hi)\n return lo;\n let mid = (lo + hi) >> 1;\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Add the animate in/out state based on section relevance
function setSectionAnimateInOrOutState() { var sectionHalfHeight = ($("section.your-senses").outerHeight()/2); var sectionOffsetCenter = $("section.your-senses").offset().top + sectionHalfHeight; var sectionOffsetCenterLeeway = 50; var windowScrollCenter = $(window).scrollTop() + ($(window)....
[ "function sectionOn() { }", "function sidemenuHighlight() {\n // Function that detects which section I am reading\n function ioCallBack (entries) {\n for (entry of entries) {\n if (entry.isIntersecting) {\n var link = \"#\" + entry.target.id;\n var indicator =...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get the comments for a given tutorial
async findTutorialById(tutorialId) { return await Tutorial.findByPk(tutorialId, { include: ["comments"] }) .then((tutorial) => { return tutorial; }) .catch((err) => { console.log(">> Error while finding tutorial: ", err); }); }
[ "async findAll() {\n return await Tutorial.findAll({\n include: [\"comments\"],\n }).then((tutorials) => {\n return tutorials;\n });\n }", "function getComment(){\r\n var categoryId = collectedData.currentCategory;\r\n var vidId = collectedData.currentVideo;\r\n var commentArr = collecte...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
FUNCTION: extUtils.isPartOfLockedContent DESCRIPTION: ARGUMENTS: RETURNS:
function extUtils_isPartOfLockedContent(currNode) { return (currNode.parentNode && currNode.parentNode.childNodes.length == 3 && currNode.parentNode.childNodes[0].tagName == "MM:BEGINLOCK"); }
[ "isNodeLocked(node) {\n return node.el.matches('[aria-disabled=\"true\"], [aria-disabled=\"true\"] *');\n }", "function checkContents() {\n\n var content = document.getElementById(\"content\");\n\n if (typeof(content) !== 'undefined' && content !== null) {\n return checkContent = true;\n }\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Here we overwrite describe() from the base class, but still use describe() from the base class using super.describe()
describe() { return `${super.describe()} : ${this.title}`; }
[ "describe(message) {\r\n\t\t\treturn NarratorTools.createChatMessage('describe', message);\r\n\t\t}", "constructor(\n expect /*:string*/,\n actual /*:mixed*/,\n article /*:string*/ = articleFor(expect)\n ) {\n super()\n this.actual = actual\n this.expect = expect\n this.article = article\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
showReplay takes no parameters. This function will change the style.display of guessingdiv to none and the style.display of the replaydiv to block making it so the user can start over after they win or lose the game.
function showReplay() { document.getElementById('guessing-div').style.display = 'none'; document.getElementById('replay-div').style.display = 'block'; }
[ "function replayGame() {\n resetGame();\n togglePopup();\n }", "function displayGame(){\n gameType.style.display ='none';\n gamePlay.style.display ='block';\n}", "function displayOrHideGameDiv(c) {\r\n\tif (c) {\r\n\t\tgameOverDiv.style.display = \"block\";\r\n\t\tgameBodyDiv.style.display = \"none\";\r\n\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
function to handle addition of new rubric
addRubrics(e) { let lastElement = this.state.rubricIds[this.state.rubricIds.length-1]; this.setState({rubricCount: this.state.rubricIds.push(lastElement + 1)}); }
[ "add(recipeId) {\n\n // First see if recipe is already present\n let item = this.getItem(recipeId)\n\n if (!item) {\n this.items.push({\n id: recipeId\n });\n\n }\n // persists to local storage\n this.update();\n }", "function addIn...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Set up for the ghosts
initialise_ghosts() { // Set up the ghosts animaton sequences for the ghost movement for (var i = 0; i < this.data.ghosts.length; i ++) { for (var s=0; s<7; s++) { this.data.ghosts[i].set_animation_sequence(s, 4, 0, 3); } ...
[ "function setup() {\n state = model.geneticEngine().state(); // Cleanup.\n\n cancelTransitions();\n viewportG.selectAll(\"g.genetics\").remove();\n g = null;\n\n if (!model.get(\"DNA\")) {\n // When DNA is not defined (=== \"\", undefined or null) genetic\n // renderer has nothing to do.\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Example productOfArray([1,2,3]) // 6 productOfArray([1,2,3,10]) // 60 helper method style 1. base case array.length === 1 return array[0] 2. return array[0] productOfArray(arr.slice(0))
function productOfArray(arr){ if (arr.length === 1) return arr[0] return arr[0] * productOfArray(arr.slice(1)) }
[ "function product(arr) {\n var total = 1;\n for (i = 0 ; i = arr.length ; i++) {\n total *= arr[i];\n }\n return total;\n}", "function productContents(array) {\r\n\tlet product = 1;\r\n\tfor (let i = 0; i < array.length; ++i)\r\n\t{\r\n\t\tproduct *= array[i];\r\n\t}\r\n\treturn product;\r\n}",...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
dropItem: Called by playGame Takes currentItem from player's backpack and drops it at the current location. If it's not in the backpack then it displays error message.
function dropItem() { // First check to make sure backpack isn't empty. If it isn't, get currentItem index // number in the players backpack. Remove the item from the backpack, add it to the // world items array and add it's location to the world items location array. Finally // tell the player...
[ "function useItem() {\r\n\r\n // First check to make sure backpack isn't empty. If it isn't, get currentItem index \r\n // number in the players backpack. It it exists in the backpack, then try to use it at \r\n // the players location. Modify the world items and backpack items appropriately if using\r\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Utility function to fold a line if it is not already folded
function _foldLine(cm, line) { var marks = cm.findMarksAt(CodeMirror.Pos(line + 1, 0)), i; if (marks && marks.some(function (m) { return m.__isFold; })) { return; } else { foldFunc(cm, line); } }
[ "function foldable(state, lineStart, lineEnd) {\n for (let service of state.facet(foldService)) {\n let result = service(state, lineStart, lineEnd)\n if (result) return result\n }\n return syntaxFolding(state, lineStart, lineEnd)\n }", "function fold(input, lineSize, lineArray = []...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Separate set into training and test by separationSize Separation size 0.7 = first 70% of data will be training, the latter 30% will be test.
function separate() { // Training set is first part of data set. const trainingSetX = xSet.slice(0, separationSize); const trainingSetY = ySet.slice(0, separationSize); train(trainingSetX, trainingSetY); // Test (verification) set is latter part of data set. const testSetX = xSet.slice(separati...
[ "function setOptimalExpectedResultsSize(fast) {\n\tif (typeof(fast) == \"undefined\") {\n\t\tfast = false;\n\t}\n\tdeselectText()\n\tvar tableWidth = $(\"#exprestable\").width() + 20;\n\tvar windowWidth = $(\"#splittercontainer\").width();\n\tvar perc = (tableWidth/windowWidth)*100;\n\tif(perc > 55) {\n\tperc = 55;...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Calls external api => omdbapi.com Search using titleInput and save title and poster information to state
searchOmdb() { this.setState({ searched : true, }) fetch(`http://www.omdbapi.com/?t=${this.state.titleInput}`) .then(r => r.json()) .then(movie => { console.log('in fetch movie', movie) this.setState({ omdbTitle : movie.Title, omdbPoster : movie.Poster, });...
[ "function whatMovie() {\n inquirer.prompt([{\n type: 'input',\n message: 'What is the movie title?',\n name: 'movieTitle'\n }]).then(function (resp) {\n\n // check that user did not enter empty query\n if (resp.movieTitle.length > 0) {\n\n // store user query for ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Ensure public key is in new PUB_ format.
function normalizePublicKey(key) { if (key.startsWith('PUB_')) { return key; } return eosjs_1.Numeric.publicKeyToString(eosjs_1.Numeric.stringToPublicKey('EOS' + key.substr(-50))); }
[ "function importPubKey() {\n var newPubKey = new PubKeys(\n {raw_key: ctrl.raw_key, self_signature: ctrl.self_signature}\n );\n newPubKey.$save(\n function(newPubKey_) {\n raiseAlert('success', '', 'Public key saved successfully');\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Misc max size in bytes for capped collection size: 100000, max number of documents inside of capped collection num: null, optionally you can pass everything separately host: 'localhost', port: 27017, db: 'socketio' Not applicable redisPub (object) options to pass to the pub redis client redisSub (object) options to pas...
function Mongo (opts) { var opts = {}.extend(Mongo.defaults, opts), self = this; // node id to uniquely identify this node var nodeId = opts.nodeId || function () { // by default, we generate a random id return Math.abs(Math.random() * Math.random() * Date.now() | 0); }; this.nodeId = nodeI...
[ "function startCleanup(mongo, redis, data) {\n var deferred = q.defer();\n var tasks = [];\n _.each(data, function (docName) {\n tasks.push(function (callback) {\n cleanDoc(mongo, redis, docName, callback);\n });\n });\n async.parallelLimit(tasks, 2, function (err) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Called when the project receives a "green flag."
onGreenFlag() {}
[ "function greenLight() {\n\tturnOffLights();\n\t$('#green').toggleClass(\"greenGlow\");\n\tgreenAudio.play();\n}", "function colourChange(){\n currentColour++;\n if(currentColour==colours.length)currentColour = 0;\n circle(context,halfWidth,halfHeight,step/2,true);\n}", "updateGreen(event) {\n\n // Se...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Initializes the end for target face mode
function initEndTargetFace() { var arrows = $scope.curArrows.data, curEnd = $scope.curEnd, i, x, y; activeArrows = 0; if (!$rootScope.archerTargets) { $timeout(function() { initEndTargetFace(); }, 300); return; } function setArrowActive(arrowsetID, arrowID) { var atRef = $rootScope....
[ "get nextFace() {\n var next = new Face(this.wrapper.nextElementSibling, this.cube);\n return (next.wrapper ? next : null);\n }", "setFaceColor ( face, RGB) {\n\t\t// debug\n\t\t//console.log(\"atomicGLskyBox(\"+this.name+\")::setFaceColor\");\n\t\tvar r = RGB[0];\n\t\tvar g = RGB[1];\n\t\tvar b = RGB[2];\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Constructs shortener with URL string and validates it.
constructor(urlString) { this.url = '' // Validates URL. let parsedURL if (urlString) parsedURL = url.parse(urlString) // console.debug('URLShortener: Parsed URL', parsedURL) if (!parsedURL || !parsedURL.host) throw new Error("URL sent is not valid.") if('Malformed.%20url' == p...
[ "static async UrlShortener() {\n\n }", "function shortenUrl() {\n var urldata = document.querySelector('#url-field').value;\n var xhr = new XMLHttpRequest();\n\n if(urldata != \"\") { \n toggleSpinner();\n xhr.open(\"POST\",\"/shorten\");\n xhr.send(JSON.stringify({\n u...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Insert List Item to SP host web
function InsertItemToList(loginname) { var ctx = new SP.ClientContext(appWebUrl);//Get the SharePoint Context object based upon the URL var appCtxSite = new SP.AppContextSite(ctx, hostWebUrl); var web = appCtxSite.get_web(); //Get the Site var listName = "TestUser"; var list = web.get_list...
[ "function addHeroInventoryItemToPage(listId,listItem){\n // Create a new list element\n let newListItem = document.createElement(\"li\");\n // Set the id attribute for the new inventory item\n newListItem.setAttribute(\"id\", listId);\n // Create the content for the new inventory item\n let newCon...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Makes the copy alert for the given container visible while hiding all others.
function showCurrentCopyAlert(containerId) { document .querySelectorAll("[copyable='flink-module']") .forEach(function (alert) { alert.style["display"] = "none"; }); var alert = document.querySelector("[copyable='flink-module'][copyattribute='" + containerId + "'"); ale...
[ "function showSelection() {\n iconsContainer.css(\"visibility\", \"hidden\");\n selectionContainer.css(\"visibility\", \"visible\");\n }", "function hideAllExcept(elementId) {\n var containerDivs = ['firstContainerDiv', 'secondContainerDiv', 'thirdContainerDiv', 'popUpWindow'];\n for (var containerDi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
constructor for the x and y positions
constructor(x = 0, y = 0) { this.x = x; // position for x this.y = y; // position for y }
[ "function point(xx,yy){\nthis.x = xx;\nthis.y = yy;\n}", "function createPosition(){\n position = [];\n // push the x and y position values to an array of position objects\n for (var i = 0; i < rangee; i++){\n for (var j = 0; j < column; j++){\n position.push(new Position(pX[j],pY[i]));\n }\n }\n}"...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get all chord symbols
function symbols() { return dictionary.map(chord => chord.aliases[0]).filter(x => x); }
[ "function getChord() {\n //get all playing keys\n var keys = document.querySelectorAll(\".key.playing\");\n\n //if less than 2 keys there is no chord, return blank\n if (keys.length < 2) {\n return \"\";\n }\n\n //get bass note (lowest playing note)\n var bass = keys[0].dataset.note;\n //get indicies of ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
SUCCESS CB: start rendering tvshows and save tvShows Global, will also wire tbl btns
function getTVShows_SuccessCB(tvShowsData) { tvShows = tvShowsData; renderTVTable(tvShows); wireTableButtons(); }
[ "function getTVShows() {\n ajaxCall(\"GET\", \"../api/Episodes\", \"\", getTVShows_SuccessCB, getTVShows_ErrorCB);\n}", "function getAdminEpisodes_success(episodesData) {\n // save the episodes for global usage\n episodes = episodesData;\n\n // if the table does not exit yet (hasnt been rendered yet),...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get an existing Host resource's state with the given name, ID, and optional extra properties used to qualify the lookup.
static get(name, id, state, opts) { return new Host(name, state, Object.assign(Object.assign({}, opts), { id: id })); }
[ "static get(name, id, state, opts) {\n return new Key(name, state, Object.assign(Object.assign({}, opts), { id: id }));\n }", "static get(name, id, state, opts) {\n return new Resolver(name, state, Object.assign(Object.assign({}, opts), { id: id }));\n }", "static get(name, id, state, opts) ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Throws an error if the invoice id is not found
function doesInvoiceExist(results, id) { if (results.rows.length === 0) { throw new ExpressError(`Could not find invoice with id: ${id}`, 404); }; }
[ "info(_, invoiceid) {\n API.info(invoiceid, (err, { invoice, state }) => {\n if (err) {\n console.log(`Error: ${err}`);\n } else {\n utils.kvpPrint([\n 'Invoice: ', invoice._id,\n 'Status: ', invoice.st...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
=== Internal functions. === / === Debugging. === When debugging is on, debugLog() prints a supplied string to the console.
function debugLog(str) { if ( DEBUG && window.console ) console.log(str); }
[ "function message(str)\n{\n if(debug)\n {\n ///Rob Chadwick - 6/1/12 - Fixed bug where console.log is sometimes not available\n ///happens in IE 8 and 9\n if(output && output.log) \n output.log(str);\n }\n}", "function debugLog() {\n if (_debug) {\n console.log.apply(conso...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
onLogin: call to action login. this action defined in middle
onLogin() {}
[ "function onLogin( evt )\n{\n\tconsole.log(\"Logged In!\");\n\tsfs.send( new SFS2X.Requests.System.JoinRoomRequest(roomid));\n}", "onLoginStart () {\n this.loggingIn = true\n this.loggedIn = false\n }", "function loginClickHandler() {\n var values = this.getLoginForm().getVal...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
When clicking on a bubble increase the bubble's speed, decrement its point value, and if the point value hits 0 remove it
function handleBubbleClick(bubble) { bubble.speed += ACCELERATION; bubble.points--; if (bubble.points === 0) { popBubble(bubble); } bubble.text(bubble.points); }
[ "decreasePoints(points) {\n\t\tthis.points -= points;\n\t\t// don't let points go below 0\n\t\tif (this.points < 0) {\n\t\t\tthis.points = 0;\n\t\t}\n\t}", "function popBubble(bubble) {\n bubble.animate({ height: 0, width: 0 }, 100, function() {\n bubble.remove();\n bubblesLeft--;\n });\n}", "removeHeal...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Update unseen chat count
updateNotification(messageObject, unseenChatCount) { for(let chatId in messageObject) { if(messageObject.hasOwnProperty(chatId)) { messageObject[chatId].unseenMsgCount !== 0 && unseenChatCount++; } } return unseenChatCount; }
[ "function update_anon_count() {\n // Obviously, only do this if we are supposed to show the anonymous user count.\n if ( show_anon_count ) {\n // If there are no anonymous users, hide the block entirely.\n if (muutObj().anon_count == 0 && !anon_count_wrapper.hasClass('hidden')) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Converts the `Provider` into `ResolvedProvider`. `Injector` internally only uses `ResolvedProvider`, `Provider` contains convenience provider syntax.
function resolveReflectiveProvider(provider) { return new ResolvedReflectiveProvider_(ReflectiveKey.get(provider.provide), [resolveReflectiveFactory(provider)], provider.multi || false); }
[ "function createProvider() {\n return (new LocalProvider());\n }", "function convertToProviderExpression(obj, property) {\n if (obj.hasOwnProperty(property)) {\n return injectable_compiler_2_1.createR3ProviderExpression(new output_ast_1.WrappedNodeExpr(obj[property]), /* isForwardRef *...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
comprobamos si los productos son los correctos y hacen match
function checkForMatch(){ //guardamos el producto del cliente en productoChosen var productoChosen = document.querySelector(productClass) //usamos el id del producto para guardar la clase del cliente clientClass = '.cliente' + productDemandaId[0] var clientCh...
[ "function checkFrequecySquare(arr,sqareArr){\n const obj = {};\n const obj2 = {};\n for(ele of arr){\n let square = ele*ele;\n obj[square] = obj[square]||0\n }\n \n for(ele of sqareArr){\n obj2[ele] = obj2[ele]||0\n }\n console.log(\"obj>>>\",obj)\n console.log(\"obj2...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Interrupt the CPU with a nonmaskable interrupt
nonMaskableInterrupt() { this.interrupt(false); }
[ "function interruptibleMask(f, __trace) {\n return (0, _core3.checkInterruptible)(flag => interruptible(f(new InterruptStatusRestoreImpl(flag))), __trace);\n}", "interruptA() {\n console.log('mcp23gpio Handle Interrupt A ----------------------------');\n return this.commonReadAndProcessA();\n }", "setTi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This method is used to get dialog path in /apps from current dialog.
function getDialogPath() { var gAuthor = Granite.author, currentDialog = gAuthor.DialogFrame.currentDialog, dialogPath; if (currentDialog instanceof gAuthor.actions.PagePropertiesDialog) { var dialogSrc = currentDialog.getConfig().src; dialogPath = dialogSrc.substrin...
[ "function getPortal() {\n\tvar path = window.location.pathname;\n\tvar pos = path.indexOf('/', 1);\n\tif (pos > 0) {\n\t\tpath = path.substring(1, pos);\n\t}\n\treturn path;\n}", "function getRootPathname() {\n let pathname,\n pathRoot,\n indEnd\n\n pathname = window.location.pathname;...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Activates a vertical tab in a tabset. tabset_id the id of the tab's tabset alttext the tab description tab_element the name of the tab to activate return none Compatibility: IE, NS6, NS4
function i2uiToggleVerticalTab(tabset_id, alttext, tab_element) { // handle Netscape 4.x if (document.layers) { var item; // display new description item = document.layers[tabset_id+"_description"]; if (item != null) { var text = '<DIV style="color:#ffffff;background-color:#9...
[ "_activateSelectedTab () {\n this.tabToActivate.setAttribute('aria-selected', 'true')\n this.tabToActivate.removeAttribute('tabindex')\n this.panelToActivate.removeAttribute('hidden')\n\n this.activeTab = this.tabToActivate\n }", "function _jsTabControl_turnTabOn(tabID) {\n\tdocum...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns a point on the path at the specified index
getPointOnPath(path, index, target = []) { const { positionSize } = this; if (index * positionSize >= path.length) { // loop index += 1 - path.length / positionSize; } const i = index * positionSize; target[0] = path[i]; target[1] = path[i + 1]; target[2] = positionSi...
[ "getPointOnPath(path, index, target = []) {\n const {positionSize} = this;\n if (index * positionSize >= path.length) {\n // loop\n index += 1 - path.length / positionSize;\n }\n const i = index * positionSize;\n target[0] = path[i];\n target[1] = path[i + 1];\n target[2] = (positionS...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
save quantity entered for an ingredient
saveIngrQuantity(box, $quan) { let ingrNode = box.node let mealNode = recipe.selectedMeal let info = mealNode.info info[ingrNode.id] = $quan.val() mealNode.info = info }
[ "function quantityChanged(event) {\n let input = event.target;\n if(isNaN(input.value) || input.value <= 0) {\n input.value = 1\n }\n let id = input.parentElement.previousElementSibling.children[2].innerText\n updateQuantityLocalStorageBasket(id)\n updateBasketTotal();\n}", "function upda...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
decode method data bytecode, from method ABI object
function decodeMethod(method, data) { var outputNames = utils.getKeys(method.outputs, 'name', true); var outputTypes = utils.getKeys(method.outputs, 'type'); return decodeParams(outputNames, outputTypes, utils.hexOrBuffer(data)); }
[ "function getBytecode() {\n console.log(web3.eth.getCode(crowdsale.address));\n//\"0x\"\n//data: '0x' + bytecode\n}", "decodeOrdersFromFillData(data) {\n const self = this;\n assert_1.assert.isString('data', data);\n const functionSignature = 'decodeOrdersFromFillData(bytes)';\n ret...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get the inview artboard index (closest to the center of the viewport)
function getInViewArtboardIndex() { // Calculate the coordinates of the midpoint of the viewport (in Viewport coordinate space) viewportCenterX = (viewportWidth / 2 - scrollOrigin.x) / zoomValue; viewportCenterY = (viewportHeight / 2 - scrollOrigin.y) / zoomValue; // See which artboard (if any) includes the c...
[ "get rowIndex() {\n return INDEX2ROW(getTop());\n }", "get index() {\n return fromCache(this, CACHE_KEY_INDEX, () => {\n const { el, items } = this;\n const { length } = items;\n const { clientWidth } = el;\n const outerLeft = el.getBoundingClientRect().l...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Requests rssi's from all xbees
function requestAllRSSI() { request_counter++; for(address in xbeeAddress) { requestRSSI(xbeeAddress[address]); } }
[ "function requestRSSI(address){\n\n //Create a packet to be sent to all other XBEE units on the PAN.\n // The value of 'data' is meaningless, for now.\n var RSSIRequestPacket = {\n type: C.FRAME_TYPE.ZIGBEE_TRANSMIT_REQUEST,\n destination64: address,\n broadcastRadius: 0x01,\n options: 0x00,\n dat...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get Storage table operation options
function getStorageTableOperationDefaultOption() { var option = StorageUtil.getStorageOperationDefaultOption(); // Add table specific options here return option; }
[ "function createTablePolicySetting(options) {\n var policySettings = {};\n policySettings.accessType = StorageUtil.AccessType.Table;\n policySettings.serviceClient = getTableServiceClient(options);\n policySettings.getAclOperation = getStorageTableOperation(policySettings.serviceClient, 'getTableAcl');\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gibt ein Produkt zurueck. Ist einer der Multiplikanten nicht definiert, wird ein Alternativwert geliefert valueA: Ein Multipliksnt. Ist dieser undefined, wird als Produkt defValue zurueckgeliefert valueB: Ein Multipliksnt. Ist dieser undefined, wird als Produkt defValue zurueckgeliefert digits: Anzahl der Stellen nach ...
function getMulValue(valueA, valueB, digits = 0, defValue = NaN) { let product = defValue; if ((valueA !== undefined) && (valueB !== undefined)) { product = parseFloat(valueA) * parseFloat(valueB); } return parseFloat(product.toFixed(digits)); }
[ "function multiplyDefaults(a = 4, b = 3) {\n return a * b;\n}", "multiply(value1, value2 = this.memory) {\n if(value2!==undefined) {\n this.memory = value1 * value2;\n console.log(`${value1} x ${value2} = ${this.memory}`);\n return this.memory;\n } else {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
set() Sets a given register to an integer value
function set (str, value) { if (registers.hasOwnProperty(str)) registers[str] = Number(value); else if (str === "$zero") return; else output("Error getting register " + str + " on Line " + line, 'e'); }
[ "LDI(register, integerValue) {\n this.reg[register] = integerValue;\n }", "function setBit(number,i) {\n\treturn number | (1 << i);\n}", "setMem(bitmask) {\n MMU.wb(regHL[0], MMU.rb(regHL[0]) | bitmask);\n return 16;\n }", "setVariable (index, isGlobal, tee) {\n if (isGlobal) {\n if (tee) {...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Set new display name
function setDisplayName(displayName){ //Save display name into the storage localStorage.setItem('displayName',displayName); }
[ "function insertDisplayName(path, id) {\n const assignment = t.assignmentExpression(\n '=',\n t.memberExpression(\n t.identifier(id),\n t.identifier('displayName')\n ),\n t.stringLiteral(id)\n )\n // Put in the assignment expression and a semicolon\n path.insertAfter([a...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
create attribute selector recreate if attributecount would change
function createAttributeSelect() { var attrSelect = $("#attr-select"); var prevDatasetId = queryParameters.dataset; if(attrSelect.length > 0 && attrSelect.data("datasetid") !== prevDatasetId){ attrSelect.parent().remove(); attrSelect = $("#attr-select"); } if (attrSelect.le...
[ "cloneAttributes(target, source) {\n [...source.attributes].forEach( attr => { target.setAttribute(attr.nodeName === \"id\" ? 'data-id' : attr.nodeName ,attr.nodeValue) })\n }", "function shouldUseCreationCache(tagName, attributes) {\r\n if (tagName === 'select') return false;\r\n if ('type'...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
import custom result class this is a utility function to use a RegEx and pull port out of a websocket address (for puppeteer)
function getPort(browser) { return parseInt(/(?<=:)\d{1,5}(?=\/)/.exec(browser.wsEndpoint())[0]); }
[ "function parseOnePortRule(rule){\n if (validRule(rule)==false ) {\n return \"err\";\n }\n\n rule = rule.split(\"\\x02\");\n\n //------------SOURCE PORT-----------------------\n rule[_src] = rule[_src].split(\"+\"); //tcp+udp\n if(isArray(rule[_src])){\n if(rule[_src].length == 2...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
function lineSelect(selectedVar): highlight line and label of variable selected in radiobuttons
function lineSelect(selectedVar) { // all lines and legend elements low opacity d3.select("#line").selectAll(".y1line") .style("opacity", ".3") .style("stroke-width", "3px"); d3.select("#line").selectAll(".y2line") .style("opacity", ".3") .style("stroke-width", "3px"); d3.selectAll(".linelabel"...
[ "function selectLine(ta, line) {\n if (!ta.setSelectionRange) return;\n \n var count = 0;\n var start = 0;\n var text = ta.value;\n for (var i = 0; i<text.length; i++) {\n if (text[i] == \"\\n\" || (start!=0 && i==text.length-1)) {\n count++; // [i] is the end of line count\n if (count == line -...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
How many points if 'Four of a kind' is selected
function pointsFourOfAKind(player) { var diceCount = countDices(player); var points = 0; for (var i = 0; i < 6; i++) { if (diceCount[i] > 3) { points = 4 * (i + 1); } } return points; }
[ "function pointsThreeOfAKind(player) {\n\n var diceCount = countDices(player);\n var points = 0; \n for (var i = 0; i < 6; i++) {\n if (diceCount[i] > 2) {\n points = 3 * (i + 1);\n }\n }\n \n return points;\n}", "function pointsYatzy(player) {\n\n var diceCount = countDices(player);\n var poi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
I think the app can be open while no simulators are booted.
async function isSimulatorAppRunningAsync() { try { const zeroMeansNo = (await osascript.execAsync('tell app "System Events" to count processes whose name is "Simulator"')).trim(); if (zeroMeansNo === '0') { return false; } } catch (error) { if (error.message.incl...
[ "function isStandaloneApp() {\n return navigator.standalone;\n }", "function target_launch_app() {\n var http = new XMLHttpRequest();\n http.open(\"GET\", \"./boa_launch.py\");\n http.onreadystatechange = function() {\n\tif (http.readyState == XMLHttpRequest.DONE) {\n\t if (http.status != 20...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Return the tags formatted for ngTagInput.
function formatTags(tags) { var formatted = []; angular.forEach(tags, function(tag) { formatted.push({ text: tag }); }); return formatted; }
[ "function createTags(tags) {\n let tagsHtml = '';\n if (tags !== undefined) {\n for (let i = 0; i < tags.length; i++) {\n tagsHtml += `<span class=\"tag\">${tags[i]}</span>`;\n }\n }\n return tagsHtml;\n}", "function format_tags (tags, nct)\n{ ftags = new Array ();\n for (var...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
function loadRelationsTable request the html to populate a div with an editable table of relationships for a transaction. Assumes the presence of a change() function defined within scole containg the agent table.
function loadRelationsTable(relationsDiv,media_id,containingFormId,changeHandler){ $('#' + relationsDiv).html(" <div class='my-2 text-center'><img src='/shared/images/indicator.gif'> Loading...</div>"); jQuery.ajax({ url : "/media/component/search.cfc", type : "get", data : { method: 'relationsTableHt...
[ "function createRelationTable() {\n\tvar token = getClientStore().token;\n\tsessionStorage.token = token;\n\ttotalRecordsize = retrieveRelationRecordCount();\n\tif (totalRecordsize == 0) {\n\t\tobjCommon.displayEmptyMessageInGrid(getUiProps().MSG0233, \"Relation\");\n\t\tobjCommon.disableButton('#btnDeleteRelation'...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Helper for subtasks where you basically just want to apply some changes to a record from disk. You name the namespace and id like in `mutateSingle`, we create a subtask that issues that call, calls your synchronous function with the result, and then writes whatever you return back. (It can be the same object if you wan...
spawnSimpleMutationSubtask({ namespace, id }, mutateFunc ) { return this.spawnSubtask( this._simpleMutationSubtask, { mutateFunc, namespace, id }); }
[ "async function asyncFunc() {\n return 123;\n}", "async function scheduleSyncTask() {\n const result = await query(`\n PREFIX ext: <http://mu.semte.ch/vocabularies/ext/>\n PREFIX dct: <http://purl.org/dc/terms/>\n PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>\n PREFIX adms: <http://www.w3.org/ns...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Event handler for 'orientationchange' events. If using the keyboard plugin and the keyboard is open on Android, sets wasOrientationChange to true so nativeShow can update the viewport height with an accurate keyboard height. If the keyboard isn't open or keyboard plugin isn't being used, waits for the window to resize ...
function keyboardOrientationChange() { //console.log("orientationchange fired at: " + Date.now()); //console.log("orientation was: " + (ionic.keyboard.isLandscape ? "landscape" : "portrait")); // toggle orientation ionic.keyboard.isLandscape = !ionic.keyboard.isLandscape; // //console.log("now orientation is...
[ "function handleOrientationChange() {\n console.log('orientationchange')\n window.addEventListener('resize', handleResize, { once: true });\n }", "function detectScreenOrientationChange() {\n if (navigator.userAgent.indexOf('Safari') !== -1) {\n window.matchMedia(\"(orientation: portrait)...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
remove flareon function begins here
function removeFlareon() { cells.forEach((currentValue, index) => { if (index !== 1 && index !== 3 && index !== 5 && index !== 7) { //* if it's not one of the end indexes then continue return currentValue.classList.remove('flareonIdle', 'flareonRunUp', 'flareonRunRight', 'flareonRunLeft', 'flareonRun...
[ "function resetFlareonOnFloat() {\n if (cells[flareonPosition].classList.contains('floatAndFlareonLeft')) {\n cells[flareonPosition].classList.remove('floatAndFlareonLeft')\n cells[flareonPosition].classList.add('float-left')\n } else if (cells[flareonPosition].classList.contains('floatAndFlareonRig...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
36) Write a function to add the class "test" to each row in the table
function addaclass() { const row = document.getElementsByTagName("tr"); for (i = 0; i < row.length; i++) { row[i].classList.add("test"); } }
[ "function setRowColorClassTableSummary(doc)\r\n{\r\n\tvar elements = getElementsByClassName(doc, \"summaryTable\");\r\n\tvar table = elements[0];\r\n if (table){\r\n var rowNum = 0;\r\n for (var i = 1,len = table.rows.length; i < len; i++)\r\n {\r\n if(table.rows[i].style.display....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function used to move a Puzzle Piece Up. Accepts the Playing Area, Puzzle Piece Number and array of puzzle pieces, return the new playing area.
function movePieceUp(playingArea, element, puzzlePieces){ // Retrives the offset value of piece from the top margin var topVal = parseInt(puzzlePieces[element - 1].style.top, 10); //Decreases the distance from the margin by 100px puzzlePieces[element - 1].style.top = (topVal - 100) + "px"; //Modifies la...
[ "function movePieceDown(playingArea, element, puzzlePieces){\n\n // Retrives the offset value of piece from the top margin\n var topVal = parseInt(puzzlePieces[element - 1].style.top, 10);\n\n //Increases the distance from the margin by 100px\n puzzlePieces[element - 1].style.top = (topVal + 100) + \"px\"; \n\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Shutdown all puppeteer services CI stop local puppeteer Local stop docker
async function globalTeardown() { if (process.env.CI) { // Close browser created in globalSetup and remove web socket file await global.__BROWSER__.close(); rimraf.sync(DIR); } else { // Connect to docker puppeteer to close browser const wsEndpoint = await getDockerWsEndpoint(); dockerBrowse...
[ "async function stopWebDriver() {\n await Client.stopWebDriver();\n}", "function stop(exitCode) {\n server.close();\n rimraf.sync('webdriver-screenshots*/**/*+(full|regression).png', {});\n if (seleniumChild) {\n seleniumChild.kill();\n }\n }", "async close() {\n // close chokidar watc...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
for loggedin case function for cop quicktab modification in logged in case
function loggedInQuicktabAlter(){ if(($("body").hasClass("logged-in")) && ($("body").hasClass("i18n-en"))){ //cop-header shifted var content = $('.cop-main-header').clone(); $('.cop-main-header').remove(); $('.customized-quicktab-menu .tab-content').before(content); //Removed the "about" tab from quickt...
[ "function loggedOutQuicktabAlter(){\n\t\n\t\tif($(\"body\").hasClass(\"not-logged-in\")){\t\n\t\t\t$('.node-type-work-group .cop-quicktab .resources , .node-type-work-group .cop-quicktab .e-learning , .node-type-work-group .cop-quicktab .experts').wrapAll('<li class=\"wrapped-list\"> </li>');\t\t\t\n\t\t\tif( $('.n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }