query
stringlengths
9
34k
document
stringlengths
8
5.39M
negatives
listlengths
19
20
metadata
dict
init wires up watchers on selections and fetches new data
function init(){ var countrySel = $('#sel-country'); var categorySel = $('#sel-category'); var genderSel = $('#sel-gender'); function updateSelections() { var params = window.winners.params || {}; params.country = countrySel.val(); params.category = categorySel.val(); pa...
[ "function init() {\n\n // reset any previous data\n displayReset();\n\n // read in samples from JSON file\n d3.json(\"data/samples.json\").then((data => {\n\n\n // ********** Dropdown Menu ************// \n\n // Iterate over each name in the names array to populate dropdowns with ID...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Utilities ========= `bubbleEvent(event)` Event listener to fire any bubbling events. Normal usage of this looks something like the following: child.addEventListener "", parent.bubbleEvent This allows the parent to fire any events that the child fires up the chain, restricted only to the events that are specified to bub...
bubbleEvent(evt) { if (evt.bubbles) { evt.bubbleTrace = (evt.bubbleTrace || []).concat(this); this.dispatchEvent(evt); } }
[ "function cancelBubble(event) {\r\n\r\n if (event.stopPropagation) {\r\n event.stopPropagation();\r\n } else {\r\n event.cancelBubble = true;\r\n }\r\n}", "callChildMethod(){\n this.template.querySelector('c-bubble-event').childMethodCallingFromParent('Parent message passed');\n }...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Return the number of "children" obj has
function numChildren(obj) { return obj.children.length; }
[ "numDescendants() {\n let num = 1;\n for (const branch of this.branches) {\n num += branch.numDescendants();\n }\n return num;\n }", "function numOfTotalEnemies() {\n\tconst totalEnemies = gameState.enemies.getChildren().length;\n return totalEnemies;\n}", "get depth() {\n let d = ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Start a JavaScript based Agent SelfUpdate
function agentUpdate_Start(updateurl, updateoptions) { // If this value is null var sessionid = (updateoptions != null) ? updateoptions.sessionid : null; // If this is null, messages will be broadcast. Otherwise they will be unicasted // If the url starts with *, switch it to use the same protoco, host and...
[ "function start()\n {\n let reloadParams = \"reload=reload\";\n fetch(\"memomedia.php\", {method: 'POST', credentials: 'include', headers: {\"Content-Type\": \"application/x-www-form-urlencoded\"}, body: reloadParams})\n .then(response => response.json())\n .then(fillPage)\n }", ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
retrievs the name of the pic from the folder
function getImg(name){ let myList = readFile("Members", name); let json = myList; for(let i = 0; i < json.length; i++){ if(!json[i].endsWith(".txt")){ return json[i]; } } return "none"; }
[ "function findcardimg(card){\r\n var cardname = card.join(\"\");\r\n return \"img/cards/\" + cardname + \".png\";\r\n }", "function findIMG(desc){\n\tvar indexJPG = desc.indexOf('.jpg');\n\tvar imageUrl;\n\tif (indexJPG === -1) {\n\t\t// if no .jpg is found, finds the first .png\n\t\timageUrl = f...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Body Detect EVENT Register.
function doHumanDetectBodyRegister(serviceId, sessionKey) { let params = { profile: 'humandetection', attribute: 'onbodydetection', params: { serviceId: serviceId } }; addBodyOptionParameter(params.params, 'body'); sdk.addEventListener(params, message => { // イベントメッセージが送られてくる...
[ "_registerEvent () {}", "function addBodyListeners() {\n /** \n * Reference to the body element.\n *\n * @private\n * @property body\n * @type Element\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
rootNode: calculation of root entropy Note: target value should be binary (0/1) Example: rootNode(obj, "target")
function rootNode(obj, target_var){ var pos = 0; var neg = 0; for(var i = 0; i < obj.length; i++){ if(obj[i][target_var] == 1){ pos = pos + 1; } else { neg = neg + 1; } } tot = pos + neg; pos1 = Math.log2(pos/tot)*pos/tot neg1 = Math.log2(neg/t...
[ "constructor(){ // Definindo construtor da classe BinaryTree\n this.root = null; // inicializa a raiz da arvore como sendo nula\n }", "function TrueNode() {\n}", "function giniIndex(obj, target_var, input_var){\n \n rootEnt = rootNode(obj,target_var);\n\n //Variable breakage\n if(typeof(ob...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Handles the user clicking the highlight edit menu item.
function menuHighlightClick() { Data.Edit.Mode = EditModes.Highlight; updateMenu(); }
[ "function menuEditClick() {\n Data.Edit.Open = !Data.Edit.Open;\n setEditMenuPosition();\n\n if (Data.Edit.Open) {\n if (Data.Edit.LastMode)\n Data.Edit.Mode = Data.Edit.LastMode;\n } else {\n Data.Edit.LastMode = Data.Edit.Mode;\n Data.Edit.Mode = EditModes.Off;\n }\n updateMenu();\n\n if (Dat...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
for checking expiry of proposals contract function will delete proposal for you
function isExpired() { ballotContract.IsProposalExpired((error, result) => { logCatcher('is proposal expired has just been called'); setTimeout(() => { // recursively check every 9 seconds. in the future make this a day. isExpired(); }, 9000); }); }
[ "function proposalDeleteConfirmation(){\n\t\t$(\".proposal_delete\").click(function(e){\t\n\t\t\tswal({\n\t title: 'Are you sure?',\n\t text: \"Deleting Proposal Slip\",\n\t icon: 'warning',\n\t buttons:{\n\t confirm: {\n\t text : 'Delete...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Find ID in DRUM_COMBO array
function getDrumComboId(inputArray){ if (inputArray.length == 0) return 0; inputArray.sort(); for (let i = 0; i < DRUM_COMBOS.length; i++){ if (DRUM_COMBOS[i].length == inputArray.length && DRUM_COMBOS[i].every((val, index) => val === inputArray[index])) return i + 1; ...
[ "function findIndexInDidArrayMatchingSelection() {\t\n\t\tvar i=0;\n\t\twhile(i<detailIdJson.did_array.length) {\n\t\t\tif(detailIdJson.did_array[i].color==self.color() &&\n\t\t\t detailIdJson.did_array[i].size ==self.size() &&\n\t\t\t detailIdJson.did_array[i].sex ==self.sex() )\n\t\t\t\tbreak;\n\t\t\ti++;\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Notify subscribers that the query has been updated.
queryUpdated() { this.emit('core.state.queryUpdated', this) }
[ "function notifyObservers() {\n _.each(views, function (aView) {\n aView.update();\n });\n } // notifyObservers", "_registerUpdates() {\n const update = this.updateCachedBalances.bind(this);\n this.accountTracker.store.subscribe(update);\n }", "function updateSubscribers(id) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Registra un pedido, validando que el estado de la mesa sea desocupado
async function registrarPedido(parent, args, { usuario, prisma }) { const mesa = await prisma.mesa.findOne({ where: { id: parseInt(args.mesa) }, select: { ocupado: true }, }); if (!mesa.ocupado) { const data = { personal: { connect: { id: usuario.id } }, mesa: { connect: { id: parseInt(args.mesa) } }, ...
[ "function onSuscriptorGuardado(err, suscriptorGuardado) {\n if (err) { return response.send(err); } \n response.send({ message: 'OK, suscriptor adicionado', _id: suscriptorGuardado._id, creado: suscriptorGuardado.creado });\n }", "function agregarAlHeruku (pedido){\n let pedidoNuevo = {...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Redraws window(s) after a key is pressed
function redrawAfterKey() { var sO = CurStepObj; if (sO.focusBoxId == CodeBoxId.Index) redrawGridIndexExpr(sO); // redraw the index *cell* else drawCodeWindow(sO); // redraw code window }
[ "function keyPressed() {\n\tif (keyCode == 32) {\n\t\t// reset canvas\n\t\tclear();\n\t\tcount = 0;\n\t\tbutton.hide(); \n\t\tparticleCount = 0;\n\t\t// load next image in paintings array\n\t\tpainting = loadImage(paintings[paintingCount]);\n\t\t// move on to next painting. Go back to first one if the last one is c...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets the next `LContainer` that is a sibling of the given container.
function getNextLContainer(container) { return getNearestLContainer(container[NEXT]); }
[ "function next () {\r\n return this.siblings()[this.position() + 1]\r\n}", "function getNextSibling(node, tag){\n\tif (!tag) tag = node.nodeName;\n\ttag = tag.toUpperCase();\n\tvar cont = 20; // Limita o numero de itera��es para evitar sobrecarga no ie\n\twhile (node.nextSibling && node.nextSibling.nodeName && n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
creatHandler creates a restify handler from a handlerObject. The handler object is or contains at the very least an action, which is executed whenever the routes receives a request. Furthermore, a transform, respond and error function can be defined.
function createHandler(handlerObject, path) { handlerObject = extendHandlerObject(handlerObject, path); return function(req, res) { var handlerObject = this; Promise.cast(req) .bind(virgilio) .then(handlerObject.validate) .then(hand...
[ "function extendHandlerObject(handlerObject, path) {\n //Instead of passing an object with only a handler property,\n //the user can pass just that property (the action name, a string).\n //In that case, create a full-fledgec handlerObject now.\n if (typeof handlerObject === 'string') {\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Correlation coefficient of population
function correlation_coeff_p(X, Y) { return covariance_p(X, Y) / (stddev_p(X) * stddev_p(Y)); }
[ "function corr(xdata, ydata)\r\n{\r\n if(xdata==null ||xdata.lengtgh<=1)return 0;\r\n var sumx = 0, sumy = 0, sqx = 0, sqy = 0, xy = 0, len = xdata.length;\r\n for(i=0;i<xdata.length;i++)\r\n {\r\n sumx += xdata[i];\r\n sumy += ydata[i];\r\n sqx += xdata[i]*xdata[i];\r\n sqy += ydata[i]*ydata[i];\r\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Potentially splits a literaltext string into multiple parts. For special cases.
function splitStringLiteral(s) { if (s === '. ') { return ['.', ' ']; // for locales with periods bound to the end of each year/month/date } else { return [s]; } }
[ "function textsplit(){\n\tvar aku = 'saya belajar di pasar';\n\tconsole.log(aku.split());\n\tconsole.log(aku.split(\"\"));\n\tconsole.log(aku.split(\" \"));\n}", "function SPLIT(text, delimiter) {\n return text.split(delimiter);\n}", "function splitSentences(text) {\r\n return text.replace(/([!?]|\\.\\.\\.)...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Appends clicked GIF to journal entry form
function GIFClick(img){ if (numberOfThumbs >= 6) { document.querySelector('#userInput').appendChild(img); img.id = "postGIF"; let postGIF = document.getElementById("postGIF").src; } img.setAttribute('onclick', 'GIFReturn(this)'); numberOfThumbs --; }
[ "function gifClicked() {\n largeGifAppears(this);\n automatedSpeech();\n}", "function largeGifAppears(e) {\n let src = $(e).attr('src');\n $chosenGif.attr(\"src\", src); // can i do this\n $chosenGif.show();\n}", "function revokeWaitingGIF() {\n//\tRichfaces.hideModalPanel('loadingPanel');\n//\tdocument.bo...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
round to nearby lower multiple of base
function floorInBase(n,base){return base*Math.floor(n/base)}
[ "function floorInBase(n,base){return base*Math.floor(n/base);}", "function roundToGrid(numb) {\n\treturn Math.round(numb/10) * 10;\n}", "function roundUp(n, up)\n{\n if (n % up == 0)\n return(n);\n else\n return(n + (up - (n % up)));\n}", "function round5(x)\r\n{\r\n return Math.round(x/5)*5;\r\n}"...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Determine whether the given properties match those of a `ActivityMetricsProperty`
function CfnStorageLens_ActivityMetricsPropertyValidator(properties) { if (!cdk.canInspect(properties)) { return cdk.VALIDATION_SUCCESS; } const errors = new cdk.ValidationResults(); if (typeof properties !== 'object') { errors.collect(new cdk.ValidationResult('Expected an object, but re...
[ "function CfnBucket_MetricsPropertyValidator(properties) {\n if (!cdk.canInspect(properties)) {\n return cdk.VALIDATION_SUCCESS;\n }\n const errors = new cdk.ValidationResults();\n if (typeof properties !== 'object') {\n errors.collect(new cdk.ValidationResult('Expected an object, but rece...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sends the stored commands possible without changing the mapping. Note: this._current_row_major_mapping (hence also this.currentMapping) must exist already
_sendPossibleCommands() { const active_ids = new Set(Array.from(this._currently_allocated_ids).map(k => parseInt(k, 10))) Object.keys(this._current_row_major_mapping).forEach(logical_id => active_ids.add(parseInt(logical_id, 10))) let new_stored_commands = [] for (let i = 0; i < this._stored_commands.l...
[ "_run() {\n const num_of_stored_commands_before = len(this._stored_commands)\n if (!this._currentMapping) {\n this.currentMapping = {}\n } else {\n this._sendPossibleCommands()\n if (len(this._stored_commands) === 0) {\n return\n }\n }\n\n const new_row_major_mapping = this...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Text is added to DOM
function addTextToDom(text) { console.log('Adding the following Stirng to dom: ' + text); const textContainer = document.getElementById('greeting-container'); textContainer.innerText = text; }
[ "appendText(str) {\n this.current.appendChild(browser.createTextNode(str));\n return this;\n }", "createText(){\n let text = Text.createText(this.activeColor);\n this.canvas.add(text);\n this.notifyCanvasChange(text.id, \"added\");\n }", "write(text) {\n this.element.appendChil...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Load the app assets for this addon. These are the various classes that live under `app/`, including actions, models, etc., as well as any custom class types. Files are loaded into the container under their folder's namespace, so `app/roles/admin.js` would be registered as 'role:admin' in the container. Deeply nested fo...
loadApp() { if (fs.existsSync(this.mainDir)) { eachDir(this.mainDir, (dirname) => { let dir = path.join(this.mainDir, dirname); let type = singularize(dirname); glob.sync('**/*', { cwd: dir }).forEach((filepath) => { let modulepath = withoutExt(filepath); if (filep...
[ "function loadAssets() {\n\t//setup a global, ordered list of asset files to load\n\trequiredFiles = [\n\t\t\"src\\\\util.js\",\"src\\\\setupKeyListeners.js\", //misc functions\n\t\t\"src\\\\classes\\\\Enum.js\", \"src\\\\classes\\\\Shape.js\", \"src\\\\classes\\\\MouseFollower.js\" //classes\n\t\t];\n\t\n\t//manua...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Loads the given name (or [name, options] pair) from the given table object holding the available presets or plugins. Returns undefined if the preset or plugin is not available; passes through name unmodified if it (or the first element of the pair) is not a string.
function loadBuiltin(builtinTable, name) { if (isArray(name) && typeof name[0] === 'string') { if (builtinTable.hasOwnProperty(name[0])) { return [builtinTable[name[0]]].concat(name.slice(1)); } return; } else if (typeof name === 'string') { return builtinTable[name]; } // Could b...
[ "function loadPlugin(name, options) {\n return require(resolvePlugin(name, options) || name);\n}", "getTable(name) {\n return this.tables.get(name);\n }", "function loadPartSupplierPricingTable(options={}) {\n\n var part = options.part;\n\n if (!part) {\n console.error('No part provided ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Close the websocket connection
function wsCloseConnection(){ webSocket.close(); }
[ "function f_CloseWebsocket(fWS)\n{\n\t// Check fWS object is defined and exists\n\tif (fWS != \"undefined\")\n\t{\n\t\tfWS.close();\n\t\tf_RADOME_log('Websocket \"'+ fWS.name+ '\" has been closed')\n\t}\n}", "close() {\n this[_socket].close();\n\n if (this[_timeout] !== null) {\n clearTimeout(this[_tim...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
ImFont FontDefault; // = NULL // Font to use on NewFrame(). Use NULL to uses Fonts>Fonts[0].
get FontDefault() { const font = this.native.FontDefault; return (font === null) ? null : new ImFont(font); }
[ "function GetFont() {\r\n return new ImFont(bind.GetFont());\r\n }", "function _loadFont(fontname){\n var canvas = document.createElement(\"canvas\");\n //Setting the height and width is not really required\n canvas.width = 16;\n canvas.height = 16;\n var ctx = canvas.getContext(\"2d\");\n\n //The...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Copyright 2018 Palantir Technologies, Inc. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at Unless required by applicable law or agreed to in writing, software distributed under t...
function formatPercentage(ratio) { return (ratio * 100).toFixed(2) + "%"; }
[ "function format_percent(percent) {\n return Number(percent * 100).toFixed(2) + ' %';\n}", "function format_percent(val) {\n return (val * 100).toFixed(places) + \"%\";\n}", "function Percent() {\n Ratio.apply(this, arguments);\n this.cssType = PERCENT;\n }", "function getPercentOf(p, n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Makes axios get request to address and returns array of all API responses and function to make another request (and update array of responses)
function useAxios() { const [responses, setResponses] = useState([]); // name is not query (changed to resource) ******* async function fetchData (url, resource="") { try { const response = await axios(`${url}${resource}`); setResponses(resps => [...resps, {...response.data, id: uuid()}]); ...
[ "apiPromise(apiAction) {\n Promise.all([this.apiCall(apiAction).getData(), this.apiCall(apiAction).getPrice()])\n .then(([data, prices]) => {\n this.setState({\n coinData: data,\n coinPrice: prices\n });\n })\n }", "function getFreeProxies() {\n return new Promise(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
parseConfig reads config from the source of truth, the environment. config must always be read this way because automation api introduces new program lifetime semantics where program lifetime != module lifetime.
function parseConfig() { const { config } = state_1.getStore(); const parsedConfig = {}; const envConfig = config[exports.configEnvKey]; if (envConfig) { const envObject = JSON.parse(envConfig); for (const k of Object.keys(envObject)) { parsedConfig[cleanKey(k)] = envObject[k...
[ "function parseConfig() {\r\n let config\r\n if (process.env.WEBMONITOR_CONFIG) {\r\n // Strip escaped newlines\r\n let configString = process.env.WEBMONITOR_CONFIG.replace(/\\\\n/g, \"\\n\")\r\n //console.log(configString)\r\n config = JSON.parse(configString)\r\n } else {\r\n config = require('....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Update Conditions Track Chart
function updateConditionsTrackChart2(){ var temp = getDpsActive(); var myData = [{ type: "bar", showInLegend: true, color: "blue", name: "Active", dataPoints: dpsActive }, { type: "bar", showInLegend: true,...
[ "function updateConditionsTrackChart() {\r\n\t\t\t\t\tupdateConditionsTrackChart2();\r\n\t\t\t\t}", "function updateHiSideChart() {\r\n\t\t\t\t\thandleHiSideTrack(2);\r\n\t\t\t\t\tupdateHiSideChart2();\r\n\t\t\t\t}", "function updateLoSideChart() {\r\n\t\t\t\t\thandleLoSideTrack(2);\r\n\t\t\t\t\tupdateLoSideCha...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[19] PathExpr ::= LocationPath | FilterExpr | FilterExpr '/' RelativeLocationPath | FilterExpr '//' RelativeLocationPath Unlike most other nodes, this one always generates a node because at this point all reverse nodesets must turn into a forward nodeset
function pathExpr(stream, a) { // We have to do FilterExpr before LocationPath because otherwise // LocationPath will eat up the name from a function call. var filter = filterExpr(stream, a); if (null == filter) { var loc = locationPath(stream, a); if (null == loc) { throw new Error(...
[ "function relativeLocationPath(lhs, stream, a, isOnlyRootOk) {\n if (null == lhs) {\n lhs = step(stream, a);\n if (null == lhs) return lhs;\n }\n var op;\n while (op = stream.trypop(['/', '//'])) {\n if ('//' === op) {\n lhs = a.node('/', lhs, a.node('Axis', 'descendant-or-self', '...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function to make text Lowercase:
function lower(text) { return text.toLowerCase(); }
[ "function lowercase(value) {\n return String(value).toLowerCase();\n}", "toSnakeCase(text, opts = {}) {\n //(1) get case if needed\n if (opts.case == \"lower\") text = text.toLowerCase();\n else if (opts.case == \"upper\") text = text.toUpperCase();\n\n //(2) replace - and whitespaces\n text = tex...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
:: (Object, ?Object) A keymap binds a set of [key names](keyName) to commands names or functions. Construct a keymap using the bindings in `keys`, whose properties should be [key names](keyName) or spaceseparated sequences of key names. In the second case, the binding will be for a multistroke key combination. When `op...
function Keymap(keys, options) { this.options = options || {} this.bindings = Object.create(null) if (keys) this.addBindings(keys) }
[ "function KeyboardLayout(options) {\n for (var key in options) {\n this[key] = options[key];\n }\n}", "function iglooKeys () {\n\tthis.mode = 'default';\n\tthis.keys = ['default', 'search', 'settings'];\n\tthis.cbs = {\n\t\t'default': {},\n\t\t'search': {\n\t\t\tnoDefault: true\n\t\t},\n\t\t'settings': {}\n\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
static g_services = [];
static Get(serviceName) { if(!this.g_services) this.g_services = []; return this.g_services[serviceName]; }
[ "getServices() {\n let services = []\n this.informationService = new Service.AccessoryInformation();\n this.informationService\n .setCharacteristic(Characteristic.Manufacturer, \"OpenSprinkler\")\n .setCharacteristic(Characteristic.Model, \"OpenSprinkler\")\n .setCharacteri...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets the actual background color for content that sticks to the top of the grid.
get actualStickyRowBackground() { return brushToString(this.i.d5); }
[ "function getGridBackgroundColorClass() {\n return 'highlighted-' + getGridBackgroundColor();\n }", "get_background_color(){\n \tconsole.log(\"returning color based on: \" + this.props.priority)\n\n \tswitch (this.props.priority){\n \t\tcase \"low\":\n \t\t\treturn \"#ffffe6\"\n \t\tcase \"medi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get folds from and array of lines
function getFolds(lines, level, offset) { var folds = Object.create(null); var currentFold = null; var key, l, line; // Iterate in lines for (l = 0; l < lines.length; l++) { line = lines[l]; // If line is not indented it can be an object key or a key: value pair if (line.substr(0...
[ "function fold(input, lineSize, lineArray = []) {\n if (input.length <= lineSize) {\n lineArray.push(input);\n return lineArray;\n }\n lineArray.push(input.substring(0, lineSize));\n var tail = input.substring(lineSize);\n return fold(tail, lineSize, lineArray);\n}", "function foldable(state, lineS...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
OpenAPI2Apigee creates an apiproxy.zip, deleting that
function deleteZip(apiProxy){ fs.unlink(__dirname+'/'+apiProxy+'/apiproxy.zip',function(err){ if(err) return console.log(err); console.log('file deleted successfully'); }); }
[ "cleanUpSDKFiles() {\n this.fileOpsUtil.deleteFile(\n path.join(\n this.dispatcherConfigPath,\n Constants.CONF_D,\n Constants.AVAILABLE_VHOSTS,\n \"default.vhost\"\n )\n );\n this.fileOpsUtil.deleteFile(\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
try to open a socket on handleChatroomModalClose
handleChatroomModalClose(save, chatRoom) { socket.on('connection', function(socket) { let newState = {chatroomModalIsOpen: false} if (save) { socket.on('setUsername', function(data) { newState.chatRoom = chatRoom; if(this.state.users.indexOf(data) > -1) { this.state.users.push(data); ...
[ "async function onDisconnect(socket) {\n // socket.rooms is at this moment already emptied (by socket.IO)\n const mapping = registry.getMapping(socket.id);\n\n if (!mapping) {\n // this happens if user is on landing page, socket was opened, then user leaves - socket disconnects, user never joined a ro...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Dismisses all currently displayed modal windows with the supplied reason.
dismissAll(reason) { this._modalStack.dismissAll(reason); }
[ "close() {\n this.showModal = false;\n\n this.onClose();\n }", "hideVisibleModals() {\n let modals = this.game.modals;\n let visibleModals = Object.keys(modals).map(function(key) {\n let modal = modals[key];\n if(modal.alive && modal.visible == true...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns a W3C DOM level 3 standard button value given an event.button property: 1 == none, 0 == primary/left, 1 == middle, 2 == secondary/right, 3 == X1/back, 4 == X2/forward, 5 == eraser (pen)
function getStandardizedButton( button ) { if ( $.Browser.vendor === $.BROWSERS.IE && $.Browser.version < 9 ) { // On IE 8, 0 == none, 1 == left, 2 == right, 3 == left and right, 4 == middle, 5 == left and middle, 6 == right and middle, 7 == all three // TODO: Support chorded (multiple) ...
[ "function getMouseButton(evt) {\n\tif (evt.which == null) { // internet explorer\n\t\treturn ((evt.button < 2)?MOUSE_BUTTON.LEFT:((evt.button == 4)?MOUSE_BUTTON.MIDDLE:MOUSE_BUTTON.RIGHT));\n\t}\n\t// other browsers\n\treturn ((evt.which < 2)?MOUSE_BUTTON.LEFT:((evt.which == 2)?MOUSE_BUTTON.MIDDLE:MOUSE_BUTTON.RIGH...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Populate the locations chart.
function populateLocationsChart(locs, id) { if(!locs.length) { $(`#${id}`).hide(); return; } let map = L.map('map', {scrollWheelZoom: false, minZoom:1}), token = 'pk.eyJ1IjoibGliY3Jvd2RzIiwiYSI6ImNpdmlxaHFzNTAwN3YydHBncHV3dHc3aXgifQ.V4WUx9SDcU_XLFJo2M3RxQ', url = `https://api.tiles.mapbox.com/v4/{i...
[ "initializeLocations() {\n for (const filename of glob(kLocationDirectory, '.*\\.json$')) {\n const description = new FightLocationDescription(kLocationDirectory + filename);\n const location = new FightLocation(description);\n\n this.#locations_.set(description.name, locatio...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This is a testType state object This is the constructor for the state object that will be used to represent the student work. An instance of this object will be created each time the student submits an answer. note: you can change the variables in this constructor, the response variable is just used as an example. you ...
function TestTypeState(response, statestring, gradingHTML ) { console.log("DEBUG: entered constructor in testTypeState.js"); this.response = ""; this.stateString = ""; this.gradingViewHTML = "<html>test</html>"; if(response != null) { this.response = response; } if(statestring != null) { this.stateString =...
[ "constructor(props) {\n super(props)\n\n const parsedExerciseFormat = parseExerciseFormat(props.exercise.format)\n\n this.state = {\n exercise: props.exercise,\n exerciseStatus: null,\n failedSets: 0,\n passedSets: 0,\n ...parsedExerciseFormat,\n }\n this.startExercise = this...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
NOTE: The values at even position need to be squared. For a language with zerobased indices, this will occur at oddlyindexed locations. For instance, in Python, the values at indices 1, 3, 5, etc. should be squared because these are the second, fourth, and sixth positions in the list. For Example: alternateSqSum([11, 1...
function alternateSqSum(arr){ let newArr = [] // happy coding :D for(let i = 0;i<arr.length;i++){ if(i%2){ newArr.push(arr[i]**2) }else{ newArr.push(arr[i]) } }return newArr.reduce((a,b)=>a+b,0) }
[ "function sumOfSquares(array){\n let squaresArray=array.map(i=>Math.pow(i,2));\n let sum=squaresArray.reduce((a,b)=>{\n return a+b;\n },0)\n return sum;\n}", "function sumOfEvenSquares(array) {\n let sum = 0\n\n for (let elem of array) {\n if (isEven(elem)) {\n sum += square(elem)\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Return the hash code specific to the current grammar. The hash code is computed based on the four elements of a grammar.
getHashCode() { let string = ''; for (const variable of this.getVariables()) { string += variable + ','; } string += '|'; for (const terminal of this.getTerminals()) { string += terminal + ','; } string += '|'; f...
[ "getHashCode() {\n let hash = this._m[0] || 0;\n for (let i = 1; i < 16; i++) {\n hash = (hash * 397) ^ (this._m[i] || 0);\n }\n return hash;\n }", "getHashCode() {\n let hash = this.width || 0;\n hash = (hash * 397) ^ (this.height || 0);\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Clear the range from character start to before end.
function clearRange(value, start, end) { return value.substring(0, start) + value.substring(end); }
[ "function clear(array, start, stop) {\n if (start === void 0) { start = 0; }\n updateRange(array, null, start, stop);\n}", "clearSelections () {\n this.editor.setCursorBufferPosition(this.editor.getCursorBufferPosition())\n }", "clearSelect() {\n const [selection] = this.cm.getDoc().listSelecti...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Erreur affichee si echec de lecture
function erreur(evt) { alert("Une erreur est survenue lors de la lecture du fichier."); }
[ "function incrementoError()\n\t{\n\t\tif(presente === false)\n\t\t{\n\t\t\tmasUnError();//Instanciar la función que aumenta los fallos acumulados.\n\t\t}\n\t}", "_observeError() {\n this._artikelService.observeError((err) => {\n // zuruecksetzen\n t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Save posts to local storage, only saves if called with argument 1 as an array
function savePosts(posts) { if (Array.isArray(posts)) { localStorage.setItem("posts", JSON.stringify(posts)); } return true; }
[ "function save () {\n\n\tvar title = postTitle.value;\n\tvar content = postContent.value;\n\tvar savedPost = { \"title\": title, \"content\": content };\n\n\tsaving = setInterval( saveItemToLocalStorage, 5000, savedPost, 'savedPost' );\n\n}", "function save(){\n const a = JSON.stringify(answers);\n localStorage...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
r2owebviewback Directive Its an attribute directive. When this directive is used as an attribute to an element, the click on the element makes the webview go back
function r2oWebviewBack(){ return { restrict : "A", link: function(scope, element, attrs){ element.on('click', function(){ window.shopWebViewOverlay.goBack(); }); } }; }
[ "get backButton() {return browser.element(\"//android.widget.FrameLayout/android.view.ViewGroup/android.view.ViewGroup/android.view.ViewGroup/android.view.ViewGroup/android.view.ViewGroup/android.view.ViewGroup[1]/android.view.ViewGroup/android.view.ViewGroup/android.view.ViewGroup/android.view.ViewGroup/android.vi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Visit a parse tree produced by PlSqlParsertableview_name.
visitTableview_name(ctx) { return this.visitChildren(ctx); }
[ "visitContainer_tableview_name(ctx) {\n\t return this.visitChildren(ctx);\n\t}", "visitSelected_tableview(ctx) {\n\t return this.visitChildren(ctx);\n\t}", "visitCreate_view(ctx) {\n\t return this.visitChildren(ctx);\n\t}", "visitObject_view_clause(ctx) {\n\t return this.visitChildren(ctx);\n\t}", "func...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function to filter shape
function filterShape(aliens) { return aliens.shape == $shapeInput.value.trim().toLowerCase(); }
[ "function filterByHairColor(arr, hairColor) {\n}", "function doFilter() {\n var output;\n var imageEl = document.getElementById('sourceimg');\n\n var tmpcanvas = document.createElement('canvas');\n tmpcanvas.width = 100;\n tmpcanvas.height = 100;\n \n var tmpctx = tmpcanvas.getContext('2d');\n tmpctx.draw...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Remove empty module declaration
function cleanEmptyNamespace (str, moduleName) { let emptyDeclareRegexp = new RegExp("declare module " + moduleName + " {\\s*}\\s*", "gm"); str = str.replace(emptyDeclareRegexp, ""); return str; }
[ "function removeModule() {\n\t\tcommon.naclModule.parentNode.removeChild(common.naclModule);\n\t\tcommon.naclModule = null;\n\t}", "function removeShrink(){\n\t\tvar rows = $b42s_header.find( '.fl-row-content-wrap' ),\n\t\t\tmodules = $b42s_header.find( '.fl-module-content' );\n\n\t\trows.removeClass( 'fl-them...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Set platform specific data.
SetPlatformData() {}
[ "GetPlatformData() {}", "_setData() {\n this._global[this._namespace] = this._data;\n }", "SetCompatibleWithPlatform() {}", "SetCompatibleWithAnyPlatform() {}", "setData(data) {\n if (!data) {\n console.log('oops.. no data');\n return;\n }\n\n // console.log('g...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
method: reset watch display count
resetWatch() { this.reset(); this.print(); }
[ "function clear() {\n if (count >= 1) {\n document.getElementById(\"numDisplay\").innerHTML = '';\n count = 0;\n }\n }", "reset() {\n const _ = this;\n _._counter = _._startCount;\n }", "function clearScreen(){ displayVal.textContent = null}", "reset() {...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
show admin data for the specific class and id
function show(model, id) { $('#adminData').show(); if (typeof model === 'object') { current = [model.attr('data-class'), model.attr('data-id')]; } else { current = [model, id]; } updateActions(model, id); return updateMeta(model, id); }
[ "displayAdmin() {\n let add_form = document.getElementById(\"add_form\");\n add_form.classList.toggle(\"hidden\");\n \n let delete_btns = document.querySelectorAll(\".delete_btn\");\n delete_btns.forEach(function(item){\n item.classList.toggle(\"hidden\");\n })\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Save and push EngineerData to empty ProductionTeam array.
function createNewEngineer (data, engineerData) { var myNewEngineer = new Engineer (data.id, data.name, data.email, engineerData.github); productionTeam.push(myNewEngineer); console.log('Production Team', productionTeam); // prompts add another question function to see whether they want to add another o...
[ "function _createTeams() {\n gTeams = storageService.load('teams')\n storageService.store('teams', gTeams)\n}", "function createNewManager (data, managerData) {\n var myNewManager = new Manager(data.id, data.name, data.email, managerData.officeNumber);\n productionTeam.push(myNewManager);\n console...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get a named token generator.
getTokenGenerator (name) { return get (this._tokenGenerators, name); }
[ "function getNextToken(){\n currentToken = tokens[0];\n tokens.shift();\n}", "forName(name) {\n let loader = ServiceLoader.load(\"io.swagger.codegen.CodegenConfig\");\n let availableConfigs = new StringBuilder();\n for (const config of loader) {\n if ((config.getName() === na...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Updates the display to show the specified time_frame
function displayTime(time_frame) { label.text(Math.floor(time_frame)); //drawCloud(total_data[ Math.round(time_frame -1)]); drawCloud(targeted_data[ Math.floor(time_frame -1)]); }
[ "function updateDisplay(display_frame_name) \n{ \n var interval = 5000; \n var display_frame = getDisplayFrame(display_frame_na...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Produces forum search form.
function forumSearchForm(root) { document.write( "<form method='POST' action='http://www.gridgainsystems.com/jiveforums/search.jspa' target='forum' style='margin: 1px; padding: 1px'>" + "" + "<input class='search_text' type='text' style='color: #ccc' onClick='this.value=\"\"; this.s...
[ "function SearchForm(enableClear, parentEl, options){\n options = this.options = mergeObjs(options,{\n 'buttonText' : 'Search',\n 'hintString' : 'Search the map!'\n });\n var z=this,\n input,\n form=z.form=createEl('form','gsc-search-box',[\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
print pseudo legal move list
function printMoveList(moveList) { var listMoves = ' Move Piece Captured Flag Score\n\n'; for (var index = 0; index < moveList.length; index++) { let move = moveList[index].move; listMoves += ' ' + COORDINATES[getSourceSquare(move)] + COORDINATES[getTargetSquare(move)]; ...
[ "printLegalMoves () {\n const legalMoves = this._board.legalMoves(this._turn);\n let result = '';\n for (const key in legalMoves) {\n result += key + ' ';\n }\n console.log(result);\n }", "function printMoves(rover){\n\n for (var i = 0 ; i < rover.travelLog.length...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Event listener for HTTPS server "listening" event.
function onHttpsListening() { var addr = httpsServer.address(); var bind = typeof addr === 'string' ? 'pipe ' + addr : 'port ' + addr.port; logger.info('HTTPS Server Started ' + new Date(Date.now()).toString()); logger.info('Listening on ' + bind); }
[ "function onSSLListening() {\n let addr = ssl_server.address();\n let bind = typeof addr === 'string'\n ? 'pipe ' + addr\n : 'port ' + addr.port;\n debug('SSL Listening on ' + bind);\n}", "function onListening() {\n var addr = server.address();\n var bind = typeof addr === 'string'\n ? 'pipe ' + add...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Assert that the direction is correct string.
function assertStudentDirection(direction) { if (!["incoming", "outgoing"].includes(direction)) { throw("Invalid student direction \"" + direction + "\"."); } }
[ "check(target) {\n const targetType = typeof target;\n assert('string' === targetType, 'Type error, target should be a string, ' +\n `${targetType} given`);\n }", "function test (actual, expected) { console.log(actual === expected ? `√ ${actual}` : `X ${actual} | ${expe...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Check changeable status for project description field
checkChangeableDescriptionStatus() { if ('config' === this.currentTab) { this.importProjectData.project.description = angular.copy(this.projectDescription); return; } this.isChangeableDescription = this.projectDescription === this.importProjectData.project.description; }
[ "@action\n statusChangeAction(field, value) {\n if (value == 'approved') {\n this.editEntry.set('create_entry', 1);\n }\n }", "haveChanges() {\n return this.code !== this.codeFromTableau;\n }", "function checkDescription(){\r\n\tif (description.value == null || description.value == \"\"){\r...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
remember time user started the video
function videoStartedPlaying() { timeStarted = new Date().getTime()/1000; alertMsg(); }
[ "function playActorVideo(actor, time) {\n //playVideo(id, time - startTime of video)\n\n}", "function onTimeupdate(){\n //if the video has finished\n if ( this.currentTime >= this.duration ){\n //if we are offering e-mail sharing\n if (configHandler.get('showLocalShare')){\n var vidElem ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
ISSUE functionality / Assigns issue to the test
function assignIssue(issue, keyWord) { if (!issue.testCaseId) { issue.testCaseId = test.testCaseId; } issue.type = 'BUG'; TestService.createTestWorkItem(test.id, issue) .then((rs) => { const workItemType = issue.type; const jiraId =...
[ "function getIssues() {\n TestService.getTestCaseWorkItemsByType(test.id, 'BUG').\n then(function(rs) {\n if (rs.success) {\n vm.issues = rs.data;\n if (test.workItems.length && vm.attachedIssue) {\n angular.copy(vm.attach...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns a new DOM builder that attaches to the given element.
static attach(element) { return new DomBuilder(element); }
[ "function addToDOM(element, someHTML) {\n var div = document.createElement('div');\n div.id = \"b\";\n div.innerHTML = someHTML;\n element.appendChild(div);\n}", "createHTMLElement(parent){\n let htmlElement=document.createElement(this.htmlTagName);\n this.parent=parent;\n this.parent.app...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
calls a callback with the correct object fragment and key from a compound name
function objectAndKeyFromAttributesAndName(attributes, name, options, callback) { var key, object = attributes, keys = name.split('['), mode = options.mode; for (var i = 0; i < keys.length - 1; ++i) { key = keys[i].replace(']', ''); if (!object[key]) { if (mode === 'serialize') { ...
[ "each(callback, ...names) {\n const {\n stack\n } = this;\n const {\n length\n } = stack;\n let value = getLast(stack);\n\n for (const name of names) {\n value = value[name];\n stack.push(name, value);\n }\n\n for (let i = 0; i < value.length; ++i) {\n if (i in value...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Widgets: Main IMGUI_API bool Button(const char label, const ImVec2& size = ImVec2(0,0)); // button
function Button(label, size = ImVec2.ZERO) { return bind.Button(label, size); }
[ "function addButton(size) {\r\n\r\n}", "button(x, y, content, opts){\n\n let button = new Button(x, y, content, opts);\n this.layer.buttons.push(button);\n return button;\n\n }", "function drawButton(btn) {\n // Move text down 1 pixel and lighten background colour on mouse hover\n var ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
addViews, handle cold videos and save game
function newViews() { if (variables.cooldown <= 0) { variables.cooldown = COOLDOWNTIME_VIDEO; bake_cookie("chocolateChipCookie", variables, 14); //save game in cookie every COOLDOWNTIME_VIDEO seconds if (variables.videos - variables.coldVideos > 10) { variables.coldVideos++; if (DEBUG) {console.log("...
[ "function addGameView() {\n // Destroy Menu screen\n stage.removeChild(TitleView);\n TitleView = null;\n\n // Add Game View\n stage.addChild(bg, world, goal, rewards[0], rewards[1], restart, die, player, InventoryView);\n\n //Call startGame\n startGame();\n}", "addViews(views) {\n for (let...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function to get MetaData for both the Demographic Info Panel and to build/update Gauge chart
function getMetadata(sampleId) { d3.json("samples.json").then((data) => { console.log(data) var metadata = data.metadata; //console.log(metadata) var metadataArray = metadata.filter(metadataObject => metadataObject.id == sampleId); //console.log(metadataArray) var metadataResult...
[ "function buildMDataPanel (data, variableID){\n\n var mData = data.metadata.filter( d => d.id == variableID)[0];\n \n var div = d3.select(\"#sample-metadata\");\n // remove any children from the div, \n div.html(\"\");\n Object.entries(mData).forEach(([key, value]) => {\n var p = div.append(\"p\");\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Scrolls to the left side of the carousel container
function scrolltoLeft() { /** Initialize 'width' to device screen width */ var width = window.innerWidth > 0 ? window.innerWidth : screen.width; /** Scroll to negative screen width on the x-axis */ document.getElementById("carousel-container").scrollTo(-width - width, 0); }
[ "setCardsScrollLeft() {\n if (this.cardsLeftGlobal) {\n let margin = window.innerWidth >= 1200 ? 62.6 : 52.8;\n const cardWidth = $('.my-card').width() + margin;\n this.$cardTrack.scrollLeft(cardWidth * this.cardsLeftGlobal);\n }\n }", "function scrolltoRight() {\n /** Initialize 'width' to...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Generates a hex file containing the user's Python from the firmware.
function getHexFile(python) { var hexlified_python = hexlify(python); var insertion_point = ':::::::::::::::::::::::::::::::::::::::::::'; return firmware.replace(insertion_point, hexlified_python); }
[ "function generateProgram()\n\t{\n\t\t// Start code generation from the root\n\t\tgenerateStatement(_AST.root);\n\t\t// Place a break statement after the program to pad the static data\n\t\t_ByteCodeList.push(\"00\");\n\t}", "function OnWroteExe() {\n // Write the padding to QuadWord Align the embedded JS\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Step 1: Iterate through all the exposures of the infected people. Exposures here are 1 way to avoid double counting. 1 ways means they possibly sneeze on them. to generate an exposure: draw if inPod or outof pod. then look at the distancing compliance and exposure of everyone in that group. Draw a person from that dist...
function exposuresInfections(infectorPerson) { // console.log("exposing for " + infectorPerson.pod + "---" + infectorPerson.indexInPod ); if (infectorPerson.infection.status === "infected" && infectorPerson.infection.quarantine!==true ) { let n; let exposuresWithDistancing= Math.floor(infectorPerson.fixedCharacte...
[ "function Population(ninfected,nhealthy,nimmune,pinfect,socialcoef,\n\t\t infticks, death_probability)\n{\n //var Population = new Object();\n //var empty = 0;\n this.ninfected = ninfected;\n this.nhealthy = nhealthy;\n this.nimmune = nimmune;\n //var death_probability = 0.01;\n this.pinfect...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
User Story 2: As a user I want to find a number that represents for a list of numbers: the sum of the numbers, divided by half the length of the list, plus the smallest value in the list. I want to do this for two lists of numbers and have the answer returned as a new list named numMeans.
function mean(numberList1, numberList2){ var numMeans = []; numMeans = sum(numberList1, numberList2); numMeans[0] = numMeans[0]/(numberList1.length/2) + Math.min.apply(null, numberList1); numMeans[1] = numMeans[1]/(numberList2.length/2) + Math.min.apply(null, numberList2); return numMeans; }
[ "function averages(numbers){\n let avgNums = [];\n if(!numbers) return avgNums;\n for(let i = 1; i < numbers.length; i++){\n let avg = (numbers[i - 1] + numbers[i]) / 2;\n avgNums.push(avg);\n }\n return avgNums;\n}", "function sumTwoSmallestNumbers(numbers) { \n let arrayNumFour ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Animate the generated kittens
function animate(activeKittens) { ctx.clearRect(0, 0, 1024, 450); for (var i = 0; i < activeKittens.length; i++) { var currentCat = activeKittens[i]; if (currentCat.update()) { i--; // Lose life and render flag if kitten reaches shore livesDisplay.innerHTML-...
[ "function textWiggle() {\n var timelineWiggle = new TimelineMax({repeat:-1, yoyo:true}); \n for(var j=0; j < 10; j++) {\n timelineWiggle.staggerTo(chars, 0.1, {\n cycle: {\n x: function() { return Math.random()*4 - 2;...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get selected mosaic and push it in mosaics array
attachMosaic() { // increment counter this.counter++; // Get current account let acct = this._Wallet.currentAccount.address; if (this.formData.isMultisig) { // Use selected multisig acct = this.formData.multisigAccount.address; } // Get th...
[ "function generate_mosaic() {\n \n \n remove_previous_layer()\n var years_list = parse_years(); // Parse the years input\n var months_list = parse_months(); // Parse the months input\n print(\"Years List:\", years_list, \"Months list\", months_list); // Testing\n \n // Prepare date variables\n var start_ye...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates Raycaster object from the mouse pointer
pointerToRay(pointer) { const camera = this.viewer.navigation.getCamera() const pointerVector = new THREE.Vector3() const rayCaster = new THREE.Raycaster() const pointerDir = new THREE.Vector3() const domElement = this.viewer.canvas const rect = domElement.getBoundingCl...
[ "function RayHelper(ray){this.ray=ray;}", "function makeMantaRayButton() {\n\n // Create the clickable object\n mantaRayButton = new Clickable();\n \n mantaRayButton.text = \"\";\n\n mantaRayButton.image = images[16]; \n\n // gives the Manta ray a transparent background \n mantaRayButton.color = \"#0000000...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
===================================================================================================// _LOAD_BOOK_FILE_===================================================================================// Function called when there's a change in the "upload_stopwords" document element. Reads the given file and stores it...
function Load_Book_File(evt) { if(evt.target.files[0]) //if the file is available { var reader = new FileReader(); //create new reader file reader.readAsText(evt.target.files[0]); //get file reader.onload = function(e) //wait for the file to load { book_text = reader....
[ "function Load_Stop_Words_File(evt)\n{\n if(evt.target.files[0]) //if the file is available\n {\n var reader = new FileReader(); //create new reader file\n reader.readAsText(evt.target.files[0]); //get file\n reader.onload = function(e) //wait for the file to load\n {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
add read button for book
function readButton(li, book) { let button = document.createElement('button'); button.setAttribute('id', 'read-' + book.title); button.textContent = 'Read/Unread' button.addEventListener('click', (e) => { book.toggleRead(); appendBooks(library); }) li.appendChild(button); }
[ "function haveIRead () {\n //console.log('haveIRead ran');\n if(haveRead === false){\n haveRead = true;\n truRead.classList.add('clicked-button');\n //console.log(haveRead);\n } else if (haveRead === true) {\n haveRead = false;\n truRead.classList.remove('clicked-button');\n /...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns a serialized copy of the exported visual model
exportSerializedVisualModel() { let iv = this.i.ea(); return (iv); }
[ "static save_both (comp) {\n if (comp.object3D) {\n const kid = comp.object3D\n kid.isVisible = true\n const kids = kid.getChildren()\n for (let i = 0; i < kids.length; i++) {\n kids[i].setEnabled(true)\n }\n kids[kids.length - 1].isVisible = false\n\n var myser = BABYLO...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function responsible for initialising connection with Ethereum blockchain If it fails to initialise web3 component, other functions will not work properly
async function initialiseBlockchainConnection() { web3 = window.web3; if (typeof web3 !== 'undefined') { console.log('Web3 Detected! ' + web3.currentProvider.constructor.name); window.web3 = new Web3(web3.currentProvider); } else { infuraAPIKey = 'Infurakey'; console.log('No Web3 Detected... usi...
[ "init() {\n // TODO: Move these constants to a global constants file\n const APP_NAME = 'DHBW Bachelors Night Ticketing 2020'\n const APP_LOGO_URL = 'https://einfachtierisch.de/media/cache/article_teaser/cms/2015/09/Katze-lacht-in-die-Kamera-shutterstock-Foonia-76562038.jpg?595617'\n con...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
function to create the HTML string for the tool tip. Loops through each key in data object and returns the html string key: value
function toolTipHTML(data) { var tip = '', i = 0; for (var key in data.data) { // if value is a number, format it as a percentage //var value = (!isNaN(parseFloat(data.data[key]))) ? percentFormat(data.data[key]) : data.data[key]; if (key ==...
[ "function toolTipHTML(data) {\n\n let tip = '',\n i = 0;\n\n for (let key in data.data) {\n\n // if value is a number, format it as a percentage\n let value = (!isNaN(parseFloat(data.data[key]))) ?\n percentFormat(data.data[key]) :\n dat...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
compare the user hashes with order hashes
function compareUserHashes(userID, userHash, orderHash) { var match = false, , o = 0 , u = 0; fs.appendFileSync(userResultsFile, "UserID: " + userID + " OrderID: " + orderHash[0] + "\n"); //for each entry in orders attempt to find the md5 in users async.forEach(userHash, function(user, callbackUsers) { +...
[ "function compareOrderHashes(userID, userHash, orderHash, callback) {\n\t\n\tvar match = false,\n\t\t, o = 0\n\t\t, u = 0;\n\n\tfs.appendFileSync(orderResultsFile, \"UserID: \" + userID + \" OrderID: \" + orderHash[0] + \"\\n\");\n\n\t//for each entry in orders attempt to find the md5 in users\n\tasync.forEach(orde...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
See if the sample plane's dimensions have changed
_checkPlaneDidChange() { const oldPlaneWidth = this._planeWidth; const oldPlaneHeight = this._planeHeight; const width = INITIAL_PLANE_SIZE * 2 * this._plane.scale.x; const height = INITIAL_PLANE_SIZE * 2 * this._plane.scale.y; if (oldPlaneWidth !== width || oldPlaneHeight !== ...
[ "resizeAxisCanvas() {\n const desiredWidth = this.visualizer.canvas.width;\n const desiredHeight = this.visualizer.canvas.height;\n\n if (this.canvas.width !== desiredWidth || this.canvas.height !== desiredHeight) {\n this.canvas.width = desiredWidth;\n this.canvas.height ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
function to find for parents, as parents were in an array in database, checks for if there arent, return appropriately
function findParents(people, foundPerson){ let parents = []; for(let i = 0; i < 2; i++){ parents.push(people.filter( function(el){ return el.id === parseInt(foundPerson.parents[i]); })); } if(parents[0].length >= 1){ let parentsOneArray = parents[0]; let parentsTwoArray = parents[1];...
[ "function getParents (collection, result, callback) {\n if (!collection._parent) return callback(null, result)\n m.Collection.findById(collection._parent, function (err, parentCollection) {\n if (err) console.log(err)\n result.push(parentCollection)\n if (!parentCollection._parent) return callback(null, ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
fn upload file to game
function upload(file) { return Games.upload($game.id, file) .then(function (res) { // update game vm.game.src = res.src; $rootScope.$broadcast('game:uploaded'); }, function (error) { console.log('error upload: ', error); }); }
[ "function uploadImage(filename) {\n \n var req = request.post(config.webhookUrl, function (err, resp, body) {\n if(err) {\n console.log(err);\n }\n // console.log('sent image', fileName);\n });\n \n var form = req.form();\n fo...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Reads container configuration from JSON or YAML file. The type of the file is determined by file extension.
static readFromFile(correlationId, path, parameters) { if (path == null) throw new pip_services_commons_node_1.ConfigException(correlationId, "NO_PATH", "Missing config file path"); let ext = path.split('.').pop(); if (ext == "json") return ContainerConfigReader.readFromJ...
[ "function loadConfig() {\n\tconfig_file = fs.readFileSync(\"./config.json\");\n\tconfig = JSON.parse(config_file);\n}", "async load() {\n await this.ensureExists();\n this.conf = await fs.readJSON(this.location);\n }", "function parseFileContents(path, extension) {\n switch (extension) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
'keystroke ...' keymaps automatically work only for the user's ~/.atom/keymap.cson keymaps. We have to manually register them for our own package keymap/ keymaps.
consumeKeystroke(keystroke) { atom.packages.getLoadedPackage(packageName).getKeymapPaths().forEach(path => { this.disposables.add( keystroke.registerKeystrokeCommandsFromFile(path), ); }); }
[ "function tm_keystroke() {\n\n tm_keystrokes++;\n tm_calculate();\n}", "function Keymap(){\r\n this.map = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q',\r\n 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'backspace', 'enter', 'shift', 'delete'];\r\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Display grid_one or grid_two
function showGridOne() { if (!gridOneVisible) { gridOne.style.display = "inline"; gridTwo.style.display = "none"; gridOneVisible = true; gridTwoVisible = false; } return null; }
[ "showGrid(){\n this.Grid = true;\n this.Line = false\n \n }", "function displayPlayingPiecesOne() {\n document.querySelectorAll('.pieces1').forEach(function(el) {\n el.style.display = 'grid';\n });\n\n }", "function displayPlayingPiecesTwo() {\n documen...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Arguments stockAmount= normal stock amount commonstockid = Id preorder = Preorder is Enable or not preorder_stock = prorder stock amount
function checkProductStockRoom(stockAmount, commonstockid, preorder, preorder_stock) { var isStock = true; if (stockAmount > 0) { if (document.getElementById('pdaddtocart' + commonstockid)) { document.getElementById('pdaddtocart' + commonstockid).style.display = ''; } ...
[ "function checkStock(variant) {\n var backorder = $variant_input.data('backorder'),\n nostock = $variant_input.data('nostock'),\n isBackorder = $.inArray(variant, backorder),\n isNostock = $.inArray(variant, nostock);\n\n // if its backordered, add class backorder (rem...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
resizePanels goes through each tab panel within the sidebar and resizes their height to use all the available height.
resizePanels () { // Retrieve the current window height. const windowHeight = window.innerHeight // Retrieve the top position of the HTML Element containing all the tab // panels. const panelsTopPosition = this.get('panelsTopPosition') // Update the height of each panel. this.get('panels')...
[ "resizeTabContents() {\n let change = $(`#pcm-tabbedPandas`).height() - this.tabNavHeight;\n if (change !== 0 && this.tabContentsHeight > 0) { $('#pcm-pandaTabContents .pcm-tabs').height(`${this.tabContentsHeight - change}px`); }\n if (MyPandaUI !== null) MyPandaUI.innerHeight = window.innerHeight;\n th...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
function that creates dashboard panel from the drag and drop element passed
function createDashboardPanel(el) { var title = el.dataset.title; var elementId = el.dataset.id; var elementExists = $('#' + elementId); if (!elementExists) { var panel = document.createElement("div"); panel.setAttribute("id", elementId); panel.classList.add('panel'); p...
[ "function createPanel( pw, ph, director ){\n\t\tdashBG = new CAAT.Foundation.ActorContainer().\n\t\t\t\t\tsetPreferredSize( pw, ph ).\n\t\t\t\t\tsetBounds( 0, 0, pw, ph ).\n\t\t\t\t\tsetClip(false);\n\n \n\t\t//create bottom panel\n\t\tfor(var i=0;i<dashBoardEle.length;i++){\n\t\t\tvar oActor = game.__addImage...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Given a dictionary and a template function build a string
function template(dictionary, templateFn) { return Object.keys(dictionary) .map(item => templateFn(item)) .reduce((acc, memo) => acc + memo); }
[ "function template(dom, object) {\n\treturn dom.replace(/{(\\w+)}/g, function(_, k) {\n\t\treturn object[k];\n\t});\n}", "function template(str, data) {\n return new Function(\"obj\",\n \"var p=[],print=function(){p.push.apply(p,arguments);};\" +\n\n // Introduce the data as local variables using...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get all videos from back end, adding average ratings and work with scroll in order to load more videos
function getVideos() { if (vm.busy) { return; } vm.busy = true; var itemsDom = angular.element('.video').length, items = (itemsDom === 0) ? 10 : itemsDom += 2; VideosService.getVideos(items) .then(function(response)...
[ "function _fetchVideos(){\n\t\t\t// the from value is defined by my videoList length + 1. If it isn't defined yet, its value is 1\n\t\t\tvar from = context.videoList.length ? context.videoList.length + 1 : 1;\n\t\t\tvar requestData = { sessionId: SessionIdManager.getSessionId(), skip: from };\n\n\t\t\tVideoListServ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Extract matrix of pixels from an image containing grid of glyphs row: source row in glyph grid col: source column in glyph grid maxTrim: [top right bottom left] upper limits in pixels of whitespace to trim from border around glyph in grid cell Trim limits allow creation of patterns with whitespace borders, useful for p...
function convertGlyphBoxToMatrix(row, col, maxTrim) { const border = 2; const columns = 16; const rows = columns; if (row < 0 || row >= rows || col < 0 || col >= columns) { // Ignore clicks on grid border, etc. return; } let w = canvas.width; let h = canvas.height; var id...
[ "function AnalyzeCells(img1, anadir, depth, resultname, intensities, areas, cell_xs, cell_ys) { \n\tif (img1.getNSlices() >= frame)\n\t\timg1.setSlice(frame);\n\n\tvar img3 = img1.duplicate(); \t\t\n\tif (img3.getNSlices() >= frame)\n \t\timg3.setSlice(frame);\n\n\tvar h = img1.getHeight(); \n\tvar w = img1.getWid...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
/// Clears out the login form based on resetCode set by programmer
function resetForm(resetCode) { var logindata = document.getElementById("userlogin"); switch (resetCode){ case 0: // Reset all fields (usernmae, passwords, and major) logindata.elements[0].value = ''; logindata.elements[3].value = 'default'; case 1: // Reset "password" and "confirm p...
[ "function resetForm() {\n $formLogin.validate().resetForm();\n $formLost.validate().resetForm();\n $formRegister.validate().resetForm();\n }", "_clearLoginFields() {\n // clear input fields\n // @ts-ignore\n document.getElementById('email').value = '';\n // @ts-ignore\n docu...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
return a string of an rgb color takes a hex color as a string in argument
function rgbString(hex) { col = hexToRgb(hex); return "rgb("+col.r+","+col.g+","+col.b+")" }
[ "function toRGBString (color) {\n\t\treturn color.r.toFixed(0) + ', ' + color.g.toFixed(0) + ', ' + color.b.toFixed(0);\n\t}", "function rgb2hexa(str) {\n colors=/^rgb\\((\\d{1,3}),\\s*(\\d{1,3}),\\s*(\\d{1,3})\\)$/.exec(str);\n hexa = \"#\";\n for (i=1; i<colors.length; i++) {\n color = colors[i];\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Set counter checks text
function setCounterText() { var qty = $( "#quantity" ).attr( "value" ); var n = $( ".receipments:checked" ).length; if( n == 0 ) { $( "#counterCheck" ).text( "No members selected." ); $( "#totalDonate" ).text( "" ); } else if( n == 1 ) { $( "#counterCheck" ).text( "Selected 1 member." ); ...
[ "function changeText() {\r\n $alertHolder.html(number);\r\n }", "function updateUncheckedCountSpan(incr) {\n uncheckedCountSpan.innerHTML = parseInt(uncheckedCountSpan.innerHTML) + incr\n}", "function setStatusText(text1, text2, text3) {\n svg.select(\".studyStatusText1\").text(text1);\n svg.select...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
stat goStatPrdUrl + ad trc
function goStatPrdUrlTrc(url, prdNo, code, target, typGugn, areaGubn, trcNo) { stck( typGugn, areaGubn, trcNo); goStatPrdUrl(url, prdNo, code, target); }
[ "function estat(){}", "function getLatency(ret, count) {\n var tmpUrl=\"\";\n if(count >= 0){\n var tmplatency=ret[0]/2;\n tmpUrl=ret[1].replace(\"images/small.bmp\", \"\");\n $latencyArray[count]=tmplatency;\n console.log(\"Evaluate_Server \"+tmpUrl+ \" Mode \"+$serverMode + \" Latency \"+ tmplaten...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Like checkStatus, but it also tries to start/stop the service as appropriate. If the user has opted out or permissions are not available, stop. If the user has opted in and perissions are available, start.
static async checkStatusAndStartOrStop() { const status = await this.checkStatus(); const { canTrack, isRunning } = status; if (canTrack && !isRunning) { this.start(); } if (!canTrack && isRunning) { this.stop(); } return status; }
[ "function check() {\n clearTimeout(timer)\n\n if (device.present) {\n // We might get multiple status updates in rapid succession,\n // so let's wait for a while\n switch (device.type) {\n case 'device':\n case 'emulator':\n willStop = false\n t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
IMGUI_API ImGuiMouseCursor GetMouseCursor(); // get desired cursor type, reset in ImGui::NewFrame(), this is updated during the frame. valid before Render(). If you use software rendering by setting io.MouseDrawCursor ImGui will render those for you
function GetMouseCursor() { return bind.GetMouseCursor(); }
[ "_setDefault(){\n this.defaultCursor = \"default\";\n // this.hOverCursor = \"pointer\";\n }", "function changeCursor(cursor) {\n document.body.style.cursor = cursor; \n}", "function showCursor(cur) {\n if (cur != undefined) selectCursor(cur);\n slides.style.cursor = currentCursor;\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }