query
stringlengths
9
34k
document
stringlengths
8
5.39M
negatives
listlengths
19
20
metadata
dict
addRestInfoWatchDb() adds price change, percentage change to the database
function addRestInfoWatchDb(sym, previousPrice) { var dbPath = "watchlist/" + sym, change, pctChange; console.log("in addRestInfoWatchDb()"); // get current stock price from database and calculate change in price database.ref(dbPath).on("value", (snapshot) => { change = snapshot....
[ "function addRestInfoWatchDb(sym, previousPrice) {\n var dbPath = \"/watchlist/\" + sym,\n change,\n pctChange;\n\n console.log(\"in addRestInfoWatchDb() dbPath: \" + dbPath);\n\n // get current stock price from database and calculate change in price\n database.ref(dbPath).on(\"value\", (s...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Save an ongoing action on the GM computer for a future reload
saveAction() { if (game.user.isGM) { localStorage.setItem('pendingAction', this.toJSON()); } }
[ "@action\n async save() {\n await this.rdfaCommunicator.persist();\n this.owner.lookup(SAVE_RESET_KEY).handleClose(this.args.info, null);\n }", "function villagerAction(){\n dataStore.waitForAll(\"nightWait\", postNightPhase, \"$null\");\n document.getElementById(\"notice\").innerHTML = \"Wa...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Method called when attempting to navigate to the 'Staff Requests' page
handleClickRequests(e) { e.preventDefault(); this.props.history.push({ pathname: '/staff-requests', state: {onUpdate: this.props.onUpdate, diningSessions: this.props.diningSessions, diningSessionAttributes: this.props.diningSessionAttribute...
[ "function DoUserInitiatedNavigation(/*object*/ sender) \r\n {\r\n// CodeAccessPermission perm = SecurityHelper.CreateUserInitiatedNavigationPermission(); \r\n// perm.Assert(); \r\n\r\n try \r\n {\r\n DispatchNavigation(sender);\r\n }\r\n finally \r\n {\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
/ shuffle produces a random list by doing len exchanges
function shuffle(list, length) { var i, rnd, temp; for (i = 0; i < length; i += 1) { rnd = i + Math.floor((Math.random() * (length - i))); temp = list[i]; list[i] = list[rnd]; list[rnd] = temp; } }
[ "shuffleElements() { \n this.deck.shuffle();\n }", "shuffleGuessList() {\r\n this.mixedGuessList = super.shuffle(this.guessList.slice());\r\n }", "shuffle() {\r\n for (let i = 0; i < this.len(); i++) {\r\n this.swap(\r\n this.getLinkByPosition(\r\n Math.floor(Math.ran...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Obtain the index value of the phrase being used so the right hint can correspond.
function getPhraseIndex(arr){ const phraseIndex = arr.indexOf(chosenPhrase); return phraseIndex; }
[ "function _index(phrase) {\n\n var indexKey = phrase.substr(0, config.indexDepth).trim();\n if (local.index[indexKey] === undefined) {\n local.index[indexKey] = {};\n }\n\n // Set Id as either the same as the previous equal phrase or\n // max id + 1\n var id = lo...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
saves userName to localStorage
function saveName() { localStorage.setItem('receivedName', userName) }
[ "function saveUsersName(text) {\n localStorage.setItem(USERS_LS, text);\n}", "function storeName() {\n const formWrapper = document.getElementById(\"personalizer\");\n const username = document\n .querySelector('[name=\"username\"]')\n .value.trim()\n .toUpperCase();\n if (username === \"\") {\n v...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
moveThisBodyPart() multipurpose reduces possibility of code errors and number of functions to maintain. Repetitive logic from before now in 1 place easier to fix if something is wrong
function moveThisBodyPart(i, thisBodyPart) { if (clicksArrayStarts0s[i] < 2) { // Cycles back to the beginning pic. $(thisBodyPart).animate({left:"-="+bodyPartWidth+"px"}, 500); clicksArrayStarts0s[i] = clicksArrayStarts0s[i]+1; } else { clicksArrayStarts0s[i] = 0; $(thisBodyPart).a...
[ "move()\n\t{\n\t\t// For every SnakePart in the body array make the SnakePart take on\n\t\t// the direction and x- and y-coordinates of the SnakePart ahead\n\t\t// of it.\n\t\tfor (let index = this.length - 1; index > 0; index--)\n\t\t{\n\t\t\tthis.body[index].x = this.body[index - 1].x;\n\t\t\tthis.body[index].y =...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
build rotated table column 1 from first row of main table
function FlexTable_stacks_in_4914_page22_SetRotHeader() { if (0 != 1) { return; } var table = document.getElementById('FlexTable_stacks_in_4914_page22'); var rtable = document.getElementById('FlexTableRot_stacks_in_4914_page22'); if (!table || !rtable) { return; } for (i=0; i<table.rows[0].cells.length; i++) { ...
[ "function FlexTable_stacks_in_5677_page22_SetRotHeader() {\n\n\tif (0 != 1) { return; }\n\n\tvar table = document.getElementById('FlexTable_stacks_in_5677_page22');\n\tvar rtable = document.getElementById('FlexTableRot_stacks_in_5677_page22');\n\tif (!table || !rtable) { return; }\n\n\tfor (i=0; i<table.rows[0].cel...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns an HTML string to show a weather icon depending "icon". A sun will be displayed by default.
function getWeatherIcon(icon) { if (icon.localeCompare('clear-night') == 0) { return '<i class="wi wi-night-clear" style="font-size: 32px"></i>'; } else if (icon.localeCompare('rain') == 0) { return '<i class="wi wi-rain" style="font-size: 32px"></i>'; } else if (icon.localeCompare('snow') == 0 || icon.local...
[ "function weatherIcon(weather) {\n const mainweather = weather.weather[0].main;\n const weather_icon = weather.weather[0].icon;\n let icon = \"\";\n\n switch (mainweather) {\n case \"Rain\":\n if (weather_icon === \"09d\") {\n icon += \"weather_icons/rainy-7.svg\";\n } else {\n icon +...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
A dimmable subcomponent for Dimmer.
function DimmerDimmable(props) { var blurring = props.blurring, className = props.className, children = props.children, dimmed = props.dimmed; var classes = __WEBPACK_IMPORTED_MODULE_1_classnames___default()(__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_4__lib__["a" /* useKeyOnly */])(blurring...
[ "get isDimmable() {\r\n return true; // we know no lightbulbs that aren't dimmable\r\n }", "function FluidPanel() {}", "function dimDot (id, dim)\n{\n\tif (dim) ph[id].dot.attr(\"opacity\", 0.15).attr(\"stroke-width\", dotstroke).toFront();\n\telse ph[id].dot.attr(\"opacity\", 1).attr(\"stroke-width\"...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
New function for deleting any info from a date. So simple it's embarrasing the way it was done before.
function deleteDateInfoAll(timestamp) { deleteDateInfo(timestamp, true, true, true, true); }
[ "deleteAppointment(date,time)\n {\n if (this.map.has(date)) {\n\n for (let i=0; i<this.map.get(date).length; i++)\n {\n if (this.map.get(date)[i].date == date && this.map.get(date)[i].time == time) {\n this.map.get(date).splice(i,1);\n break;\n }\n }\n }\n }", ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Passes all uniform values to shader program.
uploadUniforms() { const gl = EngineToolbox.getGLContext(); if (!this.shaderProgram) { return; } // pass uniforms to shader only if defined gl.useProgram(this.shaderProgram); this.uniforms.modelViewMatrix.value && uniformMatrix4fv(this.uniforms.modelViewMatrix); this.uniforms.pr...
[ "function parseUniforms(gl, uniformsJSON) {\n checkParameter(\"parseUniforms\", gl, \"gl\");\n checkParameter(\"parseUniforms\", uniformsJSON, \"uniformsJSON\");\n var shaderProgram = gl.getParameter(gl.CURRENT_PROGRAM);\n if (shaderProgram === null) {\n throw \"Applying vertex attributes with no shader prog...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
main loop: draw, capture event, update scene, and loop again
function loop(){ drawScene(); updateData(); window.requestAnimationFrame(loop); }
[ "function game_loop () {\n clear(current_level.c, current_level.ctx);\n\n // DEBUG TOOLS\n //draw_grid(current_level.c, current_level.ctx);\n //draw_room_holder_grid(current_level.c, current_level.ctx);\n //draw_ui_line(c, ctx);\n\n if (current_level.battle !== null) {\n current_level.battl...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
parent_zone_id computed: true, optional: false, required: false
get parentZoneId() { return this.getStringAttribute('parent_zone_id'); }
[ "get parentZoneName() {\n return this.getStringAttribute('parent_zone_name');\n }", "get parentId() {\n return this.getStringAttribute('parent_id');\n }", "get parent() {\n return new Path(this.parentPath);\n }", "function setParentId(/*Object*/ object,/*Store.PutDirectives?*/ options)...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
function init() to provide event listeners to make game buttons clickable and to playsound and blink when player presses game button
function init() { document .getElementById("game-photo-1") .addEventListener("click", playSound1); document .getElementById("game-photo-2") .addEventListener("click", playSound2); document .getElementById("game-photo-3") .addEventListener("click", playSound3);...
[ "function buildGameButton(){\n\tbuttonStart.cursor = \"pointer\";\n\tbuttonStart.addEventListener(\"click\", function(evt) {\n\t\tplaySound('soundButton');\n\t\tgoPage('tutorial');\n\t});\n\t\n\tbuttonGotIt.cursor = \"pointer\";\n\tbuttonGotIt.addEventListener(\"click\", function(evt) {\n\t\tplaySound('soundButton'...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
isSpamSubmission checks for a hidden field which should not be set and returns false if it is
isNotSpamSubmission() { var spamFieldValue = this.state.forbiddenInput; if(spamFieldValue.length !== 0) { return false; } return true; }
[ "function TKR_flagSpam(isSpam) {\n var selectedLocalIDs = [];\n for (var i = 0; i < issueRefs.length; i++) {\n var checkbox = document.getElementById('cb_' + issueRefs[i]['id']);\n if (checkbox && checkbox.checked) {\n selectedLocalIDs.push(issueRefs[i]['id']);\n }\n }\n if (selectedLocalIDs.lengt...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Adds health pills (which visualize tensor summaries) to a graph group.
function addHealthPills(svgRoot, nodeNamesToHealthPills, healthPillStepIndex) { if (!nodeNamesToHealthPills) { // No health pill information available. return; } var svgRootSelection = d3.select(svgRoot); svgRootSele...
[ "function heal() {\n\tif (pilot.total_health_packs == 0) {\n\t\t//The pilot can't do anything if they don't have health packs\n\t\tconsole.log(\"Can't heal,; no more health packs!\");\n\t} else {\n\t\tif (pilot.health == 100) {\n\t\t\t//Can't have more than 100 health\n\t\t\tconsole.log(\"Can't use health pack; Pil...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Extra check whether it's valid assignment target
_checkValidAssignmentTarget(node) { if (node.type === "Identifier" || node.type === "MemberExpression") { return node; } throw new SyntaxError("Invalid left-hand side in assignment expression"); }
[ "_isAssignmentOperator(tokenType) {\n return tokenType === \"SIMPLE_ASSIGN\" || tokenType === \"COMPLEX_ASSIGN\";\n }", "function analyze_assignment(stmt) {\n const name = assignment_name(stmt);\n const value_func = analyze(assignment_value(stmt));\n\n return (env, succeed, fail) => {\n value_...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
==== Marketplace Members Controller
function marketMembersCtrl ($scope, $stateParams, memberData, requests, roleData, orgScreenModel, EVENTS, memberHelper, memberService) { $scope.addMember = addMember; $scope.members = memberData; $scope.pendingRequests = requests; $scope.roles = roleData; ...
[ "static async view(ctx) {\n // team details\n const team = await Team.get(ctx.params.id);\n if (!team) ctx.throw(404, 'Team not found');\n\n // team members\n const sql = `Select TeamMemberId, MemberId, Firstname, Lastname\n From Member Inner Join TeamMember Us...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
=========================================================================== Compute the optimal bit lengths for a tree and update the total bit length for the current block. IN assertion: the fields freq and dad are set, heap[heap_max] and above are the tree nodes sorted by increasing frequency. OUT assertions: the fie...
function gen_bitlen(s, desc) // deflate_state *s; // tree_desc *desc; /* the tree descriptor */ { var tree = desc.dyn_tree; var max_code = desc.max_code; var stree = desc.stat_desc.static_tree; var has_stree = desc.stat_desc.has_stree; var extra = desc.stat_desc.extra_bits; var base = desc.stat_des...
[ "function $fb1c7bd82eb4c0c48c74268ddc57b$var$NextTableBitSize(count, len, root_bits) {\n var left = 1 << len - root_bits;\n\n while (len < $fb1c7bd82eb4c0c48c74268ddc57b$var$MAX_LENGTH) {\n left -= count[len];\n if (left <= 0) break;\n ++len;\n left <<= 1;\n }\n\n return len - root_b...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Second player wins the game
function secondPlayerWins() { secondPlayerScore.innerHTML = parseInt(secondPlayerScore.innerHTML) + 1; gameIsWon = true; }
[ "function winOrLose() {\n if (playerScore === randomNum) {\n winsCounter++;\n $(\"#wins\").html(\" \" + winsCounter);\n startGame();\n } else if (playerScore > randomNum) {\n lossCounter++;\n $(\"#losses\").html(\" \" + lossCounter);\n startGame();\n }\n }", "function check...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
UPDATE NEXT SONG ON DOM WITH SONG OBJECT
function updateNextSongDiv(nextSong){ let nextTitle = document.getElementById('next-playing-song-title') let nextArtist = document.getElementById('next-playing-song-artist') let nextImg = document.getElementById('next-playing-song-img') let nextSongData = document.getElementById('next-playing-con').data...
[ "function updatePrevSongDiv(prevSong){\n let prevTitle = document.getElementById('prev-playing-song-title')\n let prevArtist = document.getElementById('prev-playing-song-artist')\n let prevImg = document.getElementById('prev-playing-song-img')\n let prevSongData = document.getElementById('prev-playing-c...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Makes an Authorization 'Bearer' request with the given accessToken to the given endpoint.
async function callEndpointWithToken(endpoint, accessToken) { const options = { headers: { Authorization: `Bearer ${accessToken}` } }; console.log('Request made at: ' + new Date().toString()); const response = await axios.default.get(endpoint, options); return response...
[ "function bearerAuth(req, res, next) {\r\n passport.authenticate('bearer', {\r\n session: false\r\n },\r\n function(err, user, info) {\r\n if (err) return res.send(500, err);\r\n if (!req.query.access_token) {\r\n return re...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Registers a block type.
function registerBlockType(blockType) { // Bail ealry if is excluded post_type. var allowedTypes = blockType.post_types || []; if (allowedTypes.length) { // Always allow block to appear on "Edit reusable Block" screen. allowedTypes.push('wp_block'); // Check post type. var postType = acf...
[ "setType(block) {\n const type = block.type === 'customBlock' ? block.fields.type : block.type;\n block.type = type;\n }", "static registerType(type) { ShareDB.types.register(type); }", "has_block(type) { return (this.tracking_block(type)) ? this.blocks[type] : false; }", "async addBlock(block) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Merge the two, cdnjs libs takes precedence. sanitize pkg.names for both sources, lowercasing all, replacing spaces by ``. Generates a single `gimme.json` file with following props: name: package's name, lowercased, spaces replaced by `` description: package's description version: package's version, if provided (case of...
function merge(cdnjs, microjs, app, cb) { var pkgs = []; microjs = microjs.map(function(pkg) { pkg.name = sanitize(pkg.name); pkg.origin = 'microjs'; return pkg; }); // merge the two, cdnjs libs takes precedence var names = cdnjs.map(function(pkg) { pkg.origin = 'cdnjs'; return sanitize(...
[ "async function generatePackageJson() {\n const original = require('../package.json')\n const result = {\n name: original.name,\n author: original.author,\n version: original.version,\n license: original.license,\n description: original.description,\n main: './index.js',\n dependencies: Objec...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
sets the default 1616 grid size when page is loaded
function setDefaultGrid() { setGridSize(16); fillGrid(16); }
[ "function changeGridSize() {\n value = sizeSlider.value;\n container.innerHTML = \"\";\n makeRows(value, value);\n displayGridSlider.innerHTML = value.toString() + \"x\" + value.toString();\n}", "function setSizes() {\n if (!currentMap) return;\n\n const viewMaxWidth = canvasElement.width - dpi(40);...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Adds premade routes from geoJSON.js file to the map.
function addPremadeRoutes() { layerToAdd.forEach((tablica, index) => { var url = 'https://api.mapbox.com/directions/v5/mapbox/driving/' + tablica + '?geometries=geojson&steps=true&&access_token=' + mapboxgl.accessToken; var req = new XMLHttpRequest(); req.responseType = 'json'; req...
[ "function loadMapShapes() {\n // load US state outline polygons from a GeoJson file\n map.data.loadGeoJson('https://storage.googleapis.com/mapsdevsite/json/states.js', {\n idPropertyName: 'STATE'\n });\n\n // wait for the request to complete by listening for the first feature to be\n // added\n google.maps...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Game_UnitTS The superclass of Game_PartyTS and Game_TroopTS.
function Game_UnitTS() { this.initialize.apply(this, arguments); }
[ "function Game_PartyTS() {\n this.initialize.apply(this, arguments);\n}", "function Game_TroopTS() {\n this.initialize.apply(this, arguments);\n}", "function Window_BattleItemTS() {\n this.initialize.apply(this, arguments);\n}", "function antRPSGame() {\n this.Player1 = new antPlayer('Player1');\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Create empty description template and show it instead of gallery content
function showDescriptionTemplate(body) { var description = buildDescription(); description.title = ''; description.subtitle = ''; description.items.forEach(function(item) { item.title = ''; item.description = ''; }); cleanUpPage(body); var header = createAddElement('p', body); header.in...
[ "function createGalleryWithDescription(body) {\n\t\t\tjQuery.ajax({\n\t\t\t\turl: options.descriptionFile,\n\t\t\t\tdataType: 'json',\n\t\t\t\terror: function () {\n\t\t\t\t\t// As a failback, create simple gallery\n\t\t\t\t\tcreateSimpleGallery(body);\n\t\t\t\t},\n\t\t\t\tsuccess: function(description) {\n\t\t\t\t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Formats a range of years.
formatYearRange(start, end) { return `${start} \u2013 ${end}`; }
[ "formatYearRangeLabel(start, end) {\n return `${start} to ${end}`;\n }", "outputYear(years) {\n\t\tlet yearString = \"year\";\n\t\tif (years !== 1) {\n\t\t\tyearString = `${yearString}s`;\n\t\t}\n\t\treturn `${years} ${yearString}`;\n\t}", "function parse_years() {\n var raw_years = year_date_textbox...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
On click image Vocabulary
function onClickVocabularyImg() { // Set flag $('#scenario_vocabulary').val('vocabulary'); onOffAreaScenarioVocabulary(CLIENT.ONVOCABULARY); }
[ "function handleWordClick(event) {\n // get letter associated with image\n let image = document.getElementById(\"image\").src.substring(57,58)\n console.log(\"image name\", image)\n let word = event.target.value\n console.log(\"word selected\", word)\n for (let i=0; i<8; i++) {\n wordList[word][i]+=image...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Add friend to invite list
function addFriend(id) { invitedArr.push(id); var ufriends = JSON.parse(window.localStorage.getItem("uFriends")); for (var i = 0; i < ufriends.length; i++) { if (ufriends[i].id == id) { $('#friendTags').addTag(ufriends[i].name); } } }
[ "function add2List(me, friends) {\n var myName = me.name.substring(0, 20).toLowerCase();\n \n for (var i=0; i<friends.length; i++) {\n if (myName === friends[i].name.substring(0,20).toLowerCase()) {\n friends[i] = me;\n return;\n } \n }\n friends.push(me);\n }...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Called on user input event handler, logs a pause video event to the server, then pauses the video.
function runPauseSequence() { var time = getVideoTime(); logVideoEvent('pause', time, VIDEO_EVENT_LOG_URL). then(function() { pauseVideo(); }); }
[ "function _playVideoOnPause() {\n if (!_videoElementMovedWarning) {\n logging.warn('Video element paused, auto-resuming. If you intended to do this, ' + 'use publishVideo(false) or subscribeToVideo(false) instead.');\n\n _videoElementMovedWarning = true;\n }\n\n _domElement.play();\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Method to resize Lookup result droupdown according to lookup search width this method called from "resize" event registed in connectedCallBack, fired when browser resize
windowResizing(event) { let lookupSearchWidth = this.template.querySelector(".lookup-search"); if (lookupSearchWidth != null) { lookupSearchWidth = lookupSearchWidth.offsetWidth + "px"; this.template.querySelector(".dropdown").style.width = lookupSearchWidth; } }
[ "function i2uiResizeSlaveresize()\r\n{\r\n var distanceX = i2uiResizeSlavenewX - i2uiResizeSlaveorigX;\r\n //i2uitrace(1,\"resize dist=\"+distanceX);\r\n if (distanceX != 0)\r\n {\r\n //i2uitrace(1,\"resize variable=\"+i2uiResizeSlavewhichEl.id);\r\n\r\n // test that variable exists by this name\r\n if...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Generate HTML given a title, body, stylesheet paths, and script paths.
function html_document(title, body, favicon, stylesheets, scripts) { if (stylesheets === undefined) stylesheets = []; if (scripts === undefined) scripts = []; if (favicon !== undefined) { favicon_type = { 'ico': 'image/x-icon', 'gif': 'image/gif', 'png': 'image/png' }[favicon.substring(favicon.length - 3)]; } ...
[ "function createPage() {\n\t\t// check to see if the directory exists\n\t\tif (!fs.existsSync(OUTPUT_DIR)) {\n\t\t\t// if it does not, then make it\n\t\t\tfs.mkdirSync(OUTPUT_DIR);\n\t\t}\n\t\t// write the html file using the render(coworkers) data\n\t\tfs.writeFileSync(outputPath, render(coworkers), \"utf-8\");\n\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
create the final dungeon, keeping the hero's stats and items:
createFinalDungeon (heroStats, heroItems) { this.finalDungeon = true this.enemies = this.createEnemies() this.setState({ gameId: this.state.gameId + 1, heroStats: heroStats, heroItems: heroItems }) }
[ "generateDoors(){\n if(!this.walls.top){\n // make a door to the top\n this.grid[this.getIndex(2, 0)].fg = null;\n this.grid[this.getIndex(3, 0)].fg = null;\n this.grid[this.getIndex(1, 0)].fg = this.getSprite('tilemap', 'cobble-fg-right-0');\n this.grid[this.getIndex(2, 2)].fg = this.ge...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
loadModelFromText loads the model from the text.
loadModelFromText(text) { const cfg = config_1.Config.newConfigFromText(text); this.loadModelFromConfig(cfg); }
[ "function LoadOBJObject() {\r\n var mtlLoader = new THREE.MTLLoader();\r\n mtlLoader.setResourcePath(tempStorePath + lastUploadedObjectName.split(\".\")[0] + '/');\r\n mtlLoader.setPath(tempStorePath + lastUploadedObjectName.split(\".\")[0] + '/');\r\n mtlLoader.load(lastUploadedObjectName.split(\".\")[...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Convenience, remove this session from associated [[Link]] storage if set. Equivalent to: ```ts session.link.removeSession(session.identifier, session.auth) ```
async remove() { if (this.link.storage) { await this.link.removeSession(this.identifier, this.auth); } }
[ "function removeFromSession(key) {\n if (sessionStorage) {\n if (sessionStorage[key]) {\n delete sessionStorage[key];\n }\n }\n else {\n throw Error(\"Session storage not supported\");\n }\n}", "static async destroy(id) {\n db.del(`session:${id}`)\n }", "clearSess...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Do a deep render of the match result, showing the structure mismatches in context
renderMismatch() { if (!this.hasFailed()) { return '<match>'; } const parts = new Array(); const indents = new Array(); emitFailures(this, ''); recurse(this); return moveMarkersToFront(parts.join('').trimEnd()); // Implementation starts here. ...
[ "function showShallowDiff(obj1, obj2) {\n const args=global.args||{};\n var differences=false;\n if (!args.diff) return;\n Object.keys(obj1).forEach(key => {\n if (obj1[key] && typeof obj1[key] === \"object\" && obj1[key]!==null) { // it's an object\n if(obj2[key] && typeof obj2[key]==...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Bernstein Basis NumCS script: 5.5.2.8, p423 Scrpt Fabian: 3.45, p112
function bernsteinBasis(N, tt) { const n = N-1; const t = tt/n; //this basis goes from 0 to 1 for some reason //const t = tt; var sol = []; for(var i = 0; i <= n; i++) { const val = choose(n, i)*Math.pow(t,i)*Math.pow(1-t,n-i); sol.push(val); } return sol; }
[ "function get_BasePart_Energy(pos_i, int_seq)\n{\n var bp_i; // assignment of the base\n var size; // loop size\n var pos_BP_vor, pos_BP_nach; // pos. of the BPs that enclose the free base (in BP_Order)\n var i, j;\n var group_i, group_j; // left and right bord...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
3. find user sockets []
function findUserSockets(ioServer, userId, sessionId, logoutAll) { let ioSockets = []; let nsps = ioServer.nsps; for (let key in nsps) { if (key === '/') continue; let sockets = nsps[key].connected; for (let key in sockets) { if (!sockets[key].handshake.user) continue; ...
[ "listSockets() {\n var list = this.players.map(player => player.socketID);\n list.push(this.hostID);\n return list;\n }", "function onEachUserConnection(socket) {\n\t\n\tprint('---------------------------------------');\n\tprint('Connected => Socket ID ' + socket.id + ', User: ' + JSON.str...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns the computed left/right/top/bottom scrollbar widths for the given jQuery element. WARNING: given element can't have borders (which will cause offsetWidth/offsetHeight to be larger). NOTE: should use clientLeft/clientTop, but very unreliable crossbrowser.
function getScrollbarWidths(el) { var leftRightWidth = el[0].offsetWidth - el[0].clientWidth; var bottomWidth = el[0].offsetHeight - el[0].clientHeight; var widths; leftRightWidth = sanitizeScrollbarWidth(leftRightWidth); bottomWidth = sanitizeScrollbarWidth(bottomWidth); widths = { left: 0, rig...
[ "function horizontalScrollbarPos() {\n\t\tvar left = offset.x + width * pixelSize;\n\t\tvar right = canvas.width - offset.x;\n\t\treturn [(left / (left + right)) * (canvas.width - 100), canvas.height - 15];\n\t}", "function vimofy_get_el_offsetWidth(el)\r\n{\r\n\treturn document.getElementById(el).offsetWidth;\r\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
gets the current list of providers for a given user, checks if the needed provider exists with an access token calls satellizer authenticate if provider access_token doesn't exist save the provider info to userData, save userData to localStorage returns the token either way
function getAuth(provider) { let providers = userDataFactory.providers; //if the provider exists, authenticate the user if (providers[provider]) return $q.when(providers[provider]); return $cordovaOauth[provider](...PROVIDER_DETAILS[provider]) .then((response) => { userDataFactory.provider...
[ "getIdentityproviders() { \n\n\t\treturn this.apiClient.callApi(\n\t\t\t'/api/v2/identityproviders', \n\t\t\t'GET', \n\t\t\t{ },\n\t\t\t{ },\n\t\t\t{ },\n\t\t\t{ },\n\t\t\tnull, \n\t\t\t['PureCloud OAuth'], \n\t\t\t['application/json'],\n\t\t\t['application/json']\n\t\t);\n\t}", "function linkProviderWithUser...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Remove custom image from bookmark
function removeImage(bookmark) { browser.storage.sync.remove(bookmark.id) reloadFavicon(bookmark) }
[ "function removePreviousImage() {\n $capturedImage.empty();\n $capturedImage.removeAttr('style');\n $fridge.removeClass('hide');\n}", "function delbm(qdnum,bmnum) {\n\n // delete bookmark\n\n var tp1 = document.querySelectorAll('.torrentimg');\n //css选择 全部 小缩略图\n console.log(\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
PRIVATE Build a balanced tree from the sorted array where the left/right node takes on the mid of the left/right sides of the array.
function buildBalancedTree(array) { if (array.length == 0) { return null; } var mid = Math.floor((array.length)/2); var n = new treeNode(null, array[mid], null); var arrayOnLeft = array.slice(0, mid); n.left = buildBalancedTree(arrayOnLeft); var arrayOnRight= array.sli...
[ "function createAVL() {\n root = null;\n var inputArray = document.getElementById(\"inputArray\").value.split(\",\");\n for (let i = 0; i < inputArray.length; i++) { // convert sstring array to number array\n inputArray[i] = parseInt(inputArray[i]);\n }\n\n // Create a root node and tree\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Helper function for getHubActors This function searches for input actor in actor dictionary declared in getHubActors actors_dic: is a actor dictionary key: is a actor key in the dictionary value: is a list of actors associated with the key actor return TRUE if it found the value in key's list. FALSE otherwise.
function mapping_actors(actors_dic, key, value) { var actorList = actors_dic[key]; if (actorList === undefined){ return false; } else { for (var i = 0; i < actorList.length; i ++){ if (actorList[i] === value){ return true; } } } re...
[ "function actorExist(actor){\r\n\t\t\t\tvar e = false;\r\n\t\t\t\tfor(var i = 0; i<_actors.length; i++){ //Compruebo que no se repite el nombre y apellido.\r\n\t\t\t\t\tif(_actors[i].actor.name === actor.name && _actors[i].actor.lastname1 === actor.lastname1){\r\n\t\t\t\t\t\te = true;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
When focus is put on a date input
function eventFocusOnDate(element){ setInputFormat(element); var popup = element.parentNode.querySelector('.popup-date-picker'); displayPopup(popup); }
[ "function onFocusChange() {\n setFocusedInputLeftCol(focusedInputLeftCol === START_DATE ? END_DATE : START_DATE);\n }", "function eventLostFocusOnDate(element, event){\n\tvar popup = element.parentNode.querySelector('.popup-date-picker');\n\n\tif(!event || !event.relatedTarget || (!(event.relatedTarget ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Calculate the total price for a given dataset. Within each 'row' in the dataset, the 'price' attribute is denoted by 'key' variable The target currency is determined as follows: 1. Provided as options.currency 2. All rows use the same currency (defaults to this) 3. Use the result of baseCurrency function
function calculateTotalPrice(dataset, value_func, currency_func, options={}) { var currency = options.currency; var rates = options.rates || getCurrencyConversionRates(); if (!rates) { console.error('Could not retrieve currency conversion information from the server'); return `<span class...
[ "@api\n addTotalPrice(price) {\n this.totalPrice += price;\n }", "getCurrency() {\n const tier = this.getTier();\n return get(tier, 'currency', this.props.data.Collective.currency);\n }", "function calculate_price(vm_type){\n\n\t\tvar ID_SELECTOR = \"#\";\n\t\tvar CURRENCY = \"CHF\";\n\t\tva...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Check if value is primitive
function isPrimitive(value){return typeof value==='string'||typeof value==='number';}
[ "function isNonPrimitive(value) {\n return ((value !== null && typeof value === 'object') ||\n typeof value === 'function' ||\n typeof value === 'symbol');\n}", "function convertible(value, ty) {\n if (ok(value, ty)) {\n return true;\n }\n if (isNull(value) || isUndefined(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Notify the event listeners the application has stopped
function notifyApplicationStopped() { if (!_isApplicationRunning) { return; } _isApplicationRunning = false; applicationEventListeners.forEach(function (listener) { listener('stopped'); }); }
[ "stopListening() {\n this._eventsNames.forEach((eventName) => {\n process.removeListener(eventName, this.handler);\n });\n }", "_stopListeningForTermination() {\n this._terminationEvents.forEach((eventName) => {\n process.removeListener(eventName, this._terminate);\n });\n }", "function ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Change the avatar's linear or angular velocity based on controls state (set by WSAD key presses)
function updateAvatar(){ var forward = avatar.getWorldDirection(); if (controls.fwd){ avatar.setLinearVelocity(forward.multiplyScalar(controls.speed)); } else if (controls.bwd){ avatar.setLinearVelocity(forward.multiplyScalar(-controls.speed)); } else { var velocity = avatar.getLinearVelocity(); ve...
[ "updateVelocity(newVelocity) {\r\n this.v = newVelocity;\r\n }", "handleInput() {\n if (keyIsDown(LEFT_ARROW)) {\n this.vx = -PADDLE_SPEED;\n }\n else if (keyIsDown(RIGHT_ARROW)) {\n this.vx = PADDLE_SPEED;\n }\n else {\n this.vx = 0;\n }\n }", "function setDetectorVe...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
this generates an array containing a triangle that has hight h and width = (h 2 1)
function drawTriangle(h) { var image = []; var width = h * 2 - 1; for (var i = 0; i < h; i++) { image[i] = []; var edgeIdx = (width - 1) / 2; for (var j = 0; j < width; j++) { if(j < edgeIdx - i || j > edgeIdx + i ) image[i].push(" "); else image[i].push("*"); } ...
[ "function buildTriangle(length) {\n let triangle = '';\n let lineNumber = 1;\n for (lineNumber=1; lineNumber<=length; lineNumber++) {\n triangle = triangle + makeLine(lineNumber);\n \n }\n return triangle\n}", "function drawSubTriangles(h, n) {\n var smallTriangle = n === 0 ? drawTriangle(h/2): drawSu...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
FUNKCJA SORTOWANIA PO ZBIORACH
function sortujzbiory(){ $orderzbiory = "nr,dzien,miesiac,rok,10,20,30,40,50,60,70,80,1,11,21,31,41,51,61,71,2,12,22,32,42,52,62,72,3,13,23,33,43,53,63,73,4,14,24,34,44,54,64,74,5,15,25,35,45,55,65,75,6,16,26,36,46,56,66,76,7,17,27,37,47,57,67,77,8,18,28,38,48,58,68,78,9,19,29,39,49,59,69,79"; $orderzbiory = $order...
[ "function sortResults() {\n let perDesc = (a, b) => a[0] - b[0]\n let perAsc = (a, b) => b[0] - a[0]\n let indDesc = (a, b) => (a[1] + a[2]) - (b[1] + b[2])\n let indAsc = (a, b) => (b[1] + b[2]) - (a[1] + a[2])\n switch (sortBy.value) {\n case \"0\":\n result.sort(perDesc)\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Helper function to get the currently set levels in a stat.
function levels(stat) { return parseInt(document.getElementById(stat + "_levels").value); }
[ "function calculate_levels(stats) {\n\tvar total_levels = 1;\n\tfor (var stat in base_stats) {\n\t\tvar s_levels = levels(stat);\n\t\tstats[stat] += s_levels;\n\t\ttotal_levels += s_levels;\n\t}\n\tstats[\"level\"] = total_levels;\n}", "function getLevels() {\n const id = { id: $stateParams.artpackId };\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function for setting sports table in about section
function setSportsTable(response){ var b=response.sports; if(response.sports==null||response.sports==undefined||!response.hasOwnProperty('sports')) { $(".table-sports").append('Nothing to show'); } else { for(i in b) { $(".table-sports").append('<tr><td class="table-bi" >'+b[i].name+"</t...
[ "function createTab(battingTeam, bowlingTeam) {\n // Batting info table\n let tabContent = `\n <table class=\"table\" border=\"1\">\n <tr class=\"table-secondary\">\n <th>Batter</th>\n <th>R</th>\n <th>B</th>\n <th>4/6</th>\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
for contracting revoke btn on hover
function revoke_mouseout(revo) { revo.classList.remove('btn-revoke-active'); revo.classList.add('btn-revoke-in-active'); }
[ "function revoke_mouseover(revo)\n{\n revo.classList.remove('btn-revoke-in-active');\n revo.classList.add('btn-revoke-active');\n}", "function hoverOffOption(event) {\n $(event.target).css(\"border-color\",\"transparent\");\n }", "isMouseOver() {\n return this.button.isMouseOver()\n }", "f...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
below is function to restrict user from selecting specified number of data in dropdown. This function has 3 parameters. 1 parameter is control name, 2 one is index number in dropdown and 3rd one is the error to be fired.
function dontselect(objVal,indexNo,strError){ var objValue=document.getElementById(objVal); var finalerr=""; if(!objValue) {alert("Control with id " + objVal + " not found"); return;} if(objValue.selectedIndex == null) finalerr="BUG: dontselect command for non-select Item"; if(objValue...
[ "function setErrorSelect(nameControl, error) {\n\tif (jQuery('#' + nameControl +' option:selected').val()==-1) {\n\t\tjQuery('.' + nameControl + '-group').toggleClass('has-error')\n\t\tjQuery('.' + nameControl + '-group span.help-block').show();\n\t\treturn true;\n\t}\n}", "function validateIncome(errorMsg) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Updates 2 bindings if changed, then returns whether either was updated.
function bindingUpdated2(exp1, exp2) { var different = bindingUpdated(exp1); return bindingUpdated(exp2) || different; }
[ "function updateBindings() {\n // if any binding changes, loop over all bindings again to see if the changed made\n // any changes to other bindings. Similar to Angular.js dirty checking method.\n var changed = true;\n \n while (changed) {\n changed = false;\n \n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Registers the given hook function to run before leaving the given route. During a normal transition, the hook function receives the next location as its only argument and can return either a prompt message (string) to show the user, to make sure they want to leave the page; or `false`, to prevent the transition. Any ot...
function listenBeforeLeavingRoute(route, hook) { var thereWereNoRouteHooks = !hasAnyProperties(RouteHooks); var routeID = getRouteID(route, true); RouteHooks[routeID] = hook; if (thereWereNoRouteHooks) { // setup transition & beforeunload hooks unlistenBefore = history.listenBefore(t...
[ "_beforeHandleRoute() {\n this._afterHandleRouteCalled = false;\n }", "onBeforeUnload(callback) {\n return this.windowEventHandler.addUnloadCallback(callback);\n }", "function addOnloadHook (hookFunct) {\n // Allows add-on scripts to add onload functions\n if (!doneOnloadHook) {\n onloadFunct...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Abre el modal y reproduce el video
function reproducirVideo(){ $('#videoModal').modal('show'); video.play(); }
[ "function openVideo(video_id) {\n $(modal.replace(\"{VIDEO_ID}\", video_id)).appendTo('body').modal();\n}", "function playVideo(videoData) {\n document.querySelector(\"#modalYT div div div div iframe\").src = \"https://www.youtube.com/embed/\" + videoData.youtubeId;\n document.querySelector(\"#watch-vide...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
CHECKLABEL:function delete_expr() CHECKNEXT:frame = [] CHECKNEXT: %BB0: CHECKNEXT: %0 = LoadPropertyInst globalObject : object, "sink" : string CHECKNEXT: %1 = CallInst %0, undefined : undefined CHECKNEXT: %2 = ReturnInst true : boolean CHECKNEXT: %BB1: CHECKNEXT: %3 = ReturnInst undefined : undefined CHECKNEXT:functio...
function delete_expr() { return (delete sink()); }
[ "function delete_literal() {\n return (delete 4);\n}", "visitDel_stmt(ctx) {\r\n console.log(\"visitSivisitDel_stmt\");\r\n return { type: \"DeleteStatement\", deleted: this.visit(ctx.exprlist()) };\r\n }", "function foo(a,b) {\n \n // Now, deleting 'a' directly should fail\n // because...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
function to recursively build the proptype for shape
function buildShapePropType(validate) { var args = {}; Object.keys(validate.args).forEach(function (arg) { var element = validate.args[arg]; if (element.type && _react.PropTypes[element.type]) { if (element.args) { if (element.type === 'oneOfType') { var elementArgs = getArgs(...
[ "static _create2DShape (typeofShape, width, depth, height, scene) {\n switch (typeofShape) {\n case 0:\n var faceUV = new Array(6)\n for (let i = 0; i < 6; i++) {\n faceUV[i] = new BABYLON.Vector4(0, 0, 0, 0)\n }\n faceUV[4] = new BABYLON.Vector4(0, 0, 1, 1)\n fac...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Finds the closest injector that might have a certain directive. Each directive corresponds to a bit in an injector's bloom filter. Given the bloom bit to check and a starting injector, this function traverses up injectors until it finds an injector that contains a 1 for that bit in its bloom filter. A 1 indicates that ...
function bloomFindPossibleInjector(startInjector, bloomBit) { // Create a mask that targets the specific bit associated with the directive we're looking for. // JS bit operations are 32 bits, so this will be a number between 2^0 and 2^31, corresponding // to bit positions 0 - 31 in a 32 bit integer. var...
[ "function countOrbits (part, mapStr) {\n\n const map = mapStr.split('\\n');\n\n // COMMON: CREATE CHILDREN HASH MAP OF {CENTER: [...ORBITERS]} AND PARENTS HASH MAP OF {ORBITER: CENTER}\n const children = {};\n const parents = {}; // for part 2\n for (const orbit of map) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates a new result from its label and stores it in memory.
createOrGetResult( label) { if ( !this.RESULTS[label]) this.RESULTS[label] = new Result(label); return this.RESULTS[label]; }
[ "static makeNew() {\n\t\t// static helper.\n\t\treturn new JrResult();\n\t}", "function newTaskLabel(taskText) {\n\tvar taskLabel = $(document.createElement(\"LABEL\"));\n\tvar text = $(document.createTextNode(taskText));\n\ttaskLabel.append(text);\n\treturn taskLabel;\n}", "recycleByLabel(label) {\n ret...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
hide the mood panorama selector
function hideMoodSelection() { document.getElementById("mood-panorama-page").style.visibility = "hidden"; }
[ "function unhide()\r\n{\r\n if (document.querySelector('.pumpkin').style.visibility == \"visible\")\r\n {\r\n document.querySelector('.pumpkin').style.visibility = \"hidden\";\r\n }\r\n else\r\n {\r\ndocument.querySelector('.pumpkin').style.visibility = \"visible\";\r\n }\r\n}", "function hideGeoportalVi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sorts the name objects by region. Secondary and tertiary sort criteria are first name and last name respectively
function sortByRegion() { if (allNames !== null && allNames.length > 0) { allNames.sort((a, b) => { var valA = a.region.toLowerCase(); var valB = b.region.toLowerCase(); var secA = a.name.toLowerCase(); var secB = b.name.toLowerCase(); var terA =...
[ "function sortByLname() {\n if (allNames !== null && allNames.length > 0) {\n allNames.sort((a, b) => {\n var valA = a.surname.toLowerCase();\n var valB = b.surname.toLowerCase();\n\n var secA = a.name.toLowerCase();\n var secB = b.name.toLowerCase();\n\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Save the new set or save the changes to the set being edited
function saveCurrentSet() { if (!currentSet.name) { const inputValue = $headerElem.querySelector('.new-set-name').value; if (!validateSetNameInput(inputValue) || currentSet.ids.length === 0) { return; } currentSet.name = inputValue; ...
[ "save() {\n undo.push();\n store.content.fromJSON(this.getValue());\n super.save();\n }", "function updateSets(ex, action) {\n let n = ui.updateSets(ex, action);\n let id = ex.parentNode.parentNode.id;\n id = parseInt(id);\n\n exercise.updateSet(id, n);\n }", "function e...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Turns the raw data array of a VATSIM flight into an object (and performs some checks/enhancements)
function createFlightObject(rawData) { var flight = { callsign: rawData[0], lat: parseFloat(rawData[5]), lon: parseFloat(rawData[6]), alt: parseInt(rawData[7]), groundspeed: parseInt(rawData[8]), aircraft: rawData[9].match(/([A-Z]*\/)?([A-Z0-9\-]*)(\/[A-Z]*)?/)[2], origin: rawData[11], rfl: rawData[12]...
[ "parse(data, fms) {\n // Populate Waypoint with data\n if (data.fix) {\n this.navmode = 'fix';\n this.fix = data.fix;\n this.location = window.airportController.airport_get().getFixPosition(data.fix);\n }\n\n _forEach(data, (value, key) => {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns true if a bid decrease is needed, false otherwise
function isBidDecreaseNeeded(stats, currentBid, baselineConversionRate) { var conversions = stats.getConversions(); var conversionRate = stats.getConversionRate(); var targetBid = (conversionRate / baselineConversionRate) if (isBidChangeSignificant(currentBid, targetBid)) { var isDecreaseNeeded...
[ "function isBidIncreaseNeeded(stats, currentBid, baselineConversionRate) {\n var conversions = stats.getConversions();\n var conversionRate = stats.getConversionRate();\n var position = stats.getAveragePosition();\n var targetBid = (conversionRate / baselineConversionRate)\n\n if (isBidChangeSignific...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This function deletes a video from the database.
function deleteVideo(req,res,next) { myTube.Video.remove({videoId:req.params.videoID}, function(error){ if (error) { res.send(500, "Error while trying to delete"); } else { res.send(200, "video was successfully deleted from db"); } }); }
[ "function deleteVideo(videoId, callback) {\n pool.connect().then((pool) => {\n pool.request()\n .input('videoId', sql.VarChar, videoId)\n .query('DELETE FROM [dbo].[videos] WHERE videoId=@videoId')\n .then(res => {\n storageDeleteBlob(videoId)\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Calculates pi based on the number of hits and misses
function calculatePi(throws, hits) { return (4.0 * hits) / (throws > 0 ? throws : 1); }
[ "function myPi(n) {\n\treturn parseFloat(Math.PI.toFixed(n));\n}", "function piSum3(a, b) {\n return sum(\n x => 1.0 / (x * (x + 2)), //piTerm\n a,\n x => x + 4, //piNext\n b\n );\n}", "function newComputePi() {\n\t// Start at pH 7. Determine charge, contributed by N and C termini and charged amin...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This is an Amazonprovided function that checks whether the requesting device has a display. Returns True if it does and False if it doesn't
function supportsDisplay() { var hasDisplay = this.event.context && this.event.context.System && this.event.context.System.device && this.event.context.System.device.supportedInterfaces && this.event.context.System.device.supportedInterfaces.Display return hasDisplay; }
[ "static isDisplaySupported(requestEnvelope) {\n return requestEnvelope.context.System.device.supportedInterfaces.Display !== undefined;\n }", "function isMediaDevicesSuported(){return hasNavigator()&&!!navigator.mediaDevices;}", "function isViewed(display_frame_name) ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Delete the underlying WASM instance. Should be called before dereferencing this object to prevent the WASM heap from growing indefinitely.
delete() { if (_instance) { _instance.delete() _instance = null } }
[ "deleteInstance(instance) {\n this.instances.remove(instance)\n }", "destroy() {\n _wl_scene_remove_object(this.objectId);\n this.objectId = null;\n }", "_destroy() {\n\t\tthis.workspaces_settings.disconnect(this.workspaces_names_changed);\n\t\tWM.disconnect(this._ws_number_changed);\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
save all company species records
function saveCompanySpecies(obj) { return post('/companyspecies/save', { obj: obj }).then(function (res) { return res.data; }).catch(function (err) { return err.response.data; }); }
[ "function save_all() {\n\tvar type = $('#type_list').find(\":selected\").val();\n\t// if it's for a new cue, we fetch everything from the UI\n\tif (cue_id == 'xx') {\t\n\t\tvar channel = Number($(\"#channel\").val());\n\t\tvar delay = Number($(\"#delay\").val());\n\t\tvar options = {};\n\t\tvar name = $('#cue_name'...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
create a program from a function.
function Program(f) { EventEmitter.call(this); var program = this; this.cli = self; var spent = false; program._run = f; program.closed = false; program.write = function () { if (program.closed) { return program; } var len = arguments.length; for (var i = 0; i < len; i++) { o...
[ "function program(impl) {\n return function(flagDecoder) {\n return function(object, moduleName, debugMetadata) {\n object.start = function start(onAppReady) {\n return makeComponent(impl, onAppReady);\n };\n };\n };\n }", "function programWithFlags(impl) {\n return func...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Initialize a new minimal genome for the simulation.
createMinimalGenome() { return new Genome(this.genGenomeId(), this, []); }
[ "function createInitialPopulation() {\n //inits the array\n genomes = [];\n //for a given population size\n for (var i = 0; i < populationSize; i++) {\n //randomly initialize the 7 values that make up a genome\n //these are all weight values that are updated t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Utility functions and variables: Indent a (multiline) string with `JSON_INDENT` given number of times. indentFirst controls whether the first line is indented as well.
function _indent(str, levels, indentFirst) { indentFirst = indentFirst !== false; let lines = str.split('\n'); let ret = new Array(lines.length); if (!indentFirst) { ret[0] = lines[0]; } for (let i = indentFirst ? 0 : 1; i < lines.length; i++) { ret[i] = util_1.repeatStri...
[ "function prettify(json, spacing, colors) {\n if (!spacing) {\n spacing = 2;\n };\n colorize(colors);\n\n if (typeof json != 'string') {\n json = JSON.stringify(json);\n }\n //Sanitize HTML special characters.\n json = json.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Logical("xor"|"and"|"or", ax, bx) About: comparison between two arrays bits are right justified (least significant bit is to the right) Special Cases: (null can be 0 or 1 and 3 = 3 just as 1 = 1 and 0 is false always) Examples: Logical("and", 1, null) = result.value = 0 Logical("xor", 1, null) = result.value = 0 (becau...
function Logical (type, ax, bx) { var result = {value: null, // the result of the Logical operation diff : 0, // number of bits that are different between ax and bx change : 0, // estimate of the number of bits that need to be changed to get to eaither ax or bx from .value ...
[ "function XOR() {\n for (var _len15 = arguments.length, values = Array(_len15), _key15 = 0; _key15 < _len15; _key15++) {\n values[_key15] = arguments[_key15];\n }\n\n return !!(FLATTEN(values).reduce(function (a, b) {\n if (b) {\n return a + 1;\n }\n return a;\n }, 0) & 1);\n}", "function xor...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns a label for a point with an appropriate number of decimals for the given scale. Scale is typically chosen to be the range of numbers displayed in the current viewport. Rounds to pi fractions when the denominator is 24 or less, according to a tolerance that depends on x and scale. Label is returned as on object ...
function value(x, scale) { if (isNaN(x)) return { string: 'undefined', value: x }; if (x === 0) return { string: '0', value: x }; if (!scale) scale = x; var piFraction = BuiltIn.toFraction(x / Math.PI, 24); var nString; var dString; if ( fewDigits...
[ "label(text, size = -1) {\n //TODO\n }", "function format_number(label, unit, ndec, dec, grp) {\n if (isNaN(label)) return '';\n if (unit === undefined) unit = '';\n if (dec === undefined) dec = '.';\n if (grp === undefined) grp = '';\n // round number\n if (ndec !== undefined) {\n label = labe...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Reconnect CSS tasks to browsersync for streaming
function connect(cb) { css.connect(browserSync); cb(); }
[ "function watchCSS() {\n fs.watch(path.join(paths.client, \"/style.css\"), updateCSS);\n}", "function cssTask(){\n return src(files.cssToMinify)\n .pipe(uglifycss({\n \"uglyComments\": true\n }))\n .pipe(dest(files.distToDistCss));\n}", "function watchTask() {\n // watch(\n // [files.c...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
CODING CHALLENGE 478 Create a function that takes the width, height and character and returns a picture frame as a matrix.
function getFrame(w, h, ch) { if (w <= 2 || h <= 2) return 'invalid'; const a = []; for (let i = 0; i < h; i++) { if (i > 0 && i < h - 1) { a.push([ch + ' '.repeat(w - 2) + ch]); } else { a.push([ch.repeat(w)]); } } return a; }
[ "function wordStep(str) {\n var words = str.split('');\n\n var height = 0;\n var heightWordCount = 0;\n var heightWords = [];\n var onHeightWord = 0;\n\n var width = 0;\n var widthWordCount = 0;\n var widthWords = [];\n var onWidthWord = 0;\n\n var temp = [];\n var completedMatrix = [];\n\n for (let i =...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
uint16 Returns true iff the flags have the IGNORE bit set.
function isIgnore( flags ) { return (flags & FLAGS.IGNORE) === FLAGS.IGNORE; }
[ "function noFlags(){\n return (typeof(p) == typeof(v));\n}", "readUint16() {\n const value = this._data.getUint16(this.offset, this.littleEndian);\n\n this.offset += 2;\n return value;\n }", "function stillImaginary(mask) {\n for (let i = 0; i < mask.length; i++) {\n if (gpuMult) ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets the resolved version number of a dependency for a specific temp project. For PNPM, we can reuse the version that another project is using. Note that this function modifies the shrinkwrap data.
tryEnsureDependencyVersion(dependencyName, tempProjectName, versionRange) { // PNPM doesn't have the same advantage of NPM, where we can skip generate as long as the // shrinkwrap file puts our dependency in either the top of the node_modules folder // or underneath the package we are looking at...
[ "_getDependencyVersion(dependencyName, tempProjectName) {\n const tempProjectDependencyKey = this._getTempProjectKey(tempProjectName);\n const packageDescription = this._getPackageDescription(tempProjectDependencyKey);\n if (!packageDescription) {\n return undefined;\n }\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
adds a hierarchical structure to the subdymos of the given dymo in the given store
function addStructureToDymo(dymoUri, store, options) { var surfaceDymos = getAllParts([dymoUri], store); var points = toVectors(surfaceDymos, store, false, true); var occurrences = new siafun_1.StructureInducer(points, options).getOccurrences(options.patternIndices); createStructure(occu...
[ "function addFromObjArray(oArry, idKey, silent) {\n oArry.forEach(function (obj) {\n\n var id;\n\n if (obj.hasOwnProperty(idKey)) {\n id = obj[idKey];\n } else {\n id = _id + 'child' + _children.length;\n }\n\n add(Nori.model().createMap({id: id, silent: sil...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function: _fnBuildSearchRow Purpose: Create a searchable string from a single data row Returns: Inputs: object:oSettings dataTables settings object array:aData Row data array to use for the data to search
function _fnBuildSearchRow( oSettings, aData ) { var sSearch = ''; if ( typeof oSettings.__nTmpFilter == 'undefined' ) { oSettings.__nTmpFilter = document.createElement('div'); } var nTmp = oSettings.__nTmpFilter; for ( var j=0, jLen=oSettings.aoColumns.length ; j<jLen ; j++ ) { if ( oSe...
[ "function and_search(data_table, field) {\n\t// alert($('input.and_or_button').bootstrapSwitch('state'));\n\t\n\tcolumn_id = $(field).attr(\"name\");\n\t\t\t\n\t//Get the searched value\n\tvar searched_value = $(field).val();\n\t\t\t\n\t// var searched_value = \"test10 test1000\";\n\t\t\t\n\t//Search the value into...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
fills in values for assign shifter form using inputted information from the calendar (shiftType, shiftStart, shiftEnd). Similar to signup form but has restricted access
function Assign(shiftType, shiftStart, shiftEnd){ var ret = '' // allows for daq_id suggestions when typing in a shifter DAQAutocomplete('#assign_shifter'); $('#assign_start_date') .val(moment(parseInt(shiftStart)) .tz('Atlantic/St_Helena') .format("YYYY-MM-DD")); $("#assign_start_date").prop("rea...
[ "function SignUp(shiftType, shiftStart, shiftEnd){\n var ret = '';\n $('#id_start_date').val(moment(parseInt(shiftStart)).format(\"YYYY-MM-DD\"));\n $(\"#id_start_date\").prop(\"readonly\", true);\n $('#id_end_date').val(moment(parseInt(shiftEnd)).format(\"YYYY-MM-DD\"));\n $(\"#id_end_date\").prop(\"readonly\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Description There is a narrow hallway in which people can go right and left only. When two people meet in the hallway, by tradition they must salute each other. People move at the same speed left and right. Your task is to write a function that, given a string representation of people moving in the hallway, will count ...
function countSalutes(hallway) { let salutes = 0 let array = hallway.split('') console.log(array) for (let i = 0; i <array.length; i++) { if(array[i] === ">") { for (let y=i+1; y<array.length; y++) { if (array[y] === "<") { salutes += 2 console.log(salutes) } } }...
[ "function comparePsTs(string1) {\n\n string1 = string1.toLowerCase() //so P and p both count as the same letter\n\n p_array = string1.split(\"p\") //split string1 at each p and put result into an array\n p_length = p_array.length //number of elements in the resulting array = (number of Ps + 1)\n\n t_ar...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
takes GeoJSON as input, creates a GeoJSON GeometryCollection of linestrings as output
function lineify(inputGeom) { var outputLines = { "type": "GeometryCollection", "geometries": [] } switch (inputGeom.type) { case "GeometryCollection": for (var i in inputGeom.geometries) { var geomLines = lineify(inputGeom.geometries[i]); ...
[ "function lineify(inputGeom) {\r\n var outputLines = {\r\n \"type\": \"GeometryCollection\",\r\n \"geometries\": []\r\n }\r\n switch (inputGeom.type) {\r\n case \"GeometryCollection\":\r\n for (var i in inputGeom.geometries) {\r\n var geomLines = lineify(i...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Increases the revision counter and dispatches a 'change' event.
changed() { ++this.revision_; this.dispatchEvent(EventType.CHANGE); }
[ "function handleIncrease() {\n if (selectedAmount < stockCount) setSelectedAmount(selectedAmount + 1);\n }", "onDatabaseVersionChange(_) {\n Log.debug('IndexedDb: versionchange event');\n }", "function fileChanged() {\n \"use strict\";\n if (bTrackChanges) {\n if (!bFileChanged) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Deletes the current search from savedsearches.conf AND the KV Store
async _deleteSearch(search_name, kv_data) { let deletedSearchName = search_name || this.search_name; let self = this; var searchDeleted = await this.saved_searches.del(deletedSearchName, null, function (err) { if (err) { return err; } ...
[ "ClearSearch () {\n return { type: types.CLEAR_SEARCH }\n }", "function deleteSearch(title) {\n // grabs the currently logged in user's id as our identifier to delete searches in the route as well as the title\n $.get(\"/api/user_data\").then(function({ id }) {\n $.ajax({\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
TRY CHECK THE INPUT VERIFACTION FUCTION PASSED LIKE A CALLBACK
function check(callback,input){ try{ return callback(input); }catch(error){ return false; } }
[ "static checkCallbackFnOrThrow(callbackFn){if(!callbackFn){throw new ArgumentException('`callbackFn` is a required parameter, you cannot capture results without it.');}}", "hasCallback() {}", "function sendInterventionDialogYesNoConfirmInputResponse (event, fn, userInput) {\n\n incrementTimers(globals);\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Check an object for unexpected properties. Accepts the object to check, and an array of allowed property names (strings). Returns an array of key names that were found on the object, but did not appear in the list of allowed properties. If no properties were found, the returned array will be of zero length.
function extraProperties(obj, allowed) { mod_assert.ok(typeof (obj) === 'object' && obj !== null, 'obj argument must be a non-null object'); mod_assert.ok(Array.isArray(allowed), 'allowed argument must be an array of strings'); for (var i = 0; i < allowed.length; i++) { mod_assert.ok(typeof (allowed[i]) ...
[ "function defineObjectKeys(){\n Object.keys = (function() {\n 'use strict';\n var hasOwnProperty = Object.prototype.hasOwnProperty,\n hasDontEnumBug = !({ toString: null }).propertyIsEnumerable('toString'),\n dontEnums = [\n 'toString',\n 'toLocal...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns the index of the App that matches the supplied ID.
function getAppIndexById(id) { if (!id || typeof id != "string") return null; for (var node = 0; node < apps.length; node++) { if (apps[node].id == id) { return node; } } return null; }
[ "get activeManifestIndex() {\n if (this.manifest && this.manifest.items && this.activeId) {\n for (var index in this.manifest.items) {\n if (this.manifest.items[index].id === this.activeId) {\n return parseInt(index);\n }\n }\n }\n return -1;\n }", "indexOfId(id) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Controller to delete a goal, once the goal is deleted, if a member is logged in they are redirected back to their dashboard, if a trainer is logged in they are redirected back to view of the members dashboard (trainerviewmember.hbs) .
deleteGoal(request, response) { logger.debug(`Delete Goal: ${request.params.id}`); const goalId = request.params.id; goalStore.removeGoal(goalId); if (request.cookies.member != "") { response.redirect("/member-dashboard"); } else { response.redirect(`/memb...
[ "deleteAction(req, res) {\n Robot.remove({ _id: req.params.id }, (err, robot) => {\n if (err)\n this.jsonResponse(res, 400, { 'error': err });\n\n this.jsonResponse(res, 204, { 'message': 'Deleted successfully!' });\n });\n }", "static async delete(ctx) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Eva test, 0329 / / 3G / returnJSON structure contains an 3GJSON structure
function get3GInfo(callback){ jQuery.getJSON( 'APIS/return3GJSON.txt', function(returnData, status){ if(returnData.RETURN.success){ callback(returnData.RETURN.success,returnData.THREE_G); }else{ callback(returnData.RETURN.success,returnData.RETURN.errorDescription); } } ); }
[ "function pullGVizJSON(gQueryResp) {\r\n var googleRespRegex = /setResponse\\((.*)\\);/g;\r\n var cleanJSON = googleRespRegex.exec(gQueryResp);\r\n jsonResp = JSON.parse(cleanJSON[1], function(key, value) {\r\n return value == null \r\n ? \"\" \r\n : val...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
function handles initial search buttons for genres and popular movies
function handleSearch() { $(document).on('click', '.search-by-genre', function (event) { event.preventDefault(); let genre = $('#search-by-genre').val(); STORE.genre = genre; STORE.searchType = 'genre'; searchMovieAPI(); }); $(document).on('click',...
[ "function filter() {\r\n $(\"input[name=filterBtn]\").click(function() {\r\n // Get form values\r\n let title = $(\"#title\").val();\r\n let pickedGenre = $(\"select[name='genreSelect'] option:selected\").val();\r\n\r\n // Clear current result space\r\n $(\"#filteredMovies\").h...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Decrease the RefCount on the dataId and dispose the memory if the dataId has 0 refCount. If there are pending read on the data, the disposal would added to the pending delete queue. Return true if the dataId is removed from backend or the backend does not contain the dataId, false if the dataId is not removed. Memory m...
disposeData(dataId, force = false) { if (this.pendingDisposal.has(dataId)) { return false; } // No-op if already disposed. if (!this.texData.has(dataId)) { return true; } // if force flag is set, change refCount to 0, this would ensure disposal ...
[ "closeActiveBuffer(){\n this._ctx.putImageData(this._dataBuffer, 0, 0);\n this._dataBuffer = null;\n }", "_removeBarrier() {\n if (this._barrier) {\n if (this._pressureBarrier) {\n this._pressureBarrier.removeBarrier(this._barrier);\n }\n this._barrier...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
FUNCTION NAME : validationTTList() AUTHOR : James Turingan DATE : January 2, 2014 MODIFIED BY : REVISION DATE : REVISION : DESCRIPTION : validates for the test tool that has no selected ports PARAMETERS : First function for this YEAR!! :)
function validationTTList(){ var msgStr = ''; var ctr = 0; for(var x = 0; x < testToolObj.length; x++){ if(testToolObj[x].Ports.length == 0){ ctr++; if(ctr == 1){ msgStr = testToolObj[x].DeviceName; }else if(ctr == 2 && x == testToolObj.length){ msgStr += 'and' + testToolObj[x].DeviceName; }els...
[ "function checkPortTestToolList(row,html,checkType,opStr){\n\tvar ttype='';\n\tvar porttype='';\n\tfor(var a =0; a< row.length; a++){\n\t\tif(globalInfoType == \"XML\"){\n\t\t\tttype = row[a].getAttribute('ConnectivityType');\n\t\t\tporttype = row[a].getAttribute('Type');\n\t\t\tvar linc = row[a].getAttribute('Lice...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Load the window skins pictures
static async loadWindowSkins() { for (let i = 1, l = this.windowSkins.length; i < l; i++) { await this.windowSkins[i].updatePicture(); } }
[ "function drawImages(){\n image(handSanatizer, handSanatizerX, handSanatizerY, imageSizes, imageSizes);\n image(mask, maskX, maskY, imageSizes, imageSizes);\n image(broom, broomX, broomY, imageSizes, imageSizes);\n image(washingHands, washingHandsX, washingHandsY, imageSizes ,imageSizes);\n}", "function loadA...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns a new row where the leading nonzero number (if any) is positive, and the GCD of the row is 0 or 1. For example, simplifyRow([0, 2, 2, 4]) = [0, 1, 1, 2].
static simplifyRow(x) { let sign = 0; for (const val of x) { if (val != 0) { sign = Math.sign(val); break; } } if (sign == 0) return x.slice(); const g = Matrix.gcdRow(x) * sign; return x.map(val => val /...
[ "gaussJordanEliminate() {\n // Simplify all rows\n let cells = this.cells = this.cells.map(Matrix.simplifyRow);\n // Compute row echelon form (REF)\n let numPivots = 0;\n for (let i = 0; i < this.numCols; i++) {\n // Find pivot\n let pivotRow = numPivots;\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }