query
stringlengths
9
34k
document
stringlengths
8
5.39M
negatives
listlengths
19
20
metadata
dict
Defines restrictions on what cards this attachment can be placed on.
attachmentRestriction(...restrictions) { this.attachmentRestrictions = restrictions.map(restriction => { if(typeof(restriction) === 'function') { return restriction; } return CardMatcher.createAttachmentMatcher(restriction); }); }
[ "canAttach(player, card) {\n if(this.getType() !== 'attachment' || !card) {\n return false;\n }\n\n if(!this.attachmentRestrictions || this.isAnyBlank() || this.facedown) {\n return card.getType() === 'character';\n }\n\n let context = { player: player };\n\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Generates all the eslint config files in this package.
function makeFiles() { const out = {} const isNode = rule => /^node/.test(rule) const splitNodeEnv = splitObject(standardConfig.env, isNode) const splitNodePlugins = splitArray(standardConfig.plugins, isNode) const splitNodeRules = splitObject(standardConfig.rules, isNode) const coreConfig = { ...stand...
[ "generateConfigs() {\n this._createDirs();\n this._readFiles(this.source)\n .then(files => {\n console.log('Loaded ', files.length, ' files');\n const configs = this._loadConfigs(files);\n const common = this._getCommonJson(configs);\n\n this._writeData(common, 'default', 'json');\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
support highlighting and capture data when leaving fields
function highlight(field) { if(field.getAttribute('readonly')) { return; } if(field.select != null) field.select(); field.onblur=unhighlight; // field.oldBackgroundColor = computedStyle(field,'backgroundColor','background-color'); field.style.backgroundColor='#e6e6e6'; }
[ "function highlight(field) {\r\n\t\tif(field.getAttribute('readonly')) {\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tif(field.select != null)\r\n\t\tfield.select();\r\n\t\tfield.onblur=unhighlight;\r\n\t\t// field.oldBackgroundColor = computedStyle(field,'backgroundColor','background-color');\r\n\t\tfield.style.backgroundCol...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function getCompletedWorkouts returns the following selected workouts
function getCompletedWorkouts(res, mysql, context, userID, complete){ var sql = "SELECT Workouts.workoutName, Workouts.bodyPart, Workouts.linkToVideo, UserWorkouts.sets, UserWorkouts.reps FROM UserWorkouts, Workouts WHERE userID=? and UserWorkouts.completed=`Y`"; var inserts = [userID]; mysql.po...
[ "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" ] ] } }
Clicking the add button opens a dialog to assign workflows to sites & folders.
function openAssignWorkflowSitesAndFoldersDialog() { // The variable selectedWorkflow is in the closure scope $.perc_assign_workflow_sites_folder_dialog.createDialog(selectedWorkflow, updateSitesFolderAssignedSection); }
[ "_handleCommandAddWorkflow(options)\n {\n var workflow = new Workflow({project: options.project.get('url'), name: 'untitled'});\n workflow.save({}, {success: (model) => this._handleCreateSuccess(model, this._collection)});\n }", "function addClick() {\n // open the modal with the create...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Removing the max element from a heap
extractMax(){ // bubble down // swap first and last element. // then pop [this.values[0],this.values[this.values.length-1]] = [this.values[this.values.length-1], this.values[0]] // console.log(element + ' removed from the heap'); this.values.pop(); let index = 0; ...
[ "delete() {\n if (this.storage[0] === undefined) return undefined;\n // according to heap property, remove the max and put the min to the front of heap\n const max = this.storage.shift();\n const min = this.storage.pop();\n this.storage.unshift(min);\n // swapping the min until positioning it in t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
if project is being viewed as https then force iframe src to be https too
function iFrameCheck(txt) { // if project is being viewed as https then force iframe src to be https too if (window.location.protocol == "https:") { function changeProtocol(iframe) { if (/src="http:/.test(iframe)){ iframe = iframe.replace(/src="http:/g, 'src="https:').replace(/src='http:/g, "src='https:"); ...
[ "function useSecureSchema(element) {\n if (element.attribs && element.attribs.src) {\n if (element.attribs.src.indexOf('https://') === -1) {\n if (element.attribs.src.indexOf('http://') === 0) {\n // Replace 'http' with 'https', so the validation passes\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Initializes forest background by creating a given number of trees.
initTrees(number) { //Front rows: let distance = this.lastTreePosition / this.numberOfTreeRows * 2; //Distance to next tree row. let positionCurrent = this.lastTreePosition; for(let i = this.trees.length; i < number; i++) { let imageNumber = this.treeCounter % this.imageIniti...
[ "function createForest() {\n\tfor (i=0;i<500;i++) {\n\t\t// random point\n\t\tvar wsz = WORLD_SIZE * TILE_SIZE;\n\t\tvar x = Math.random() * wsz;\n\t\tvar z = Math.random() * wsz * Math.sqrt(3)/2;\n\t\tvar y = find_ground_height_at(x,z);\n\t\t\n\t\tobj = new THREE.Mesh( treeBase, treeMat );\n\t\tobj.GUID = getGUID(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets the view which displays a list of available simulations
function simulationListView(){ //sets the header view defaultheaderView(); //clears everything on the page clearNav(); clearSection(); var simulations = get_local_simulation_list(); //adds the list of simulations into the page var html = SimulationDataListTemplate(simulations); //gets the container of t...
[ "function simulationListView(){\n\t//sets the header view\n\tdefaultheaderView(); \n\t//clears everything on the page\n\tclearNav();\n\tclearFooter();\n\tclearSection();\n\t//gets the local application and the local session\n\tvar local_application = get_local_application();\n\tvar local_simulation_list = get_local...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
The tree view element representing the target.
get target() { return this.view.domConverter.mapDomToView( this.domTarget ); }
[ "get target () {\n var parentNode = dom(this).parentNode;\n // If the parentNode is a document fragment, then we need to use the host.\n var ownerRoot = dom(this).getOwnerRoot();\n var target;\n\n if (this.for) {\n target = dom(ownerRoot).querySelector('#' + this.for);\n } else {\n targe...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Writes any iterable value to the buffer. Used by [[ArrayType]] and [[SetType]]. Appends value bytes to an [[AppendableBuffer]] according to the type.
function writeIterable({ type, buffer, value, length }) { buffer.addAll(flexInt.makeValueBuffer(length)); for (const instance of value) type.writeValue(buffer, instance); }
[ "writeValue(buffer, value) {\n assert.isBuffer(buffer);\n assert.instanceOf(value, Array);\n write_util_1.writeIterable({ type: this.type, buffer, value, length: value.length });\n }", "writeValue(buffer, value) {\n assert.isBuffer(buffer);\n assert.instanceOf(value, Array);\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Completes a profiling measure operation being executed as part of the set.
completeMeasure() { if (this._profiles.length === 0) return; let current = this._profiles[this._profiles.length - 1]; current.complete(false); }
[ "endBenchmark() {\n this.end = perf_hooks_1.performance.now();\n this.time = this.end - this.start;\n }", "function endMeasure(name, element) {\n\tvar height;\n\t\n\tif (element) { // Wait till browser finish rendering\n\t\theight = element.clientHeight; \n\t\tsetTimeout(function() {\n\t\t\tsetMe...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Convert internal attachments (every attachment creates a new FB message) and add to message.
function addAttachments (channelUserId, message, primaryFBMessage, postDataItems) { if (!message.attachments || !message.attachments.length) { return; } const fbAttachments = convertToFacebookAttachments(message.attachments); fbAttachments.map(fbAttachment => { let shell; let newShellMessage; if (primaryFB...
[ "processAttachments(sender, attachments) {\n this.preProcess(sender);\n\n console.log(attachments);\n\n switch (this.users.get(sender).currentState) {\n\n case 'create-note':\n quill.addAttachments(this.users.get(sender).note, attachments)\n break;\n\n default:\n this.sendTex...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
The Commit Block List operation writes a blob by specifying the list of block IDs that make up the blob. In order to be written as part of a blob, a block must have been successfully written to the server in a prior Put Block operation. You can call Put Block List to update a blob by uploading only those blocks that ha...
commitBlockList(blocks, options) { const operationArguments = { blocks, options: coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {}) }; return this.client.sendOperationRequest(operationArguments, commitBlockListOperationSpec); }
[ "function commitBlockList() {\n var uri = submitUri + \"&comp=blocklist\";\n var requestBody = getCommitRequestBody();\n\n $.ajax({\n url: uri,\n type: \"PUT\",\n headers: { \"x-ms-blob-content-type\": selectedFile.type },\n data: requestBody\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets the set of role assignments for this item
get roleAssignments() { return new RoleAssignments(this); }
[ "assignmentsForRole (teamId, roleId, projectId) {\n let teamRole = ContributorTeamRoles.findOne({ contributorId: this._id, teamId: teamId, roleId: roleId });\n if (teamRole) {\n return teamRole.projectAssignments(projectId);\n }\n }", "function RoleAssignments(baseUrl, path) {\n if (path ===...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
find number for Char
getCharNum(letter) { if (!this.initialized) return; return this.options.mapping.indexOf(letter); }
[ "function characterToNumber(char){\n let charCodeOfA = \"A\".charCodeAt(0);\n let charCodeOfChar = char.charCodeAt(0);\n return charCodeOfChar - charCodeOfA + 1;\n}", "function findChar(str, int) {\n return str.charAt(int);\n}", "function intFromChar(c){\n if (c == '0') return 0;\n else if (c == '1'...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
this is to purchase a single clickUpgrade need to increase the quantity of item purchased by 1
function purchaseSingleUpgrades(upgradeChoice){ let purchSing = clickUpgrades[upgradeChoice] let buySing = purchSing + clickUpgrades[upgradeChoice].quantity if (cheese >= clickUpgrades[upgradeChoice].price) { clickUpgrades[upgradeChoice].quantity ++ cheese -= clickUpgrades[upgradeChoice].price ...
[ "increaseQty(cartItem){\n cartItem.product.inStock--\n cartItem.quantity++\n }", "function purchaseAutoUpgrades(autoUpgradeChoice) {\n let purchSing = automaticUpgrades[autoUpgradeChoice]\n let buySing = purchSing + automaticUpgrades[autoUpgradeChoice].quantity\n if (cheese >= au...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
returns bounds of the given tile in pixels
function tilePixelsBounds( tx, ty, zoom ) { var bounds = this.tileMetersBounds( tx, ty, zoom ); var min = this.metersToPixels(bounds[0], bounds[1], zoom ); var max = this.metersToPixels(bounds[2], bounds[3], zoom ); return [ min[0], min[1], max[0], max[1] ]; }
[ "_tileBoundsWGS84(tile) {\n var e = this._tile2lon(tile[0] + 1, tile[2]);\n var w = this._tile2lon(tile[0], tile[2]);\n var s = this._tile2lat(tile[1] + 1, tile[2]);\n var n = this._tile2lat(tile[1], tile[2]);\n return [w, s, e, n];\n }", "function bounds2d(height, width, htiles, wtiles, h, w) {\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
fac=>datos de los productos tk=>numero de ticket
function dibujar_factura(fac,tk){ console.log("function dibujar_factura"); console.log(fac); var vf=obtener_valores_formulario("formVentaProductos"); var tbCuerpoFactura=document.getElementById("tbCuerpoFactura"); tbCuerpoFactura.innerHTML=""; var numCantidad=document.getElementById("numCantidad"); tbC...
[ "function t_CrearTicket(esCopia) {\n\tvar ticket = new Ticket();\n\n\n\t/* Iniciamos un nuevo ticket, trae num del servidor, etc */\n\tticket.IniciaNumeroDeSerie(ModoDeTicket);//trae del servidor etc\n\t\n\t/* Dinero entregado, y quien es el dependiente */\n\t\n\tif( modoMultipago ){\n\t\tticket.multipago = true;\t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
valueCheck ensures the type is `arrayOf(p.string)` if `multiple` is set and `p.string` otherwise.
function valueCheck(props, ...args) { if (props.multiple) return p.arrayOf(valueShape).isRequired(props, ...args) return valueShape(props, ...args) }
[ "function assertIsArrayOrString(value, message) {\n\t\tif (!isArray(value) && 'string' !== typeof value) {\n\t\t\tfail(typeof value, 'Array or string', message || ('expected an array or string'));\n\t\t}\n\t}", "_validateValue() {\n const that = this,\n value = that.value;\n\n if (!Array....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Change a card label from `done`
function switchFromDoneLabel(card, label) { $(card).removeClass('issue-list-item-done'); $(card).addClass('issue-list-item-' + label); }
[ "function switchToDoneLabel(card, label) {\n $(card).addClass('issue-list-item-done');\n $(card).removeClass('issue-list-item-' + label);\n}", "function changeCardForename() {\n\tvar textName = document.getElementsByClassName('card-label')[0];\n\ttextName.textContent = \"Forename:\"\n\ttextName.textContent += f...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Change class of the dot
setDotActive(dotElement) { [].forEach.call(document.querySelectorAll('.active'), (el) => { el.classList.remove('active'); }); dotElement.classList.add('active'); }
[ "function setDotClass() {\n if (allDots[preIndex].classList.contains(\"currentDot\"))\n allDots[preIndex].classList.remove(\"currentDot\");\n allDots[currentPictureIndex].classList.add(\"currentDot\");\n}", "function createDot(dot, className) {\n const dotEl = document.createElement(\"div\");\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
What genres are not in Lance's favorites? Write a function that finds what genres are NOT in Lance's favorites
function checkGenres(genre, faves) { let notFave = []; for (let i = 0; i < genre.length; i++) { let found = false; for (let j = 0; j < faves.length; j++) { if (genres[i] == faves[j]) { found = true; break; } } if (found == false) { notFave.push(genres[i]); } ...
[ "function getNonFictionBooks() {\n let result = myBooks.filter((book) => book.genre === \"non-fiction\");\n return result;\n}", "function nonFavorite(gist) {\n return (favoriteIDs.indexOf(gist.id) == -1);\n}", "function filterGenre(shows, genre) {\n let foundShow = [];\n // user selects genre from dr...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
These event listeners listen for a change in the title, tagInput or qEditor, if any change was made, this.edited is set to true, which is used to fire a confirmation event if leaving an unsaved recipe.
constructChangeListeners() { // TODO it would be best to remove the event listeners after they are fired // and then re-instantiate them after a new recipe loads // Listener for the editor itself this.qEditor.on('text-change', () => { this.edited = true }) // Listener for the tagInput ad...
[ "clickedAddRecipe() {\n this.openEditorCallback();\n }", "onEdit(event) {\n if (this.options.onDidEdit) {\n this.options.onDidEdit({\n event,\n node: this.editing.node.data,\n editType: this.editing.node.renaming ? 'rename' : 'create',\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Implements smart indentation for selected text. Its parameters are the start/end points of a text range, and an optional Boolean where "true" indicates that we want to unindent rather than indent the selected text.
indentLines (start, end, backwards = false) { for (var i = start; i > 0 && this.text[i - 1] !== '\n'; i--); let replace = this.text.slice(i, end); let insert, offset; if (backwards) { insert = (replace[0] === "\t" ? replace.slice(1) : replace).replace(allNewLineTabs, "\n"); offset = (i < s...
[ "indent() {\n var session = this.session;\n var range = this.getSelectionRange();\n\n if (range.start.row < range.end.row) {\n var rows = this.$getSelectedRows();\n session.indentRows(rows.first, rows.last, \"\\t\");\n return;\n } else if (range.start.col...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
create a function that takes an ingredient that's selected and take 1 or +1 to change ingredients on hand
function changeIngredientsOnHand(ingredient, positive1Negative1) { for (var i = 0; i < recipeBook.length; i++) { for (var j = 0; j < recipeBook[i].ingredients.length; j++) { if (recipeBook[i].ingredients[j] === ingredient) { recipeBook[i].ingredientsOnHand += positive1Negative1; } } } }
[ "function onIngredientSelect(event) {\n if (event.target.className === 'buttonOff') {\n event.target.className = 'buttonOn';\n selectedIngredients[event.target.value] = 1;\n changeIngredientsOnHand(event.target.value, 1);\n } else {\n event.target.className = 'buttonOff';\n selectedIngredients[even...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
+ Run git related commands +
function runGitCommands(args, cwd, cb, commands, message) { exec('git --version', { cwd, stdio: 'ignore' }, err => { if (err) { cb(); return; } const spinner = ora(message).start(); runSeries(commands, error => { if (error) { spinne...
[ "function git(cmd, args = \"\") {\n execSync(\"git \" + cmd + \" \" + args);\n}", "function git(...args) {\n\treturn run('git', ...args);\n}", "static async git(arguments_, options = {}) {\n return System.run('git', arguments_, { cwd: this.projectPath, ...options });\n }", "function git(args) {\n cons...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns the list of countries the user has selected.
function getSelectedCountries() { return countries.filterBounds(ee.Geometry.MultiPoint(selectedPoints)); }
[ "function getSelectedCountries() {\n\t\t\t\n\t\t\tvar items = [];\n\t\t\t$('#chk_c option:selected').each(function(){ items.push($(this).val()); });\n\t\t\treturn items.join(',');\n\t\t}", "function getSelectedCountries() {\n var selected = [];\n \n for(var i = 0; i < map.dataProvider.areas.length; i++) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Check if all the gifs are set to the right frame.
function areGifWellSet(){ let bool = true; let i = 0 ; const len = gifClickZone.length; while(i < len && bool){ if(gifClickZone[i].id[2][gifOnScene[i].get_current_frame()] != 2){ bool = false; } i++; } return bool; }
[ "function openAll() {\n let allOK = true;\n\n for(let i = 0; i <= maxX; i++) {\n for(let j = 0; j <= maxY; j++) {\n with(cellArray[arrayIndexOf(i, j)]) {\n if(!isExposed) {\n if((isBomb) && (!isFlagged)) {\n boardImages[imageIndexOf(i, j)].src = bombDeath.s...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Redraws the transcription SVG.
function redraw() { if (mainSvg == null) return; let textfield = document.querySelector("#textfield"); let sentence = Parse.ParseSentence(textfield.value); Render.render(mainSvg, sentence); if (downloadButton != null) downloadButton.disabled = false; }
[ "redrawGr() {\n\t\t\tthis.clearGr();\n\t\t\tthis.drawGr();\n\t\t}", "function xTextRefresh(){\nxText.attr(\"transform\",\n \"translate(\" +\n ((svgWidth - labelArea)/2 +labelArea) + \",\" +\n (svgHeight - margin +textPadBot) + \")\"\n );\n }", "function repaint() {\n\t\t\tif (_element) {\n\t\t\t\t_elem...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
TODO this is terrible logic to find an attack target, it needs to be alot better...
findAttackTarget(creep) { let hostile = creep.pos.findClosestByPath(FIND_HOSTILE_CREEPS, {filter: (enemy) => !global.Friends[enemy.owner.username]}); if (!hostile) { hostile = creep.pos.findClosestByPath(FIND_HOSTILE_STRUCTURES, {filter: (enemy) => !global.Friends[enemy.owner.username]});...
[ "calculateTarget () {\n\t\tlet currentMaximum = this.attackThreshold;\n\n\t\tlet currentTarget = undefined;\n\n\t\tif (Game.creativeMode) {\n\t\t\treturn currentTarget;\n\t\t}\n\n\t\tfor (let i = 0; i < this.attackTargets.length; i++) {\n\t\t\tlet target = this.attackTargets[i];\n\t\t\t// check that target is not s...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Redraw the data set with a given window.
function redraw(wcol) { // Limit to 0 and len-windowsize. wcol = wcol.clamp(0, _COLLENGTH - windowsize); // Compute the window. var data = emptyBlock(); var yindex = 0; //_CHECK : replace with the y position from the left panel (or whichever panel controls the y axis) for (var row=0; row<windowsize; ++row){ fo...
[ "function redraw_Y(wrow) {\n\t// Limit to 0 and len-windowsize.\n\twrow = wrow.clamp(0, _ROWLENGTH - windowsize);\t\n\t// Compute the window.\n\tvar data = emptyBlock();\n\tvar xindex = 0; //_CHECK : replace with the x position from the left panel (or whichever panel controls the x axis)\n\tfor (var row=0; row<wind...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
apply account receivable rule to the credit note header if no existing invoice 1.0.12 created 31/8/2012 MJL
function applyARRuleToCreditNoteHead() { var arInternalID=0; arInternalID = determineAccountReceivable(channelDesc); creditMemo.setFieldValue('account', arInternalID); }
[ "function applyARRuleToInvoiceHead()\r\n{\r\n\r\n\tvar arInternalID=0;\r\n\t\r\n\tarInternalID = determineAccountReceivable(channelDesc);\r\n\tinvoiceRecord.setFieldValue('account', arInternalID);\r\n\r\n}", "function postCreditNote(invIntID)\r\n{\r\n\t\r\n\tvar creditMemoID = 0;\r\n\tvar invLineNum = 0;\r\n\r\n\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
format xaxis date, based on the min and max dates of the data set to figure out how precise we want to be
function formatXAxisDate(date, min, max) { var date = new Date(date); if (max - min < 1000 * 60 * 60 * 24) return date.toLocaleTimeString().substring(0,5); else return date.getDate() + "/" + (date.getMonth() + 1) + "/" + date.getYear(); }
[ "function getXAxisFormat() {\r\n\t\t/*Check if the timespan bigger then 1 day*/\r\n\t\t//var d_start = new Date($scope.startTime.substring(6, 10),$scope.startTime.substring(3, 5),$scope.startTime.substring(0, 2));\r\n\t\t//var d_end= new Date($scope.endTime.substring(6, 10),$scope.endTime.substring(3, 5),$scope.end...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Rotate the cubes based on random values for player 2
function roll2(dice) { let xValue = getRandom(max,min); let yValue = getRandom(max,min); dice.css('-webkit-transform', 'rotateX('+xValue+'deg) rotateY('+yValue+'deg)'); console.log(Resultplayer2(xValue,yValue)); display2(); }
[ "rotate_u() {\n var cubies = this.cubies.map(c => c.copy()); // Creates a deep copy of this.cubies\n let rot = quat_1.default.fromAxisAngle(vec3_1.default.up, -Math.PI / 2);\n this.apply_rotation(cubies.filter(c => c.position.y == 1), rot);\n return new CubeState(cubies);...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Controls closing of TOC
function closeToc(lastFrame){ if(lastFrame == true){ cpCmndPause = true; cpCmndTOCVisible = false; } else{ cpCmndResume = true; cpCmndTOCVisible = false; } }
[ "close() {\n this.header.on('mousedown', null);\n super.close();\n }", "function openCloseList(finTOC, curLvl, prevLvl, listElement) {\n // cur-prev = + --> new nested list needed\n // cur-prev = - --> close current list\n // cur-prev = 0 --> no action needed\n diff = curLvl - prevLvl...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Repopulates the list handling any property changes.
function repopulateList() { instruments_list_obj.clear(); populateList(instruments_list_obj); }
[ "function clearAndRepopulate(){\n clearCurrent();\n populateList();\n}", "function loadPropertyList(newPropertyList) {\n propertyList=clonePropertyList(newPropertyList);\n setTrackingPropertyList();\n _clearFilters();\n _addFilters();\n _updateSliders();\n}", "function refreshPropertyList(){\n\tView.pane...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
tfnewCenterMap This function will center the map, showing all markers attached to this map
function tfnewCenterMap( map, zoom = 16 ) { // Set $ as jQuery. const $ = jQuery; // vars var bounds = new google.maps.LatLngBounds(); // loop through all markers and create bounds $.each( map.markers, function( i, marker ){ var latlng = new google.maps.LatLng( marker.position.lat(), marker.position...
[ "centerMap() {\n map.setCenter([31.900092, 27.318739])\n map.setZoom(4.5)\n }", "function centerMap() {\n \tmap.setCenter({\n \t\tlat: lat,\n \t\tlng: lng\n \t});\n \tmap.setZoom(17);\n }", "function centerMap(){\n map.fitBounds(b);\n map.setZoom(z);\n }", "...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Just started a idea about ..... energy levels :P
function energyLevels(levelsList, ev) { const queue = new Queue(); const toUpEnergyLevel = []; for (let i = 0; i < levelsList.length; i++) { queue.enqueue(levelsList[i]); // get a list of energy(ev), and queue all of them } while (queue.size() > 1) { for (let i = 0; i < ev; i++) { queue.enqueue...
[ "function EnergyLogic(v,t){\n\n /*\n Energy/Work Units\n\n All unit values are conversions of J (Joule) at the value of 1 converted into each unit.\n */\n var l = {\n AJ:1e18,\t\t\t\t\t//Attojoule\n BTU:1/1055.05585262,\t\t//British Thermal Unit\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sets `different_shipping_address` which controls appearance of "Different Shipping Address" form
handleClickDifferentShippingAddress(e){ const { rfq } = this.props if( ! e.target.checked ){ rfq.shipping_address = { company: '', contact: '', street: '', city: '', state: '', zip: '', country: '' } this.props.updateRFQ( rfq ) this...
[ "function escope_shop_shipto_different_address() {\r\n $(document.body).on('click', '#checkbox-ship-to-different-address', function(e) {\r\n $(\"#checkout-shipping-address\").toggle(this.checked);\r\n });\r\n }", "function onBasketChangeWhileDifferentStoreShippingAddressSet() {\n va...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates a promise that returns a connected MQTT client initialized from environment options or returns null if no MQTT environment options are specified.
function createClient() { if (MQTT_URL && MQTT_TOPIC) { try { console.log('Initializing MQTT client') const options = JSON.parse(MQTT_OPTIONS) if (MQTT_USERNAME && MQTT_PASSWORD) { Object.assign(options, { username: MQTT_USERNAME, password: MQTT_PASSWORD, }) ...
[ "function initMqttClient() {\n // With Google Cloud IoT Core, the username field is ignored, however it must be\n // non-empty. The password field is used to transmit a JWT to authorize the\n // device. The \"mqtts\" protocol causes the library to connect using SSL, which\n // is required for Cloud IoT Core.\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns the current ambient light color by looking at the time of day and the color gradient
updateAmbientLightColor() { // Calculate the position on the gradient by looking at the time (0..1, 0.5 = 12:00) var h = (this.time.getHours() / 24) * 24; var m = this.time.getMinutes(); // Calculate the time step taking minutes into accout aswell var hour = (0.5 * (h * 60 + m))...
[ "function ambient_light (r, g, b) {\r\n a_red = r;\r\n a_green = g;\r\n a_blue = b;\r\n}", "async setupGradient() {\n if (!this.data.sun) { await this.setupSunrise() }\n \n if (this.isNight(this.now)) {\n return {\n color() { return [new Color(\"16296b\"), new Color(\"021033\"), new Color(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
adds event listeners to help buttons
function actionHelp(helpAll) { "use strict"; for(i = 0; i < helpAll.length; i++) { helpAll[i].addEventListener('click', help); } }
[ "function setupHelpButton()\n{\n\thelpButton.setText(\"Show Help\");\n\t\n\tvar helpButtonHandler =\n\t{\n\t\tactionPerformed: function(evt)\n\t\t{\n\t\t\thelpEnabled = !helpEnabled;\n\t\n\t\t\tif(helpEnabled)\n\t\t\t{\n\t\t\t\thelpButton.setText(\"Hide Help\");\n\t\t\t\tcckModule.setHelpEnabled(helpEnabled);\n\t\t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Create an app for the specified `projectRoot`. `projectId` is optional, if you don't specify we'll ask the user for one.
async createApp(projectRoot = store.projectRoot, projectId) { try { const project = await projectRoot.createProject(projectId) if (project) { store.showEditor(project.path) store.showNotice(`Created ${project.type} ${project.projectName}.`) } } catch (e) { store.showError...
[ "function createapp(){\n var project = getProjectInfo()\n createTiApp(project.appname, atom.config.get(\"ti-atom.id\"), atom.config.get(\"ti-atom.url\"), project.dirname);\n}", "async function createApp(appName, isPostgres, workspaceDir, rootDir) {\n const child = spawnPiped(\n [\n 'node',\n resol...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This defines the skew matrices (also are called shear matrices) about the axes, takes in a point and an angle, and return a transformed point
function skewXaxis(point, theta) { var pointVec = point; var M = [[1, Math.tan(theta), 0], [0, 1, 0], [0, 0 ,1] ]; var pointRot = math.multiply(M,pointVec); return pointRot; }
[ "function skew(x, y, a, genes, mm = new THREE.Matrix4()) {\n if (!isFinite(a))\n return undefined;\n mm.elements[x + 4 * x] = 1;\n mm.elements[y + 4 * y] = 1;\n mm.elements[x + 4 * y] = a;\n mm.elements[y + 4 * x] = a;\n return mm;\n}", "static rotationAroundPoint(angle, point) {\n ret...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
delete or remove bookmark by url
function deleteBookmark(url) { // get bookmarkArray from local storage; var bookmarkArray = JSON.parse(localStorage.getItem('bookmarks')); // loop through bookmark array and check if url tobe deleted equals the one in local storage for(var k = 0; k < bookmarkArray.length; k++){ if(bookmarkArra...
[ "function removeBookmark(url) {\n var db = getDatabase();\n var respath=\"\";\n db.transaction(function(tx) {\n var rs = tx.executeSql('DELETE FROM bookmarks WHERE url=(?);', [url]);\n// if (rs.rowsAffected > 0) {\n// console.debug(\"Url found and removed\");\n// } else {\n/...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
orderByID specifies ascending ID order for the query results. On multiple calls, only the last one is considered.
orderByID() { this.sort = { fieldPath: '_id', desc: false }; return this; }
[ "orderByIDDesc() {\n this.sort = { fieldPath: '_id', desc: true };\n return this;\n }", "async getOrderByID(id){\n return await fetch(ORDER_API_BASE_URI+\"/\"+id,{\n method:'GET',\n }).then(response =>{\n return response.json();\n }).catch(reason => {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Calculates area of four walls
calcWallsArea( height, length, width ){ const wallsArea = ( ( height * length ) + ( height * width ) ) * 2 ; return wallsArea ; }
[ "function area(w,h){\n return w * h \n}", "function areaOfCube (l, w, h) {\n area = l * w * h\n return area;\n}", "_get_combined_floor_area() {\n const {zone} = this._homeValues;\n let combinedFloorArea = 0;\n zone.zone_floor.forEach((floor) => {\n combinedFloorArea += T...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
valids start and end points, returning true if valid and false if not start is an [x, y] coordinate array of the starting letter end is an [x, y] coordinate array of the ending letter dir is the direction where 1 is diagonal, 0 is horizontal, and 1 is vertical
function valid(start, end, dir) { let i, j; // iterators // invalid if out of bounds if (end[1] < 0 || end[1] >= ROWS || end[0] < 0 || end[0] >= COLS) return false; // loop through all elements to make sure that spot isn't taken if (dir === 1) { // vertical for ...
[ "function isStartOrEnd(x, y) {\n\tif (x == currSX && y == currSY) {\n\t\treturn true\n\t} else if (x == currEX && y == currEY) {\n\t\treturn true\n\t} else {\n\t\treturn false\n\t}\n}", "function validateStartEnd(start,end){return!!start&&!!end&&start.isValid&&end.isValid&&start<=end;}", "validCol(startCoordina...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
end `if` statement (needed if gen.if was used only with condition)
endIf() { return this._endBlockNode(If, Else); }
[ "endIf() {\n return this._endBlockNode(If, Else);\n }", "endIf() {\n\t return this._endBlockNode(If, Else);\n\t }", "endIf() {\n return this._endBlockNode(If, Else);\n }", "exitIfStatement(ctx) {\n\t}", "exitIf_stmt(ctx) {\n\t}", "exitIf_statement(ctx) {\n\t}", ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
withWindow: a component wrapper that wraps the frame state and puts the state in a plane which resizes on canvas resize.
function withWindow(PlaneFrame, options) { // get the tags the user wants for state reducers and dimension changes let { state, dimensions, frameSource } = (options || {}); if (!state) { state = 'state'; } if (!dimensions) { dimensions = 'dimensions'; } if (!frameSource) { frameSource = 'frameSource'; } //...
[ "function putInWindow(frame, width, height) {\n return {\n type: 'root',\n width,\n height,\n children: [\n { \n type: 'window',\n worldMatrix: [\n [width/2, 0, width/2],\n [0, -height/2, height/2],\n [0, 0, 1],\n ],\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Recursively update parents selection.
function update_parent_selection( db_tree, parent_id ) { if ( !parent_id ) { return; } var parent_node = $('#node-' + parent_id + '-check'); var higher_parent_id; if ( is_subtree_selected( db_tree, parent_id ) ) { parent_node.removeClass('pl-tree-node-un...
[ "assignParentSelection(node, siblingsSelection, selected) {\n const isLeaf =\n node[this.keyAttr] !== undefined && !this.parentKeyNodeMap.has(node[this.keyAttr]);\n if (isLeaf) {\n if (selected.selectedLeaves.has(node[this.keyAttr])) {\n // eslint-disable-next-line no-param-reassign\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
creates a tower of boxes
function setupTower(){ //you code here for(var i=0; i<6; i++) { for(var j=0; j<3; j++) { colors.push(color(0, random(150,255), 0)); boxes.push(Bodies.rectangle(750+j*80, 0, 80, 80)); } } World.add(engine.world, boxes); }
[ "function setupTower() {\n\n //you code here\n for (let i = 0; i < 6; i++) {\n for (let j = 0; j < 3; j++) {\n var box = Bodies.rectangle(700 + j * 80, 140 + i * 80, 80, 80, {\n angle: 0,\n restitution: 0.95,\n friction: 0.9\n });\n\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
called once the SOCKS proxy has connected to the specified remote endpoint
function onhostconnect(err, result) { if (err) return fn(err); var socket = result.socket; var s = socket; if (opts.secureEndpoint) { // since the proxy is connecting to an SSL server, we have // to upgrade this socket connection to an SSL connection if (!tls) tls = __webpack_require...
[ "function onproxyconnect (err) {\n if (err) return fn(err);\n socks.connect(opts.host, opts.port, onhostconnect);\n }", "function onhostconnect (err, socket) {\n if (err) return fn(err);\n var s = socket;\n if (secureEndpoint) {\n // since the proxy is connecting to an SSL server, we have\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
(en) check, if this page is a quiz (de) teste, ob es sich bei dieser Seite um ein Quiz handelt
function isNotQuiz() { var quiz = "www1.spiegel.de"; var isQuiz = document.URL.indexOf(quiz) != -1; return (!(isQuiz)); }
[ "function validatePage() {\n ////debugger;\n if (pages[SeqID][innerPage][\"type\"] == \"page\" || pages[SeqID][innerPage][\"type\"] == \"summary\") {\n isAnswered = true;\n }\n else {\n isAnswered = true;\n checkAnswer();\n }\n}", "function pageIsLessonAndArticleHasCertificateC...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
NOTE This function is responsible for calculating/returning the total of cheese collected according to how many autoUpgrades the user has
function collectAutoUpgrades() { let passiveCheeseIncome = 0; for (let key in automaticUpgrades) { passiveCheeseIncome += automaticUpgrades[key].quantity * automaticUpgrades[key].multiplier; } cheese += passiveCheeseIncome; document.getElementById('CPS').innerText = passiveCheeseIncome.toString(); updat...
[ "function purchaseAutoUpgrades(autoUpgradeChoice) {\n let purchSing = automaticUpgrades[autoUpgradeChoice]\n let buySing = purchSing + automaticUpgrades[autoUpgradeChoice].quantity\n if (cheese >= automaticUpgrades[autoUpgradeChoice].price) {\n automaticUpgrades[autoUpgradeChoice].quantity ++\n chees...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Set user Operation from devicemanager Fa, this interface can only used by devicemanager Fa.
setUserOperation(operation) { this.log('setUserOperation: ' + operation) if (dmClass != null) { var data = dmClass.setUserOperation(operation); this.log('setUserOperation result: ' + JSON.stringify(data)) } else { this.log('deviceManagerObject not exit') ...
[ "function restoreUserOperations() {\n\t\t\t\trequest.get(\"rest/operation/userOperationsList\").then(function(answer) {\n\t\t\t\t\tvar userOperations = JSON.parse(answer, true);\n\t \tarray.forEach(userOperations, function(op) {\n\t \t\taddNewTab(\n\t \t\t\t\t{id: op.id, message: op...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Generate (or fetch a cached) user ID
GenerateUserID() { return this.Cache.Wrap('user_id', () => { // generate new UUID if cache hit fails const newUserID = uuid(); this.Log(`Generated new UserID ${newUserID}`); return Promise.resolve(newUserID); }, 43200000); }
[ "generateUserID() {\n return this.cache.wrap('user_id', () => {\n // generate new UUID if cache hit fails\n const newUserID = uuid();\n\n this.log(`Generated new UserID ${newUserID}`);\n\n return Promise.resolve(newUserID);\n }, this[symbolUserIDCacheTime]);\n }", "function generateUser...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Load sample locations data on startup. The locations are retrieved from the node server.
function loadSampleLocations() { $.ajax({ url: "/api/sample-locations", data: {}, success: function(data, status) { if (status === "success") { var sampleLocations = data.sampleLocations; createMarkersForMultiplePlaces(sampleLocations); } }, error: function(error, stat...
[ "function loadSamples() {\n bLoader.loadBufferList(sampleBuffers, sampleUrls, function() {\n\t\tsamplesLoaded = true;\n\t});\n}", "function InitializeAllWorldPlace() {\n\tallWorldPlace = readCSVModule.LoadWorldData();\n}", "function loadData() {\n locationsFactory.getAllLocations()\n .success...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
decrese font size and draw to canvas
function onDecreaseFontSize() { decreaseFontSize() let elFont = document.querySelector('.font-size-display') elFont.innerHTML = gMeme.currText.size draw() }
[ "function setFontSize() {\n var fsizeW = Math.round(can.width / 16),\n fsizeH = Math.round(can.height / 16);\n\n if (fsizeW < fsizeH) {\n diag.fsize = fsizeW;\n } else {\n diag.fsize = fsizeH;\n }\n ctx.font = diag.fsize + \"px sans-serif\";\n }", "function _measureTextSize(): void ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
END :: TileEditor UI Interaction Add widget to localStorage then refresh
function addWidget(widget_id, tile_location, storage_data) { widgets = storage_data.tiles; var extensionID = chrome.extension.getURL("").substr(19, 32); var scope = angular.element("#widgets").scope(), installedWidgets = scope.widgets, installedApps = scope.apps, obj = installedWidgets[w...
[ "function _updateWidgetStorage() {\n storage.putObjectValue(vm.storageName, vm.widgetInfo);\n }", "function addWidget(widget_id, tile_location, storage_data) {\n let widgets = storage_data.tiles;\n\n let scope = angular.element(\"#widgets\").scope(),\n installedWidgets = scope.widgets,\n ins...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Increments the horizontal scroll position of a node.
function incrementHorizontalScroll(node, amount) { if (node === window) { node.scrollBy(amount, 0); } else { // Ideally we could use `Element.scrollBy` here as well, but IE and Edge don't support it. node.scrollLeft += amount; } }
[ "function incrementHorizontalScroll(node, amount) {\n if (node === window) {\n node.scrollBy(amount, 0);\n } else {\n // Ideally we could use `Element.scrollBy` here as well, but IE and Edge don't support it.\n node.scrollLeft += amount;\n }\n}", "function incrementHorizontalScroll(node, amount) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
given a word from this.words, find currentWord in this.chains and return a random word from this.chains[word]
getNextWord(currentWord) { console.log("getNextWord ran and currentWord is:", currentWord); let randomIdx = Math.floor(Math.random() * this.chains[currentWord].length); let newWord = this.chains[currentWord][randomIdx]; return newWord; }
[ "_getNextWord(word) {\n // find chain of possible words\n let chain = this.chains[word];\n\n // pick one from chain\n return chain[Math.floor(Math.random() * chain.length)];\n }", "getWord(){\n\t\t//generate a randome number between 0 and 1\n\t\tvar r = Math.random();\n\t\tvar sum = 0;\n\t\t//for eac...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates the array with square coordinates [Lookup Table] [0,0] Pixels X: 11 Y: 9, [1,0] Pixels X: 34 Y: 9, ...
function CreateCoordArray() { let xR = 0, yR = 19; let i = 0, j = 0; for (let y = 9; y <= 446; y += 23) { // 12 * 23 = 276 - 12 = 264 Max X value for (let x = 11; x <= 264; x += 23) { coordinateArray[i][j] = new Coordinates(x, y); // console.log(i + ":" + j + " = " + ...
[ "function getSquareArray() {\n let counter = 1;\n for (let i = 20; i <= 400; i += 20) {\n for (let j = 20; j <= 400; j += 20) {\n gridSquares[counter] = {\n x: i,\n y: j,\n width: 20,\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Helper function that takes a UInt8 result and converts to a string
function uint8arrayToString(data) { return String.fromCharCode.apply(null, data); }
[ "function uint8arrayToString(data){\n return String.fromCharCode.apply(null, data);\n}", "function uint8arr2str(arr) {\r\n var out = \"\";\r\n for (var i=0; i<arr.length; ++i) {\r\n out = out + arr[i].toString() + \" \";\r\n }\r\n return out;\r\n}", "byteToString(arr) {\n if (typeof arr === 'string...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Define inReplyTo message id
inReplyTo(messageId) { this.nodeMailerMessage.inReplyTo = messageId; return this; }
[ "get replyId() {\r\n return this.payload.reply_to_comment;\r\n }", "function generateReplyTo(replyTo) {\n\tvar replyToString = '';\n\tfor( i = 1; i <= replyTo.length; i++) {\n\t\treplyToString += '&ReplyToAddresses.member.' + i + '=' + replyTo[i - 1];\n\t}\n\treturn replyToString;\n}", "get replyUserI...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sends request to GetWeatherServlet for Meteo of the day
function sendMeteo(){ $.ajax({ type: "GET", date:{}, url : "GetWeatherServlet", dataType : 'json', success : function(data) { var div_meteo = $("#meteo"); if(data.message="1") { var temp = data.temp; var temp_min = data.temp_min; var temp_max = data.temp_max; var humid...
[ "function weatherMap() {\n $.get(\"https://api.openweathermap.org/data/2.5/onecall\", {\n APPID: OWM_TOKEN,\n lat: lat,\n lon: long,\n units: \"imperial\",\n exclude: \"minutely,hourly\",\n }).done(function (data) {\n handleResponse(dat...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Game_BattlerBase The superclass of Game_Battler. It mainly contains parameters calculation.
function Game_BattlerBase() { this.initialize.apply(this, arguments); }
[ "function Game_Battler() {\n this.initialize.apply(this, arguments);\n}", "function JABS_Battler() { this.initialize(...arguments); }", "function Sprite_BattlerLMBS() {\n this.initialize.apply(this,arguments);\n}", "function Sprite_Battler() {\n this.initialize.apply(this, arguments);\n}", "calcPar...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
given a face id, return the populated edge objects referenced by that face
edgesForFaceId(face_id, geometry) { return geometry.faces.find(f => f.id === face_id) .edgeRefs.map(eR => this.edgeForId(eR.edge_id, geometry)); }
[ "facesForEdgeId(edge_id, geometry) {\n return geometry.faces.filter(face => face.edgeRefs.find(eR => eR.edge_id === edge_id));\n }", "verticesForFaceId(face_id, geometry) {\n return geometry.faces.find(f => f.id === face_id)\n .edgeRefs.map((edgeRef) => {\n const edge = ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Response handler that caches file icons in the filesystem API.
function successCallbackWithFsCaching(resp, status, headers, config) { var docs = []; var totalEntries = resp.items.length; resp.items.forEach(function(entry, i) { var doc = { title : entry.title, updatedDate : Util.formatDate(entry.modifiedDate), updatedDateFull : entry.modifiedDate, ...
[ "function successCallbackWithFsCaching(resp, status, headers, config) {\n var docs = [];\n var totalEntries = resp.items.length;\n console.log(totalEntries);\n resp.items.forEach(function (entry, i) {\n var doc = {\n title: entry.title,\n updatedDate: Util.formatDate...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
public: return internals in an object
function internals(){ return {a: acc, b: brs, c: cnt, m: m, r: r}; }
[ "function internals(){\n return {a: acc, b: brs, c: cnt, m: m, r: r};\n }", "function _internals() {\n return {\n a : acc\n , b : brs\n , c : cnt\n , m : m\n , r : r\n , g : gnt\n };\n }", ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get a build resource ID for a specific beta build localization.
function getBuildIDForBetaBuildLocalization(api, id) { return api_1.GET(api, `/betaBuildLocalizations/${id}/relationships/build`) }
[ "function getBuildBetaDetailsResourceIDForBuild(api, id) {\n return api_1.GET(api, `/builds/${id}/relationships/buildBetaDetail`)\n}", "function getAppResourceIDForBetaAppLocalization(api, id) {\n return api_1.GET(api, `/betaAppLocalizations/${id}/relationships/app`)\n}", "function getBuildIDForBetaAppRev...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Init jQuery sortable for radio
radioListSortable (){ // jQuery sortable init $("#user-radio").sortable({ revert: "true", delay: 100, tolerance: "pointer", update: function (event, ui) { if ($('.station-place[data-radio-id]', '#user-radio').length > 2) { var newFavoriteArr = []; $(".station-...
[ "function aq_sortable_list_init() {\n\t\t$('.aq-sortable-list').sortable({\n\t\t\tcontainment: \"parent\",\n\t\t\tplaceholder: \"ui-state-highlight\",\n\t\t\topacity: 0.6,\n\t\t\tcursor: 'move',\n\t\t\trevert: true\n\t\t});\n\t}", "function aq_sortable_list_init() {\n\t\t$('.aq-sortable-list').sortable({\n\t\t\tc...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Check for activity of tabs/windows and updates variables correctly
function checkActivity() { //console.log("checkActivity initialized"); // Check for changing tab chrome.tabs.onActivated.addListener( function(tabs) { curTabId = tabs.tabId; console.log("Tab changed - " + tabs.tabId); updateInfo(); }); // Check for tabs updating chrome.tabs.onUpdated.addListener( fun...
[ "function checkTab() {\n\tchrome.tabs.query({active: true, currentWindow: true}, function(arrayOfTabs) {\n\tvar url = arrayOfTabs[0].url;\n\n\t\tif (url.indexOf(\"netflix.com\") > -1) {\n\t\t\n\t\t\t//show the button if netflix is the current tab\n\t\t\tvar id = arrayOfTabs[0].id;\n\t\t\tchrome.pageAction.show(id);...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
List the running sessions.
function listRunning(settings) { return default_1.DefaultSession.listRunning(settings); }
[ "function listRunning(settings) {\n settings = settings || __1.ServerConnection.makeSettings();\n let url = coreutils_1.URLExt.join(settings.baseUrl, SESSION_SERVICE_URL);\n return __1.ServerConnection.makeRequest(url, {}, settings)\n .then(response => {\n if (response.sta...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
If a topic has an attribute "name2", then using code=2, "name" will be changed to "name2". This means new topics get added to the TOPIC command tested
function updateTopics(npc, code) { for (let opt of npc.askOptions) { if (opt["name" + code] !== undefined) { opt.name = opt["name" + code] } } }
[ "onUpdateTopicName( data, prop, value ) {\n\t\t// console.log(\"*****************TopicName**********\")\n\t\tthis.props.updateTopics( this.props.selectedCategory.id,this.props.companyName,\n\t\t\t{\n\t\t\t\tid : data.topicId,\n\t\t\t\tname : this.safeName(value),\n\t\t\t\tseededTopicWords: d...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Reloads modules based on the given changes. If reloading fails, this function tries to restore old implementation.
function reload(changes) { var changedModules = changes.map(function (c) { return c[0]; }); var newMods = changes.filter(function (c) { return !c[1]; }).map(function (c) { return c[0]; }); try { info("Applying changes..."); debug("Changed modules", changedModules);...
[ "function reload(changes) {\n var changedModules = changes.map((c) => c[0]);\n var newMods = changes.filter((c) => !c[1]).map((c) => c[0]);\n\n try {\n info(\"Applying changes...\");\n debug(\"Changed modules\", changedModules);\n debug(\"New modules\", newMods);\n evaluate(entryId, {})...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Finds all formula ranges and add a namedrange for them, no matter the selection If there were already named ranges, order the ranges.
function detectFormulaRanges_(doc, body, header, footer) { var doc = doc || DocumentApp.getActiveDocument(); var body = body || doc.getBody(); var header = header || doc.getHeader(); var footer = footer || doc.getFooter(); var namedRanges = getFormulas_(doc); var namesFound = []; foreachNamedRange_(namedR...
[ "function reorderFormulaRanges_(doc) {\n var doc = doc || DocumentApp.getActiveDocument();\n var searchResult = null;\n var namedRanges = getFormulas_(doc);\n var toSort = [];\n var toAdd = true;\n foreachNamedRange_(\n namedRanges,\n function(name /* Maybe to expand */, range, namedRange) {\n fore...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Represents a Data Emitter
function DataEmitter() { }
[ "function Emitter() {}", "function Emitter() {\n this.listeners = {};\n }", "function Emitter() {\n\t\tthis.listeners = {};\n\t\tthis.singleListener = {};\n\t}", "function Emitter() {\n\n this._events = {};\n this._isDestroyed = false;\n\n }", "emitData(outport, data) {\n return this.emi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
POST a create_video API call for the live renditions (nonHLS)
function createVideo() { var video = getVideoObject(); submitVideo(video, 'create_video', onCreateSuccess); }
[ "function createVideo() {\n const video = document.createElement(\"video\");\n video.setAttribute(\"id\", \"video\");\n getVideoWrapper().appendChild(video);\n\n}", "async videoAdd(request, response) {\n try {\n const { title, url, favorite } = request.body;\n const newVideo ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Skips a certain amount of bits in the buffer Default: 1
skipBits(amount = 1) { this.at += amount; }
[ "skipBytes(amount = 1) {\n this.skipBits(amount * 8);\n }", "skip(length) {\n }", "function stbtt__cff_skip_operand(b) {\n var b0 = stbtt__buf_peek8(b);\n if (b0 == 30) {\n stbtt__buf_skip(b, 1);\n while (b.cursor < b.length) {\n var v = stbtt__buf_get8(b);\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Changes siteModel to make sure it has a urlFormatModel
function ensureUrlFormatModel(siteModel) { const urlFormatModel = siteModel.urlFormatModel || {}; if (experiment.isOpen('urlFormat', siteModel)) { urlFormatModel.format = warmupUtilsLib.siteConstants.URL_FORMATS.SLASH; } else { urlFormatModel.format = urlFormatModel.format || warmu...
[ "function weLinkModel() {\n\t\treturn Weblink;\n\t}", "function normalizeModel(model) {\n\t if (!model.configuration) {\n\t // if configuration is not set, we want to use the default configuration\n\t model.configuration = afpActionBarModelService()...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Deserialize a node from its JSON representation. This method is bound.
nodeFromJSON(json) { return Node$1.fromJSON(this, json); }
[ "_decodeNode() {\n\n // if the most significant bit is set the node refers to a container\n const nodeType = this.readUInt8();\n if (nodeType & 0x80) {\n return this._decodeContainerNode(nodeType);\n }\n\n // handle simple scalars\n if (nodeType === constants.TNS_JSON_TYPE_NULL) {\n retu...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
The timer() is used repeat the DealingHand().
function timer() { document.getElementById("button").disabled = true; //Disables the id that has 'button'. timersubtract = setInterval(DealingHand, 1); //Goes to DealingHand() every 1 millisecond. defines timersubtract. }
[ "function DealingHand()\n{\n\tRandVal() //Calls on RandVal() to create a rand value.\n\tchecklist() //Calls on checklist() to check the rand value.\n\ttime++; //Increments time.\n\n\t//The if statement will only activate once time equals 10.\n\t//Is used to stop the timer() and start the ImgTimer().\n\tif (time == ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates a transport that uses IndexedDb to store events when offline.
function makeBrowserOfflineTransport( createTransport, ) { return makeIndexedDbOfflineTransport(core.makeOfflineTransport(createTransport)); }
[ "function Transport() {}", "constructor(options = {}) {Offline.prototype.__init.call(this);\n this.maxStoredEvents = options.maxStoredEvents || 30; // set a reasonable default\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n this.offlineEventStore = localForage.default.createIns...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Renders inner reveal as a circle fading into edges.
renderInnerHover() { this.revealInner.style.background = `radial-gradient( circle var(--reveal-inner-radius) at ${this.x}px ${this.y}px, rgba(var(--foreground-rgb), var(--reveal-inner-opacity)), rgba(var(--foreground-rgb), 0) )` }
[ "renderInnerClicked() {\n\t\tthis.revealInner.style.background = `radial-gradient(\n\t\t\tcircle var(--reveal-inner-radius-click) at ${this.x}px ${this.y}px,\n\t\t\trgba(var(--foreground-rgb), 0) 20%,\n\t\t\trgba(var(--foreground-rgb), var(--reveal-inner-opacity-click)) 60%,\n\t\t\trgba(var(--foreground-rgb), 0) 10...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
determine sessionStorage variable prefix based on url up to the date
static get prefix() { if (JSONStorage.#$prefix) return JSONStorage.#$prefix; let base = document.getElementsByTagName("base")[0].href; let origin = window.location.origin; if (!origin) { origin = window.location.protocol + "//" + window.location.hostname + (window.location.port ? ":" + window.loc...
[ "function getLocalStorageKeySuffix(){\n\t\tif(!localStorageKeySuffix){\n\t\t\tlocalStorageKeySuffix = encodeURIComponent(configs.ignoreSearchStringInUrl?location.href.split('?')[0]:location.href.replace(location.hash,''))+'__'\n\t\t}\n\t\treturn localStorageKeySuffix\n\t}", "function getSessionIndex() {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Microsoft Marker Function I have declared an insertMicrosoftMarker function, which then consists of multiple data inputs
function insertMicrosoftMarker(map) { // Microsoft Location var MicrosoftLocation = new google.maps.LatLng(47.6371, -122.1237); var MicrosoftLocationMarker = new google.maps.Marker({ position: MicrosoftLocation, icon: { url: "http://maps.google.com/mapfiles/ms/icons/green-dot.png...
[ "function createMarkers() {\n\n}", "function insertSASMarker(map) {\n // SAS Location\n var SASLocation = new google.maps.LatLng(35.822830042, -78.757330304);\n var SASLocationMarker = new google.maps.Marker({\n position: SASLocation,\n icon: {\n url: \"http://maps.google.com/map...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
calculate top location so menu will not overlap the viewport and be partially hidden
function getTopLocation(e) { var mouseHeight = e.pageY; var pageHeight = $(window).height(); var menuHeight = $(settings.menuSelector).height(); // opening menu would pass the bottom of the page if (mouseHeight + menuHeight > pageHeight && ...
[ "function getMainMenuTopPos(menuObj, y) { // Private method\n if (y + menuObj.offsetHeight <= getClientHeight()) {\n return y;\n }\n else {\n return y - menuObj.offsetHeight;\n }\n}", "function viewTop() {\r\n if (self.pageYOffset)\r\n return self.pageYOffset;\r\n\r\n if (document.body && document....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
microsoft speech keyword analyzer. finds the key words inside of text using microsoft cognitive services
function keyWordFinder(transcript, callback) { let accessKey = 'b8857193e0c84f448c91c81cd7d180b0'; let uri = 'westcentralus.api.cognitive.microsoft.com'; let path = '/text/analytics/v2.0/keyPhrases'; let get_key_phrases = function(documents, callback) { let documentsString = JSON.stringify(documents); ...
[ "function getKeyWatson(conversation){\n var parameters = {\n 'text': conversation,\n 'features': {\n 'entities': {\n 'emotion': true,\n 'sentiment': true,\n 'limit': 2\n },\n 'keywords': {\n 'emotion': true,\n 'sentiment': true,\n 'limit': 2\n },\n 'semantic_roles':...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Converts a Pokemon team into a string. The string is in standard showdown format. It currently does not produce nicknames.
function exportTeam(pokemonTeam) { var text = ''; for (var i = 0; i < pokemonTeam.length; i++) { var pokemon = pokemonTeam[i]; if (pokemon.valid) { // export it text += exportPokemon(pokemon); }; }; return text; }
[ "stringifyTeam(team, nicknames, hideStats) {\n\t\tlet output = '';\n\t\tfor (const [i, mon] of team.entries()) {\n\t\t\tconst species = exports.Dex.getSpecies(mon.species);\n\t\t\tconst nickname = _optionalChain([nicknames, 'optionalAccess', _15 => _15[i]]);\n\t\t\toutput += nickname && nickname !== species.baseSpe...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
check if Episodio is valid lvl 4
function checkIfEpisodioIsValidOrNotLVL4(episodio, it){ if(episodio['estado'] == "0"){ var user = JSON.parse(sessionStorage.getItem('user')); if(user.role_id == "4"){ $("#container_pendente_secretariado_"+it).html(""); } $("#edit"+it).remove(); } else if(episodio[...
[ "function notValidLevel(level){\n if (level.trim().length === 1){\n if(level > 0 && level < 4)\n return false;\n }\n return true;\n}", "function edif4(jugador, i){\n\tif (tauler[i+7].level < 5 && jugadors[jugador].mon >= tauler[i+1].preuedif){\n\t\tvar e = minim(i+1, i+3, i+5, i+7);\n\t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
remove response from sel_features
function unselectFeature(response) { var index = sel_features.indexOf(response); if (index > -1) { sel_features.splice(index, 1); } console.log("Unselected " + response + " as Feature!"); }
[ "function featureUnselected(feature){\n for (var i = 0; i < selectedFeatures.length; i++) {\n if (selectedFeatures[i].data.SOVEREIGNT == feature.data.SOVEREIGNT) {\n selectedFeatures.splice(i, 1);\n }\n else {\n console.lo...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
show clip currentTime, Duration in m:s, move time range bar.
function showTime() { // update range time location based on time var clipBarValue = vidPlayer.currentTime * (100 / vidPlayer.duration); clipBar.value = clipBarValue; // convert currentTime and Duration in min:sec var curmins = Math.floor(vidPlayer.currentTime / 60); var cursecs = Math.floor(vid...
[ "function timeUpdater() {\n var totalValue = (100 / video.duration) * video.currentTime; // Calculate the slider value\n timeBar.value = totalValue; // Update the slider value\n }", "function setTimebar() {\n video.currentTime = (+timebar.value * video.duration) / 100;\n}", "function moveTimebar()\n{\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
example for closure var stepoftwo= step_iterator(0, 2)
function step_iterator(start, step) { return function () { var res = start; start = start + step; return res; } }
[ "iterationDelegate(i){}", "step() {\n }", "function steppedForEach(arr, fn, step) {\n if (arr.length > step) {\n fn(...arr.slice(0, step));\n steppedForEach(arr.slice(step), fn, step);\n }\n else {\n fn(...arr);\n }\n}", "*[Symbol.iterator]() {\n yield 1;\n yi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
When a temporal field has timeUnit, itemData will give us duplicated fields (e.g., Year and YEAR(Year)). In tooltip want to display the field WITH the timeUnit and remove the field that doesn't have timeUnit.
function removeDuplicateTimeFields(itemData, optFields) { if (!optFields) { return undefined; } optFields.forEach(function (optField) { if (optField.removeOriginalTemporalField) { removeFields(itemData, [optField.removeOriginalTemporalField]); } }); }
[ "function displayTimeGroup(data, field) {\n\t\t\tvar filterCondition = function (item) {\n\t\t\t\treturn item.name === data.value[0];\n\t\t\t};\n\t\t\tif (data.option == util.constants.misc.VALUE) {\n\t\t\t\tvar selectedItem = self.dimensionList().filter(filterCondition);\n\t\t\t\tselectedItem = selectedItem.length...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Copyright (c) Microsoft Corporation. Converts an OperationOptions to a RequestOptionsBase
function operationOptionsToRequestOptionsBase(opts) { const { requestOptions, tracingOptions } = opts, additionalOptions = tslib.__rest(opts, ["requestOptions", "tracingOptions"]); let result = additionalOptions; if (requestOptions) { result = Object.assign(Object.assign({}, result), requestOptions)...
[ "function operationOptionsToRequestOptionsBase(opts) {\n var requestOptions = opts.requestOptions, tracingOptions = opts.tracingOptions, additionalOptions = tslib.__rest(opts, [\"requestOptions\", \"tracingOptions\"]);\n var result = additionalOptions;\n if (requestOptions) {\n result = tslib.__assi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
getIgnoreKeywords_allWords_nonEnglishWords() Get the common words to ignore that start with: a nonenglish character.
function getIgnoreKeywords_allWords_nonEnglishWords() { return [ ]; }
[ "function getIgnoreKeywords_allWords_C_Words() {\n\t\treturn [\n\t\t\t'call',\n\t\t\t'called',\n\t\t\t'came',\n\t\t\t'can',\n\t\t\t'can\\'t',\n\t\t\t'cannot',\n\t\t\t'case',\n\t\t\t'certain',\n\t\t\t'certainly',\n\t\t\t'cetera', // LATIN\n\t\t\t'chapter',\n\t\t\t'chiefly',\n\t\t\t'circumstances',\n\t\t\t'claim',\n\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
=============================================================== Return the nth triangular number. If n doesn't work, return 0. triangular(4); > 10
function triangular( n ) { return (n > 0) ? ((n * n) + n) / 2 : 0; }
[ "function triangular(n) {\n return (n > 0) ? (n * (n + 1) / 2) : 0;\n}", "function triangular( n ) {\n if(isNaN(n) || n < 0) return 0;\n return (n+1)*n/2;\n}", "function triangular(n) {\n \n}", "function nthTriangularNumber(n){\n if (n === 0) {\n return 0\n }\n return n + nthTriang...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets Homework put into the input boxes and adds it to the authorized user's calendar.
function addHomework() { /* * WORKS! * WORKING CODE I WILL COMMENT LATER * WHEN I FIGURE OUT WHAT I DID! */ var date = $('#dueDate').val().split("-"); console.log(date, $('#dueDate').val()); d = date[2]; day = 0 + parseInt(d) + 1; m = date[1]; month = parseInt(m, 10); year = date[0]; console.l...
[ "function listUpcomingHomework() {\n\n // GETS TODAY'S DATE\n var todayDate = new Date(),\n d = todayDate.getDate(),\n m = todayDate.getMonth() + 1,\n today;\n\n if (d < 10) {\n d = \"0\" + d;\n }\n if (m < 10) {\n m = \"0\" + m;\n }\n\n today = m + \"-\" + d;\n console.log('Today is: ' + today);\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }