query
stringlengths
9
34k
document
stringlengths
8
5.39M
negatives
listlengths
19
20
metadata
dict
function to add audio clip for question
function addAudio (audioFile){ //appending audio tag to #heroVoice // var audio_link = questions[audioIndex].audio; var audio = $("<audio controls='controls' autoplay></audio>").attr( "preload", "metadata").attr("style", "width: 500px;").attr( "src", audioFile); $('#heroVoice').html(audio); }
[ "function escucharAudio(select){\n var id_select = $(select).attr(\"id\");\n var codigo_inspector = $(select).val();\n var nombre_audio = $('#'+id_select+' option:selected').text(); //tomamos el texto seleccionado\n $(\"#audio\").remove(); //se elimina el div por si hay algun audio cargado\n if (nombre_audio !...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Clear the thing in the registry at `path`.
clear(...path) { delete this.__REGISTRY__[path.join("/")]; }
[ "static deleteCache (path) {\n delete require.cache[require.resolve(path)]\n }", "async remove(path, ignoreMissing = false) {\n const ref = this.ref(path);\n try {\n const result = await ref.remove();\n return result;\n }\n catch (e) {\n if (e.code ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Enable all buttons in the question.
function enableAllButtons() { disableOrEnableButtons(true); owner.notifyButtonStatesChanged(); }
[ "function disableAllButtons() {\n disableOrEnableButtons(false);\n }", "function setButtons() {\n hitButton.disabled = false;\n standButton.disabled = false;\n continueButton.disabled = true;\n }", "function enableButtons()\n{\n\tg_Options[g_TabCategorySelected].options...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Method to get month list starting from current month
function getMonthList() { var today = new Date(); var aMonth = today.getMonth(); var i; var matrixMnthList = $(".div-lpc-wrapper #matrixMonthList"); for (i = 0; i < 12; i++) { var monthRow = '<th class="label-month-lpc-wrapper" id=\"' + i + '\">' + monthArray[aMonth] + '</th>'; if ($...
[ "function buildMonth(start, month){\n var done = false, date = start.clone(), monthIndex = date.month(), count = 0;\n monthArray = [];\n $scope.month = moment().month(start.month() +1).format('MMMM');\n var viewedMonth = moment().month(start.month() +1);\n $scope.viewedMonth = viewedMonth.month();\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
FIND STUDENTS WITH ALL MARKS WITHIN (93,95)
function Q1(callback) { Student.aggregate([ { $match: { scores: { $not: { $elemMatch: { score: { $lt: 93} } } } } }, { $match: { scores: { $not: { $elemMatch: { score: { $gt: 95} } } } } ...
[ "function Q2(callback)\n\t{\n\t\tStudent.find({\n\t\t\tscores: {\n\t\t\t\t$elemMatch: { \n\t\t\t\t\tscore: { $gt: 93, $lt: 95} \n\t\t\t\t} \n\t\t\t} \n\t\t\t},function(err, docs) {\n\t\t\t\tconsole.log(\"-----------FIND STUDENTS WITH A MARK WITHIN (93,95)-----------\");\n\t\t\t\tif(JSON.stringify(docs) === \"[]\"){...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
TabbedElement creates and manages a component that allows the user to switch between several "pages" of content by clicking on labeled tabs. The component will occupy the space provided by a specified DIV element; be sure to leave room above the DIV for the tabs.
function TabbedElement(containerDiv, managementData, styleClass) { var tabContainer = containerDiv.appendChild(document.createElement("div")); containerDiv.className = styleClass || "tabbedElement"; tabContainer.className = "tab-container"; this._containerDiv = containerDiv; this._tabContainerDiv = tabC...
[ "function TabDom(h, b) {\n this.head = h;\n this.body = b;\n }", "function WMEAutoUR_Create_TabbedUI() {\n\tWMEAutoUR_TabbedUI = {};\n\t/**\n\t *@since version 0.11.0\n\t */\n\tWMEAutoUR_TabbedUI.init = function() {\n // See if the div is already created //\n\t\tvar urParentDIV = null;\n\t\tif ($(\"...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Updates the data on the left representing the players.
updatePlayerData(playerData) { console.log("Updating player info..."); this.updateTeamData(this.contentRows, ".simLeft", playerData); }
[ "static sPlayerLeft(sid, room, username) {\n // Sending new state of the room.\n Signals.emit(sid, \"sPlayerLeft\", {\n \"username\": username, \"playerList\": getPlayerList(room.users),\n \"host\": getHostUsername(room.users)\n });\n }", "function updateNumberOfPlaye...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Destroys this manager and all its shards.
destroy() { if (this.destroyed) return; this.debug(`Manager was destroyed. Called by:\n${new Error('MANAGER_DESTROYED').stack}`); this.destroyed = true; this.shardQueue.clear(); for (const shard of this.shards.values()) shard.destroy({ closeCode: 1000, reset: true, emit: false, log: false }); }
[ "destroy() {\n // Prevent multiple destruction of entities.\n if (this._destroyed === true) return;\n\n this._destroyed = true;\n\n this.onDestroy();\n }", "destroy() {\n _wl_scene_remove_object(this.objectId);\n this.objectId = null;\n }", "async destroy() {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets countryname by ID
function getCountryName(id) { let sql = `SELECT countryName FROM "country" WHERE countryid = '${id}' limit 1` return db.query(sql) }
[ "findCountryData(name) {\n\t\treturn this.state.data?.countries[name.toLowerCase().replace(\" \",\"_\")]?.data\n\t}", "function getCountryNames(){\n for(let i = 0; i < country_info[\"ref_country_codes\"].length; i++){\n let country = country_info[\"ref_country_codes\"][i][\"country\"];\n countryN...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Determine if two cartesian coordinate offsets are equal
function areCoordsEqual(offsetA, offsetB) { if (!offsetA && !offsetB) { return true; } else if (!offsetA || !offsetB) { return false; } else { return offsetA.x === offsetB.x && offsetA.y === offsetB.y; } }
[ "function isequal(o1, o2) {\n\t if (o1.x == o2.x && o1.y == o2.y && o1.w == o2.w && o1.h == o2.h) return true;\n\t return false;\n\t }", "oppositeColors(x1,y1,x2,y2){\r\n if(this.getColor(x1,y1) !== 0 && this.getColor(x2,y2) !== 0 && this.getColor(x1,y1) !== this.getColor(x2,y2)){\r\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Set the given function as the callback for the given handler and identifier.
onEventHandlerSet(room, handler, callback, identifier) { if (!this.handlers[handler]) { this.handlers[handler] = {}; } this.handlers[handler][identifier] = callback; }
[ "function eventWithId(func, id) {\n\t\treturn function(event) {func(event, id);};\n\t}", "function setFormCallbackListener(selectorString,handler){\n\t//console.log(\"setOnCallbackListener\");\n\t$(selectorString).iframePostForm({\n\t\tjson : true,\n\t\tcomplete : function (data){\n\t\t\t// do something here\n\t\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Appends this part after `ref` This part must be empty, as its contents are not automatically moved.
insertAfterPart(ref) { ref._insert(this.startNode = createMarker()); this.endNode = ref.endNode; ref.endNode = this.startNode; }
[ "function addFromRef(dataRef, header, id, originalData) {\n dataRef.once('value').then(\n\t\tfunction(snapshot) {\n\t\t\t// Add the information to the webpage.\n\t\t\tappendHTML(header, snapshot.val(), id, originalData);\n\n\t\t\t// Print the data for debugging purposes.\n\t\t\tconsole.log('(' + snapshot.key + '...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Update when skill cap is changed.
function capChange(e) { //Get oldNum and newNum, parsed into ints. let oldNum = parseInt(cap); let newNum = parseInt(O('sheet.cap').value); //Save the 'all skill paragraphs' div as skillDiv. let skillDiv = O('skillps'); if (newNum < oldNum) { //Need to remove some paragraphs. Will go top to bottom....
[ "function updateSP() {\n\t\tlet skillSpent= 0;\n\t\t\n\t\t//Loop from 1 to the skill cap, to find the current number of slots. (Cannot simply .reduce() the aSlots array because it remembers ratings which have been nixed by lowering the skill cap.)\n\t\tfor (let i=1; i<= cap; i++) {\n\t\t\tskillSpent += aSlots[i] * ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Traverse the template AST and look for the symbol located at `position`, then return its definition and span of bound text.
function getDefinitionAndBoundSpan(info, position) { var e_1, _a, e_2, _b; var symbols = locate_symbol_1.locateSymbols(info, position); if (!symbols.length) { return; } var seen = new Set(); var definitions = []; try { for (var symbols_1 = ...
[ "function getTemplateHover(info, position, analyzedModules) {\n var _a, _b, _c;\n var symbolInfo = locate_symbol_1.locateSymbols(info, position)[0];\n if (!symbolInfo) {\n return;\n }\n var symbol = symbolInfo.symbol, span = symbolInfo.span, staticSymbol = symbolInfo.st...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Query instructions can ask for "current queries" in 2 different cases: when creating view queries (at the root of a component view, before any node is created in this case currentQueries points to view queries) when creating content queries (i.e. this previousOrParentTNode points to a node on which we create content qu...
function getOrCreateCurrentQueries(QueryType) { // if this is the first content query on a node, any existing LQueries needs to be cloned // in subsequent template passes, the cloning occurs before directive instantiation. if (previousOrParentTNode && previousOrParentTNode !== viewData[HOST_NODE] && ...
[ "function clearCurrentQuery() {\n // don't clear the history if existing queries are already running\n if (cwQueryService.executingQuery.busy || pastQueries.length == 0)\n return;\n\n pastQueries.splice(currentQueryIndex,1);\n if (currentQueryIndex >= pastQueries.length)\n currentQ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
generate an object represnting a brewery. can be used to generate seed data for db or request.body data
function generateBreweryData() { return { name: generateBreweryName(), price: generatePricePerBeer(), image: generateImage(), description: generateDescription() }; }
[ "function makeBeerObject(apiBeer) {\n var beer = new Beer();\n beer.id = apiBeer.id;\n beer.name = apiBeer.name;\n beer.styleId = apiBeer.style.id;\n beer.styleName = apiBeer.style.name;\n beer.styleDescription = apiBeer.style.description;\n beer.categoryName = apiBeer.style.category.name;\n if (apiBeer.abv...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
auto display first tab control
focusFirst(){ const tab = this.tabControl.querySelector('.glu_verticalTabs-tab'); if (!tab) return; this.focusTab(tab); }
[ "_focusFirstTab () {\n this.tabs[0].focus()\n }", "function afterTabChange(tabPanel, selectedTabName){\n\n // Detect whether the characteristics tab was selected. If so, set variable, so that\n // the first child tab (the summary characteristics tab) will be displayed first\n if (selectedTab...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
"A" > 65, and "Z" > 90
function isLetter(c) { return c.charCodeAt(0) >= 65 && c.charCodeAt(0) <= 90 ; }
[ "function basic(cp){\r\n return cp < 0x80;\r\n // ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789@*_+-./\r\n }", "shifter(str) {\n\t\tlet newString = '';\n\t\tfor (const char of str) {\n\t\t\tnewString += /[a-z]/.test(char) ? String.fromCharCode(((char.charCodeAt(0) - 18) % 26) + 97) :...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Getting modal gallery HTML
function GetGalleryHTML() { return "<div class='modal fade' id='bootstrap-gallery' tabindex='-1' role='dialog' aria-hidden='true'>" + "<div class='modal-dialog modal-lg'>" + "<div class='modal-content'>" + "<div class='modal-header'>" + "<a href='' class='modal-button glyphicon glyphicon-remove' da...
[ "function renderGallery() {\n var imgs = getImgs()\n var strHtmls = imgs.map(img => {\n return `<img onclick=\"onImageClick(this)\" id=\"${img.id}\" src=\"${img.url}\" alt=\"${img.keywords}\"> `\n })\n document.querySelector('.gallery-container').innerHTML = strHtmls.join('')\n}", "openGallery_...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
setNavigation() Sets the navigation to use for dequeuing messages.
setNavigation() { errors.throwNotImplemented("setting navigation (dequeue options)"); }
[ "getNavigation() {\n errors.throwNotImplemented(\"getting navigation (dequeue options)\");\n }", "function setMessage(){\n //set navigation object to JSON\n var messageJSON = JSON.stringify(navigation);\n \n //asign message to message property in radio object\n radio.message = messageJSON;\n \n}", "no...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
The first pass splits the children fibers into two sets. A head and tail. We first render the head. If anything is in fallback state, we do another pass through beginWork to rerender all children (including the tail) with the force suspend context. If the first render didn't have anything in in fallback state. Then we ...
function updateSuspenseListComponent(current, workInProgress, renderLanes) { var nextProps = workInProgress.pendingProps; var revealOrder = nextProps.revealOrder; var tailMode = nextProps.tail; var newChildren = nextProps.children; validateRevealOrder(revealOrder); validateTailOption...
[ "function createBatcher() {\n var queue = new Set();\n return {\n add: function (child) { return queue.add(child); },\n flush: function (_a) {\n var _b = _a === void 0 ? defaultHandler : _a, measureLayout = _b.measureLayout, layoutReady = _b.layoutReady, parent = _b.parent;\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
draw a prototype actor circle
drawCircle(context, actor){ context.fillStyle = actor.color; context.beginPath(); context.arc(actor.x, actor.y, actor.r, 0, 2 * Math.PI, false); context.fill(); }
[ "drawBall() {\n fill('#FFFFFF');\n circle(this.x, this.y, 2 * this.radius);\n }", "function drawCircle(x, y, radius, color){\n\tcontext.beginPath();\n\tcontext.arc(x, y, radius, 0, Math.PI * 2, true);\n\tcontext.fillStyle = color;\n\tcontext.fill();\n\tcontext.closePath();\n\tcontext.addHitRegion({id: x+'....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Extend and override the default options used by the 5e Actor Sheet
static get defaultOptions() { const options = super.defaultOptions; options.classes = options.classes.concat(["worldbuilding", "actor-sheet"]); options.template = "public/systems/cod/templates/actor-sheet.html"; options.width = 600; options.height = 600; return options; }
[ "static get defaultOptions() {\n const options = super.defaultOptions;\n options.template = \"public/modules/ffg-roller/templates/roller-window.html\";\n options.width = 150;\n options.height = \"auto\";\n return options;\n }", "function Scene_Workman_Options() {\n this.init...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns tan of a number.
function tan(value) { return round(Math.tan(RADIANS * value), 10); }
[ "function tan (angle) { return Math.tan(rad(angle)); }", "function TAN(value) {\n\n if (!ISNUMBER(value)) {\n return error$2.value;\n }\n\n return Math.tan(value);\n}", "function radian_oa(o,a) {\n console.log(Math.atan(o/a))\n}", "function toDegree(radian) {\n return (radian * 180) / Math.PI;\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Similar to the above methods, but fetch resources in an iframe. Allows matching full context of reports sent from an iframe that's samesite relative to the domains a policy set.
function loadResourceWithBasicPolicyInIframe(subdomain) { return loadResourceWithPolicyInIframe( getURLForResourceWithBasicPolicy(subdomain)); }
[ "function getFrames() {\n\t\tvar result = [];\n\t\tvar frames = targetWindow.document.getElementsByTagName(\"iframe\");\n\t\tforEach(frames, function(frame) {\n\t\t\tresult.push({\n\t\t\t\tsrc: frame.src,\n\t\t\t\tname: frame.name,\n\t\t\t\tid: frame.id,\n\t\t\t\tposition: flatten(frame.getBoundingClientRect())\n\t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Adds number of days where the temp gets above 60 to station data in stationsObj. Note that this is basically the same as the other functions adding above/below32Info info and I should really extract into one function.
function addAbove80(data, stationsObj) { let above80Info = formatNoaaData(data); above80Info = separateFlags2C(above80Info); above80Info = fixSpecialValues(above80Info); above80Info = fixDecimal(above80Info); // Add above60Info data to stationsObj. for (let i of above80Info) { const station = i[0]; ...
[ "function add_to(station_name, is_pick, week, hour){\n let condition = (\n typeof station_name === 'string' && \n typeof is_pick === 'boolean' &&\n typeof hour === 'number' && hour >= 0 && hour < 24 &&\n typeof week === 'number' && week >= 0 && week < WEEK\n );\n week = (week + ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
handler for favourite selection
function doChoice(e) { if (this.selectedIndex > 0) { var c = favlist[this.options[this.selectedIndex].value]; var fail = false; if (c) { for (var i=1; i<=c.length; i++) { fail |= setState(i, c[i - 1]); } clearState(i - 1); } ...
[ "selectInputSourceFavorites() {\n this._selectInputSource(\"i_favorites\");\n }", "function goToFavoritesClick() {\n $('.favorites').show();\n $('.results').hide();\n }", "function closeFavHandler(e){\n if(e.target.className === \"joke-finder joke-finder--not-active\"){\n to...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Return a dictionary in the form of |_savedColumnStates| representing the current column states.
getColumnStates() { if (!this._active) { return this._savedColumnStates; } let columnStates = {}; let cols = document.getElementById("threadCols"); let colChildren = cols.children; for (let iKid = 0; iKid < colChildren.length; iKid++) { let colChild = colChildren[iKid]; if (c...
[ "_restoreColumnStates() {\n if (this._savedColumnStates) {\n this.setColumnStates(this._savedColumnStates);\n this._savedColumnStates = null;\n }\n }", "_persistColumnStates(aState) {\n if (this.view.isSynthetic) {\n let syntheticView = this.view._syntheticView;\n if (\"setPersistedS...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
set seconds lights every even second the light is yellow, otherwise it's off
function setSecondsLights() { //every even second light is yellow //otherwise light is off if(time.getSeconds() % 2 == 0) { addLight("yellow", secondsRow); } else { addLight("off", secondsRow); } }
[ "function changeColorToBlackEveryMinute(){\n today = new Date();\n h = today.getHours();\n m = today.getMinutes();\n s = today.getSeconds();\n if(isEven(m) && s === 0){\n document.body.style.backgroundColor = \"black\"; \n }else if(s === 0) {\n docume...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
helper function for the logout() function. Releases all beacons owned by a given owner:
function releaseBeacons(user) { beacons.forEach(function(beacon){ if (beacon.owner === user) { beacon.owner = null; } }); }
[ "function registerClose(subchainaddr) {\n\n //chain3.personal.unlockAccount(BaseAccount, BaseAccountPassword);\n sendtx(BaseAccount, subchainaddr, '0', '0x69f3576f');\n}", "function onSocketClose() {\n this[owner_symbol].destroy();\n}", "onDestroy() {\n STATE.cows--;\n }", "exitDelegationSpecifiers(ctx...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Name: get_tweets Descr: Create an array with a list of tweets for a search query from IndexedDB
function get_tweets(query, $q) { var q = $q.defer(); var transaction = tweets_db.transaction(["tweets"],"readonly"); var store = transaction.objectStore("tweets"); console.log("Nemam Amma Bhagavan Sharanam -- Query is " + query); // Open index var index = store.index("query, status_id"); var boundedK...
[ "function get_twitter_search_queries($q) {\n\n\tconsole.log(\"Nemam Amma Bhagavan Sharanam -- Calling get_twitter_search_queries\");\n\n\tvar q = $q.defer();\n\n\tvar transaction \t= twitter_search_queries_db.transaction([\"twitter_search_queries\"],\"readwrite\");\n\t\n\tvar store \t\t\t= transaction.objectStore(\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Create a standard view a challenge a user is participating in Each challenge is a part of a collapsible accordion
function createChallengeView(challenge, i) { return `<div class="column"> <h2><b><font color='#7A7A7A'>${challenge.title}</font></b></h2> <p><b>Description:</b> ${challenge.description}</p> <p><b>Participants:</b> ${challenge.participantNames.join(", ")}</p> <p><b>Check in: </b> every day...
[ "static view() {\n const coursesByDepartment = getCoursesByDepartment(\n courses.list,\n selectedDepartment,\n );\n return getUniqueYears(coursesByDepartment).map(year =>\n m(expandableContent, { name: `Year ${year}`, level: 0 }, [\n getUniqueLecturesByYear(\n coursesByDepart...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Instancia o phaser com a configuracao definida
function initGame() { return new Phaser.Game(defaultConfiguration()); }
[ "function defaultConfiguration() {\n return {\n type: Phaser.AUTO,\n width: 800,\n height: 600,\n physics: { \n default: 'arcade', // configura fisica do game estilo arcade\n arcade: {\n gravity: {y: 300},\n debug: false\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
BuildSetter returns a function that takes a value and assigns it to the key on the object.
function buildSetter(key) { if (key === "cmd") { return function(val) { this.cmd = val; return this; }; } else { return function(val) { this.options[key] = val; return this; }; } }
[ "set(propObj, value) {\n propObj[this.id] = value;\n return propObj;\n }", "createProperty(obj, name, value, post = null, priority = 0, transform = null, isPoly = false) {\n obj['__' + name] = {\n value,\n isProperty: true,\n sequencers: [],\n tidals: [],\n mods:...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
download hiscores to json file
function saveJson(){ saveJSON(hiScoreArray, 'hiscores.json'); }
[ "function downloadJSON() {\r\n\t// Save the data object as a string into a file\r\n\tsaveTextAsFile(2);\r\n}", "function loadJson(){\n for(let i = 0; i < hiScoreJSON.scores.length; i++){\n let user = hiScoreJSON.scores[i].user;\n let carNum = hiScoreJSON.scores[i].cars;\n let difMode = hiS...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates a new Color4 object from red, green, blue values, all between 0 and 1
function Color4(/** * Defines the red component (between 0 and 1, default is 0) */r,/** * Defines the green component (between 0 and 1, default is 0) */g,/** * Defines the blue component (between 0 and 1, default is 0) */b,/** * Defines the alpha component ...
[ "static FromInts(r, g, b) {\n return new Color3(r / 255.0, g / 255.0, b / 255.0);\n }", "static Red() {\n return new Color4(1.0, 0, 0, 1.0);\n }", "toColor4(alpha = 1) {\n return new Color4_1.Color4(this.r, this.g, this.b, alpha);\n }", "static Green() {\n re...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Adds all the parts of the wheel
_addParts() { this._wheel.anchor.set(0.5, 1); this._wheel.y = + 5; this._flap.anchor.set(0.5); this._flap.y = -this._wheel.height + 60; this._prompt.y = -this._wheel.height - 70; this._particles.y = -(this._wheel.height / 2); this.addChild(this._particles); this.addChild(this._whe...
[ "_addSectors() {\n const numberOfSectors = this.sectorValues.length;\n\n for (let i = 0; i < numberOfSectors; i++) {\n const sectorRotation = i * Math.PI / (numberOfSectors / 2);\n const sector = new Sector(i, this.sectorValues[i], sectorRotation);\n this._sectors.addChild(sector);\n }\n\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
refresh page for VL Coverage, this function is called when employee is cancelled sucessfully
function refreshPage() { var url = location.href; // Strip of information after the "?" if (url.indexOf('?') > -1) { url = url.substring(0, url.indexOf('?')); } url = buildMenuQueryString("", url); url = removeParameterFromUrl(url, "policyViewMode"); url += "&policyViewMode...
[ "function cancelled() {\n fire(\"refresh-cancelled\");\n finish();\n }", "function refreshReport(event) {\n const refresher = event.target\n actions.loadReport(selectedTripId, true).finally(() => refresher.complete())\n }", "function refeshGrid() {\n ConstCemDataServices...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Friends search dropdown list
function friendsSearchDropdown() { $(".drop-Search-list").hide(); $('.golf').click(function(event){ if($(event.target).attr('class') == 'search-items'){ $(event.target).parents('div.search-friends-ui').find('.drop-Search-list').slideToggle("fast"); }else { $('.drop-Search-list').hide(); } }); // $('.drop...
[ "function search() {\n\t\tvar searchVal = searchText.getValue();\n\n\t\tsources.genFood.searchBar({\n\t\t\targuments: [searchVal],\n\t\t\tonSuccess: function(event) {\n\t\t\t\tsources.genFood.setEntityCollection(event.result);\n\t\t\t},\n\t\t\tonError: WAKL.err.handler\n\t\t});\n\t}", "function filterNames() {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
used to display the results of pingdom checks
function showResults(pingdomChecks, pingdomOutages, res, req){ var content = '<div class = "checks">'+ '<h1>Pingdom Checks</h1>'+ pingdomChecks+ '<h1>Outage List</h2>'+ pingdomOutages+ '</div>'; output(content, res, req) }
[ "function seeRunningChecks() {\n $(\".page\").css(\"display\", \"none\");\n $(\"#running_checks\").css(\"display\", \"block\");\n\n sendMessage(\"checks/running\", \"\", \"post\",\n function(data, status, xhr){\n $(\"#running_checks\").html(DOMPurify.sanitize(data));\n }, function() {\n $(\"#running_chec...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Resolves the specified known declaration to a resolved value. For example, the known JavaScript global `Object` will resolve to a `Map` that provides the `assign` method with a builtin function. This enables evaluation of `Object.assign`.
function resolveKnownDeclaration(decl) { switch (decl) { case host_1.KnownDeclaration.JsGlobalObject: return exports.jsGlobalObjectValue; case host_1.KnownDeclaration.TsHelperAssign: return assignTsHelperFn; case host_1.KnownDeclaration.TsHelpe...
[ "getResolve() {\n return {\n extensions: ['.js', '.jsx', '.ts', '.tsx'],\n alias: this.config.alias !== undefined ? _objectSpread({}, this.config.alias) : {}\n };\n }", "function resolveSchema(\n root, // root object with properties schema, refs TODO below SchemaEnv is assigned to it\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
funcion para pasar al registro anterior
function registroAnterior(){ if (posicion>0){ posicion--; } //llamamos a la funcion de mostrar registros mostrarRegistro(); }
[ "function registroAnterior(){\n /*\n if (posicion>0){\n posicion--;\n }\n */\n\n if(posicion-1>=0){\n posicion = posicion - 1; \n }\n //llamamos a la funcion de mostrar registros\n mostrarRegistro();\n}", "modificar_datos(user, nombre, apellido, anio, mes, dia, gener) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Build tests Karma test
function testUnit() { return new karmaServer({ configFile: __dirname + "/../../test/config/karma.conf.js" }) .start(); }
[ "function runUnitTestServer() {\n\n return new karmaServer({\n configFile: __dirname + \"/../../test/config/karma.conf.js\",\n autoWatch: true,\n port: 9999,\n singleRun: false,\n keepalive: true\n })\n .start();\n}", "function main() {\n console.log(`testing ngtools A...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Given a diagnostic source, this function returns an extension that / enables linting with that source. It will be called whenever the / editor is idle (after its content changed).
function linter(source) { return ViewPlugin.fromClass(class { constructor(view) { this.view = view; this.lintTime = Date.now() + LintDelay; this.set = true; this.run = this.run.bind(this); setTimeout(this.run, LintDelay); } run() { ...
[ "function linter(source, config = {}) {\n return [lintConfig.of({ source, config }), lintPlugin, lintExtensions]\n }", "function less() {\n return new LanguageSupport(lessLanguage, lessLanguage.data.of({ autocomplete: lessCompletionSource }));\n}", "function scriptsLint() {\n\treturn gulp\n\t .src(j...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Set up a watch for given mountpoint
watch(mountpoint) { if (mountpoint.attributes.watch === false) { return; } if (this.core.config('vfs.watch') === false) { return; } if (!mountpoint.attributes.root) { return; } const adapter = mountpoint.adapter ? this.adapters[mountpoint.adapter] : this.adap...
[ "launch() {\n for (let d of this.forceDirs) {\n this._log(\"force to check dir \" + d.dir + \" with limit \" + d.limitMB);\n this._activateWatch(d.dir, d.limitMB);\n }\n\n if (this.autoDiscoverNewSubDirs) {\n this.objIntervalAutoScan = setInterval(() => {\n this._scanRoot();\n },...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Create a new data edit element Id is the database ID Values is an array of objects which have properties name and value
function createEditElement(id, values) { // main containing element into which other nodes are appended let containerElement = document.createElement('div'); containerElement.classList.add('data-container'); // create text element for the id let idElem = document.createElement('span'); idElem.a...
[ "function inserisci(data){\n id.value = data[0]._id\n name.value = data[0].regione_sociale\n indirizzo.value = data[0].indirizzo\n cap.value = data[0].cap\n località.value = data[0].località\n provincia.value = data[0].provincia\n nazionalità.value = data[0].nazionalità\n cod_fiscale.value =...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
goToWebIndex redirect the webview to the online webapp
function goToWebIndex(){ var webUrl = getWebappStartUrl(); loadUrl(webUrl); }
[ "function navigateWebview(webview, url, callback) {\n webview.onloadstop = function() {\n webview.onloadstop = null;\n callback();\n };\n webview.src = url;\n}", "function switchIndex(){\n\twindow.location.href=(\"./servletIndex.html\")\n}", "navigateToWebPage() {\n this[NavigationMixin.Navigate...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Refreshes internal informations (sitemap and navigations)
function refresh() { var sitemap = {}; var helper = {}; var navigation = {}; var partial = []; var sql = DB(); sql.select('pages', 'tbl_page').make(function(builder) { builder.where('isremoved', false); builder.fields('id', 'url', 'name', 'title', 'parent', 'language', 'icon', 'ispartial', 'navigations', '...
[ "function refresh() {\n map.remove();\n mapView();\n createRoute();\n busLocation();\n}", "reload() {\n this.requestWebsites();\n }", "refreshMap() {\n this.removeAllMarkers();\n this.addNewData(scenarioRepo.getAllEvents(currentScenario));\n this.showAllMarkers();\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
insertar en el carrito el curso seleccionado
function insertarCarrito(curso) { const row = document.createElement('tr'); row.innerHTML = ` <td> <img src="${curso.imagen}"width="100%"> </td> <td> ${curso.titulo} </td> <td> <p>${curso.precio}</p> </td> ...
[ "function mostrarCursosCarreraQueImparte(){\n let listaCursosCarrera = getListaCursos();\n let sede = getSedeVisualizar();\n let nombreSede = sede[0];\n let cuerpoTabla = document.querySelector('#tblCursosCarrera tbody');\n cuerpoTabla.innerHTML = '';\n\n for (let i = 0; i < listaCursosCarrera.len...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Toggle the state of all checkbox that belong to the domain
function toggleAllCheckBoxOfADomain(domainID, state) { var checkBox; domainID = parseInt(domainID); // Toggle the state of all sub-domains and their questions for (var i = 1; i <= domainsAndQuestions.domains[domainID].NumOfChild; i++) { checkBox = document.getElementById ("CheckBox Domain " + domainsAnd...
[ "function toggleInputsStates(inputs,checkedState) {\n\tinputs.each(function() {\n\t\t$(this).prop(\"checked\",checkedState);\n\t});\t\n}", "function toggleAuthCodes (){\n\t\tif (dojo.byId('outOfStateCheckBox').checked){\n\t\t\tdojo.byId('outOfStateAuthCodes').disabled = false;\n\t\t\tfor (var i=0; i<dojo.byId('ou...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This is a MedicationRequestDispenseRequest resource
static get __resourceType() { return 'MedicationRequestDispenseRequest'; }
[ "async _makeManagementRequest(request, options = {}) {\n const retryOptions = options.retryOptions || {};\n try {\n const abortSignal = options && options.abortSignal;\n const sendOperationPromise = async () => {\n let count = 0;\n const retryTimeout...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
return list of days in the past
function dates_past_n_days(days) { today = new Date() month = String(today.getMonth() + 1) year = String(today.getFullYear()) date_string = moment().format("YYYY-MM-DD") //year + "-" + month + "-01" start_time = moment(date_string) hours_list = [] for (i = 0; i < days; i++) { next_ti...
[ "function getPastTimes()\n{\n //get current UNIX time\n let currTime = Math.round((new Date()).getTime() / 1000)\n let dayInSeconds = 24*60*60 //24 hrs * 60 min * 60 sec\n let pastTimes = []\n\n //get past 5 days from now in UNIX times\n for (let i = 1; i <= 5; i++)\n {\n pastTimes.push(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
CODING CHALLENGE 122 Write a function that takes a string name and a number num (either 0 or 1) and return "Hello" + name if num is 1, otherwise return "Bye" + name.
function sayHelloBye(name, num) { return (num === 1) ? `Hello ${name[0].toUpperCase() + name.slice(1)}` : `Bye ${name[0].toUpperCase() + name.slice(1)}`; }
[ "function helloName (name) {\n return 'Hello, ' + name + '!'\n}", "function greet(name) {\n return \"Hello \" + name + \"!\";\n}", "function greeter (name) {\n return \"hoi \" + name + \"!\";\n}", "function boom(num) {\n if (checkNum(num))\n return \"BOOM\";\n else \n return String(num)...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
When submit check if is a valid graph.
handleSubmit() { let edges = this.state.graph.edges; let check = new Set(); for (let i = 0; i < edges.length; i++) { check.add(edges[i].source); check.add(edges[i].target); } if (check.size != this.state.graph.nodes.length) { confirmAlert({ title: `Warning!`, messag...
[ "function validStartAndEndSemester() {\n\n // First access our selects from the form and get their selected values\n var startSemesterSelect = $('#startSemesterSelect');\n var endSemesterSelect = $('#endSemesterSelect');\n var startSemester = startSemesterSelect.val();\n var endSemester = endSemester...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
CODING CHALLENGE 572 Write a function that returns an anonymous function, which transforms its input by adding a particular suffix at the end.
function add_suffix(suffix) { return x => x + suffix; }
[ "insert(suffix) {\n if (suffix === \"\") return;\n\n for (let a = suffix.length - 1; a >= 0; a--) {\n this.insertSubSuffix(suffix.slice(a));\n }\n }", "function makeReplaceFunction(values) {\n return function(match, id) {\n values.push(id);\n return '';\n };\n }", "function func8...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Click a beats action
function clickBeatsAction(params) { $log.debug("clickBeatsAction", params); vm.params = params; }
[ "function C101_KinbakuClub_Fight_Click() {\n\tFightClick();\n}", "function clickThatCow(imageElement) {\n\tsetSaving();\n\n\t// get the image name\n var imgName = parseCowName(imageElement);\n\t// run through the cow switch\n var cowAttributes = cowClickSwitch(imgName);\n\n\t// adjust points\n\tprevClick = ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Removes the passed item/s from the DOM.
function remove(items){items=getList(items);for(var i=0;i<items.length;i++){var item=items[i];if(item&&item.parentElement){item.parentNode.removeChild(item);}}}
[ "function deleteListItem(){\n\tthis.parentNode.remove();\n}", "removeItem(item) {\n Items.remove(item._id)\n }", "function removeItem(event) {\n var id = event.target.id;\n var listName = id.split('_')[0];\n var listItem = id.split('_')[1];\n \n var index = items[listName].indexOf(listI...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Validates a Fedex Ground Tracking Number returns true if valid
function _validFedexGround(number) { // check the length (we only need 15 digits, the rest depend on the barcode type etc.) number = number.trim(); valid_prefixes = ["96","95", "00"] // valid prefixes for fedex ground (I'm a little unsure if 00 ...
[ "function _validUPS(number) {\n number = number.trim();\n if (number.length != 18) { return false; }\n var check = number.substr(17, 1);\n\n // First Two Digits Must Be 1Z\n if (number.substr(0, 2) !== \"1Z\") { return false; }\n\n // Remaining Characters To Check\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Set the FOV depending on wether the display is horizontal or vertical
function adaptFOV() { // display is vertical if ( window.innerHeight > window.innerWidth ) { camera.fov = 110 ; camera.updateProjectionMatrix(); // display is horizontal } else { camera.fov = 90 ; camera.updateProjectionMatrix(); }; }
[ "function fovy() {\n return ( 2 * Math.atan(Math.tan(radians(fovx)/2) / aspect) * 180 / Math.PI);\n}", "setSideView() {\n\t\t'use strict';\n\t\tvar ratio = 6;\n\t\tvar camera = new THREE.OrthographicCamera(window.innerWidth / - ratio, window.innerWidth / ratio, window.innerHeight / ratio, window.innerHeight / ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns an employee email from "Employee Data" sheet Parameter(s): String employee, name of employee on Employee Data sheet Return: String email of employee
function getEmployeeEmail(employee){ var employeeNameIndex = 1; var employeeEmailIndex = 2; var employeeData = SpreadsheetApp.openById(sheetID).getSheetByName("Employee Data"); // Employee Data Sheet for(var i=2; i <= employeeData.getLastRow(); i++){ // Search for employee name down the name column if(...
[ "function getTutorEmail(tutorName, spreadsheetId) {\r\n // Open spreadsheet and access the appropriate sheet within (there's only one)\r\n let tutorsSpreadsheet = SpreadsheetApp.openById(spreadsheetId);\r\n let tutorsSheet = tutorsSpreadsheet.getSheets()[0];\r\n\r\n // Get the values for column A which contains...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
21. Write a Javascript program to print 34 upto 41. Sample Output: 34 35 36 37 38 39 40 41
function print34to41() { const array = [] for(let i = 34; i < 42; i++) { array.push(i); } return array.map(item => `<p class="output">${item}</p>`).join(""); }
[ "function printNumber(start, finish) {\n var count = start;\n while (count <= finish) {\n console.log(count);\n count = count + 1;\n\n\n }\n }", "function prog14()\n{\n\tvar n= prompt(\"Enter Even No\");\n\tn=parseInt(n);\n\t\n\t\tfor( var i=n+2;i<=n+10;i=i+2)\n\t\t{\n\t\tconsole.log(i);\n\t\t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
returns the euclidean distance between two given city indeces from an array
function getDistanceOfCities(ary,indexA, indexB) { return dist(ary[indexA].x, ary[indexA].y, ary[indexB].x, ary[indexB].y); }
[ "function calcDistancia(puntos, orden) {\n var sum = 0;\n for (let i = 0; i < orden.length - 1; i++) {\n var cityAIdx = orden[i];\n var cityA = puntos[cityAIdx];\n var cityBIdx = orden[i + 1];\n var cityB = puntos[cityBIdx];\n var d = dist(cityA.x, cityA.y, cityB.x, cityB.y);\n sum += d;\n }\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Scroll listener and current card mapper for card track.
setCardScrollTrackerMapper() { document .querySelector('#scrl4') .addEventListener('scroll', this.trakerMapperBound, { passive: true, }); }
[ "onScroll_() {\n if (!this.isActive_()) {\n return;\n }\n this.vsync_.run(\n {\n measure: state => {\n state.shouldBeFullBleed =\n this.getOverflowContainer_()./*OK*/ scrollTop >=\n FULLBLEED_THRESHOLD;\n },\n mutate: state => {\n this....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Put in $scope.instances the instances workshops to display
function getWorkshopsInstances() { EventsService.getInstancesWorkshop() .success(function (data) { $scope.instances = data; for (var i = 0; i < $scope.instances.data.length; i++) { var d = new Date($scope.instances.data[i].begin_at); ...
[ "async function listInstances() {\n const instancesClient = new compute.InstancesClient();\n\n const [instanceList] = await instancesClient.list({\n project: projectId,\n zone,\n });\n\n console.log(`Instances found in zone ${zone}:`);\n\n for (const instance of instanceList) {\n conso...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
`_lastHeading` returns the last heading.
_lastHeading() { const headings = this._allHeadings(); return headings[headings.length - 1]; }
[ "_firstHeading() {\n const headings = this._allHeadings();\n return headings[0];\n }", "function last() {\n return _navigationStack[_navigationStack.length - 1];\n }", "_prevHeading() {\n const headings = this._allHeadings();\n // Use `findIndex` to find the index of the c...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
creates new state from props and validates it
updateStateFromProps(props){ this.setState(this.State(props)); this.status('valid',this.isValid()); }
[ "constructor(props) {\n super(props)\n\n const parsedExerciseFormat = parseExerciseFormat(props.exercise.format)\n\n this.state = {\n exercise: props.exercise,\n exerciseStatus: null,\n failedSets: 0,\n passedSets: 0,\n ...parsedExerciseFormat,\n }\n this.startExercise = this...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns true if the keyword already has this label applied.
function hasLabel(keyword, label) { return keyword.labels().withCondition("Name = '" + label + "'").get().hasNext(); }
[ "function existsNameAlready() {\r\n\t\t$requests.getAllCategories(self.getCategories);\r\n\r\n\t\tfor (var i = 0; i < self.existingCategories.length; i++)\r\n\t {\r\n\t if (self.existingCategories[i].name === self.name)\r\n\t {\r\n\t return true;\r\n\t }\r\n\t }\r\n\t return...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Generates a key for this dependency. This allows this dependency to be found again at a later time, after the originial dependency might have already been deleted.
getKey() { return new DependencyKey(this.context, this.identifier); }
[ "ComputeKeyIdentifier() {\n\n }", "computeKey(type, id) {\n if (type === undefined || id === undefined) {\n throw Error('computeKey() needs type, id');\n }\n\n let sha1sum = crypto.createHash('sha1');\n id = id || '';\n return type + ':' + sha1sum.update(id).digest('hex') + '-' + this.versi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Individualitem formulas Construct an array for an item row in an order.
function constructItemRow(rowObject) { // Convert to array. var rowDataToAppend = constructArrayFromObject(MERGED_SHEET_HEADERS, rowObject); // Add the formulas for columns that don't contain static data. rowDataToAppend[ORDER_FULFILLED_COLUMN_INDEX] = " "; rowDataToAppend = addOrderDate(rowDataToAppend, row...
[ "function tasks_array_customize_item(item) {\n item['sub_project'] = sub_project_from_task(item) //item_name.split(\":\")[0].trim()\n item['duration'] = duration_from_task_dictionary(item)\n item['cost'] = task_cost_calculation(item)\n item[\"DT_RowId\"] = item.id;\n return item\n}", "getEquationAr...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Activate the pump using AWS IoT Device Shadow
function activatePump (intent, session, callback) { var repromptText = null; var sessionAttributes = {}; var shouldEndSession = true; var speechOutput = ""; //Prepare the parameters of the update call //Set the pump to 1 for activation on the device if (intent.slots.Power.val...
[ "function sustainOn() {\n echo = \"sustain\";\n console.log('sustain on');\n }", "trigger() {\n return new Promise((resolve, reject) => {\n gpiop.write(this.pin, true, err => {\n if (err) return reject(err)\n\n setTimeout(() => {\n gpiop.wr...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
If provided, let actions restrict the playlist by mentioning "1s" or "Doubles" etc in args.
function parsePlaylistArgs(argsLeft) { argsLeft = argsLeft.map(function(s) { return s.toLowerCase(); }); var playlists = []; if (argsLeft.indexOf("duel") > -1 || argsLeft.indexOf("1s") > -1) { playlists.push("Duel"); } if (argsLeft.indexOf("doubles") > -1 || argsLeft.indexOf("2s") > -1) { ...
[ "function togglePlaylistOptions() {\n\thasPermission(\"playlistjump\") ? $_opt2.show() : $_opt2.hide();\n\t(hasPermission(\"playlistadd\") && UI_ChannelDatabase==\"1\") ? $_opt3.show() : $_opt3.hide();\n\thasPermission(\"playlistmove\") ? $_opt4.add($_opt5).show() : $_opt4.add($_opt5).hide();\n\thasPermission(\"pla...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
checks if the race selection
function handleRace(){ var o = document.getElementById("race"); var val = o.options[o.selectedIndex].value ; if (val == "1" ){ return true; } else{ alert("This tool can only accurately calculate melanoma risk for patients who are non-Hispanic whites."); o.focus(); return fals...
[ "function check_selection(){\n\n console.log(\"here\")\n\n var slected = $('#TradingStrategiesList').find('.selected');\n console.log(slected.length)\n if(slected.length!==0){ // Which strategy was originally selected\n\n $(\"#editStrategy\").prop(\"disabled\",false)\n }\n}", "function teeS...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
get the current handler and action, with regex and add a class 'active' to the proper li item
function activeNavigation() { var locationUrl = window.location.href; var handlerAndAction = locationUrl .replace(/(.*\/\/vacation.+?\/)(index.cfm\/)?/i, '') .replace(/\?.+/, '') .split('/'); var currentHandler = handlerAndAction[0].toLowerCase(); var currentAction = handlerAndAc...
[ "function currentMenuItem() {\n\n\tvar cur_url = window.location.href;\n\tvar firstChar = cur_url.indexOf(\"/\", 7);\n\tvar lastChar = cur_url.indexOf(\"/\", firstChar + 1);\n\n\tif (lastChar > -1) {\n\t\tvar cur_word = cur_url.substring(firstChar + 1, lastChar);\n\t} else {\n\t\tvar cur_word = 'home';\n\t}\n\n\t$(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sort owned bodies by total resources Return array of bodies, most powerful first
function getSortedBodies(team) { var sortedBodies = []; bodies(function(body, name) { if (body.owner == team) { sortedBodies.push(name); } }); // Factions might change while viewing one planet sortedBodies.sort(function(a, b) { return totalBodyIncome(getBody(b)) - totalBodyIncome(getBody(a)); }); return...
[ "function sortEntitiesByHealth(array) {\n array.sort(function (current, next) {\n let hpCurrent = current.hp / current.max_hp;\n let hpNext = next.hp / next.max_hp;\n if (hpCurrent < hpNext) return -1; else if (hpCurrent > hpNext) return 1; else return 0;\n });\n return array;\n}", "...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Update an existing device group.
function updateDeviceGroup(axios$$1, token, payload) { return restAuthPut(axios$$1, '/devicegroups/' + token, payload); }
[ "function updateGroup(oContext) {\n\t\t\t\tvar oNewGroup = oBinding.getGroup(oContext);\n\t\t\t\tif (oNewGroup.key !== sGroup) {\n\t\t\t\t\tvar oGroupHeader;\n\t\t\t\t\t//If factory is defined use it\n\t\t\t\t\tif (oBindingInfo.groupHeaderFactory) {\n\t\t\t\t\t\toGroupHeader = oBindingInfo.groupHeaderFactory(oNewGr...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
end of globals / displayBroadcasts generates the html code to display broadcasts locationID: is the ID of the element eg div where the broadcasts are going to be sitting feedsArr: is an array of keyvalue pair dictionary which contains Broadcasts Broadcasts are arranged in order of retrieval status: tested
function displayAds(adsArr,locationID){ for (var i=0;i<adsArr.length;i++){ var ad =adsArr[i]; var advert = buildAd(ad); document.getElementById(locationID).innerHTML=advert+document.getElementById(locationID).innerHTML; } bindBroadcastLikeEvents(); //bindBroadcastLikeEvents(); bindBroadcastCommentEv...
[ "function render(msg)\n{\n document.getElementById('feeds').innerHTML = msg;\n}", "function showNextBroadcast() {\n // Make sure there's any broadcast to show\n if(broadcastQueue.length == 0)\n return;\n\n // Get the broadcast to show\n const broadcast = broadcastQueue[0];\n\n // Determin...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Take a part of a path and turn it into a truncated value
function truncatePathPart(pathPart) { if (pathPart == null || pathPart.length == 0) { return ""; } // is not blank, if greater, turn into pathPart...lastPart format var pathPartLen = pathPart.length; if (pathPartLen > 40) { var s = pathPart.substring(0, 15); s += "..."; s += pathPart.substring(pathPartLe...
[ "function reduce_path(full_path){\n let partial_path = [];\n if(full_path.length === 11){\n partial_path = full_path.slice(0,9); \n }else{\n partial_path = full_path.slice(0,10);\n };\n return partial_path;\n}", "function trimPath(path) {\n\t\tif (path.indexOf(\"#\") == 0) path = pa...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
a handy function to emit a sequence of keypresses/releases
function emitKeySequence(keys) { var i; for (i = 0; i < keys.length; i++) emitKey(keys[i], 1); for (i = keys.length - 1; i >= 0; i--) emitKey(keys[i], 0); }
[ "setKeyStateOrder() {\n this.keyStates = [this.KEY_LEFT, this.KEY_UP, this.KEY_RIGHT, this.KEY_DOWN]\n }", "function keyEvent() {\n for (const key of keyboard) {\n key.addEventListener(\"click\", keyboardClick);\n }\n}", "function keyEvent(code, isDown) {\r\n\tfor (const [key, value] of Object.entries(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
wrapper around jQuery.ajax, moves token_auth parameter to POST data while keeping other parameters as GET
function ajax(params) { delete params['token_auth']; return $.ajax({ url: 'index.php?' + $.param(params), dataType: 'json', data: { token_auth: tokenAuth }, type: 'POST' }); }
[ "function updateToken() {\n var CustomerId = $('#CustomerId').val();\n var postData = {'Customer':{'id':CustomerId}};\n $.ajax({\n type: \"POST\",\n // dataType: \"JSON\",\n data: postData,\n url: webroot + 'customers/resetCustomerToken',\n success: function (data) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
var oReq = new XMLHttpRequest(); oReq.addEventListener("load", reqListener); oReq.open("GET", 'music'); oReq.setRequestHeader("Range", "bytes=010000"); oReq.send();
function loadAudio (playerId, source) { var player = document.getElementById(playerId); var request = new XMLHttpRequest(); request.onreadystatechange = function() { console.log('readyState: ' + request.readyState + ', status: ' + request.status) if (this.readyState == 4 && this.status >= 20...
[ "function loadSong(id){\n var getBuffer = new XMLHttpRequest();\n getBuffer.open('GET', '/media/'+id+'.mp3');\n getBuffer.responseType = 'arraybuffer';\n getBuffer.onload = function(){\n audioContext.decodeAudioData(getBuffer.response, function(buffer){\n songBuffer = buffer;\n play(songBuffer);\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Load the studies dropdown box with the specified values
function loadStudies(values) { require(["dojo/ready", "dijit/form/MultiSelect", "dijit/form/Button", "dojo/dom", "dojo/_base/window"], function(ready, MultiSelect, Button, dom, win){ ready(function(){ if (studiesMultiSelect != null) studiesMultiSelect.destroyRecursive(true); selStudies = dom.byId('selectStudie...
[ "function admin_post_edit_load_univ() {\n get_univ(faculty_selector_vars.countryCode, function (response) {\n\n var stored_univ = faculty_selector_vars.univCode;\n var obj = JSON.parse(response);\n var len = obj.length;\n var $...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
leave create a leave receipt a leave receipts is signed by the oracle to exit a player from the table at a specific handId. when the leave receipt is accepted in the contract, the exitHand of the player is set to the handId provider in the receipt and a nettingRequest is created at handId
leave(...args) { const [handId, leaverAddr] = args; // make leave receipt // size: 32bytes receipt const payload = Buffer.alloc(32); // <1 bytes 0x00 space for v> payload.writeInt8(0, 0); // <7 bytes targetAddr> payload.write(this.targetAddr.replace('0x', '').substring(26, 40), 1, 'hex')...
[ "leave(player) {\n this.restoreDefaultPlayerStatus(player);\n\n // To avoid abuse we'll kill the player if they had recently fought.\n const decision = this.limits_().canLeaveDeathmatchZone(player);\n if (!decision.isApproved()) {\n player.sendMessage(Message.DEATH_MATCH_LEAVE...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Update the order information table based upon information from the backend. Use the /orders PHP AJAX call to obtain all information about the orders and then dynamically build the table with information.
function update_orders() { $.ajax({ contentType: 'application/json; charset=UTF-8', data: null, dataType: 'json', error: function (jqXHR, textStatus, errorThrown) { failure('Failed to get order data', jqXHR.statusText); }, success: function (data, textStatus, jqXHR) { if(data.result == 'ok') { fo...
[ "function sendOrdersToView(){\n $.ajax({\n method: 'GET',\n url: '/populateOrders',\n success: function(data, status) {\n $(\"#orderTableContents\").html(\"\");\n let htmlString = \"\";\n\n // If no orders exist in the DB\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
2) Em uma festa, homens pagam 20 reais de entrada e as mulheres pagam 17. Crie um programa que pergunta quantos homens e quantas mulheres participaram da festa e calcula o valor total arrecadado com as entradas. H = 20, M = 17 => h20 + m17
function calculaArrecadacao(qtdHomens, qtdMulheres){ return qtdHomens*20 + qtdMulheres*17; }
[ "function tasaSimple(meses, monto_total, monto_men){\n\t\n\t// var i = 0.05;\n\n\tvar resigual = monto_total / monto_men;\n\tvar res = 0;\n\ti = 0.00;\n\n\t// alert(\"resigual: \" + resigual);\n\n\tdo{\n\t\ti += 0.01;\n\t\tres = (1 - (Math.pow((1 + i), -1 * meses))) / i ;\n\t\t// alert(res);\n\t\t\n\t}while(res>res...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
scan and list certificate files from SDCard
function scan() { clear(); var storages = navigator.getDeviceStorages('sdcard'); var cursor = enumerateAll(storages, ''); cursor.onsuccess = function() { var file = cursor.result; if (file) { var extension = _parseExtension(file.name); var cerExtension = ['ce...
[ "async function findCRL(certificate)\n\t\t{\n\t\t\t//region Initial variables\n\t\t\tconst issuerCertificates = [];\n\t\t\tconst crls = [];\n\t\t\tconst crlsAndCertificates = [];\n\t\t\t//endregion\n\t\t\t\n\t\t\t//region Find all possible CRL issuers\n\t\t\tissuerCertificates.push(...localCerts.filter(element => c...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Add new playlist Note that all entries used in a playlist will become public and may appear in KalturaNetwork.
static add(playlist, updateStats = false){ let kparams = {}; kparams.playlist = playlist; kparams.updateStats = updateStats; return new kaltura.RequestBuilder('playlist', 'add', kparams); }
[ "function addPlaylist( mixtape, change )\r\n{\r\n \r\n var newId = mixtape.playlists[mixtape.playlists.length-1].id;\r\n newId++;\r\n newId = newId.toString();\r\n var newPlaylist = {\r\n id : newId,\r\n user_id : change.playlist.user_id,\r\n song_ids: change.playlist.song_ids\r\n }\r\n mi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
The number of IPv6 interfaces (regardless of their current state) present on this system.
async getIpv6Interfaces() { return Promise.resolve() .then(() => addIfIndexes()) .then((ifNames) => ifNames.length); }
[ "async getIpv6IfTableLastChange()\n {\n return 0; // Assume interfaces came up before management system\n }", "async getIpv6RouteNumber()\n {\n return Promise.resolve()\n .then(() => getRouteInfo6())\n .then(routeInfo => routeInfo.length);\n }", "get ipv6Supported() {\n return this.ge...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Modified accesskey system. While Alt key is pressed letter keys moves focus to next marked link. Alt key release activates focused link.
function setHotKeys() { document.onkeydown = function(ev) { ev = ev||window.event; key = ev.keyCode||ev.which; if (key == 18 && !ev.ctrlKey) { // start selection, skip Win AltGr _hotkeys.alt = true; _hotkeys.focus = -1; return stopEv(ev); } else if (ev.altKey && !ev.ctrlKey && ((key>47 && key<58) ||...
[ "function OnQueryCursor(/*object*/ sender, /*QueryCursorEventArgs*/ e)\r\n { \r\n /*Hyperlink*/var link = sender;\r\n\r\n if (link.IsEnabled && link.IsEditable)\r\n { \r\n if ((Keyboard.Modifiers & ModifierKeys.Control) == 0)\r\n { \r\n e.Cursor = link.Te...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
After adding a user role, fix it and get the checkboxes sorted
function fix_role_checkboxes(e) { var user_id = $(this).val(); $(this) .parent() .html(user_id) .parent() .attr('user_id', user_id); for (var i in roles) { $('#checkbox-'+roles[i]+'-') .attr('id', 'checkbox-'+roles[i]+'-'+user_id); } $('#remove-') .attr...
[ "function populate_roles_fields () {\n // Populate the fields from the roles table\n for (var i in roles) {\n var current_role = new Array();\n $('.roles-row').each(function(index) {\n user = $(this).attr('user_id');\n if ($('#checkbox-'+roles[i]+'-'+user).is(':checked')) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Cleanup the steps and set pointerEvents back to 'auto'
function cleanupSteps(tour) { if (tour) { var steps = tour.steps; steps.forEach(function (step) { if (step.options && step.options.canClickTarget === false && step.options.attachTo) { var stepElement = step.target; if (stepElement instanceof HTMLElement) { stepElement.style.po...
[ "function resetAllEvents(){\n\t\t\tevents.forEach( ev => { \n\t\t\t\tev.button.gotoAndStop(0);\n\t\t\t\tev.button.cursor = \"pointer\";\n\t\t\t\tev.choosen = false; \n\t\t\t});\n\t\t\t// update instructions\n\t\t\tself.instructions.gotoAndStop(0);\n\t\t\t// update side box\n\t\t\tself.sideBox.gotoAndStop(0);\n\t\t}...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Check if we're currently closer to the start of the day or the end.
function getClosestToStartOrEnd() { secondsInDay = 24*60*60; secondsSinceMidnight = getSecondsSinceMidnight(); // Direct Test - First we test which of the numbers is closer on a number line. directStart = Math.abs(startTime - secondsSinceMidnight); directEnd = Math.abs(endTime - secondsSinceMidnight) ...
[ "function checkDate(check1, check2) {\n\tif (check1.getHours() + getHourOffset() > check2.getHours() + getHourOffset()) { // If the hours are greater, you know it comes after\n\t\treturn 1;\n\t} else if (check1.getHours() < check2.getHours()) { // Likewise if they're less, then you know it comes before\n\t\treturn...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Super minimal version of Babel's wrapNativeSuper. We only use this for extending Function, for ComputedDecoratorImpl and AliasDecoratorImpl. We know we will never directly create an instance of these classes so no need to include `construct` code or other helpers.
function wrapNativeSuper(Class) { if (nativeWrapperCache.has(Class)) { return nativeWrapperCache.get(Class); } function Wrapper() {} Wrapper.prototype = Object.create(Class.prototype, { constructor: { value: Wrapper, enumerable: false, writable: true, config...
[ "function WrappedNativeObject(handle) {\n // Don't call the base constructor, because we initialize this.handle differently\n this._eventHandlers = {};\n this._properties = {};\n\n // Wrap an unknown native object. All we know is its handle.\n this.handle = handle;\n}", "function super_fn() {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Fetch the running kernels via API: GET /kernels
function listRunningKernels(baseUrl) { var url = utils.urlPathJoin(baseUrl, KERNEL_SERVICE_URL); return utils.ajaxRequest(url, { method: "GET", dataType: "json" }).then(function (success) { if (success.xhr.status !== 200) { throw Error('Invalid Status: ' + success.xhr.sta...
[ "function getKernelSpecs(baseUrl) {\n var url = utils.urlPathJoin(baseUrl, KERNELSPEC_SERVICE_URL);\n return utils.ajaxRequest(url, {\n method: \"GET\",\n dataType: \"json\"\n }).then(function (success) {\n var err = new Error('Invalid KernelSpecs Model');\n if (success.xhr.stat...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Walk through localApp and check if those fields exist
function checkLocalApp(app_fields){ if(!window.localApp) { alert('No localApp!'); }else{ if(Array.isArray(app_fields)) { for(var i=0, j=app_fields.length; i<j; i++){ checkField(app_fields[i]); } } else if(app_fields.indexOf('.')!=-1) { ...
[ "async existsInDB() {\n let result = {\n dataValues: null\n };\n try {\n const tmpResult = await db.appModel.findOne({\n where: {\n appId: this.appId\n }\n });\n\n if (tmpResult) {\n result = tmpResult;\n this.setApp(result.dataValues);\n retu...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sets the widget info cookie. The cookie contains the name of the widget (used for settings) and visibility status of the widget.
function _updateWidgetCookie() { cookie.putObjectValue(vm.cookieName, vm.widgetInfo); }
[ "function updateCookie() {\n var state = {\n userId: chat.id,\n activeRoom: chat.activeRoom,\n preferences: ui.getState()\n },\n jsonState = window.JSON.stringify(state);\n\n $.cookie('jabbr.state', jsonState, { path: '/', expires: 30 });\n }", "func...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
areConvex, areConcave :: Float > Float > Bool
function areConvex (angle1, angle2) {return isConvex (angle2 - angle1);}
[ "function isConvex (angle) {return mod_0_360(angle) <= 180;}", "function isConvex(points) {\n\t// get the string of points into a 2D array structure\n\tvar pointsList = points.split(\" \");\n\tvar pointsArray = [];\n\tfor (var j = 0; j < pointsList.length; j += 2) {\n\t\tpointsArray.push([Number(pointsList[j]), N...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Validates the slots against the provided validator and calls the responseCallback appropriately. Note: This is a mutating method. If an invalid field is found, the violated slot in the slots array is nulled.
function validateAndReElicit(eventRequest, slots, sessionAttributes, validator, responseCallback) { // Validate any slots and re-elicit const validationResult = validator(slots); if (!validationResult.valid) { // If an invalid field exists slots[`${validationResult.violatedSlot}`] = null; responseCal...
[ "function slotsChange(e) {\n\t\tlet i= this.id.substring(this.id.indexOf('.')+1);\n\t\t\n\t\t//Otherwise, they are still treated as strings and will run into trouble in double digits.\n\t\tlet oldSlots= parseInt(aSlots[i]);\n\t\tlet newSlots= parseInt(this.value);\n\t\t\n\t\tif (newSlots < oldSlots) {\n\t\t\t//Need...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Use trip count to determine number of children trip count nodes are necessary
function fillupTripCountTreeNode(tripCountNode) { if (Object.entries(tripCountNode['children']) == 0) return; let tripCount = tripCountNode.trip_count; for (let childID in tripCountNode['children']) { // For every subloop, make sure there are enough trip count nodes if (parseInt(trip...
[ "function initializeTripCountTreeNode(ownLoopNode, tripCount, parentTCNode) {\n if (parentTCNode === undefined) {\n parentTCNode = {};\n }\n let tripCountNode = {};\n tripCountNode[\"trip_count\"] = tripCount;\n tripCountNode['children'] = {};\n tripCountNode['id'] = ownLoopNode.id;\n //...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Listening to clicks on the handle. Hides/shows the dropdown.
function onHandlerClick() { dropdown.fadeToggle(200); }
[ "function dropdownHandler() {\n $('#question-dropdown').toggle(\"show\");\n}", "dropdownClickListener() {\n if (this.clickout) {\n const dropdown = this.dropdown;\n const rotate = this.rotateIcon.bind(this);\n const button = this.slotted.assignedNodes()[0];\n\n document.addEventListener(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
route GET '/admin' Affichage de la page de configuration du chatbot
index(req, res) { res.redirect('/admin/chatbotEdit'); }
[ "function Admin() {\n return (\n <div></div>\n // <Frame>\n // <Helmet>\n // <meta charSet=\"utf-8\" />\n // <title>Admin | ModestFun的个人博客</title>\n // <link rel=\"icon\" href={fileIp.defaultIp + \"/img/?name=logo\"} />\n // </Helmet>\n // <Switch>\n // {\n // ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }