query
stringlengths
9
34k
document
stringlengths
8
5.39M
negatives
listlengths
19
20
metadata
dict
Set the sprite offset position based on the width and height of the sprite image.
set_sprite_offset_center() { this.sprite.x_offset = -(Math.round(this.sprite.width / 2)); this.sprite.y_offset = -(Math.round(this.sprite.height / 2)); }
[ "set_sprite_offset(x_offset, y_offset) {\r\n this.sprite.x_offset = x_offset;\r\n this.sprite.y_offset = y_offset;\r\n }", "SetTextureOffset() {}", "setSpriteOffsets()\n {\n const frontDraw = this.settings.frontDraw;\n this.settings.offsets['sprites'] = [];\n\n for (let ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Handle rolling of an item from the Actor sheet, obtaining the Item instance and dispatching to it's roll method
_onItemRoll(event) { event.preventDefault(); const itemId = event.currentTarget.closest(".item").dataset.itemId; const item = this.actor.getOwnedItem(itemId); // Trigger the item roll if ( item.data.type === "scroll" ) { return ui.notifications.warn(`Scrolls cannot be rolled yet.`); // ...
[ "_onItemRoll (event) {\n event.preventDefault()\n const itemId = event.currentTarget.closest('.item').dataset.itemId\n const item = this.actor.getOwnedItem(itemId)\n\n // Trigger the item roll\n if (item.data.type === 'scroll') {\n return ui.notifications.warn('Scrolls ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Dependencias de armaduras e escudos.
function _DependenciasClasseArmadura() { gPersonagem.armadura = null; for (var i = 0; i < gPersonagem.armaduras.length; ++i) { if (gPersonagem.armaduras[i].entrada.em_uso) { gPersonagem.armadura = gPersonagem.armaduras[i]; break; } } gPersonagem.escudo = null; for (var i = 0; i < gPersona...
[ "function DependenciasGerais() {\n _DependenciasNivelConjurador();\n _DependenciasEquipamentos();\n _DependenciasFamiliar();\n _DependenciasDadosVida();\n _DependenciasAtributos();\n _DependenciasTalentos();\n _DependenciasPontosVida();\n _DependenciasIniciativa();\n _DependenciasTamanho();\n _Dependencia...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get High Get the high byte of the memory location.
getHigh (addr) { // make sure that the address is within bounds addr = Memory.wrap(addr, this.SIZE); return this.data[addr] << 8; }
[ "function getNumHigh(numHigh, numLast) {\n\tif(numLast > numHigh) return numLast;\n\telse return numHigh;\n}", "getHighBitsUnsigned() {\n return this.high >>> 0;\n }", "get zHigh() { return this._zHigh; }", "getLow (addr) {\n // make sure that the address is within bounds\n addr = Memory.wrap(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Starts playback for all AnimationActions in the scene
play() { this.animActions.forEach( action => action.play() ); this.isPlaying = true; }
[ "play() {\n\t\treturn Promise.all(this.$.animations.map(anim => anim.play()));\n\t}", "_animateScene(){\n var len = this._animations.length;\n for(var i = 0; i < len; i++){\n\n if(this._animations[i] != null && this._animations[i].length != 0 )\n //Processes an Animation ob...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns the video codec configured as the preferred codec on the peerconnection.
getConfiguredVideoCodec() { return this.peerconnection.getConfiguredVideoCodec(); }
[ "function getVideoType(codecs)\n{\n var mime = 'video/mp4';\n var codecs_param = 'avc1.42E01E, mp4a.40.2';\n\n var videotag = document.createElement(\"video\");\n\n if ( videotag.canPlayType &&\n videotag.canPlayType('video/ogg; codecs=\"theora, vorbis\"') )\n {\n mime = 'video/ogg';\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
svg.transition() .duration(30000) .ease(d3.easeLinear) .tween("year", tweenYear);
function animate(){ svg.transition() .duration(30000) .ease(d3.easeLinear) .tween("year", tweenYear); }
[ "function tweenYear(dots) {\n /*var year = d3.interpolateNumber(1, 13);\n console.log(\"year=\" + year);\n return function (t) {\n console.log(t);\n var i = Math.round(year(t));\n console.log(i);\n console.log(\"show = \" + yearSet[i - 1]);\n displayYear(dots, yearSet[i - 1]);\n }...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
utility function to see if it is prioritized.
function isPrioritized(status) { return (status == "Prioritize - Approved" || status == "Prioritized - Deferred" || status == "Prioritized - Denied" || status == "To Be Prioritized"); }
[ "function OrderedVm_isPrioritized() {\r\n return (this.intVmPriority!=VM_NO_PRIORITY);\r\n }", "function isPreorder(relation, numEntries) {\n return isReflexive(relation, numEntries) &&\n isTransitive(relation, numEntries);\n}", "function isPriorityDone() {\n var priorityDone = true,...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Check is in available view
function isAvailableView(){ return !!document.querySelector("head meta[value=repo_source]") && resolveUrl(window.location.href) !== false; }
[ "isViewAllowed(props = this.props, view = this.state.view) {\n const views = this.getLimitedViews(props);\n\n return views.indexOf(view) !== -1;\n }", "function isView( node ) {\n\t\t\treturn editor.dom.hasClass( node, 'wpview' );\n\t\t}", "function checkView(hostView,component){var hostTView=hostView[TV...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This function returns the request duration recording by the browser via window.performance.getEntries().
function getRequestEntryDurationMetrics(url, requestPerformanceStartTime) { if (!window || !window.performance || !url || !requestPerformanceStartTime) { return { duration: -1 }; } try { var entries = performance.getEntriesByType("resource"); // If targetOrigin is missing it means th...
[ "function getRequestEntryDurationMetrics(url, requestPerformanceStartTime, overrideWindow) {\n var currentWindow = overrideWindow || window;\n if (!currentWindow || !currentWindow.performance || !url || !requestPerformanceStartTime) {\n return { duration: -1 };\n }\n try {\n var entries = ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns true if all key/value pairs in the given query are currently active.
function queryIsActive(query, activeQuery) { if (activeQuery == null) return query == null; if (query == null) return true; return deepEqual(query, activeQuery); }
[ "function queryIsActive(query, activeQuery) {\n\t if (activeQuery == null) return query == null;\n\t\n\t if (query == null) return true;\n\t\n\t for (var p in query) if (query.hasOwnProperty(p) && String(query[p]) !== String(activeQuery[p])) return false;\n\t\n\t return true;\n\t}", "function _queryIsActive(q...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
If a file is present in the cache, but some of its artifacts are missing on disk, we remove it from the cache to force it to be recompiled.
async function invalidateCacheMissingArtifacts(solidityFilesCache, artifacts, resolvedFiles) { for (const file of resolvedFiles) { const cacheEntry = solidityFilesCache.getEntry(file.absolutePath); if (cacheEntry === undefined) { continue; } const { artifacts: emittedArti...
[ "async invalidateCache() {\n // we simple remove all entries from the node cache that fall below the build or src directory\n Object.keys(require.cache).forEach((file) => {\n if (file.startsWith(this._buildDir) || (this._srcDir && file.startsWith(this._srcDir)) || file.indexOf('/cgi-bin') > 0) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Initiate an AJAX request to submit a new tweet to the web service.
function submitTweet() { var tweetData = $("#content").val(); if(tweetData){ flag = true; $.ajax('twitter.php',{ data:{ action:'add', tweet: tweetData }, success: addCallback, error:ajaxError }); } }
[ "function postTweet() {\n $.ajax({\n url: '/tweets/',\n method: 'POST',\n data: $(\".composer-form-textarea\").serialize() //turns the form data into a query string. This serialized data will be sent to the server in the POST request body. outputs \"text=hi\"\n })\n .done(function() {\n loadTweets();...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
c) So, we can change a property value? Change the class to "XI".
function changeValueProperties(){ var student = {name: "David Aughan", class: "VI", id: "12"}; console.log ("Show diferents properties: \n Name: " + student.name + "\n Class: "+ student.class +"\n Id: " + student.id) student.class = "XI"; console.log("Now is changed the value of property class. \n Class: " + studen...
[ "changeClassValue (eleObject, valueToChange, replacement) {\n let eleClassValue = eleObject.getAttribute('class');\n eleClassValue = eleClassValue.replace(valueToChange, replacement);\n eleObject.setAttribute('class', eleClassValue);\n return;\n }", "_upgradeProperty(prop) {\n if (this.hasOwnPrope...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
/ Do Spherical linear interpolation between two quaternions / / The first quaternion / The second quaternion / The blend factor / A smooth blend between the given quaternions
slerp(q2, blend) { blend = Math.clamp(blend, 0, 1); // if either input is zero, return the other. if (this.lengthSq() === 0) { if (q2.lengthSq() === 0) { return Quaternion.identity; } return q2; } else if (q2...
[ "static slerpQV(qv, qa, qb, T) {\nvar ONE, T_COMP, cosOmega, doLinear, omega, qb_, sA, sB, sinOmega, sinSqOmega;\n//-------\nONE = 1;\nT_COMP = ONE - T;\n// Omega is the angle of the interval (on the unit hypersphere)\n// over which we are to interpolate.\ncosOmega = this.innerProductQV(qa, qb);\n// Adjust if neces...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
readOptionalJSON by Ben Alman
function readOptionalJSON( filepath ) { var data = {}; try { data = grunt.file.readJSON( filepath ); grunt.verbose.write( "Reading " + filepath + "..." ).ok(); } catch(e) {} return data; }
[ "function readOptionalJSON( filepath ) {\n\t\tvar data = {};\n\t\ttry {\n\t\t\tdata = grunt.file.readJSON( filepath );\n\t\t\tgrunt.verbose.write( \"Reading \" + filepath + \"...\" ).ok();\n\t\t} catch(e) {}\n\t\treturn data;\n\t}", "function readOptionalJSON(filepath) {\n var data = {};\n try {\n\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
E V E N T H A N D L E R S These will be called when the (obviously associated) event is triggered. they serve as wrappers that will invoke userspecified event handlers for the same, or similar (kinds of) events. Most if not all of these are installed using livequery and so follow that calling convention. ==============...
function _mousemoveHandler(ev) { var $this = $(ev.target).closest(".hm-container").parent(); var $cfg = $this.data('heatmap').config; // Are both the image and its metadata loaded? If not, just return. if ($cfg.onReady.state != loadStates.READY) return true; if (typeof $cfg.onMousemove.val == 'function') { ...
[ "function mouseMoveHandler(event){\n\t\t\tif(event.pageX == null && event.clientX != null){\n\t\t\t\tvar de = document.documentElement, b = document.body;\n\t\t\t\tlastMousePos.pageX = event.clientX + (de && de.scrollLeft || b.scrollLeft || 0);\n\t\t\t\tlastMousePos.pageY = event.clientY + (de && de.scrollTop || b....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Display the fetched domain token in the domain display area
function DisplayDomainToken(pToken) { let domainArea = document.getElementById('v-token-results'); domainArea.innerHTML = ''; let message = document.createTextNode('Domain token = ' + pToken); domainArea.appendChild(message); }
[ "function showToken(response){\n console.log(response);\n}", "function OpGetDomainToken(evnt) {\n let username = document.getElementById('v-username').value.trim();\n let passwd = document.getElementById('v-password').value.trim();\n\n if (username.length < 1 || passwd.length <...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Methods Makes a clone of the sprite.
clone() { return new hamonengine.graphics.animsprite(this); }
[ "function clone()\n{\n\tvar sprite = new Sprite();\n\n\tsprite.texture = this.texture;\n\n\tsprite.follow_camera_rotation = this.follow_camera_rotation;\n\n\tsprite.position.set(this.position.x, this.position.y, this.position.z);\n\tsprite.rotation.set(this.rotation.x, this.rotation.y, this.rotation.z);\n\tsprite.s...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
! Copyright (c) 2015, Salesforce.com, Inc. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the followi...
function pathMatch(reqPath, cookiePath) { // "o The cookie-path and the request-path are identical." if (cookiePath === reqPath) { return true; } const idx = reqPath.indexOf(cookiePath); if (idx === 0) { // "o The cookie-path is a prefix of the request-path, and the last // character of the coo...
[ "function pathMatch(reqPath,cookiePath){// \"o The cookie-path and the request-path are identical.\"\nif(cookiePath===reqPath){return true;}var idx=reqPath.indexOf(cookiePath);if(idx===0){// \"o The cookie-path is a prefix of the request-path, and the last\n// character of the cookie-path is %x2F (\"/\").\"\nif(c...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Initializes a new instance of the XmppIM class.
function XmppIM(opts) { var core = new XmppCore(opts); var that = this; // Setup handlers for events exposed by XmppCore. core.on('message', function(s) { that._onMessage.call(that, s); }) .on('presence', function(s) { that._onPresence.call(that, s); }) .on('iq', function(s) { that._onIq.call(tha...
[ "function XmppCore(opts) {\n\t// jsnode events boilerplate.\n\tevents.EventEmitter.call(this);\t\n\t\t\t\n\t/**\n\t * Set to true for debugging output.\n\t */\n\tthis._debug = true;\n\n\t/**\n\t * The set of options passed into the constructor.\n\t */\n\tthis._opts = require('extend')(defaultOpts, opts);\t\n\t\n\t/...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
set timefield begin time
function setTimefieldTimeBegin(time) { if (!continueProcessing) { $('#clipBegin').timefield('option', 'value', time); } }
[ "SetTime() {}", "function setTimeStart(timeStart) {\n\tsetAttributeUndoable(\n\t\tgetSetting(), \"TimeStart\",\n\t\ttimeStart);\n\n}", "markStartTime() {\n super.markStartTime();\n this.grader.setStartTime(this.startTime);\n }", "function eventSliderSetTimeField(value) {\n\ttimeField = value;\n}", "s...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
handleSubmit will serve as an error validator
function handleSubmit(event) { event.preventDefault(); setErrors(validate(form)); }
[ "submitError(){\n\t\tif(!this.isValid()){\n\t\t\tthis.showErrorMessage();\n\t\t}\n\t}", "function handleSubmit(e) {\n e.preventDefault()\n let err = false\n \n // Name\n if (name === '') {\n err = true\n setNameError('- Cannot be blank')\n } else {\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns a 2D array (8 by 8) with two black pieces at [3, 4] and [4, 3] and two white pieces at [3, 3] and [4, 4]
function _makeGrid () { grid = new Array(8) for(let i = 0; i <= grid.length - 1; i++){ grid[i] = new Array(8); } grid[3][4] = new Piece('black'); grid[4][3] = new Piece('black'); grid[3][3] = new Piece('white'); grid[4][4] = new Piece('white'); return grid; }
[ "function _makeGrid () {\n var x = new Array(8);\n for (var i = 0; i < 8; i++) {\n x[i] = new Array(8);\n }\n\n x[3][4] = new Piece(\"black\");\n x[4][3] = new Piece(\"black\");\n x[3][3] = new Piece(\"white\");\n x[4][4] = new Piece(\"white\");\n\n return x;\n}", "function _makeGrid () {\n let grid =...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
We need to update input contents when we get new props. Hmm, is there a managed form components library?
componentWillReceiveProps(newProps) { this.type = newProps.p.parameter_spec.type; this.name = newProps.p.parameter_spec.name; // update form controls to current values if (this.stringRef) this.stringRef.value = newProps.p.value; if (this.numberRef) this.numberRef.value = newProps.p.value; if (t...
[ "renderInputPropEditor() {\n // Set default values in case form is not fully initialized\n let inputProps = {}\n const action = {\n name: 'settings-add-template',\n id: 'inputProps',\n value: {} \n }\n\n // If form has been initialized, set appropriate values\n if (this.props.form) ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
getParameter wrapper to convert GL objects to indices
function getParameter(pname) { const result = gl.getParameter(pname); switch (pname) { case GL.ARRAY_BUFFER_BINDING: case GL.ELEMENT_ARRAY_BUFFER_BINDING: case GL.COPY_READ_BUFFER_BINDING: case GL.COPY_WRITE_BUFFER_BINDING: case GL.PIXEL_PACK_BUFFER_BINDING: case GL.PIXEL_UNPACK_BUFFER_B...
[ "constructor(){\n\t\tthis.vertices = [-1, 1, 0, -1, -1, 0, 1, -1, 0, 1, 1, 0];\n\t\tthis.indices = [0, 1, 2, 2, 3, 0];\n\t\t\n\t\tthis.vertexBufferID = gl.createBuffer();\n\t\tthis.uvBufferID = gl.createBuffer();\n\t\tthis.indexBufferID = gl.createBuffer();\n\n\t\tthis.tex_id = gl.createTexture();\n\n this.u...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Verifica se todos os checkboxes estao ticados e atualiza a variavel de controle chamada todosFeitos (declarada no topo)
function checarTodosMarcados() { const todosOsCheckbox = Array.from(document.querySelectorAll('input[type=checkbox]')); console.log(typeof todosOsCheckbox) if (todosOsCheckbox.length === 0) { todosFeitos = false; } else { todosFeitos = todosOsCheckbox.every(checkb...
[ "function VerificaQtosCamposChecados(checkbox){\r\n var campoChecado = 0;\r\n var qtde = checkbox.length;\r\n\r\n if (qtde > 0)\r\n {qtde = checkbox.length;}\r\n else\r\n {\r\n if(checkbox.checked)\r\n {\r\n campoChecado += 1;\r\n return campoChecado;\r\n }\r\n }\r\n\r\n for (var i = 0; i < ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
OnEnter: This is fired when Expert hits in the chat message window
function OnEnter() { if (window.event.keyCode == 13) { // // Send chat data to user // SendChatData(); } }
[ "function updateOnEnter(e){\n\tvar enterKey = 13;\n\tif (e.which == enterKey){\n\t\tupdateChat();\n\t\t// now clear the message box!\n\t\tchatmsg.value = '';\n\t}\n}", "onEnter(event) {\n event.preventDefault();\n let input;\n if ((event.key === 'Enter') && event.target.value) {\n input = event.targ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function to delete stored data (via cookies or local storage)
function deleteStoredData() { // Detects if using cookies or local storage if (ie7) { // Grabs select elements on page to remove cookies var selections = document.getElementsByTagName("select"); // Loops through select elements and deletes cookies named the same for (selection in selections) { if (...
[ "function deleteData() {\n localStorage.removeItem(\"final\");\n}", "function removeOldData() {\n\tlocalStorage.clear();\n}", "function deleteCoffeeFromStorage(coffeeID) {\n localStorage.removeItem(coffeeID + \"\");\n}", "function deleteUserDataFromSessionStorage() {\n localStorage.removeItem('userData...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
time dilation management (1 is normal speed, 0 is full freeze, 2 is 2x speed)
timeDilation(){ if(game.global.timeDilation > 0){ console.log("Beginning time dilation!"); game.global.timeDilation += 0.1; console.log(game.global.timeDilation); } else { console.log("Max time dilation reached!"); } }
[ "function timeWarp (warpSpeed) {\nclock += warpSpeed;\n return \n}", "function adjtime(tim) {\n if (player.STEALTH) player.updateStealth(-tim);\n if (player.UNDEADPRO) player.updateUndeadPro(-tim);\n if (player.SPIRITPRO) player.updateSpiritPro(-tim);\n if (player.CHARMCOUNT) player.updateCharmCount(-tim);...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
a generic function to add an annotation action checkbox
function addAnnotationCheckBox(planNode, mNode, mKey, mOper, mValue, planValue) { var dNode = document.getElementById(planNode); var x = document.createElement("INPUT"); x.setAttribute("type", "checkbox"); x.setAttribute("name", planNode + "Action"); x.setAttribute("value", planValue); dNode.appendChild(x);...
[ "function AfCreateInputCheckbox(input)\n{\n return AfAddAttributes($('<input type=\"checkbox\"/>'), input);\n}", "function addPermissionsCheckboxes(editor, ident, authz) {\n function createLoadCallback(action) {\n return function loadCallback(field, annotation) {\n field = util.$(field).sho...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Fetching data for getAllPolicies
async getAllPolicies() { return await axios.get(POLICY_API_BASE_URL + "/policy"); }
[ "function getData () {\n $scope.loading = true;\n let params = [];\n params.search_term = $scope.searchText;\n\n Policy.getAll(params).then((policies) => {\n $scope.allPolicies = policies.data;\n order();\n $scope.loading = false;\n });\n }", ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
code TODO: ovinosCtrl | controller_by_user controller by user
function controller_by_user(){ try { //debug: all data //console.log(data_ovinoss); $ionicConfig.backButton.text(""); } catch(e){ console.log("%cerror: %cPage: `ovinos` and field: `Custom Controller`","color:blue;font-size:18px","color:red;font-size:18px"); console.dir(e); } }
[ "function controller_by_user(){\n\t\ttry {\n\t\t\t\n\t\t\t\n\t\t} catch(e){\n\t\t\tconsole.log(\"error: page index => custom controller\");\n\t\t\tconsole.log(e);\n\t\t}\n\t}", "function controller_by_user(){\n\t\ttry {\n\t\t\t\n\t\t\t\n\t\t} catch(e){\n\t\t\tconsole.log(\"error: page winner_singles => custom con...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
show person based on item
function showPerson(person) { const item = reviews[person]; img.src = item.img; author.textContent = item.name; job.textContent = item.job; info.textContent = item.text; }
[ "function showPerson(person) {\n const item = persons[person]\n\n author.innerText = item.name\n job.innerText = item.job\n info.innerText = item.text\n if (item.isMale) {\n img.src = \"./img/man.jpg\"\n }\n else {\n img.src = \"./img/woman.jpg\"\n }\n}", "function showPerson () {\n let item ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Police Show up 1.3
function policeShowUp(){ story("You chose to talk with the guy HOW WISE, you guys have a good 30 minute conversation about your favorite sports teams and the sports you like the best before the cops show up"); choices = ["Act like you know the guy", "Wake up from a dream", "Have a nightmare of the man"]; answer = se...
[ "function showPolice() {\n\twindow.open(urlPolice);\n}", "showPolicy() {\n if (this.pol) {\n this.pol = false;\n }\n else if (!this.pol) {\n this.pol = true;\n }\n }", "function show_greetings(){if(_settings.greetings===undefined){// signature have ascii art ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Method to get the next node
getNextNode() { return this.next; }
[ "getNext() {\n return this.nodeNext;\n }", "get_next() {\n return pop_leftmost_node(this.rb_tree);\n }", "function next(node) {\r\n var next_node;\r\n\r\n assert(isElement(node), 'pklib.dom.next: @node is not HTMLElement');\r\n\r\n while (true) {\r\n next_node = nod...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
TODO: implement the renderNewList method to render the list creation form. Tips: Render a Form component in creation mode to let the user enter the new list title Otherwise, render a button to trigger the creation mode (creatingNewList)
renderNewList() {}
[ "renderNewList() {\n return this.state.creatingNewList ? (\n <Form\n type=\"list\"\n placeholder=\"Enter a title for this list...\"\n buttonText=\"Add List\"\n onClickSubmit={this.handleAddList}\n onClickCancel={() => this.setState({ creatingNewList: false })}\n ></Fo...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Perform an inplace replacement of glob patterns with glob instances. A glob is an instance of Minimatch.
function convertGlobPatternsToGlobs(patterns, cache, minimatch) { for (var i = 0; i < patterns.length; i++) { var globPattern = patterns[i], mm = cache.get(globPattern); if (!mm) { mm = new minimatch.Minimatch(globPattern); cache.put(globPa...
[ "function glob(/* patterns... */) {\n return glob.pattern.apply(null, arguments);\n }", "glob_files() {\n var filenames = [], i;\n\n for(i=0; i<this.filenames.length; i++) {\n filenames.push.apply(filenames, glob.sync(this.filenames[i]));\n }\n\n this.filenames = filenames;\n }", "co...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Copyright (c) 20122016 The ANTLR Project. All rights reserved. Use of this file is governed by the BSD 3clause license that can be found in the LICENSE.txt file in the project root. A DFA walker that knows how to dump them to serialized strings.
function DFASerializer(dfa, literalNames, symbolicNames) { this.dfa = dfa; this.literalNames = literalNames || []; this.symbolicNames = symbolicNames || []; return this; }
[ "function DFASerializer(dfa, literalNames, symbolicNames) {\n this.dfa = dfa;\n this.literalNames = literalNames || [];\n this.symbolicNames = symbolicNames || [];\n return this;\n}", "function DFASerializer(dfa, literalNames, symbolicNames) {\n this.dfa = dfa;\n this.literalNames = literalNames || ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Bottom Panel run tab
get bottomPanelRunTab () { return element(by.xpath(".//*[contains(@class,'GDPEHSMCKHC')][contains(text(),'run')]")); }
[ "function createBottomPanel() {\n panel = WorkspaceManager.createBottomPanel('bliitzkrieg.todoer.panel', $(panelTemplate), 100);\n }", "function runPanel(){\n\t\t\n\t\t//validate orientation\n\t\tvalidateOrientation();\n\t\t\n\t\tprocessOptions();\n\t\t\n\t\tg_objGrid.run();\n\t\t\n\t\tsetArrows();\n\t\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
add new user to favorites
function addToFavs() { favorites.push(users[0].userName); dismissResult(); }
[ "async addFavourite (req, res) {\n try {\n if (req.session.user.user === req.body.ad.user) {\n const newUser = await User.findOne({\n email: req.body.ad.user\n })\n\n // Check if favourite exists then add\n for (let i = 0; i < newUser.favourites.length; i++) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
====================================================== GET CLOSEST CELLS ====================================================== find the domain and range of grid cell neighbors for each marker
function getClosestCells(_currPos, gridDiv, gridW, gridH) { var neighbors = []; var boxWidth = gridW / gridDiv; var boxHeight = gridH / gridDiv; var _startX = 0.0; var _startY = 0.0; var _endX = 0.0; var _endY = 0.0; //establish current grid cell boundaries of agent for(var i = 0; i < gridW; i += box...
[ "getNeighbours() {\n let neighbours = new Array();\n for (let i = -1; i < 2; i++) {\n for (let j = -1; j < 2; j++) {\n let row = (this.rowIndex + i + this.map.rows) % this.map.rows;\n let col = (this.colIndex + j + this.map.cols) % this.map.cols;\n if (row != this.rowIndex || col != ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
'Character' iterated character class. Recognizers for specific mbcs encodings make their 'characters' available by providing a nextChar() function that fills in an instance of iteratedChar with the next char from the input. The returned characters are not converted to Unicode, but remain as the raw bytes (concatenated ...
function IteratedChar() { this.charValue = 0; // 1-4 bytes from the raw input data this.index = 0; this.nextIndex = 0; this.error = false; this.done = false; this.reset = function() { this.charValue = 0; this.index = -1; this.nextIndex = 0; this.error = false; this...
[ "function eucNextChar(iter, det) {\n iter.index = iter.nextIndex;\n iter.error = false;\n var firstByte = 0;\n var secondByte = 0;\n var thirdByte = 0;\n //int fourthByte = 0;\n buildChar: {\n firstByte = iter.charValue = iter.nextByte(det);\n if (firstByte < 0) {\n // Ran off the end of the inp...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Set Full Width Function
function setFullWidth(){ $fullwidth_el.each(function(){ var element = $(this); // Reset Styles element.css('margin-left', ''); element.css('width', ''); if(!$body.hasClass('boxed-layout')){ var element_x = element.offset().left; // Set New Styles ...
[ "function setFullWidth(){\n \n if(!$(\"body\").hasClass(\"b960\") && !$(\"body\").hasClass(\"b1170\")){\n $(\".full-width\").each(function(){\n \n var element = $(this);\n\n // Reset Styles\n element.css...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
end of cssStyling function / Function scrollScript: Every time a scroll animation element is found while looping through the story, it will call this function and pass the ID of the div element being affected (e.g. "text1" and the object of the scrolling animation. This function outputs the controller.addTween lines in...
function scrollScript(scroll_id, scrollElement){ //loop through the XML object (scrolling_animation) $(scrollElement).each(function(){ var scrollAnimationName = $(this).children()[0].nodeName; /*Check for optional attributes that can tweak any animation. If it doesn't exist, simply set the ...
[ "function Marquee() {\nif(document.getElementById)\n{\nvar obj = document.getElementsByTagName(\"marquee\");\nfor (var i=0; i< obj.length; i++)\n{ \nobj[i].style.visibility=\"visible\";\nif ((obj[i].id).indexOf(\"slothful\") != -1)\nobj[i].scrollAmount=1;\nelse if ((obj[i].id).indexOf(\"slow\") != -1)\nobj[i].scro...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Convert back from a byte to [value, shuttle value].
function fromByte(b) { const sv = (b & VTOI.shuttle) ? 'shuttle' : (b & VTOI.thinshuttle) ? 'thinshuttle' : null; const v = ITOV[b & 0x3f]; assert(v != null); return [v, sv]; }
[ "bytesToValue(bytes) {\n // HACK: the whole value is stored in the first byte\n return bytes[0];\n }", "asSByte() {\n if ((value & 0x80) == 0x80) {\n return ((~value + 1) & 0xFF);\n } else {\n return value;\n }\n }", "function explodeBits(byte) {\n\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Forward the request directly
function forward(){ return function forward(req, res, next){ var url = utils.processUrl(req); var options = { url: url, method: req.method, headers: req.headers } var buffers = []; var cachedResponse, cacheFile; req.__reqData = null; function checkIfCached() { ...
[ "function forward(){\n return function forward(req, res, next){\n var url = utils.processUrl(req);\n var options = {\n url: url,\n method: req.method,\n headers: req.headers\n }\n var buffers = [];\n\n log.debug('forward: ' + url);\n \n if(req.method === 'POST'){\n req.on(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
DAS 1.6 features command
function DASFeature() {}
[ "function DASFeature() {\n}", "function toggle_features() {\n //TODO\n\n }", "function get_features(refseqID) {\n\n\tvar myFeatures;\t\n\tglue.inMode(\"reference/\"+refseqID, function(){\n\t\tmyFeatures = glue.getTableColumn(glue.command([\"list\", \"feature-location\"]), \"feature.name\");\n\t});\n\t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
execution of usersinfo database
function executeUsersinfo(){ let database_user = users_info_data.openUsersInfoDatabase(); // users_info_data.insertUsersBasic(-1,'\'lwjabcd\'','\'a987654321\'','\'42@qq.com\''); // TODO:create&insert can't be done in one time -BUG // users_info_data.createTable('test2', attributes, notes); // use...
[ "function userDB() { }", "function users() {\r\n\r\n\tvar sql = 'CREATE TABLE Users (';\r\n\tsql += 'email TEXT PRIMARY KEY,';\r\n\tsql += 'name TEXT NOT NULL,';\r\n\tsql += 'dob TEXT NOT NULL,';\r\n\tsql += 'organiser TEXT NOT NULL,';\r\n\tsql += 'picture TEXT NOT NULL,';\r\n\tsql += 'password TEXT NOT NULL,';\r...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Adds and prepares for offline user parcels layer
addUserParcelsLayer(layerURL) { var user = this.get('parcels.user'); var _this = this; // Symbol for painting parcels var symbol = this.get('userParcelSymbol'); var querySentence = ""; // Common online and offline FeatureLayer creator and injector function createAndAddFL(layerReference, ev...
[ "addParcelsLayer(layerURL) {\n var featureLayer = new FeatureLayer(layerURL, {\n model: /*FeatureLayer.MODE_ONDEMAND,//*/FeatureLayer.MODE_SELECTION,\n outFields: ['PARCEL_ID']\n });\n\n this.get('layersMap').set('parcelsLayer', featureLayer);\n this.get('map').addLayer(featureLayer);\n }", ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Calculates the distance between two nodes.
function distanceBetween(nodeA, nodeB) { let xDiff = Math.abs( nodeA.x - nodeB.x ); let yDiff = Math.abs( nodeA.y - nodeB.y ); return Math.hypot( xDiff, yDiff ); }
[ "static distanceOfNodes(node1, node2){\n d = dist(node1.getXPos(), node1.getYPos(), node2.getXPos(), node1.getYPos());\n return d;\n }", "function getDistance(firstNode, secondNode) {\n return Math.sqrt(Math.pow(firstNode.currentX - secondNode.currentX, 2) + Math.pow(firstNode.currentY - sec...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get an existing Budget 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 Budget(name, state, Object.assign(Object.assign({}, opts), { id: id })); }
[ "static get(name, id, state, opts) {\n return new HealthCheck(name, state, Object.assign(Object.assign({}, opts), { id: id }));\n }", "static get(name, id, state, opts) {\n return new ConditionalForwader(name, state, Object.assign(Object.assign({}, opts), { id: id }));\n }", "static get(name...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Working with widths and heights jQuery makes it easy for you to work with the dimensions of your elements and even the browser window. You can use the width() and height() methods for finding the dimensions, or alternatively the innerWidth()/innerHeight()/outerWidth()/outerHeight() methods, depending on the measurement...
function ShowElementDimensions() { var result = ""; result += "Dimensions of div: " + $("#divTestAreaA").width() + "x" + $("#divTestAreaA").height() + "</br>"; result += "Inner dimensions of div: " + $("#divTestAreaA").innerWidth() + "x" + $("#divTestAreaA").innerHeight() + "</br>"; result += "Outer di...
[ "function dimensionsFunction() {\n width = $(window).width();\n height = $(window).height();\n $(\"#body\").css(\"height\", height);\n $(\"#body\").css(\"width\", width);\n}", "calcElementDimensions(w, h) {}", "function showWindowDimensions()\r\n{\r\n alert('Window height: ' + jQuery(window).height()); /...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
=========================================== 03 Wow Animation =============================================
function wowAnimation() { new WOW({ offset: 100, animateClass: "animated", mobile: true, }).init(); }
[ "function wowAnimation() {\n new WOW({\n offset: 100,\n mobile: true\n }).init()\n }", "function lcwowanimation() {\n wow = new WOW({\n animateClass: 'animated',\n offset: 50\n }\n);\nwow.init();\n}", "function playObjectAnimations() {\r\n powerUps.playAnimation...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Funtion For Drop Dynamic Tables
function dropDynamicTable(tableName) { db.transaction(function(transaction){ dropTable(transaction, tableName);}, errorCB, successCB); }
[ "visitDropTable(ctx) {\n\t return this.visitChildren(ctx);\n\t}", "function dropTable () {\n\n db.transaction(function (tx) { tx.executeSql(dropStatement, [], showRecords, onError); });\n\n resetForm();\n\n initDatabase();\n \n}", "static dropTables() {\n SQL.tables = {};\n }", "functi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
MTHD Radius Selection Desc: selects radius depending on position of ring
radiusSelection() { if (this.steps < this.stepsOut / 2) { this.radius = floor(random(1, this.steps)) * this.singleStep } else if (this.steps > this.stepsOut / 2) { this.radius = floor(random(1, this.stepsOut - this.steps)) * this.singleStep } else { this.radiu...
[ "function setSelectedRadius(radius) {\n var cmds = document.getElementsByClassName(\"radiusOption\");\n\n for (var i = 0; i < cmds.length; i++) {\n cmds[i].winControl.selected = false;\n }\n\n document.getElementById(radius).winControl.selected = true;\n }", "function def...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
sort the array based on votes
function sortMovieArray(a, b) { var votesA = a.votes; var votesB = b.votes; var comparison = 0; if (votesA < votesB) { comparison = 1; } else if (votesA > votesB) { comparison = -1; } return comparison; }
[ "sortCandidates() {\n this.candidates.sort((a, b) => b.votes - a.votes);\n }", "function sortArray(questionArr){\n\tquestionArr.sort(function(a,b){\n \t\treturn b.val().votes - a.val().votes;\n \t});\n}", "function sortPostsByVotes() {\n let posts = Object.entries(postsState);\n\n retu...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
/ Saves shortcuts to OmniDB database.
function saveShortcuts() { var v_shortcut_list = []; for (var property in v_shortcut_object.shortcuts) { if (v_shortcut_object.shortcuts.hasOwnProperty(property)) { v_shortcut_list.push(v_shortcut_object.shortcuts[property]); } } var input = JSON.stringify({"p_shortcuts": v_shortcut_list}); ex...
[ "function saveShortcuts() {\n\n\tvar v_shortcut_list = [];\n\n\tfor (var property in v_shortcut_object.shortcuts) {\n if (v_shortcut_object.shortcuts.hasOwnProperty(property)) {\n v_shortcut_list.push(v_shortcut_object.shortcuts[property]);\n }\n }\n\n\tvar input = JSON.stringify({\n\t\t\"p_shortcuts\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
The total number of new TCP connections established from clients to the load balancer and from the load balancer to targets.
metricNewConnectionCount(props) { try { jsiiDeprecationWarnings.print("aws-cdk-lib.aws_elasticloadbalancingv2.ApplicationLoadBalancer#metricNewConnectionCount", "Use ``ApplicationLoadBalancer.metrics.newConnectionCount`` instead"); jsiiDeprecationWarnings.aws_cdk_lib_aws_cloudwatch_Metri...
[ "get totalConnectionCount() {\n return this[kConnections].length + (this.options.maxPoolSize - this[kPermits]);\n }", "function connectionCount() {\n return connections.length;\n}", "async totalConnections() {\n // Retrieve all instances\n await this.instanceObject();\n\n return this.parent....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Change location to hte given locationID
function TravelTo(locationID){ if(locations[locationID] == null){ console.log("Invalid location id: " + locationID); return; } currentLocation = locationID; RenderCurrentLocation(); }
[ "function setLocation(id){\n $location.path('/'+id);\n }", "function updateLocation(locationId) {\n personBasicInfoLogic.updateLocation($scope.location, personReferenceKey, locationId).then(function (response) {}, function (err) {\n appLogger.error('ERR', err);\n });\n }", "u...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
add vote to poll
function insertVote(pollId, optionId) { getConnection((err, db, collection) => { if(err) throw err; collection.update({ _id: new ObjectId(pollId), 'options.option_id': optionId }, { $inc: {'options.$.votes': 1, totalVotes: 1} }); }); }
[ "function addVotes() {\n votesSetter(votes => votes + 1);\n }", "async vote() {\n this.totalVote++;\n }", "function addOneToVote(context){\n var scoreContext=$(context).parent().parent().find(\"div#nbVotes\");\n $(scoreContext).attr(\"nbvotes\",parseInt($(scoreContext).attr(\"nbvotes\"))+1);...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets the parameter value based on it's path string. Return empty string as a fallback if the value does not exist.
function getParameterValueFromPath(path, parameters) { return path.split('.').reduce(function (res, key) { var value = res[key]; if (value === undefined || value === null) return ''; return value; }, parameters); }
[ "getParamValue(path) {\n return this.parameters.get(path).value;\n }", "getParamValue(path)\n {\n return this.parameters.get(path).value;\n }", "get(path, fallback) {\n let val = path.split('.').reduce((a, b) => a && a[b], this);\n if (val !== undefined && typeof val !== typeof fall...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Fin EliminarLesion Esta funcion se encarga de limpiar el efecto de seleccion de las lesiones
function quitarSeleccion(mensaje){ // Remueve la clase lesionActiva de cada elemento <li> de la lista #listaLesiones // Esto elimina el efecto de selección de la lesión $('.body_m_lesiones > .item_lesion').each(function (indice , elemento) { $(elemento).removeClass('lesionActiva'); }); // Re...
[ "function eliminarCadenasSeleccionadas() {\r\n\t//Guardamos las cadenas de texto seleccionadas en un array\r\n\tconst elementosSeleccionados = lista.getCadenaTextoSeleccionadas();\r\n\r\n\tif(elementosSeleccionados.length > 0) lista.setUltimaAccion(\"eliminar\");\r\n\t//Recorremos el array para guardar los elemento...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Check if nodes present in local storage or set default according to network
setDefault() { if (this._Wallet.network == nem.model.network.data.mainnet.id) { if (this._storage.selectedMainnetNode) { this._Wallet.node = this._storage.selectedMainnetNode; } else { let endpoint = nem.model.objects.create("endpoint")(nem.model.nodes.mai...
[ "getNodeInLocalStorage() {\n if (this._Wallet.network == Network.data.Mainnet.id) {\n if (this._storage.harvestingMainnetNode) {\n this.harvestingNode = this._storage.harvestingMainnetNode;\n } \n } else if (this._Wallet.network == Network.data.Testnet.id) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
unlock the save button on admin selection of order status from list
function unlockSaveButton(orderId){ $('#'+orderId+'-save').removeAttr('disabled'); }
[ "function adminOrderStatusUpdate() {\r\n // get selection\r\n let updateStatus = document.getElementById('editOrderStatus').value;\r\n shopOrderState[selectedOrderUpdateStoreIndex][selectedOrderUpdateOrderIndex].progress = updateStatus;\r\n // set selection and update the page\r\n drawShop(selectedOrderUpdateS...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Cancel the paymemnt timer. No more incrementing payments.
function cancel_payments() { if (payment_update_timer) { clearInterval(payment_update_timer); payment_update_timer = null; } }
[ "cancelItemCountdown() {\n \n this.changeTimer();\n }", "function Cancel(args) {\n args.hiPayState = \"cancel\";\n HiPayProcess.Decline(args);\n}", "cancelNext() {\n clearTimeout(this.TO);\n var nextArr = asArray(this.next).map((item, ind)=>item + (this.recur[ind] || 0));\n this....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
function to activate an command block on x, y, z to execute a "/butcher 25 all" command to replace all visual bunties so we wont have millions of entities. WARNING !! this will happen within the same tick !!!
function changeBounty(args) { var x = -407, y = 61, z = 398; var hiddenChatSender = args.sender.doAs(null, true); Server.runCommand(hiddenChatSender, 'setblock', x, y, z + ' redstone_block'); Server.runCommand(hiddenChatSender, 'setblock', x, y, z + ' air'); // this function will be executed AFTER...
[ "function tick() {\n for (i = 0 ; i < commands.length; i++){\n if (commands[i] != null) {\n execute(commands[i])\n }\n }\n }", "updateBB() {\n this.lastBB = this.BB;\n this.BB = new BoundingBox(this.x + 15, this.y, 45, 85);\n if (this.attackWindow) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
API 3 Load recommended items API end point: [GET] /recommendation?user_id=1111
function loadRecommendedItems() { activeBtn('recommend-btn'); // request parameters var url = './recommendation' + '?' + 'user_id=' + user_id + '&lat=' + lat + '&lon=' + lng; var data = null; // display loading message showLoadingMessage('Loading recommended items...'); // make AJAX call ajax( ...
[ "function loadRecommendedItems() {\n activeBtn('recommend-btn');\n\n // request parameters\n var url = './recommendation' + '?' + 'user_id=' + user_id + '&lat=' + lat + '&lon=' + lng;\n var data = null;\n\n // display loading message\n showLoadingMessage('Loading recommended items...');\n\n // ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Popping will remove 8 bytes but mask with the register size
function memoryPop(process, lhs) { const regValue = readMemoryBytes(process, process.registers.rsp, 8); process.registers.rsp += 8n; process.registers[lhs.register] = maskBytes(regValue, lhs.bytes); }
[ "function popByte() {\n return( memory[regPC++] & 0xff );\n}", "function popByte() {\n\treturn( memory[regPC++] & 0xff );\n}", "function popWord() {\n return popByte() + (popByte() << 8);\n}", "function popWord() {\r\n return popByte() + (popByte() << 8);\r\n }", "function popWord() {\n\treturn po...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
loading appends the loader to the specified element and displays the loading icon. The loader will block all interaction with the specified element until Application.loaded is called.
loading (el) { el.appendChild(this.page.loader) }
[ "showLoadingScreen() {\n this.setUIStep(AssistantUIState.LOADING);\n this.$.loading.onShow();\n }", "addLoader() {\n this._loaderElement.classList.add(this._loadingClassName);\n }", "function setLoading($element) {\n $element.addClass(\"loading\");\n }", "function addLoadingIcon(ele...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns the name of the layer mask of the active layer (or "Alpha" if none...in English at least...)
function layerMaskName() { ref = new ActionReference(); args = new ActionDescriptor(); ref.putProperty( classProperty, keyChannelName ); // keyChannelName ref.putEnumerated( classChannel, typeOrdinal, enumMask ); args.putReference( keyTarget, ref ); var resultDesc = executeAction( eventGet, args, DialogModes.NO ...
[ "function getLayerNameByIndex(layerIndex) { \r var layer = app.activeDocument.layers[layerIndex];\r layer.visible = true;\r var layerName = layer.name;\r // Replace weird charecters in layer names\r var layerName = layerName.replace(/\\_-+/g,'-'); // Collapse multiple dashes into a single one \r v...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
this function assigns a random value to each tile and make sures that each tile has a matching tile as well
function setVal(frame, bgList){ var tileIndice = mkTileIndice(); var tile = frame.children; var rand, rand2; for(var i = 0; i < GAME_SIZE/2; i++){ rand = Math.floor(Math.random()*tileIndice.length); // gen a rand number tile[tileIndice[rand]].value = i; // assign value of iteration to the random tile ...
[ "function assignTileNumbersRandomly() {\n var arrayValues = Array(numTiles);\n arrayValues.fill(true, 0);\n\n var index = 0;\n var randNum;\n while (index < numTiles) {\n randNum = Math.floor(Math.random() * numTiles);\n if (arrayValues[randNum]) {\n randNum == 0\n ? setupEmptyTile(tileArray[...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sets depth buffer clear value
setClearDepth (depth) { if (this._clearDepth !== depth) { this._gl.clearDepth(depth); this._clearDepth = depth; } }
[ "resetColorDepth() {\n this.updateParam('sd', this._root('screen.colorDepth',24));\n }", "setDepthMask(value) {\n this.gl.depthMask(value);\n }", "reset() {\n\t const renderTarget = this.createBuffer(this.inputBuffer.depthBuffer, this.inputBuffer.stencilBuffer);\n\t this.dispose();\n\t ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
this data fills the gifData array with object elements
function fillGifDataArray(rawDataArray){ //clear the gif data object to refresh the list gifData.length = 0; let newObj; for(var i = 0; i < rawDataArray.length; i++){ newObj = { id: i, title: rawDataArray[i].title.toUpperCase(), rating: rawDataArray[i].rating....
[ "function returnGifJson(gif) {\n var dataObj = {};\n dataObj['src'] = gif.attr('src');\n dataObj['alt'] = gif.attr('alt');\n dataObj['data-still'] = gif.attr('data-still');\n dataObj['data-animated'] = gif.attr('data-animated');\n return dataObj;\n }", "function giphy(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
apply the panZoom tool on a selected element
function applyPanZoom(element) { if (panZoom != null) delete panZoom; panZoom = svgPanZoom(element, { panEnabled: true, zoomEnabled: true, dblClickZoomEnabled: false, controlIconsEnabled: true, center: true, fit: true, minZoom: 0, maxZoom...
[ "function zoomToElem() {\n var elemsel = $(self.util.svgRoot).find('.selected').closest('g');\n if ( elemsel.length == 0 ) {\n elemsel = self.util.toScreenCoords(self.util.mouseCoords);\n elemsel = $(self.util.elementsFromPointPolyfill(elemsel.x, elemsel.y)).closest('g');\n elemsel = ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Fetch all tasks by subtab id
static async listTasksBySubtab(sub_id, user) { const query = ` SELECT * FROM tasks WHERE tasks.sub_id = $1 AND tasks.user_id = (SELECT id FROM users WHERE email=$2) ORDER BY created_at DESC; ` const result = await db.query(query, [sub_id, user.email]); ...
[ "getSubtasks ( taskID ) {\n return _subtasks[ taskID ];\n }", "function getDBDetailEntries(id){\n log(\"collecting Task Detail information...\");\n dbShell.transaction(function(tx){\n tx.executeSql(\"SELECT taskId, taskName, taskDetails, taskTime, taskStatus FROM tbTasks WHERE tas...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function 3 Values to String ///////////////////////////////////// //////////////////////////////////////////////////////////////////// create an empty array for in loop through input object check if the data type of key string value is a string, push value in newArr return joined array seperated by space
function valuesToString(object) { var newArr = []; for (var key in object){ if (typeof object[key ]=== 'string'){ newArr.push(object[key]); } } return newArr.join(' '); }
[ "function collectStrings (obj) {\n\tlet newArr = [];\n\n\t//base condition\n\tif (Object.keys(obj).length === 0) return '';\n\n\tfor (let key in obj) {\n\t\t//check if the value is string\n\t\tif (typeof obj[key] === 'string') {\n\t\t\tnewArr.push(obj[key]);\n\t\t} else {\n\t\t\tnewArr.push(...collectStrings(obj[ke...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Carga los slots del argumento
function cargarSlots(slots){ operarSlots(slots, cargarSlot); }
[ "setArgumentsFunction() {\r\n \r\n }", "constructor() {\n this.arguments = new Array();\n this.argumentJson = {};\n this.argumentIndexByLabel = {};\n }", "processArgs() {\n this.args = [];\n this.argObject = {};\n let pair = [];\n\n process.argv.forE...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Validate that the provided shoe size is between 0 and 16, and allow half steps. This is used to instantiate a specialized NumberPrompt.
async shoeSizeValidator(prompt) { if (prompt.recognized.succeeded) { const shoesize = prompt.recognized.value; // Shoe sizes can range from 0 to 16. if (shoesize >= 0 && shoesize <= 16) { // We only accept round numbers or half sizes. if (Math...
[ "function checkPrompt(input) {\n if (input >= 1 && input <= 64) {\n changeSize(input);\n }\n else {\n input = prompt(\"Your size did not work! Please choose between 1 and 64!\");\n checkPrompt(input);\n }\n}", "function validatePermutationSize() {\n var x = parseInt($(\"#x\").v...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns a nonempty list of parse nodes, determined by the parseFn. This list begins with a lex token of openKind and ends with a lex token of closeKind. Advances the parser to the next lex token after the closing token.
many(openKind, parseFn, closeKind) { this.expectToken(openKind); const nodes = []; do { nodes.push(parseFn.call(this)); } while (!this.expectOptionalToken(closeKind)); return nodes; }
[ "many(openKind, parseFn, closeKind) {\n this.expectToken(openKind);\n const nodes = [];\n do {\n nodes.push(parseFn.call(this));\n } while (!this.expectOptionalToken(closeKind));\n return nodes;\n }", "many(openKind, parseFn, closeKind) {\n this.expectToken(op...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Set up sticky headers for the recommendation tables
function setupStickyHeaders() { $('table').stickyTableHeaders('destroy'); $('table').stickyTableHeaders({fixedOffset: $("nav")}); $(window).trigger('resize.stickyTableHeaders'); }
[ "reflowStickyHeaders() {\n let usingStickyHeaders = this.get('table.stickyHeaders');\n let $table = this.$('table');\n\n if (usingStickyHeaders && $table) {\n this.$('table').floatThead('reflow');\n }\n }", "function setStickyHeaderTop() {\n const stickyTables = document.getElementsByClassName(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sends the user list as well as the score
function sendUserList(io, userList) { let userScoreList = {}; for (user in userList.users) { userScoreList[userList.users[user].username] = userList.users[user].score; } io.emit("update userScorelist", userScoreList); }
[ "function sendUserListData() { // Send User List data\r\n\t io.sockets.emit('UserListData', {\r\n\t 'count': userList.length,\r\n\t 'list': userList\r\n\t });\r\n\t}", "function updateUsersList() {\n console.log(\"sending updated users list to all connected clients\");\n var htmlString = \"<ul id='users...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Processes the remove subscription command `subscription remove ` removes subscription with ID:
function processSubscriptionRemoveCommand(bot, config, message, id) { return Q.fcall(function() { var requester = bot.getSlackUserFromNameOrID(message.user); return db.Subscription.findAll({ where: { requester: requester.name.toLowerCase(), id: id ...
[ "removeSubscriptionById(id, name) { throw new Error('Server is not configured to use subscriptions.'); }", "_removeSubscriptionById(subscriptionId) {\n const stringId = subscriptionId.getValue();\n const found = this._subscriptions.find(s => s.id() === stringId);\n if (found) {\n this._removeSubscri...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Removes the default view that has been defined, note that the original view won't be removed from the repository.
static dropDefault(){ super.dropDefault('com.lala.view'); }
[ "function clearView() {\n\t\t\theader.deactivateButton(currentView.type);\n\t\t\tcurrentView.removeElement();\n\t\t\tcurrentView = t.view = null;\n\t\t}", "function clearView() {\n\t\theader.deactivateButton(currentView.type);\n\t\tcurrentView.removeElement();\n\t\tcurrentView = t.view = null;\n\t}", "async onR...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get the expected context key from a stack with missing parameters
function expectedContextKey(stack) { const missing = lib_1.ConstructNode.synth(stack.node).manifest.missing; if (!missing || missing.length !== 1) { throw new Error(`Expecting assembly to include a single missing context report`); } return missing[0].key; }
[ "getContextKey( ctx, req ) {\n // This negotiator chooses a resource path using only\n // the request path, so that can be used as the decision\n // context key.\n return req.path;\n }", "calculateStackName() {\n // In tests, it's possible for this stack to be the root object...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
sorts notes by timestamp and adds duration and wait to each object
function withMidiInfo(notes) { const result = []; const sortedInput = notes.sort((a, b) => a.timestamp - b.timestamp); let prevTime = 0; for(let note of sortedInput) { if(result.length && note.timestamp === prevTime) { result[result.length - 1].pitch.push(note.pitch[0]); } else { if(res...
[ "function sortNotes(notes) {\n notes.sort((a, b) => {\n return b.createdAt - a.createdAt;\n });\n }", "static organizeAllNotes(allNotes) { \r\n allNotes = allNotes.sort((noteA, noteB) => { \r\n return noteA.timestamp > noteB.timestamp ? -1 : 1\r\n })\r\n\r\n return allN...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Create a new parser instance with the current configuration.
instantiateParser() { return new this.ParserClass(this.config); }
[ "configParser() {\n return new ConfigParser_1.ConfigParser(this.cwd, this.configFileName, this.ts);\n }", "function Parser() {\n if (!(this instanceof Parser)) return new Parser;\n this.plugins = [];\n}", "getParserFor(source) {\n const config = this.getConfigFor(source.filename);\n re...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
function to display content (from hash or menu)
function disp_content(a,hash){ //hide all d3.select("#content").transition().style("opacity", 0); d3.select("#description").transition().style("opacity", 0); //send backwards d3.select("#content").style("z-index", -1); d3.select("#description").style("z-index", -1); //set title var text="Morphology"; if (a=="#...
[ "function showContent(){\n\n}", "function display(){\n menuTitle.textContent = menu[page].title;\n soup.textContent = menu[page].soup;\n salad.textContent = menu[page].salad;\n lighterFare.textContent = menu[page].lighterFare;\n entree.textContent = menu[page].entree;\n soupPrice.textContent ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
functions written in jsfunctionsfunctionalpractice1 GO BACK AND USE YOUR OWN FUNCTIONS Write a function pluck() that extracts a list of values associated with property names.
function pluck(list, propertyName) { var listOutcome = list.map(function (a) { return a[propertyName]; }); return listOutcome; }
[ "function pluck(list, propertyName) {\n // YOUR CODE HERE\n return map(list, function(item){\n return item[propertyName];\n })\n}", "function pluck1 (prop) {\n return map(get(prop))\n}", "function pluck(list, propertyName) {\n\n var arr = []\n for (var i in list) {\n //console.log(li...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
/ Writes the end of the section.
writeSectionEnd(section, lastSection) { this.curSectionIndex++; }
[ "function onSectionEnd() {\n resetAll();\n writeActivityComment(\" *** SECTION end ***\");\n writeln(\"\");\n}", "function sectionEnd()\r\n{\r\n\tvar end_action=media_data[current].end;\r\n\tconsole.log(\"section End Action: \"+end_action);\r\n\tswitch(end_action)\r\n\t{\r\n\t\tcase \"next\":\r\n\t\t\tarrowDow...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This function finds the next prime number; the for loop sarts from the val + 1 to prevent the checkIfPrime() function from returning the starting value.
function findNextPrime(val) { for (var n = val + 1; n < (Math.pow(n, 2) + 2); n++) { if (checkIfPrime(n)) { return n; break; //break on the first possible find } } }
[ "function nextPrime(num){\n var pp;\n if (bigInt(num).isOdd() === true){\n for (let i= bigInt(num); i< bigInt(num).multiply(2); i = bigInt(i).add(2)){\n if ((bigInt(i).mod(3) != 0) && (bigInt(i).mod(5) != 0) ){\n if (bigInt(i).isPrime()){ //Primality Test (built-in big-integer method)...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
restore previously defined key and return reference to our key object
function noConflict() { var k = global.key; global.key = previousKey; return k; }
[ "function pop_key() { const value = back_key; back_key = null; return value; }", "getPrevKey(key) {\n\t return this.registry.prev(key);\n\t }", "function resetKey(){//reseting key variable after update is done\n\t\tkey = '';\n\t}", "restoreState() {\n var self = this;\n\n return new Pr...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This function just takes each measure key and pushes to array then returns array Normally array of measure contains object with name and agg_type. This function just collects the name and return array of names..
function getMeasureKeys(measures) { let measureKeys = []; measures.forEach(measure => { measureKeys.push(measure.name); }); return measureKeys; }
[ "static getMeasureList(selections) {\n let i = 0;\n let cur = {};\n const rv = [];\n if (!selections.length) {\n return rv;\n }\n cur = selections[0].selector.measure;\n for (i = 0; i < selections.length; ++i) {\n const sel = selections[i];\n if (i === 0 || (sel.selector.measure ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Removes navigation mesh, if any, from scene.
clearNavMesh () { const navMeshEl = this.sceneEl.querySelector('[nav-mesh]'); if (navMeshEl) navMeshEl.removeObject3D('mesh'); }
[ "removeFromScene() {\n if (this.scene)\n this.scene.remove(this.mObject3D);\n }", "clearScene() {\n\n while(this.scene.children.length > 0) {\n this.scene.remove(this.scene.children[0]);\n }\n this.addDefaultLights();\n }", "clearScene() {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Usage : leaveGame(sockId) For : sockId is the client socket connected to the server After : calls the game lobby to remove the client from the game
function leaveGame(sockId) { GameLobby.leftGame(sockId); }
[ "function leaveGame() {\n var gameID = currentGame.id;\n currentGame = undefined;\n socket.emit('boardleave', {\n gameID: gameID,\n boardID: boardID\n });\n openHomeScreen($(\"#gameLobbyScreen\"));\n}", "leaveGameRoom() {\n this.socket.leave(this.gameroom);\n this.gameroom.informsPlayerLeft(this....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
encase :: (a, () > b) > Either a b
static encase (leftValue, rightFn) { try { return Right.of(rightFn()) } catch(e) { return Left.of(leftValue) } }
[ "static encase (leftValue, rightFn) {\n try {\n return Right.of(rightFn())\n }\n catch(e) {\n return Left.of(leftValue)\n }\n }", "function encase(f) {\n return B (eitherToMaybe) (encaseEither (I) (f));\n }", "function Either(){}", "function either(f){ return function(g)...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Update product variant price based on selected variant ============================================================
function updateVariantPrice(variant) { $('#buy-button-1 .variant-price').text('$' + variant.price); }
[ "function updateVariantPrice(product) {\n let variant = product.selectedVariant;\n\n $(`#product-${product.id} .product-price`).text('$' + variant.price);\n }", "function updateVariantPrice(variant) {\n $('#ext-product .variant-price').text('$' + variant.price);\n }", "_onUpdateVariant(event) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
histogram equalization, blended with orignal image amount is between 0 and 1
function equalize(__src, amount) { var h = __src.h, w = __src.w; // grayscale image var gimg = grayscale(__src); // build histogram var hist = histogram(gimg, 0, 0, w, h); var cumuhist = buildcdf( hist ); var total = cumuhist[255]; for(var i=0;i<256;i++) cumuhist[i] =...
[ "function histeq2(imgData) {\n var data = imgData.data;\n var npix = imgData.width * imgData.height;\n\n var hsv = [];\n for (var i = 0; i < npix; ++i)\n hsv[i] = rgb2hsv(data[i * 4 + 0], data[i * 4 + 1], data[i * 4 + 2]);\n\n var hist = [];\n for (var i = 0; i < 256; ++i) \n hist[i...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
downloadNewLabyrinth This will download a new labyrinth for the user. It will save it to there local storage.
function downloadNewLabyrinth() { // Set the data var data = 'labyrinths=true' // Grab the labyrinths sendRequest('https://php-shibbard01.rhcloud.com/database.php', 'POST', data, function(params) { // Now parse the json data = JSON.parse(params); labs = data.labyrinths; ...
[ "download() {\n if (this._Wallet.ntyData !== undefined) {\n // Wallet object string to word array\n let wordArray = nem.crypto.js.enc.Utf8.parse(angular.toJson(this._Wallet.ntyData));\n // Word array to base64\n let base64 = nem.crypto.js.enc.Base64.stringify(wordA...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
If user changes the isolation level, setIsolation restarts the animation with an amount of balls staying at home (dependent on user input).
function setIsolation(val) { ISOLATION = val; // change ISOLATION level start(); // (re)start the simulation // Recolour the balls for (var i = 0; i < BALL_COUNT; i++){ if (balls[i].infected) { d3.select("circle#ball"+i.toString()).style("fill", INFECTED); } else { ...
[ "function setMainAnimation() {\r\n\tif (motor != null) {\r\n\t\tif ((motor.inputMoveDirection.x < 0.1 && motor.inputMoveDirection.z < 0.1) && (motor.inputMoveDirection.x > -0.1 && motor.inputMoveDirection.z >- 0.1)) {\r\n\t\t\t//gameObject.animation.CrossFade(\"stand_Idle\");\r\n\t\t\tCharSpeed = 0;\r\n\t\t\t//stan...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }