query
stringlengths
9
34k
document
stringlengths
8
5.39M
negatives
listlengths
19
20
metadata
dict
Validation alarm text input
function validation() { userInputHours = document.getElementById("userInputHours").value; userInputMinutes = document.getElementById("userInputMinutes").value; userInputSeconds = document.getElementById("userInputSeconds").value; // Validates blank fields if (userInputHours == "" || userInputMinutes == "" ...
[ "textInputCheck(txtInput, emptyMessage) {\n // var regex = /^[a-zA-Z ]+$/;\n // console.log(\"TXTInput-->\" + txtInput);\n\n if (txtInput !== null && txtInput.trim().length > 0) {\n return true\n } else {\n // Alert.alert(globals.appName, emptyMessage)\n return false\n }\n }", "func...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Fetch a list of ETH transactions for the user's wallet
static getEthTransactions() { const { walletAddress } = store.getState(); return fetch( `https://${this.getEtherscanApiSubdomain()}.etherscan.io/api?module=account&action=txlist&address=${walletAddress}&sort=desc&apikey=${ Config.ETHERSCAN_API_KEY }`, ) .then(response => response....
[ "static async getEthTransactions(walletAddress, offset) {\n const fetchString = 'https://' + this.getEtherscanApiSubdomain() + '.etherscan.io/api?module=account&action=txlist&address=' + walletAddress + '&sort=desc&apikey=' + ETHERSCAN_API_KEY; \n return fetch(fetchString)\n .then(response => response...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Methode die de index van de select data teruggeeft, op basis van het toernooi type.
function getIndexByType(type) { for (var i=0; i<$scope.select_data.length; i++) { if ($scope.select_data[i].type == type) return i; } return 0; }
[ "get indexType()\n {\n return 'text';\n }", "setQuery(type, sql, data){\n\t\t//si vamos a insertar primero hacemos un select, de ahi si es 0 resultados, hacemos un insert si hay resultados hacemos un update\n\t\t\n\t}", "function biquad_type_select(table, handler) {\n var row = table.insertRow(-1)...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
this function will check weather a number is empty or not, means 0 values are not allowed here.
function checkEmptyNumber(id_d,message) { var data_d = getValue(id_d); if(checkEmptyAll(id_d,message)) { if(parseFloat(data_d)<=0) { takeCareOfMsg(message); return false; } else { return true; } } return false; }
[ "function validNumber(n) {return ( n != 0.0 && !isNaN(parseFloat(n))); }", "function isBlankOrZeroOrAPositiveInteger(theVal)\n{\n var retVal = true;\n \n if (theVal)\n {\n if (parseInt(theVal) != theVal || theVal<0)\n {\n retVal = false;\n }\n }\n \n return retVal;\n}", "isNumberValid(numbe...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
put voronoi edges into a vbo
function voronoiToEdgeVBO() { vboMesh.clear(voronoiEdges); for(var i=0;i<voronoi.triangles.length;++i) { var tri = voronoi.triangles[i]; if(false || tri.interior_) { if(tri.neighbors_[0] && (false || tri.neighbors_[0].interior_)) { vboMesh.addVertex(voronoiEdges,tri.circumcenter); vboM...
[ "generateVoronoi() {\n this.voronoi = new Voronoi()\n let bbox = { xl: 0, xr: this.width, yt: 0, yb: this.height }\n this.diagram = this.voronoi.compute(this.points, bbox)\n }", "buildFromVoronoiDiagram( vd ){\n var vCells = vd.cells;\n\n // for each cell\n for(var i=0; i<vCells.l...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
loop through the answers nodeList using array's foreach method and assign the createOverlay function as a click event for every answer. // get the child nodes of definitionTest
function bindAnswers(){ answers = document.getElementById('definitionTest').childNodes; Array.prototype.forEach.call(answers, function(answer){ answer.addEventListener('click', createOverlay); }); }
[ "function addAnswersEventListeners(){\ndocument.querySelectorAll('.answer').forEach(item => {\n item.addEventListener('click', event => { \n checkAnswer(item); \n fillAnswersSection();\n })\n})\n}", "function dispQuestion(question) { qNameElement.textContent=question.question\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
bnodes aren't good for tpf clients so would need to give the reactionparticipant a URI
async function processReactant(node, s, nParticipant) { if(node.name() !== 'reactant') throw new Error('expected reactant, got ' + node.name()) let participantUri = s + '#participant' + nParticipant let chebiID = node.get('cml:molecule/cml:identifier', { cml: 'http://www.xml-cml.org/schema/cml2/...
[ "function rtcommPresenceNode(n) {\r\n RED.nodes.createNode(this,n);\r\n\t var subtopic = n.subtopic;\r\n this.topic = (n.topic || '/rtcomm/')+'sphere/'+subtopic;\r\n this.broker = n.broker;\r\n this.brokerConfig = RED.nodes.getNode(this.broker);\r\n this.rtcConnector = null;\r\n\t var end...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
makes button for RGB color
function makeRGB() { const boxes = container.querySelectorAll('.box'); rgb.textContent = "RGB"; rgb.addEventListener('click', () => { boxes.forEach(box => box.addEventListener('mouseover', () => { let R = Math.floor(Math.random() * 256); let G = Math.floor(Math.random() * 256...
[ "function colorThemOwn() {\n button.style.background = buttonValue;\n }", "getButtonColor() {\n if (this.mixed) return color(76, 199, 79); // green - finished\n else if (this.mixing) return color(255, 218, 101); // yellow - mixing\n return color(102, 153, 204); // blue - normal...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Return a JSON representation of this line
getJSONRepresentation() { return { type: "LineEnv", lineStartingX: this.startingX, lineStartingY: this.startingY, lineEndingX: this.endingX, lineEndingY: this.endingY, lineColour: this.colour, lineWidth: this.lineWidth }...
[ "json() {\n var pos = this.input.pos(this.start)\n return {\"input\":this.input.id, \"start\":this.start,\n \"row\":pos[0], \"column\":pos[1]}\n }", "json() {\n var pos = this.input.location(this.start)\n return {\"input\":this.input.id, \"start\":this.start,\n \"row\"...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
set the channel name to listen on
setChannelName (/*callback*/) { throw 'stream channels are deprecated'; /* // listening on the stream channel for this stream this.channelName = 'stream-' + this.stream.id; callback(); */ }
[ "setChannelName (callback) {\n\t\t// we'll listen on our me-channel, but no message should be received since we're not a member of the stream\n\t\tthis.channelName = `user-${this.currentUser.user.id}`;\n\t\tcallback();\n\t}", "setChannelName (callback) {\n\t\t// expect on the \"everyone\" team channel\n\t\tthis.c...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
=== Use this to add score and trigger animation
function addScore(amount) { score += amount; scoreAnimTimer = 0; }
[ "function createScoreAnimation(x, y, message, score){\n \n var me = this;\n \n var scoreFont = \"90px Arial\";\n \n //Create a new label for the score\n var scoreAnimation = this.game.add.text(x, y, message, {font: scoreFont, fill: \"#39d179\", stroke: \"#ffffff\", strokeThickness: ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
calcule le prix de la prochaine amelioration de l autoclic
function autoclickprix(){ return Math.round(200 * (nbMultiplicateurAmelioAutoclick * 0.40)); }
[ "function prix() {\n return 50 * (nbMultiplicateur * nbMultiplicateur * 0.2);\n}", "function calculerPrixTotal(nounours) {\n prixPanier = prixPanier += nounours.price;\n}", "calcularIva() {\n this.precio = this.precio * 1.21;\n }", "calculaCashback(valor,porcentagem){\n return (valor * po...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Compares two ArrayBuffer or ArrayBufferView objects. If bitCount is omitted, the two values must be the same length and have the same contents in every byte. If bitCount is included, only that leading number of bits have to match.
function equalBuffers(a, b, bitCount) { var remainder; if (typeof bitCount === "undefined" && a.byteLength !== b.byteLength) { return false; } var aBytes = new Uint8Array(a); var bBytes = new Uint8Array(b); var length = a.byteLength; if (typeof bitCount !== "undefi...
[ "function equalBuffers(a, b, bitCount) {\n var remainder;\n\n if (typeof bitCount === \"undefined\" && a.byteLength !== b.byteLength) {\n return false;\n }\n\n var aBytes = new Uint8Array(a);\n var bBytes = new Uint8Array(b);\n\n var length = a.byteLength;\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get an existing OpenIdConnectProvider resource's state with the given name, ID, and optional extra properties used to qualify the lookup.
static get(name, id, opts) { return new OpenIdConnectProvider(name, undefined, Object.assign(Object.assign({}, opts), { id: id })); }
[ "static get(name, id, state, opts) {\n return new RegistryPolicy(name, state, Object.assign(Object.assign({}, opts), { id: id }));\n }", "static get(name, id, state, opts) {\n return new ExternalKey(name, state, Object.assign(Object.assign({}, opts), { id: id }));\n }", "static get(name, id,...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
======================================================================================================= Follow table : =======================================================================================================
function _getTableFollowResult() { var limit = gtableProfileParams.data.limit; //var offset = params.data.offset + 1; var offset = gtableProfileParams.data.offset; var contract = { "function": "sm_get_followed_users", "args": JSON.stringify([limit, offset, gUserAddress]) } return neb.api.call(ge...
[ "function processCurrentTable()\n{\n\tlet firstRow = table.rows[0],\n\t\tlastRow = table.rows[table.rows.length - 1];\n\tcreateTableTags(firstRow.pos, lastRow.pos + lastRow.line.length);\n\n\taddTableHead();\n\tcreateSeparatorTag(table.rows[1]);\n\taddTableBody();\n}", "getTable() {\n const eos = Eos();\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
ai functions fn(unit, map) > commandlist TODO: actually perform actions on the given map for better lookaheads TODO: more reliable indexing; prone to breaking as units are removed stay in one place, but attack if an enemy is in direct attack range
function wait(unit, map) { let cmd = [] let targets = nbrhd(unit.cell, unit.wpn.rng) .map(cell => map.units.find(unit => Cell.equals(cell, unit.cell))) .filter(target => !!target && !Unit.allied(unit, target)) let target = targets[0] if (target) { let attack = Unit.attackData(unit, target) Unit.attack(unit,...
[ "startUnitTurn(unit) {\n var aiType = unit.aiType || aiTypeEnum.Normal;\n var tauntInRange = this.isTauntInRange(unit);\n\n // Bring to front while selected\n this._map.selectedOrigX = unit.xTile;\n this._map.selectedOrigY = unit.yTile;\n unit.increaseDepth(10);\n this._map.selectedUnit = unit;...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns the count of the available pins.
function getPinCount(){ return this.cachedPinInfo.length; }
[ "async available(provider_id = null) {\n let m = 0;\n if (provider_id) {\n m = await this.get_n_available_pp(provider_id);\n }\n\n let n = await this.get_n_available();\n\n return m+n;\n }", "get availableConnectionCount() {\n return this[kConnections].length;\n }", "get count() {...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Dispose all Tensors in an UnresolvedLogs object.
function disposeTensorsInLogs(logs) { if (logs == null) { return; } for (var key in logs) { var value = logs[key]; if (typeof value !== 'number') { value.dispose(); } } }
[ "function disposeTensorsInLogs(logs) {\n if (logs == null) {\n return;\n }\n for (var key in logs) {\n var value = logs[key];\n if (typeof value !== 'number') {\n value.dispose();\n }\n }\n}", "function disposeTensorsInLogs(logs) {\n if (logs == null) {\n return;\n }\n for (co...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets a description string for a `ComponentHarness` query.
function _getDescriptionForComponentHarnessQuery(query) { const harnessPredicate = query instanceof HarnessPredicate ? query : new HarnessPredicate(query, {}); const { name, hostSelector } = harnessPredicate.harnessType; const description = `${name} with host element matching selector: "${hostSelector}"`; ...
[ "function _getDescriptionForHarnessLoaderQuery(selector) {\n return `HarnessLoader for element matching selector: \"${selector}\"`;\n}", "function _getDescriptionForTestElementQuery(selector) {\n return `TestElement for element matching selector: \"${selector}\"`;\n}", "function _getDescriptionForLocatorF...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Used to calculate shortest route and return the route.
function shortestRoute(source, target, roadMapGraph){ var previous = []; var dist = []; //contains the value from the var targetNode = roadMapGraph.getNodeByName(target); //initialize the dist and previous arrays. for (var i = 0; i < roadMapGraph.nodes.length; i++) { dist.push(Number.MAX_VALUE); previous.pus...
[ "function shortest() {\n if(!this.routes.length) { return NO_SUCH_ROUTE; }\n\n return _.min(_.map(this.routes, function(route) {\n return _.sumBy(route, 'weight');\n }));\n}", "function getShortestDistance(){ \n for(var i = 0; i < routes.length; i++){\n var path = routes[i];\n var distance = 0;\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
hovers the correspoinding position on the map/ the height profile
function handleHeightProfileHover(atts) { map.hoverPosition(atts.lon, atts.lat); }
[ "function handleHover(centered, d){\n mediumlightBar(mapObj[d.properties.ID].realname);\n}", "function hoverPositions(){\n if(board === \"Player\"){\n if(!handleHover) return\n handleHover(coords)\n } else if(board === \"Ai\"){\n if(!handleHover) return\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Show the navigation element dialog
function showNavigationElementDialog(options) { return spNavigationElementDialog.showDialog(options); }
[ "function open(){\n\t\tresizePopin();\n\t\toptions.show(domElement);\n\t}", "function navigateToFrmOptions(){\n\tfrmOptions.show();\n}", "showHyperlinkDialog() {\n if (this.hyperlinkDialogModule && !this.isReadOnlyMode && this.viewer) {\n this.hyperlinkDialogModule.show();\n }\n }", ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Remove a file from the git index (aka staging area) Note that this does NOT delete the file in the working directory.
async function remove ({ dir, gitdir = path__WEBPACK_IMPORTED_MODULE_0___default.a.join(dir, '.git'), fs: _fs, filepath }) { const fs = new FileSystem(_fs); await GitIndexManager.acquire( { fs, filepath: `${gitdir}/index` }, async function (index) { index.delete({ filepath }); } ); // ...
[ "function removeFile(index){\r\n\t\tdelete(files.local[index]);\r\n\t}", "async function remove ({\n core = 'default',\n dir,\n gitdir = join(dir, '.git'),\n fs: _fs = cores.get(core).get('fs'),\n filepath\n}) {\n try {\n const fs = new FileSystem(_fs);\n await GitIndexManager.acquire(\n { fs, fi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
generate a Random Number between 0 and upper. (e.g. 0255)
function getRandomNum(upper){ return Math.floor( Math.random() * upper ); }
[ "function randomNumber(upper) {\n return Math.floor( Math.random() * upper);\n}", "function randint(lower, upper) { return Math.floor(Math.random() * (upper-lower) + lower); }", "function randomInt(upper) {\n with(Math) {\n return floor(random() * upper);\n };\n}", "function randValue (upper) {\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
scrape new article and then udpate HTML page
function getNewArticles() { // update table to notify we are loading new items $("#articleList").html(processingArticlesHTML) // scrape for new stories $.get("/api/scrapeNotSaved") .then(function (data) { console.log(data) if (data.length > 0) { console.log("I have data! Will call upd...
[ "function populateArticle(html, article) {\n if (html.length > 1) {\n html = $(html[0]);\n }\n if (!article.seen) {\n html.find(\".breaking-news\").removeClass(\"hidden\");\n } else {\n html.find(\".breaking-news\").addClass(\"hidden\");\n }\n article.seen = true;\n html.find(\".network-icon\").attr...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Destructively modify MDAST to rename all footnote ids to be unique and based on the contents of the footnote. Id is short and friendly id including a hash of the contents, e.g. the text " ends up with footnote id "^investoped.dreyz4".
function normalizeFootnoteIds(mdast) { const footnoteIdMapping = {}; const newFootnoteIds = new Set(); const missingFootnoteIds = new Set(); const orphanedFootnoteIds = new Set(); const footnoteTextSet = new Set(); let footnoteRefCount = 0; // Calculate new footnote ids based on present definitions and a...
[ "function normalizeTitlesId() {\n var titles = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'];\n var ids = [];\n var counter;\n\n titles.forEach(function(title) {\n $(title).each(function() {\n // Compute new id\n var oldId = $(this).attr('id');\n var textId = normalizeId($...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Process each lines in dictionary and compare with words_to_find contents
async function processLineByLine(){ const rl = createInterface({ input: dictionaryFile, crlfDelay: Infinity }); for await(const line of rl){ let currentWord = line.split(','); let regx = new RegExp('\\b' + currentWord[0] + '\\b', 'g'); let foundCount = words...
[ "find(terms) {\n let names, score, lines;\n let resultsArray = [];\n\n if (terms.length > 1) {\n let bothTermsExist = true;\n // Check if the words exist in the same sentence.\n for (let term of terms) {\n term = normalize(term);\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
accountObject will have below property name, balance createaccount(accountObject) push onto accounts array return account object (on which we added)
function createAccount(account){ accounts.push(account); return account; }
[ "function createAccount(account){\n accounts.push(account);\n return account;\n}", "function createAccount (account) {\r\n\taccounts.push(account);\r\n\treturn account;\r\n}", "function createAccount(account) {\n accounts.push(account);\n return account;\n}", "function createAccount(balance, userName){\n\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Converts hours to milliseconds
function hoursToMs(hours) { return minutesToMs(hours * 60); }
[ "function fullTimeToMilliseconds(hours, minutes, seconds, milliseconds){\n hoursInMilli = hours * 3600000;\n minutesInMilli = minutes * 60000;\n secondsInMilli = seconds * 1000;\n return hoursInMilli + minutesInMilli + secondsInMilli + milliseconds;\n}", "function hrTimeToMilliseconds(time) {\n return Math...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
handles the names bouncing left and right
function updateNamePositions() { name_trackers.forEach((v, k) => { v.vx = v.vx + DEFAULT_ACCELERATION v.x = v.x + v.vx if (v.x < 0 || v.x > v.max_x) { if (v.x < 0) { v.x = 0; } else { v.x = v.max_x; } v.vx = -0.5...
[ "animateName(direction){\n if(direction === \"in\"){\n const nameContainer = document.getElementById(\"name_container\");\n nameContainer.style.pointerEvents = \"none\";\n nameContainer.classList.remove(\"name_bounce_out\");\n nameContainer.classList.add(\"name_bou...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Adds keys that matches `alwaysShowRegExp` to `alwaysShow`. Passes `alwaysShowRegExp` down to children so that it is applied recursively.
fixAlwaysShowRegExp(schema) { if (!schema.alwaysShow) { schema.alwaysShow = []; } Object.keys(schema.properties) .forEach(key => { // pass alwaysShowRegExp down to apply it recursively. const subSchema = schema.properties[key]; if (subS...
[ "fixAlwaysShow(schema) {\n const alwaysShow = schema.alwaysShow;\n schema.alwaysShow = alwaysShow.filter(key => {\n if (schema.properties[key]) {\n return true;\n }\n else {\n console.warn(`${key} is configured as alwaysShow but it is not ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
search for products by subcategory from params
async getProductsBySubcategory() { try { const subcategory = Number(this.props.match.params.subcategory.split('+')[1]); const collection = await gameApi.getProductsBySubcategory(subcategory); // const title = await gameApi.getTitle({subcategory}); // if (this.is_m...
[ "getItemsInSubCategory(subcategory, items = this.items) {\n // assume items array is a value from getItemsInCategory\n const categoryName = this.getCategories(items)[0];\n return items.filter((item) => item.category[categoryName][0] === subcategory);\n }", "filteredProducts(){\n const allProductsinCa...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
function anneal( ... ) args: get_proposal: proposed_cost = f(iter, epoch) set_proposal: f(is_accepted) num_iters, num_epochs params: .schedule: temperature = f(iter/num_iters)
function anneal( get_proposal, set_proposal, num_iters, num_epochs ) { if (!num_iters) num_iters = 100 if (!num_epochs) num_epochs = 1 // ensure first proposal always accepted var cost = Infinity // epochs (outer loop) for (let epoch = 0; epoch < num_epochs; epoch++) { // iterations (inner loop) ...
[ "function anneal() {\n let currentCost = computeCost(currentSolution);\n let candidate = swapRandom(currentSolution.slice());\n let candidateCost = computeCost(candidate);\n \n let delta = candidateCost - currentCost;\n let acceptDecrease = acceptance(delta);\n let is_better = true;\n if (de...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
this disables and grays out the demo portions except for loading a video
function DisableDemoExceptLoadVideo() { $(".grayNoVideo a, .grayNoVideo button, .grayNoVideo input, .grayNoVideo textarea").prop("disabled", true); $(".grayNoVideo, .grayNoVideo a").css("color", "rgb(153,153,153)"); }
[ "function EnableDemoAfterLoadVideo() {\r\n $(\".grayNoVideo, .grayNoVideo a\").removeAttr(\"style\");\r\n $(\".grayNoVideo a, .grayNoVideo button, .grayNoVideo input, .grayNoVideo textarea\").prop(\"disabled\", false);\r\n $(\"#pauseButton, #saveCaptionAndPlay, #justSaveCaption\").prop(\"disabl...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
copy zIndex style from theme element to mover
function setZIndex() { if (vm.element.fullscreen) { vm.moverStyle['z-index'] = vm.themeStyle['z-index']; } else { vm.moverStyle['z-index'] = vm.themeStyle['z-index'] + 10; } }
[ "function\nBayRaiseZIndex\n(InBay)\n{\n InBay.style.zIndex = 30;\n}", "function zIndexControl(elem) {\n zIndexCount++;\n elem.css(\"z-index\", zIndexCount);\n}", "function\nBayLowerZIndex\n(InBay)\n{\n InBay.style.zIndex = 30;\n}", "updateZindexHandler () {\n this.style.zIndex = zIndex\n zIndex+...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Remove edge connect to this vertexs
removeAllEdgeConnectToVertex(vertex) { this.findEdgeRelateToVertex(vertex.id).forEach(edge=>{ edge.remove() }) }
[ "removeAllEdgeConnectToTheseVertex(lstVertex)\n\t{\n\t\tlstVertex.forEach(e=>{\n\t\t\tthis.findEdgeRelateToVertex(e.id).forEach(edge=>{\n\t\t\t\tedge.remove()\n\t\t\t})\n\t\t})\n\t}", "removeEdge(vertex1, vertex2) {\n this.adjacencyList[vertex1] = this.adjacencyList[vertex1].filter(\n val => val !== verte...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
A cell's children must be "block"s. If they're not then we wrap them within a block with a type of opts.typeContent
function onlyBlocksInCell(opts: Options, editor: Editor, error: SlateError) { const block = Block.create({ type: opts.typeContent }); editor.insertNodeByKey(error.node.key, 0, block); const inlines = error.node.nodes.filter(node => node.object !== 'block'); inlines.forEach((inline, index) =...
[ "function onlyBlocksInCell(opts, change, context) {\n var block = _slate.Block.create({\n type: opts.typeContent\n });\n change.insertNodeByKey(context.node.key, 0, block, { normalize: false });\n\n var inlines = context.node.nodes.filter(function (node) {\n return node.object !== 'block';...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
gets all categories for a given userID
function getCategories(userID) { return new Promise ((resolve, reject) => { connection.query('SELECT name FROM Categories WHERE user_fk = ?', [userID], function(err, result) { if (err) { reject(err) } else { resolve(result) } }) }) }
[ "categories(user) {\n\t\treturn UserModel.getCategories(getDBDriver(), user.id)\n\t\t\t.then(res => res)\n\t\t\t.catch(err => [])\n\t}", "getCategories(userId) {\n\t\treturn this._getObjects(\n\t\t\t(\n\t\t\t\t'SELECT DISTINCT c.name FROM category c ' + \n\t\t\t\t'JOIN message_category mc ON c.id = mc.categoryId ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Place text labels within an atlas of the given max size
setTextureTextPositions (texts, max_texture_size) { let texture = { cx: 0, cy: 0, width: 0, height: 0, column_width: 0, texture_id: 0, texcoord_cache: {} }, textures = []; ...
[ "placeText (text_width, text_height, style, texture, textures, max_texture_size) {\n let texture_position;\n\n // TODO: what if first label is wider than entire max texture?\n\n if (texture.cy + text_height > max_texture_size) {\n // start new column\n texture.cx += textur...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Write a function `averageOfFour(num1, num2, num3, num4)` that takes in four numbers. The function should return the average of all of the numbers. Examples: averageOfFour(10, 10, 15, 5); // => 10 averageOfFour(3, 10, 11, 4); // => 7 averageOfFour(1, 2, 3, 4); // => 2.5
function averageOfFour(num1, num2, num3, num4) { return (num1 + num2 + num3 + num4) / 4; }
[ "function averageOfFour(num1, num2, num3, num4) {\n var sum = num1 + num2 + num3 + num4\n var avg = sum / 4\n return avg\n}", "function averageOfFour(num1, num2, num3, num4) {\n return ((num1 + num2 + num3 + num4) / 4);\n}", "function mean(num1,num2,num3,num4) {\n var sum = num1 + num2 + num3 + num4;\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns the clone URL for a protocol.
function makeCloneUrl(stack, repositoryName, protocol, region) { switch (protocol) { case 'https': case 'ssh': return `${protocol}://git-codecommit.${region !== null && region !== void 0 ? region : stack.region}.${stack.urlSuffix}/v1/repos/${repositoryName}`; case 'grc': ...
[ "function getRepoCloneUrl () {\n var gitExt = '.git';\n var urlConfig = {\n protocol : 'https',\n hostname : cred.repo.hostname,\n auth : cred.repo.auth,\n pathname : '/' + cred.user.login + '/' + cred.repo.name + gitExt\n };\n return url.format(urlConfig);\n}", "function getCloneUrl() {\n const ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Query the MySQL database, and call output_actors on the results res = HTTP result object sent back to the client year = Year to query for rate = new rating from user
function query_db_mascot(res,year,rate) { query = "SELECT * FROM Mascot WHERE Mascot.Year = '"+year+"'"; connection.query(query, function(err, rows) { if (err) console.log(err); else { var x = rows[0]; console.log(x.Rating); console.log(x.numOfUser); var newAvg = (x.Rating * x.numOfUser); console....
[ "function query_db(res,name) {\n oracle.connect(connectData, function(err, connection) {\n if ( err ) {\n \tconsole.log(err);\n } else {\n\t \t// selecting rows\n\t \tconnection.execute(\t\"SELECT m.name, m.rank, m.year, a.first_name, a.last_name \" + \n\t \t\t\t\t\t\t\"FROM actors a, movies m, roles r...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
remove chat from firebase if no players exists
function removeChat() { if (!player1Name && !player2Name) { chatRef.remove(); $("#chat-log").empty(); $(".post-login").hide(); $(".pre-login").show(); } }
[ "emptyMatches() {\n firebaseApp.database().ref('Matches').once(\"value\").then(function (snapshot) {\n snapshot.forEach(function (childSnapshot) {\n childSnapshot.forEach(function (grandChildSnapshot) {\n if (childSnapshot.key = friend_uid.key && grandChildSnapsho...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns whether a native element can be inserted into the given parent. There are two reasons why we may not be able to insert a element immediately. Projection: When creating a child content element of a component, we have to skip the insertion because the content of a component will be projected. `delayed due to proj...
function canInsertNativeNode(tNode,currentView){var currentNode=tNode;var parent=tNode.parent;if(tNode.parent){if(tNode.parent.type===4/* ElementContainer */){currentNode=getHighestElementContainer(tNode);parent=currentNode.parent;}else if(tNode.parent.type===5/* IcuContainer */){currentNode=getFirstParentNative(curren...
[ "function canInsertNativeNode(parent, currentView) {\n // We can only insert into a Component or View. Any other type should be an Error.\n ngDevMode && assertNodeOfPossibleTypes(parent, 3 /* Element */, 2 /* View */);\n if (parent.tNode.type === 3 /* Element */) {\n // Parent is an element.\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Convert suit to entity code
translateSuitToEntityCode(){ return this.suitObjects[`${this.randomSuitName0 }`]; }
[ "function ecode(entity) /* (entity : entity) -> int */ {\n return entity.ecode;\n}", "function mapGadQuestion4ToCode(entity){\n\n\tswitch(entity){\n\t\tcase 'not at all':\n\t\t\treturn 'at0024';\n\t\t\tbreak;\n\t\tcase 'several days':\n\t\t\treturn 'at0025';\n\t\t\tbreak;\n\t\tcase 'more than half the days':\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns true if the given object is an instance of Assessment. This is designed to work even when multiple copies of the Pulumi SDK have been loaded into the same process.
static isInstance(obj) { if (obj === undefined || obj === null) { return false; } return obj['__pulumiType'] === Assessment.__pulumiType; }
[ "static isInstance(obj) {\n if (obj === undefined || obj === null) {\n return false;\n }\n return obj['__pulumiType'] === Association.__pulumiType;\n }", "static isInstance(obj) {\n if (obj === undefined || obj === null) {\n return false;\n }\n re...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Helper function to filter through the venue object and only keep the necessary fields Retrive the venue fields by: id,name,price,rating,category,location and url
function parse_venue_object(venues) { var venues_list=[]; for (var i=0;i<venues.length;i++) { var venue_id = venues[i]['id']; var venue_name = venues[i]['name']; //not all vendors have prices information included, but the data object always a tag of price var venue_price = venues[i]['price']; ...
[ "function venue_with_price_and_rating(venues,price,rating)\n{\n filtered_list=[];\n \n var isValid = function(param) {\n \treturn typeof param!='undefined' && param!=\"\";\n }; \n \n _.each(venues,\n \tfunction(venue,i,venues) {\n \tvenue_price = venues[i]['price'];\n \tvenue_rating = venues[i]['ratin...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
set the globals currentProblemIndex, partialProblems, and currentProblem from the currentproblemindex and partialproblems fields of the currently logged in student in order to preserve the problem state for the student.
function getStudentInfo () { //get the currentProblemIndex currentProblemIndex = StudentModel.find({_id: Meteor.userId()}).fetch()[0].currentproblemindex; if (currentProblemIndex == undefined) { currentProblemIndex == 0; Meteor.call('updateStudentModel', 'currentproblemindex', 0); } //get the partialProblems ...
[ "function loadSavedProblems(lesson, currSet){\n var problems = currSet.problems;\n // Update problemNum variable so numbering appears correctly when adding problems\n problemNum = problems.length;\n\n // Add input fields for the saved problems\n for(var i = 1; i < problems.length;...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Close the MicroChain register process
function registerClose(subchainaddr) { logger.info("registerClose", subchainaddr); sendtx(baseaddr, subchainaddr, '0', '0x69f3576f'); }
[ "function handleCloseRegister() {\n setOpenRegister(false);\n }", "async function closeI2C() {\n await writeDemodReg(1, 1, 0x10, 1);\n }", "close() {\n /* Disconnect Trueno session */\n process.exit();\n }", "close() {\n this.api.destroyBuffer(this.wasmInputPtr);\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Add tracks to the playlist that now exists in user's account
function addTracksToPlaylist(data, callback){ sessionStorage.songs = JSON.stringify(MASTER_TRACKLIST); sessionStorage.spotifyUserId = JSON.stringify(spotifyUserId); playlistId = data.id; sessionStorage.playlistId = JSON.stringify(playlistId); var tracks = []; for(var i = 0; i < MASTER_TRACKLIST.length; i++){ ...
[ "async function syncPlaylist (playlist, tracks) {\n try {\n const results = { added: 0, removed: 0 }\n // Exit early on empty tracks.\n if (!tracks.length) return results\n const spotify = createSpotify()\n const uid = playlist.user\n const name = playlist.name\n\n // Search for user playlist....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets the iterator of the tree from the given root node. This will iterate the nodes like they were traversed in a preorder fashion
function getPreOrderIterable(rootNode) { if (!(rootNode instanceof Node)) { throw new TypeError('Parameter rootNode must be of Node type') } // to generate an iterator, a stack data structure will be created // the nodes will be pushed to this stack as if they were traversed in pre order ...
[ "function BSTIterator(root) {\n //do in order traversal, have result queue\n //keep track of current index in i\n //each time you call next, you will increase index i\n\n this.result = []\n this.i = 0\n var traverse = (curr) => {\n if(!curr) return\n\n if(curr.left !== null) traverse(curr.left)\n thi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Updates the query after the specified search delay.
updateQueryDelayed(query, callback = () => { }) { this._query = query; clearTimeout(this._searchDelayTimeout); this._searchDelayTimeout = window.setTimeout(() => { this.updateQuery(query, callback); }, this.searchDelay); }
[ "function afterDelay() {\n\t\t\t\tvar currentTime = new Date().getTime();\n\t\t\t\t\n\t\t\t\t// Check if enough time has elapsed since latest keyup event\n\t\t\t\tif (currentTime >= this.__searchKeyUpTime + SEARCH_DELAY) {\n\t\t\t\t\tvar keyword = $(this.options.searchInput).val();\n\t\t\t\t\t\n\t\t\t\t\t// Perform...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Objects Code Challenge: Create an object named "Box" with 3 properties, height, width, volume. Create 2 buttons for Height. The first button decreases the Box Height by 1. The second button increases the Box Height by 1. Create a button that prints the object and its attributes to the page (use the span "output". Extra...
function Box(width, height, volume) { this.width = width; this.height = height; this.volume = volume; }
[ "function DiagramObject(container, name, width, height, fillColor, strokeColor) {\n // create diagram \n $(\"<div id='\" + name + \"'>\").css({\n position: 'absolute',\n width: width + 'px',\n height: height + 'px'\n }).appendTo(container);\n // make diagram draggable\n $(\"#\" +...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Write a function called printVacations whose input is an array of arrays. Each subarray should have two strings as elements: The 0th element should be a person's name and the 1st element should be that person's most desired vacation destination. Include a minimum of 3 subarrays in your input array, like so: [ ['Tammy',...
function printVacations(input_array) { output = "" for (i = 0; i < input_array.length; i++) { // item_array = `input_array[i] output+= `${input_array[i][0]} really wants to go to ${input_array[i][1]}. \n` } return output }
[ "function printVacations(arr) {\n return arr.map(subarr => {\n return (`${subarr[0]} really wants to go to ${subarr[1]}.`);\n }\n )\n}", "function printVacations2(input_array) {\n output = \"\";\n for (i = 0; i < input_array.length; i++) {\n // item_array = `input_array[i] \n var lastval...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
function that add our personal rating to the hospital array
function addRatings(){ if(choice == 0){ ratingFields = [ {field:"averageTotalPayments",weight:3,order:"dsc"}, {field:"center_distance",weight:2,order:"dsc"}, {field:"totalDischarges",weight:1,order:"dsc"} ]; }else{ ratingFields = [ {field:"averageTotalPayments",weight:3,order:...
[ "addRating(newRating) {\n this._ratings.push(newRating)\n }", "addRating(ratings) {\n this._rating.push(ratings)\n }", "addRating(ratings) {\n this._ratings.push(ratings);\n }", "function setWeightsForRecommendedInsurance(){\n weighted_recommendedInsurance.essential = [];\n w...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Xuice is the XML full framework upgrade from Juice This is a tech test, it should be the next exi framework base
function Xuice() { }
[ "function XUtils() { }", "static createAllureXML() {\n const allureReporter = require(\"cucumberjs-allure-reporter\");\n const xmlReports = process.cwd() + \"/reports/xml\";\n Reporter.createDirectory(xmlReports);\n allureReporter.config({\n targetDir: xmlReports\n })\n }", "xmlGenerator() ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Render Template Friends List
function renderFriendList(friends, $container){ $playlistFriends.children[0].remove(); friends.forEach((friend) => { let HTMLString = friendsTemplate(friend); let friendElement = createTemplate(HTMLString); $container.append(friendElement); }); }
[ "render(){\n\t\tif(this.props.loggedIn && !this.props.loadedFriends &&this.props.token){\n\t\t\tthis.props.getFriends(this.props.userId, this.props.token); \n\t\t}\n\t\t//const [dense, setDense] = this.setDense();\n\t\treturn(\n\t\t\t<div className={this.classes.root}>\n\t\t\t\t<Grid container justify = \"center\">...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
takes the random item and inserts it into the css class image destination
function getRandomImage() { var jumbo = document.getElementById("jumbotron"); var randomItem = randomList[Math.floor(Math.random()*randomList.length)]; jumbo.style.backgroundImage = "url(../javapic/images/" + randomItem +")"; }
[ "setRandomImg(item, lstImgs) {\n var h = $(item).height();\n var w = $(item).width();\n $(item).css(\"width\", w + \"px\").css(\"height\", h + \"px\");\n $(item).attr(\"src\", lstImgs[Math.floor(Math.random() * lstImgs.length)]);\n }", "setRandomImg(item, lstImgs) {\n c...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
join csv and topoJ data
function joinData(b, data){ //loop through csv to assign each set of csv attribute values to geojson region for (var i=0; i<data.length; i++){ var csvRegion = data[i]; //the current region var csvKey = data[i].Country; //the CSV primary key //console...
[ "function joinData(data){\n \n dataset = data[0];\n //Convert topojson into geojson format\n counties = topojson.feature(data[1],data[1].objects.SouthCarolina_Counties).features;\n \n //Join the csv file to the geojson file\n //variables for data ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
define a Penguin class
function Penguin(name) { this.name = name; }
[ "function Penguin(name){\r\n this.name = name;\r\n this.numLegs = 2;\r\n }", "function Penguin (name) {\r\n\t\tthis.name = name;\r\n\t\tthis.numLegs = 2;\r\n\t}", "function Penguin(name){\r\n this.name = name;\r\n this.numLegs = 2;\r\n}", "function Penguin(name){\n\n this.name = name;\n t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Simple helper that gets a single screen (React component or navigator) out of the navigator config.
function getScreenForRouteName( // eslint-disable-line consistent-return routeConfigs, routeName) { var routeConfig = routeConfigs[routeName]; if (!routeConfig) { throw new Error('There is no route defined for key ' + routeName + '.\n' + ('Must be one of: ' + Object.keys(routeConfigs).map(function (a) { ...
[ "function getCurrentScreen(getStateFn) {\n const navigationState = getStateFn()[navigationStateKey];\n // navigationState can be null when exnav is initializing\n if (!navigationState) return null;\n\n const { currentNavigatorUID, navigators } = navigationState;\n if (!currentNavigatorUID) return null;\n\n co...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Notify a game result.
notifyGameResult(result, ownHand, opponentsHand) { // ˅ switch (result) { case GameResultType.Win: this.winCount++; this.gameCount++; break; case GameResultType.Loss: this.lossCount++; this.gameCount+...
[ "notifyTournamentOver(gameResults) {\n }", "notifyGameResult(result, ownHand, opponentsHand) {\n throw new Error(`An abstract method has been executed.`);\n }", "function setGameResult() {\n\n\n }", "function result() {\n\n Swal.fire( {\n title: 'Good Job! you got',\n text: docume...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Battery stack Extends mxShape.
function mxShapeElectricalBatteryStack(bounds, fill, stroke, strokewidth) { mxShape.call(this); this.bounds = bounds; this.fill = fill; this.stroke = stroke; this.strokewidth = (strokewidth != null) ? strokewidth : 1; }
[ "function mxShapeBasicBendingArch(bounds, fill, stroke, strokewidth)\n{\n\tmxShape.call(this);\n\tthis.bounds = bounds;\n\tthis.fill = fill;\n\tthis.stroke = stroke;\n\tthis.strokewidth = (strokewidth != null) ? strokewidth : 1;\n\tthis.startAngle = 0.25;\n\tthis.endAngle = 0.75;\n\tthis.arcWidth = 0.5;\n}", "pro...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
set the home screen product screen selected option based on the user choice (popular, best, new)
function setPopularSectionSelected(btnName){ $('#popular').removeClass('active'); $('#best').removeClass('active'); $('#new').removeClass('active'); $('#'+btnName).addClass('active'); }
[ "function updateProductSelection() {\n var flavor = document.querySelectorAll(\".flavor-selected\")[0];\n var glazing = document.querySelectorAll(\".glazing-selected\")[0];\n\n if (flavor != null && glazing == null) {\n var flavorText = flavor.innerHTML;\n document.getElementById(\"flavor\").innerHTML = \"...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
if view,edit,delete & add is true the update selectAll is true
function updateSelectAllValue(data) { if (data.view && data.edit && data.add && data.delete) data.selectAll = true; else data.selectAll = false; }
[ "function updateDataTableSelectAllCtrl(table){\n var $table = table.table().node();\n var $chkbox_all = $('tbody input[type=\"checkbox\"]', $table);\n var $chkbox_checked = $('tbody input[type=\"checkbox\"]:checked', $table);\n var ch...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
clear options on select by parameter
function clearSelect(selectElement) { //selectElement.find('option').remove(); $(selectElement.find("option")).each(function (index, element) { if (element.value != "0") element.remove() }); // selectElement.append(new Option("---" + selectElement.attr("data-text") + " Seçiniz ---", ...
[ "function clearOptions(select)\n{\n for(let i = 0; i < select.length; i++)\n {\n select.remove(i);\n }\n}", "function clearSelect() {\r\n for (var i = 0; i < arguments.length; i++) {\r\n var element = arguments[i];\r\n\r\n if (typeof element == 'string')\r\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
clear the previous search results by removing all the children of the "searchResultsList" ul element
function clearSearchResultsList() { var ul = document.getElementById("searchResultsList"); while (ul.firstChild) { ul.removeChild(ul.firstChild); } }
[ "function clearList(){\r\n while(searchList.firstChild){\r\n searchList.removeChild(searchList.firstChild);\r\n }\r\n }", "function clearResults() {\n $results.children().remove();\n }", "function clearSearchResults() {\n $(\".search-results\").empty();\n }", "f...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Darken a color based on its HSV value with a percent
darkenColor(h, s, v, percent) { h = (v * (1 + percent) > 1) ? 1 : v * (1 + percent); return { h, s, v }; }
[ "function darkenColor(color, percentage) {\n return d3.hsl(color).darker(percentage);\n}", "function darkenColor(color) {\n const re = /(hsl\\(\\d{1,3}, \\d{1,3}%, )(\\d{1,3})%\\)/;\n let light = parseInt(color.match(re)[2]);\n\n if (light - 10 > 0) light -= 10;\n else light = 0;\n\n let darkendedColor = ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
ajoute un eveenement sans ecraser l'existant. param obj => element sur lequel appliquer l'evenement param eventType => 'click', 'dblclick', 'mouseover', 'mouseout', 'focus' ...... param fn => script ? executer
function addEventToElement(obj,eventType,fn){ if(obj.addEventListener) obj.addEventListener(eventType,fn,false); // NS6+ else if(obj.attachEvent) obj.attachEvent("on"+eventType,fn); // IE 5+ else return false; return true; }
[ "function addEvent(obj, eventType, fn){\n\n\t\tif (typeof obj === \"string\") {\n\t\t\tobj = document.getElementById(obj);\n\t\t}\n\n\t /* Written by Scott Andrew: nice one, Scott */\n\t if (eventType === \"load\") {\n\t //hack me\n\t loadEventList.addLoadEvent(fn);\n\t return true;\n\t ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get the index of an element amongst sibling nodes of the same type
function nodeIndex(el, amongst) { if (!el) return -1; amongst = amongst || el.nodeName; var i = 0; while (el = el.previousElementSibling) { if (el.matches(amongst)) { i++; } } return i; }
[ "function siblingIndex(aNode){\n var siblings = aNode.parentNode.childNodes;\n var allCount = 0;\n var position;\n\n if (aNode.nodeType==Node.ELEMENT_NODE){\n var name = aNode.nodeName;\n for (var i=0; i<siblings.length; i++){\n var node = siblings.item(i);\n if (node...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
reset counter and score
function resetCounter() { score = 0; questionNum = 1; $('.score').text(0); $('.questionCounter').text(0); console.log('reset counter processed'); }
[ "function resetScore() {\r\n score = 0;\r\n}", "function resetScore() {\n score = 0;\n}", "function totalScoreReset(){\n totalScore = 0;\n }", "resetScore() {\n this.score = INITIAL_SCORE;\n }", "function resetScore() {\n scoreValues = _getEmptyScore();\n _saveScoreValues()...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
returns the most recently saved opinion for a user/topic
function getOpinionByUserTopic (userId, topicId) { return cq.query(qb.opinionDraftByUserTopic(userId, topicId)) .then(transformer.opinion) .then(opinion => opinion || models.opinion); }
[ "function requeryMostOverdueTopic() {\n store\n .dispatch('fetchFromStorage', 'topics')\n .then(() => {\n const topics = store.getters.topics;\n const overdueTopics = topics.filter(topic => {\n let isOverdue = false; // default to not overedue\n if (topic.custom.ena...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
function _hiLightBottomOfSebTree(eTR) this function hilights the last node on a sub tree, internal use only
function _hiLightBottomOfSebTree(eTR) { var eTBody=eTR.cells(1).firstChild.firstChild; var eTRBottom=eTBody.rows(eTBody.rows.length-1); if(eTRBottom.style.display !='none') _hiLightBottomOfSebTree(eTRBottom); else eTBody.rows(eTBody.rows.length-2).cells(1).fireEvent("onclick"); }
[ "function _hiLightTopOfSebTree(eTR)\n\t{\n\t\tvar eTBody=eTR.cells(1).firstChild.firstChild;\n\t\teTBody.rows(0).cells(1).fireEvent(\"onclick\");\n\t}", "function hiLightDown(currentElement)\n\t{\n\t\tvar eTR=currentElement.parentNode;\n\t\t\n\t\tif(eTR.tagName != \"TR\")\n\t\t\treturn;\n\t\n\t\tvar nRowIndex=eTR...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
recieve and add message to array
function addmessagestoarray(data) { if (filteredmessages.length !== 0) { messagestore = filteredmessages } messagestore.push(data) setchats([messagestore]) scrollmessages(); }
[ "function appendReceived(msg) {\n console.log([\"chat:appendReceived\"]);\n\n x = that.messages.shift(); // pop the oldest off the front\n that.messages.push('<i>' + msg + '</i><br>');\n\n console.log([\"chat:appendReceived2\"]);\n notifyUpdate(true);\n }", "_newMessage(message) {\n this.m...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Evaluates, or attempts to evaluate, a BooleanLiteral
function evaluateBooleanLiteral({ node, typescript }) { return node.kind === typescript.SyntaxKind.TrueKeyword; }
[ "function BooleanLiteralExpression() {\n}", "eval_bool(input) {\n const rs = this.evaluate(input);\n return (rs && rs.length === 1 && rs[0] === true)\n }", "BooleanLiteral(value) {\n this._eat(value ? 'true' : 'false');\n return {\n type: 'BooleanLiteral',\n value,\n };\n }"...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
draw ascending diagonal lines in reference to center point
function diagonalAscending(x, y, s) { line(x - s / 2, y + s / 2, x + s / 2, y - s / 2); }
[ "function drawDiagonal (lineCount) {\n // how many lines?\n for (let i = 1; i <= lineCount; i++) {\n // for each line\n if (i === 1 || i === lineCount) {\n console.log(drawOneline(lineCount));\n } else {\n console.log(drawDiagonalBorder(lineCount, i));\n }\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
let v: void = 10; // error TS2322: Type '10' is not assignable to type 'void' void is only really useful for functions:
function voidFunction() { // i don't return a value // return 10; // error TS2322: Type '10' is not assignable to type 'void' }
[ "function foo(x: void) { }", "function showVoid() {\n console.log(\"Void type\");\n}", "function myVoid() {\n return;\n}", "function VoidType() {\n}", "Void(options = {}) {\r\n return { ...options, type: 'void', kind: exports.VoidKind };\r\n }", "function Pair$AssignmentExpression$function...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Inserts the paint color master data.
function insertMasterData() { PaintColor.create(paintColors, function (err, paintColors) { if (err) { throw err; } log.info('Number of PaintColors created: %d', Object.keys(paintColors).length); endScript(callback); }); }
[ "function addColor () {\n painter = $('#paintGrid');\n\n painter.click(function (event) {\n var target = $(event.target);\n if (target.hasClass('cell')) {\n target.css('background-color', targetColor);\n }\n });\n }", "function _addCanvasColor() {\n background_color = document.g...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Display function, sets up various matrices, binds data to the GPU, and displays it.
function display() { // Clear the color buffer gl.clear( gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT ); // Set the model-view matrix to the current CameraController rotation quat4.toMat4( controller.currentOrientation, mvmat ); // Get the normal matrix from the model-view matrix (for lightin...
[ "function display() {\n displayer({\n destination: null,\n source: buffers[bufferID],\n count: count,\n viewport: {x:0, y:0, width: canvas.width, height: canvas.height}\n });\n }", "display() {\n this.scene.pushMatrix();\n this.scene.rotat...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
sort an array by the reg expression or default by number
sortByReg(arr, reg) { var defaultReg = /\d/; if (reg) { defaultReg = reg; } return arr.sort(function(a, b) { return a.match(defaultReg) - b.match(defaultReg); }); }
[ "function extractsort (a, b) {\n const pattern = />\\d+</\n const pattern2 = /\\d+/\n var a_val = pattern2.exec(pattern.exec(a))\n var b_val = pattern2.exec(pattern.exec(b))\n return b_val - a_val\n }", "function sort(array) {\n\n}", "function getSortFunctionByData(values) {\n var...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
An event listener to start card entry flow
async onStartCardEntry() { const cardEntryConfig = { collectPostalCode: false, }; //callback to start card entry await SQIPCardEntry.startCardEntryFlow( cardEntryConfig, this.onCardNonceRequestSuccess, this.onCardEntryCancel, ); }
[ "addcard(){\n console.log(\"enter details pressed\");\n Actions.addcard();\n }", "addCardClickHandler() {\n this.deckElement.addEventListener('click', (event) => {\n if (event.target.className === 'card') {\n const card = event.target;\n deck.run(card);...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This function provides the recursion and is synchronous May not be strictly needed as aliases are supposedly without chains
recurseAlias(tag) { //This is for if recursive alias retrieval has already gotten the alias if (tag in this.tag_aliases) { return;} this.async_requests++; const resp = $.getJSON('/tag_aliases',{'search':{'antecedent_name':tag}},data=>{ //Only process active aliases ...
[ "function recurse(list, out, level) {\n if (level >= 256) throw \"Plug-in alias recursion detected.\";\n list = list.filter(pred);\n list.forEach(function (name) {\n const alias = aliases[name];\n if (!alias) {\n out.push(name);\n } else {\n out = out.concat(rec...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
function for pagininating userRailActivity results
function userRailActivity(page_no, results_per_page) { $('#user_rail_activity_container').load('/opengraph/paginateUserRailActivity', { page_no: page_no, results_per_page: results_per_page }); }
[ "function userRailActivityLog(page_no, results_per_page) {\n $('#activity_box').load('/opengraph/paginateUserRailActivityLog', {\n page_no: page_no, \n results_per_page: results_per_page\n });\n}", "function pagination(data) {\n $(\"#userPaging\").empty();\n\n var li = \"\";\n\n for (index = 0; i...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Set styles of body background color, font style, image selection, and paragraph font color using the getItem() method to retrieve their values from local storage.
function setStyles() { let currentBgColor = localStorage.getItem('bgcolor'); let currentFont = localStorage.getItem('fontfamily'); let currentImage = localStorage.getItem('image'); let currentFontColor = localStorage.getItem('fontcolor'); document.getElementById('bgcolor').value = currentBgColor; do...
[ "function checkStyles(){\r\n\tdocument.body.style.backgroundColor = localStorage.getItem(\"backgroundColour\");\r\n\tdocument.body.style.color = localStorage.getItem(\"fontColour\");\r\n\tdocument.body.style.fontSize = localStorage.getItem(\"fontSize\");\r\n\t\r\n}", "storeStyles( pStyles ){\r\n \r\n v...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
ajax delete the configuration
function deleteConf($id){ if($id==""){ alert("Please select a configuration range to delete"); return false; }else if(confirm("Are you sure you want to delete the configuration?")) { $.ajax({ type: "POST", url: "../ajax_common.php", data: { 'id': $id, ...
[ "function configDelete(cfId, cfName, ev) {\n if (window.confirm(\"Delete '\" + cfName + \"'?\")) {\n var d = loadJSONDoc(cfId + \"/delete/\")\n d.addCallback(partial(alertConfigDelete, cfName, ev.src()));\n }\n}", "function deletePreviewConfiguration(url) {\n $http.delete(url).then(function (respon...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
updates current state with new comment
updateComment(event) { this.setState({ comment: event.target.value }); }
[ "_updateFromComment() {\n const oldComment = this.previous('comment');\n const comment = this.get('comment');\n\n if (oldComment) {\n oldComment.destroyIfEmpty();\n }\n\n if (comment) {\n const defaultRichText = this.defaults().richText;\n\n /*\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Handles the browser mouseDown event and removes the pressed button from the activeCommands list.
mouseUp(event) { var button = event.which || event.button; delete this.activeCommands[button]; }
[ "mouseDown(event) {\n var button = event.which || event.button;\n this.activeCommands[button] = true;\n }", "static _HandleButtonDown(e) {\n if (!Mouse._button_down.includes(e.button))\n Mouse._button_down.push(e.button)\n }", "function handleMouseUp() {\n oscillator.disconnect(audioConte...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
dim This function returns the inner dimensions of the current window. If any of the optional dimension arguments are supplied, the window will be resized before its dimensions are returned. Prototype: Dim dim([[Dim d][int w, int h]]) Arguments: d ... An optional Dim object representing w and h w ... An optional width h...
function dim() { var d = _dfa(arguments); if (d) { if (ie) { // The resizeBy can throw an exception if the user clicks too fast (PR39015); // catch and do nothing since the window is ultimately resized correctly anyway. try { var ow = document.body.clientWidth; var oh...
[ "function dim( w, h ) {\n return { w: w, h: h };\n}", "function objDim(o) {\r\n var w, h;\r\n if (arguments.length == 3) {\r\n w = arguments[1];\r\n h = arguments[2];\r\n } else if (arguments.length == 2) {\r\n w = arguments[1].w;\r\n h = arguments[1].h;\r\n }\r\n\r\n var d = new Dim(objW(o, w...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Create the symlink when running as root
function createRootSymLink() { var li1 = process.argv[1].lastIndexOf('\\'), li2 = process.argv[1].lastIndexOf('/'); if (li2 > li1) { li1 = li2; } var AppPath = process.argv[1].substring(0,li1); var p1 = resolve(AppPath + "/" + nativescriptAppPath); var p2 = resolve(AppPath + "/" + webAppPath); i...
[ "createSymboliclink(target, link, done) {\n const commands = [\n 'mkdir -p ' + link, // Create the parent of the symlink target\n 'rm -rf ' + link,\n 'mkdir -p ' + utils.realpath(link + '/../' + target), // Create the symlink target\n 'ln -nfs ' + target + ' ' + li...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Bearish Price Flip occurs when the market records a close greater than the close four bars earlier, immediately followed by a close less than the close four bars earlier.
function findCandlesSinceBearishFlip(candles) { // is close of current candle greater than 4 candles previous // is previousClose less than current minus 5 let currentCandleIndex = 0; let bearishFound = false; const candleDataLength = candles.length; return _.reduce(candles, (acc, currentCandle)...
[ "function checkStockDelta (stockArray) {\n if (stockArray[1] > stockArray[2]) {\n // console.log(stockArray[0] + ' open is higher than close')\n stockTickerHTML = stockTickerHTML + `\n <div class=\"ticker__item__down\">${stockArray[0]}</div>\n <div class=\"ticker__image\"><img src=\"img...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
function for checking highScores
function checkForHighscore(score) { if (score >= highScores[0].score || score >= highScores[1].score) { console.log(chalk.bgYellowBright("Congratulations you have got a highscre please send me a screenshot so that i can update the highScores")); } else { console.log(chalk.bgBlueBright("Highscore...
[ "function checkHighScore(score) {\n if(score>highScore[1].finalScore){\n console.log(chalk.yellow(\"Congragulations! You have made a highscore.\"));\n }\n \n }", "function checkHighScore()\n{\n if(score > highScores.scored)\n {\n\t console.log(chalk.bold.bgCyan(\"\\n Hurray ! 🍾 You beaten \" + high...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Retrieves containers list of an Azure Storage account.
function GetContainersList(blobService, continuationToken, options) { if (options === void 0) { options = {}; } return tslib_1.__awaiter(this, void 0, void 0, function () { return tslib_1.__generator(this, function (_a) { return [2 /*return*/, new Promise(function (resolve, reject) { ...
[ "function listContainers(accountID){\n var request = gapi.client.tagmanager.accounts.containers.list({\n 'accountId' : accountID\n });\n request.execute(printContainers);\n}", "function listContainers(accountId) {\n return new Promise((resolve, reject) => {\n var request = gapi.client.tagmanager.a...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get the heatmap as a layer values: [[longitude:float, latitude:float, weight:float]] A list of coordinates with a weight. The higher the weight, the hotter this point is:) Values for the weight must be in the range from 01.
function heatmapLayer(values) { var data = new ol.source.Vector(); for (var i = 0; i< values.length; i++) { var v = values[i]; var coord = ol.proj.transform([v[0], v[1]],'EPSG:4326', 'EPSG:3857'); var lonLat = new ol.geom.Point(coord); var pointFeature = new ol.Feature({ geometry: lonLat, ...
[ "function createHeatMapData(heatWeights) {\n var heatMapData = []\n i = 0\n for(const county in heatWeights) {\n const location = heatWeights[county].location;\n const newPoint = {\n location: new google.maps.LatLng(location.lat, location.lng),\n weight: heatWeights[county].weight\n }\n hea...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
On mouse out: Set style class of element id to class
function doMouseOut(id, mclass) { if (dragdropongoing) return; if (id!=overId) return; stopHigh = false; obj = document.getElementById(id); if (sel_edit_areas[id]) { obj.className = "il_editarea_selected"; } else { //obj.className = mclass; obj.className = edit_area_original_class[id]; } var typetext ...
[ "function doMouseOut(id, mclass)\n{\n\tif (dragdropongoing) return;\n\tif (id!=overId) return;\n\tstopHigh = false;\n\tobj = document.getElementById(id);\n//\tif (oldclass[id])\n//\t{\n//\t\tobj.className = oldclass[id];\n//\t}\n//\telse\n//\t{\n\t\tobj.className = mclass;\n//\t}\n}", "function handleMouseOutElem...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Display plaintext in the helperTV
function displayHelperPlaintext(text) { loc = document.getElementById("helperTV"); htmldata = '<div class="plaintext">' + text + '</div>'; loc.innerHTML += htmldata; MathJax.Hub.Queue(["Typeset",MathJax.Hub]); }
[ "showText(currentText) {\n console.log(currentText)\n }", "function displayPlaintext(text,loc=mainTV) {\n\thtmldata = '<div class=\"plaintext\">' + text + '</div>';\n\t\n\tloc.innerHTML += htmldata;\n\tMathJax.Hub.Queue([\"Typeset\",MathJax.Hub]);\n}", "function display(text) {\n $(\"#infotext\").tex...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
The JavaScript function that is set to the value of KoolOnLoadCallFunction. This function calls the two functions, setLayout() and setData(). The two functions (setLayout() and setData()) set the layout and data on the chart. Parameters: id The chart identifier that is used as the first parameter of KoolChart.create().
function chartReadyHandler(id) { document.getElementById(id).setLayout(layoutStr); document.getElementById(id).setData(chartData); }
[ "function loadchart(id) {\n const sensorDiv = document.createElement('div');\n const chartsDiv = document.querySelector('#charts');\n const content = document.createElement(\"div\");\n const chartDiv = document.createElement('div');\n const chart = document.createElement(\"canvas\")\n\n let sensorData;\n sen...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
createCartView() / createCartItemView() Creates a view for a single cart item. This exists so that we can attach the item to the remove button so that when it's clicked, we know what item to remove.
function createCartItemView(config) { var view = createTemplateView(config); view.afterRender = function(clonedTemplate, model) { clonedTemplate.find('.remove-item').click(function(){ view.cartModel.removeItem(model); }); }; //view.afterRender() return view; }
[ "function createCartView(config) {\n config.cartModel = config.model;\n config.templateView = createCartItemView(config);\n\n var view = createTemplateListView(config);\n\n view.afterRender = function() {\n this.subtotalPrice.html(this.model.getSubtotalPrice());\n this.taxPrice.html(this.m...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
When an incoming mutation is applied to HEAD, this is called to remove the mutation from the unresolved state. If the newly applied patch is the next upcoming unresolved mutation, no rebase is needed, but we might have the wrong idea about the ordering of mutations, so in that case we are given the flag `needRebase` to...
consumeUnresolved(txnId) { // If we have nothing queued up, we are in sync and can apply patch with no // rebasing if (this.submitted.length == 0 && this.pending.length == 0) { return false; } // If we can consume the directly upcoming mutation, we won't have to rebase if (this.submitted.len...
[ "removeMutation() {\n this.setState({\n externalMutations: undefined\n });\n }", "function rebase(toHEAD) {\n return function (store) {\n var sceneGraph = store.get('sceneGraph');\n var HEAD = sceneGraph.refs.HEAD;\n\n return store.dispatch(saveIndex()).then(function () {\n var INDEX = ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Transmit the message and rearm the timer
function txandrerun(msg) { node.send(msg); timerRef = setTimeout(testSource, 30 * 1000); }
[ "function sendTimerStop() {\n emitEvent(constants.socketEvents.timerStop, '0');\n }", "function socketSendTimer() {\n ws.send(\"Socket Refreshed\");\n}", "function sentTimer() {\n pubsub.publish(\"serverClock\");\n}", "function sendTimerPause() {\n // Make sure timer is runnin...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
inactivate a relationship and add new relationships for children
function inactivateRelationship(rel, axiom, newTargets) { angular.forEach(newTargets, function (parent) { var newRel = angular.copy(rel); newRel.relationshipId = null; newRel.effectiveTime = null; newRel.released = false; newRel.target.co...
[ "setRelations () {\n this[hasMany].forEach(relation => {\n this[relation] = (new Blueprint(relation)).belongsTo(this)\n })\n }", "function addRelationship(){\n\n if(vm.relationshipFrom ==undefined || vm.relationshipTo == undefined || vm.relation == undefined){\n logError('Al...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }