query
stringlengths
9
34k
document
stringlengths
8
5.39M
negatives
listlengths
19
20
metadata
dict
Loads the Trigger Cookies Mod Manager.
function LoadTriggerCookies() { if (!IsModLoaded('TriggerCookies')) { Game.LoadMod(GetModURL() + 'TriggerCookies.js'); } }
[ "function LoadTriggerCookies() {\n\tif (!IsModLoaded('TriggerCookies')) {\n\t\tGame.LoadMod(GetModURL() + 'Scripts/TriggerCookies.js');\n\t}\n}", "function kissmanga_loadCookies(callback) {\n\tif (GM_getValue(\"KMloadcookies\", false) + 30*1000 < Date.now()) {\n\t\tGM_setValue(\"KMloadcookies\", Date.now());\n\t\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
process object tree based on mime requested
function processDoc(object, mimeType, root) { var doc; // clueless? assume HTML if(!mimeType) { mimeType="text/html"; } // dispatch to requested representor switch(mimeType.toLowerCase()) { case "application/json": doc = json(object, root); break; case "application/h...
[ "function process_unknown_object(obj)\n{\n if(obj.typename == 'PathItem')\n {\n process_path_item(obj);\n } else \n if(obj.typename == 'CompoundPathItem')\n {\n process_compound_path(obj);\n } else \n if(obj.typename == 'GroupItem')\n {\n process_group(obj);\n }\n}",...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get card history. ean = 2000005399862 Datetime with timezone
getCardHistory (clientId, ean, dateFrom=null, dateTo=null, limit = null, page = null) { const query = {}; if (limit) data.limit = limit; if (page) data.page = page; if (dateFrom) data.dateFrom = dateFrom; if (dateTo) data.dateTo = dateTo; return this.createRequest(`/clients/${clientId}/...
[ "async function historicRatesForAcurrency() {\n let currencyService = new CurrencyService(process.env.MICRO_API_TOKEN);\n let rsp = await currencyService.history({\n code: \"USD\",\n date: \"2021-05-30\",\n });\n console.log(rsp);\n}", "function getDate() {\r\n var newTimeHistory = new Date();\r\n tim...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
sends a get request to back end to retrieve account details
async getAccount(id){ // console.log('Getting account...'); data = { URI: `${ACCOUNTS}/${id}`, method: 'GET' } return await this.sendRequest(data) }
[ "account() {\n return this.request('get', 'account').then(result => result.data)\n }", "async getAccountInfo () {\n try {\n const params = { timestamp: Date.now() }\n\n const response = await this.HttpClient.get('/v3/account', { params, secure: true })\n\n return response.data\n } catch (...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets a prompt and displays it on the page. Also shows the prompt container and hides the answer container.
function displayPrompt() { // TODO: Make sure the same prompt is not seen twice. // Display stat dataContainers.stat.innerText = game_data.prompt; // Display source dataContainers.source.setAttribute("href", game_data.sourceURL); dataContainers.source.innerText = game_data.source; // Show/Hide container...
[ "function showPrompt(prompt) {\n\tvar t = document.querySelector('#prompt');\n\tt.content.querySelector('#prompt-title').textContent = prompt.promptTitle;\n\tt.content.querySelector('#prompt-text').textContent = prompt.promptText;\n\tt.content.querySelector('#prompt-image').src = prompt.promptImage;\n\tvar clone = ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
countCart()> returns no. of items in cart
function countCart(){ var totalCount=0; for(var i in cart){ totalCount+=cart[i].count; } return totalCount; }
[ "function getItemCount(cart) {\n let q = 0;\n cart.filter((cartItem) => cartItem.inCart === true).forEach(cartItem => {\n q += parseInt(cartItem.quantity);\n });\n return q;\n }", "function cartHasItems() {\n return cartItems.length > 0;\n }", "function num_items_inCart(c) {\n c.item_count;\n}", ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Override the execute function; if we already have a redirect result, then just return it.
async execute() { let readyOutcome = redirectOutcomeMap.get(this.auth._key()); if (!readyOutcome) { try { const hasPendingRedirect = await _getAndClearPendingRedirectStatus(this.resolver, this.auth); const result = hasPendingRedirect ? await super.execute...
[ "async execute() {\r\n let readyOutcome = redirectOutcomeMap.get(this.auth._key());\r\n if (!readyOutcome) {\r\n try {\r\n const hasPendingRedirect = await _getAndClearPendingRedirectStatus(this.resolver, this.auth);\r\n const result = hasPendingRedirect ? awai...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Set requirements for all commands at once
setGlobalRequirements(requirements) { Object.assign(this.globalCommandRequirements, requirements); return this; }
[ "constructor(...requirements) {\n const flat = _uniq(_flatten(requirements)).filter(Boolean);\n if (flat.length === 0) {\n this.requirements = [DefaultRequirement];\n }\n else {\n this.requirements = flat.map((req) => GemRequirement.parse(req));\n }\n }", ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
21.1.4 Properties of String Instances 21.1.4.1 length 21.1.5 String Iterator Objects
function StringIterator() {}
[ "static get STRLENGTH () { return 40; }", "function getLength(string1){\n return string1.getLength;\n}", "function len(string){\n return string.len;\n}", "function testcase() {\n var str = new String(\"abc\");\n\n Object.defineProperty(str, \"ownProperty\", {\n value: \"ownString\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Moves text from Experiors textarea to the hidden field.
function moveText() { hidden.value = experior.getText(); }
[ "function moveTextUp() {\t\r\n\texperior.setText( hidden.value );\r\n}", "function hidePreviewOwner() {\n $('#preview-owner-standart').find('textarea[name=\"owner_word\"]').val('');\n $(\"#panel_preview_owner\").hide();\n}", "function updateHiddenTextareaPosition() {\n //The text's bounding rectang...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
goal: any two values of the indexes to add up to target return value will be any two indexes
function twoSum(arr=[1,2,3], target = 4){ // loop through arr // second loop to iterate through arr again // get the first loop incremental index value and sum that to the second loop incremental index value for(let i = 0; i < arr.length-1; i++){ for(let j = i+1; j < arr.length; j++){ ...
[ "function twoSum(arr, target) { }", "function twoSum(numbers, target) {\n let index = [];\n\n for (let i = 0; i < numbers.length - 1; i++) {\n for (let j = i + 1; j < numbers.length; j++) {\n if (numbers[i] + numbers[j] === target) {\n index.push(i, j);\n }\n }\n }\n return index;\n}", ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets if the provided structure is a GetAccessorDeclarationStructure.
static isGetAccessor(structure) { return structure.kind === StructureKind_1.StructureKind.GetAccessor; }
[ "static isSetAccessor(structure) {\r\n return structure.kind === StructureKind_1.StructureKind.SetAccessor;\r\n }", "static isGetAccessorDeclaration(node) {\r\n return node.getKind() === typescript_1.SyntaxKind.GetAccessor;\r\n }", "static isSetAccessorDeclaration(node) {\r\n return n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
init state if we can getContext in canvas > start game else show message
init() { if (this.canvas.getContext) { this.start(); } else { canvas.textContent = 'Sorry canvas not suport'; } }
[ "function init() {\n // get a referene to the target <canvas> element.\n if (!(canvas = document.getElementById(\"game-canvas\"))) {\n throw Error(\"Unable to find the required canvas element.\");\n }\n\n // resize the canvas based on the available browser available draw size.\n // this ensures ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Add magic custom button if configured (in localStorage).
function addMagicButton(magic_name) { var spacer = document.createElement("span"); spacer.setAttribute("class", "spacer"); var a = document.createElement("a"); a.setAttribute("id", magic_name); a.setAttribute("href", localStorage[magic_name + "_link"]); a.setAttribute("title", localStorage[magi...
[ "function addCustomButton(){\n var a = {};\n for (d in attributes) a[attributes[d]] = arguments[d];\n mwCustomEditButtons.push(a);\n}", "function InsertButtonsToToolBar() {\n //Redirect\n mwCustomEditButtons[mwCustomEditButtons.length] = {\n \"imageFile\": \"http://upload.wikimedia.org/wikipedia/en/c/c...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Create Input and GPSButton for Map Controls
function createMapControls() { let input = document.createElement("input") let btn = document.createElement("button") input.setAttribute("id", "search-location") input.setAttribute("class", "map-control") btn.setAttribute("id", "gps-btn") btn.setAttribute("class", "btn btn-outline-primary") btn.innerHTM...
[ "function addGeoLocationButton() {\r\n\t\t\tif (_geoBtn)\r\n\t\t\t// already added\r\n\t\t\t\treturn;\r\n\r\n\t\t\tvar onClickEvent = function (evt) {\r\n\t\t\t\t_plugIn.setMapCentreByGeo();\r\n\t\t\t};\r\n\r\n\t\t\t_geoBtn = createControlButton(\r\n\t\t\t\tBUTTONS.Geo,\r\n\t\t\t\tgm.ControlPosition.TOP_LEFT,\r\n\t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
return the better of two performance strings. For running events, lower times are better For field events, greater numbers are better
function betterPerformance(perfA, perfB, eventCode) { const fA = perfToFloat(perfA) const fB = perfToFloat(perfB) let better if (isFieldEvent(eventCode) || isMultiEvent(eventCode)) { better = (fA > fB) ? perfA : perfB // further is better } else { better = (fA < fB) ? perfA : perfB // faster is better...
[ "getPerformance(performance) {\n switch(performance) {\n case \"ls\":\n return \"has-text-danger\"\n case \"gt\":\n return \"has-text-success\"\n case \"eq\":\n return \"has-text-grey\"\n }\n }", "function getFastestAnd...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Emails users with tasks yet to be completed params: context context to retrun method results
emailTasks(context) { var mailer = this.mailer; var tasksBody = 'Incomplete Tasks for you:'; var emailsToSend = {}; var uniqueNames = []; var params = { Destination: { ToAddresses: [ 'jazaret@gmail.com' ] ...
[ "function notifyAdminOfTaskCompletion(task) {\n var transporter = nodemailer.createTransport(smtpTransport({\n host: 'smtp.zoho.com',\n port: 465,\n secure: true, // use SSL\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
.split method automatically turns things into array? if not I'm not seeing where we turn the string into an array so we can work with it. isn't there a toString method or something similar? Q: Write a function called valTimesIndex which accepts an array and returns a new array with each value multiplied by the index it...
function valTimesIndex(arr) { return arr.map(function(val, idx) { return val * idx; }); }
[ "function valTimesIndex(arr) {\n\tconst valuesTimesIndexArr = arr.map(function(item, index) {\n\t\treturn item * index;\n\t});\n\treturn valuesTimesIndexArr;\n}", "function valTimesIndex(array) {\n\treturn array.map(function(value, index) {\n\t\treturn value * index;\n\t});\n}", "function valTimesIndex(arr) {\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Randomly selects facts from facts.js
function getRandomFacts() { factsUl.empty(); let randomChoices = []; for(i = 0; i < 5; i++) { let randomChoice = Math.floor(Math.random() * facts.length); while(randomChoices.includes(randomChoice)) { randomChoice = Math.floor(Math.random() * facts.length); } ran...
[ "function getRandomFact() {\n return facts[Math.floor(facts.length * Math.random())];\n}", "function getRandomFact(facts){\n let random = getRndInteger(0,facts.length);\n swap(random,facts.length-1,facts);\n return facts.pop();\n}", "randomFact() {\n if (this.species.toLowerCase() != \"human\")...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Register the dialog with the bot
register(bot, rootDialog) { bot.dialog(this.dialogId, this); this.authProvider = bot.get(this.providerName); this.providerDisplayName = this.authProvider.displayName; this.onBegin((session, args, next) => { this.onDialogBegin(session, args, next); }); this.onDefault((session) => ...
[ "register(bot) {\n bot.dialog(\"/\", this);\n\n this.onBegin((session, args, next) => {\n this.onDialogBegin(session, args, next);\n });\n this.onDefault((session) => {\n this.onMessageReceived(session);\n });\n this.matches(/ShowProfile/, (session) => {\n this.showUserProfile(sessi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This function will return product images and videos
function getAttachments(attachments) { const productAttachment = []; let i; let j; for (i = 0; i < attachments.length; i++) { if (attachments[i].usage === 'ANGLEIMAGES_FULLIMAGE') { for (j = 1; j < attachments.length; j++) { if ( attachments[j].usage === 'ANGLEIMAGES_THUMBNAI...
[ "function getMediaGallery(product) {\n var e_1, _a;\n var mediaGallery = [];\n if (product.media_gallery) {\n try {\n for (var _b = __values(product.media_gallery), _c = _b.next(); !_c.done; _c = _b.next()) {\n var mediaItem = _c.value;\n if (mediaItem.image)...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
function that evaluates the distances between closest stations and the given station
getStationDistanceToLocation(dest) { let currentStation = this.props.closestStations[0] if (!currentStation) return 0 // wtf? return Utils.getDistanceFromLatLonInKm(currentStation.latitude,currentStation.longitude,dest.latitude,dest.longitude).toFixed(2) }
[ "function find_closest(){\n stations.forEach(calcDist);\n curr_line();\n}", "function findClosest(){\n\n\tclosest = calculateDistance(myLat, myLng, stations[0].lat, stations[0].lon);\n\tsta = 0;\n\tfor (var k=1; k<numstations; k++){\n\t\tdistance = calculateDistance(myLat, myLng, stations[k].lat, stations[k].lo...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get the coordinates for a cid or key inside this view
function getCoordinatesForFieldNode(key, cid, view) { var hidden, coordinates; var placeholder = view.find('[data-dvs-placeholder="' + key + '"]').last(); var element = view.find('[data-devise-' + cid + ']').first(); if (element.length) { hidden = !element.is(':v...
[ "getXY(key)\n {\n var i;\n var p = [];\n for (i = 0; i < this.nbrPoints; i++)\n {\n if (this.point[i].key === key)\n {\n p[0] = this.point[i].x;\n p[1] = this.point[i].y;\n }\n }\n return p;\n }", "funct...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Delete an item (login or user)
function deleteItem(type) { type = typeof type !== 'undefined' ? type : false; if(type) { var noun; switch(type) { case 'logins': noun = 'login'; break; case 'users': noun = 'user'; break; case 'edit-account': noun = 'user'; break; } ...
[ "function deleteItem(req, res, next) {\n var userId = req.userId,\n offerId = req.params.id;\n db.query('DELETE FROM wallet WHERE userId=$1 AND offerId=$2', [userId, offerId], true)\n .then(function () {\n return res.send('OK');\n })\n .catch(next);\n}", "function deleteItem(req, res, next) {\n var us...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns consecutive list of elements satisfying the predicate starting from startIndex and traversing the array in reverse order.
function sliceFromReverseWhile(arr, startIndex, predicate) { var result = { elements: [], sliceStartsAt: -1 }; for (var i = startIndex; i >= 0; i--) { if (!predicate(arr[i])) { break; } result.sliceStartsAt = i; result.elements.unshift(arr[i]); ...
[ "function getRangesWhere(arr,pred,cb){var start;for(var i=0;i<arr.length;i++){if(pred(arr[i])){start=start===undefined?i:start;}else{if(start!==undefined){cb(start,i);start=undefined;}}}if(start!==undefined)cb(start,arr.length);}", "function selectiveArrayReversal(array,reverse_length){\n\n if (array ===null |...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Authenticate an user with a token to be saved locally
static authenticateUser(token) { localStorage.setItem('token', token); }
[ "static authenticateUser(token) { \n localStorage.setItem('token', token);\n }", "static authenticateUser(token) {\n localStorage.setItem('token', token);\n }", "static authenticateUser(token, email){\n localStorage.setItem('token', token);\n localStorage.setItem('email', email);\n }", "s...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
getColumns() method. This method calculates the width of each column based on the number of columns specified. If no number is specified, then the width is calculated via the length of the children inside.
getColumns() { const {props} = this; let children = []; for (let i = 0; i < (props.numberOfColumns || props.children.length); i++) { children.push(<GridCell key={this.uniqueId + i} columnSize={100 / (props.numberOfColumns || props.children.length)} style={props.gridCellStyle}>{props....
[ "function columnwidth(){\n\t//this should affect whole page, so first we need to find every .row element\n\tlet allMyRows = document.querySelectorAll('.row');\n\t\n\t//we want a base minimum width for every column, I don't want them smaller than 150px\n\tlet baseWidth = 150;\n\t\n\t//loop through all of the rows \n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Helper function that iterates through keys defined on passedin prototype object, which is always a fragment of this.proto, assigning to tempObj the data at matching keys in passedin item. If a key on the prototype has an object as its value, buildArray is recursively called. If item does not have a key corresponding to...
function buildItem(prototype, item, map) { let tempObj = {}; // gets all the in-cache data // Traverse fields in prototype (or nested field object type) for (let key in prototype) { // if key points to an object (an object type field, e.g. "cities" in a "country") if (typeof prototype[key] === 'object') ...
[ "function restorePrototype(obj) {\n if (obj != null && obj.type != undefined) {\n obj.__proto__ = findPrototype(obj.type);\n for (var entry in obj) {\n restorePrototype(obj[entry]);\n \n // Deal with the fact arrays don't have names when transferred over JSON\n // Need ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Create an existing table if not exists, returns a callback with the blueprint for the user to edit.
createIfNotExists(schemaName, callable){ const blueprint = new CreateBlueprint(schemaName, true); callable(blueprint); this.blueprints.push(blueprint); }
[ "function createSchema(callback) {\n console.log(\"Creating table \" + tableName + \"...\");\n var params = {\n AttributeDefinitions: [{\n AttributeName: 'SystemId',\n AttributeType: 'S'\n }, {\n AttributeName: 'AgendaId',\n AttributeType: 'S'\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Language: Nim Description: Nim is a statically typed compiled systems programming language. Website: Category: system
function nim(hljs) { return { name: 'Nim', aliases: ['nim'], keywords: { keyword: 'addr and as asm bind block break case cast const continue converter ' + 'discard distinct div do elif else end enum except export finally ' + 'for from func generic if import in include interfa...
[ "function nim(hljs) {\n return {\n name: 'Nim',\n keywords: {\n keyword: 'addr and as asm bind block break case cast const continue converter ' + 'discard distinct div do elif else end enum except export finally ' + 'for from func generic if import in include interface is isnot iterator ' + 'let macro m...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
function to show all the posts from the user feed response an object containing array of data return shows 5 posts at a time and loads 5 more when user clicks load more button
function showMyFeed(response) { var begPostidx = 0; // beginning index for data array var endPostidx = 5; // end index for data array /*if array is empty that means no posts have been created by user*/ if( response.data[0].length == 0 ){ $("div#post").append("No posts yet"); return ; } else{ if(...
[ "function grabFeedPosts()\n\t{\n\t\t$.ajax(`/poem/fetchmore/4?page=${$page}`, {\n\t\t\t\ttype:'GET',\n\t\t\terror:function(data) {\n\t\t\t\tconsole.log(data.responseText);\n\t\t\t},\n\t\t\tsuccess:function(data) {\n\t\t\t\t$poemscontainer.append(data);\n\n\t\t\t\tif($spanmore.text().trim() == $('.poem').length)\n\t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
pop up warning box that user have to select text span for adding data set current data field for editor form to the field that user chosen
function warnSelectTextSpan(field) { $("#dialog-select-text-for-data").show(); $("#select-text-dialog-close").click(function() { $("#dialog-select-text-for-data").hide(); }); }
[ "function displayExistingDocumentInfo() {\n //$(\"#update-title\").val(value);\n //$(\"#update-keywords\").val(value);\n //$(\"#update-abstract\").val(value);\n //$(\"#update-citation\").val(value);\n}", "function saveDescribeText() {\n $('#changeOutboundRuleText').val($('#describeOutboundChanges').v...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Obtener detalle de un pedido en particular
async detallePedido(req,res){ let idPedido = req.params.id; try{ let detalleProds = await querysAdmin.detalleProdsPedido(idPedido); let infoUsuario = await querysAdmin.infoUsuarioPedido(idPedido); let detail = { detalleProductos : detalleProds }; let ...
[ "function Pedidos(){\n client.ConsultarPedidos({}, (err, response) => {\n if (err != null) {\n console.log(\" >>> Ocorreu um erro na consulta!\");\n console.log(err);\n return;\n }\n\n const pedidos = response.pedidos;\n\n console.log(\"----- Pedidos -...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
will render using your grid renderer. If you want it to ignore the grid renderer, have the column set _csvIgnoreRender: true
getCSVFromGrid(grid) { let deferred = Ext.create('Deft.Deferred'); let store = grid.getStore(); let columns = grid.columns; let column_names = []; let headers = []; let csv = []; Ext.Array.each(columns, (column) => { if (column.dataIndex || column.r...
[ "function exportCSV() {\r\n return gridOptions.api.getDataAsCsv();\r\n}", "function formatGridAsCsvOrHtml(grid, startCol, type) {\r\n\r\n ogrid = grid;\r\n ostartCol = startCol;\r\n otype = type;\r\n var gridTbl = getSingleObject(grid);\r\n var retVal = '';\r\n var gridRecCount = eval(gridTbl.i...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Extends recursively all rownodes by RowModel.
function recInitRowModels(rows){ _ext.visitNodes(rows, visitor, rows); function visitor(row, idx, level){ RowModel.prototype = row; level[idx] = new RowModel(); return row.childs; } }
[ "createRows(model) {\n // Populate the row/col node attributes.\n\n // No controls row\n this.addRow(new cmMatrixRow(this.svg, 0, [], this.numHeaderCols), 0);\n\n // No attribute rows\n for (let i = 0; i < this.attributes.length; ++i) {\n this.addRow(new cmMatrixRow(this.svg, i, [], this.numHead...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
get current scene object
getCurrentScene() { return this.scenes[this.currentSceneIndex]; }
[ "function getScene() {\n\n\treturn scene;\n}", "getCurrentScene() {\n return this.currentScene;\n }", "get scene() {\n return (typeof this._activeScene !== \"undefined\")\n ? this._activeScene.id : undefined;\n }", "function getScene()\n {\n return SCENE;\n }", "get scene() {...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Utility function use to remove the CSS border around the element passed as a parameter. Used when an event is fired so that we are using returnEventElement function
function removeBorder(e) { var elm = returnEventElement(e); elm.style.border = 'none'; }
[ "function removeBorder(event){\r\n\tthis.style['border'] = \"\";\r\n}", "function removeBorder(element) {\n element.style.removeProperty(\"border\");\n}", "function removeBorder(event){\r\n\tthis.style['border'] = \"\";\r\n\tthis.style['padding'] = \"\";\r\n}", "function _hideBorder()\n{\n\twindow.event.srcE...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Add the potion to the hero's backpack
function savePotion() { // Put the potion into the hero's backpack array hero.backpack.push(currentPotion); // Rehide the prompt area $("#prompt").hide(); // Update the screen with the drawHero function drawHero(); }
[ "addPotion( potion ) {\n this.inventory.push( potion );\n }", "addPotion(potion) {\n return this.inventory.push(potion);\n }", "usePotion(){\n if(this.healingItem > 0){\n this.healingItem -= 1;\n this.hp += 10;\n }\n }", "function addHero(package){\n du...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
tic function this will run the render function every tic
function _tic() { // Logic _ticBalls(); _changeVectors(); // Draw all of the balls on the table _renderBalls(); }
[ "function render() {\n if (!rendertime.active){\n rendertime.start = window.performance.now();\n rendertime.end = rendertime.start + 200;\n rendertime.active = true;\n window.requestAnimationFrame(run);\n }\n}", "run() {\n this._timer.run();\n this.render();\n }", "function startRenderTimer...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
end of addEventListenerWrapper() add_orv_core_styles
function addOrvCoreStyles() { let s = [],s2=[]; const o1 = "."+sOrvCoreLibClassName+" " let sPos try { if (typeof styleBlk !== "undefined") { return; // aleady set up } // end if styleBlk = document.createElement("STYLE") ...
[ "styleUpdated() {\n this.i.og();\n }", "function addSomeStyle(elly) {\n\telly.addEventListener(\"click\", function() {\n\t\tstyleChange();\n\t});\n}", "addStyleTag() \n\t{\n\t\tif (DOM.find('#Turboe-Commerce')) {\n\t\t\treturn;\n\t\t}\n\n\t\tlet css = `\n\t\t\t${this.settings.element} {\n\t\t\t\tposit...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function which navigates to patient/staff/equipment search results
function goToSearchResults(searchType) { if ("Patient" == searchType) { parent.document.searchResultsForm.processorName.value = 'PatientProcessor'; parent.document.searchResultsForm.processorAction.value = 'getSearchResult'; } else if ("Staff" == searchType) { parent.document.searchResultsForm.processorNam...
[ "function navigate() {\n \n var s = '!search/s=' + freetext();\n\n if (datebegin() != null) {\n var d = datebegin();\n s += '&d=' + format.getQueryDateStr(d);\n }\n if (dateend() != null) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
function to spotlight rock bottom
function spotlightRock(){ var Rock = document.getElementById("Rock"); darknessFalls(Rock); }
[ "function drawTopBurrow() {\r\n\t if (topfloorburrow) {\r\n \t\tvar x = translate ( b1i * SQUARESIZE ); \t\r\n \t\tvar z = translate ( b1j * SQUARESIZE ); \t\r\n \t\tvar y = 1950;\t\r\n \r\n \t\ttopfloorburrow.position.x = x;\r\n \t\ttopfloorburrow.position.y = y;\r\n \t\ttopfloorburrow...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Bind AdaptiveCard with data
renderAdaptiveCard(rawCardTemplate, dataObj) { const cardTemplate = new ACData.Template(rawCardTemplate); const cardWithData = cardTemplate.expand({ $root: dataObj }); const card = CardFactory.adaptiveCard(cardWithData); return card; }
[ "static renderAdaptiveCard(rawCardTemplate, dataObj) {\n const cardTemplate = new ACData.Template(rawCardTemplate);\n const cardWithData = cardTemplate.expand({ $root: dataObj });\n const card = CardFactory.adaptiveCard(cardWithData);\n return card;\n }", "function BindedCard(element, card){\n thi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
js int to date
function intToDate(intDate) { var dtm = new Date(Number(intDate)); return (dtm.getMonth()+1)+'/'+dtm.getDate()+'/'+dtm.getFullYear(); }
[ "dateToInt(date){\n let newDate = new Date(date);\n let dateNumbers = {\n day: newDate.getDate(),\n month: newDate.getMonth() + 1,\n year: newDate.getFullYear()\n };\n return dateNumbers;\n }", "function converteData(data){\n\t\treturn new Date(data)...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
NOTE: A Very Big Sum
function aVeryBigSum(ar) { }
[ "function aVeryBigSum(ar) {\n return ar.reduce((accumulator, currentValue) => accumulator + currentValue);\n}", "function aVeryBigSum(ar) {\n let value = 0;\n for (let i = 0; i < ar.length; i++) {\n value += ar[i];\n }\n return value;\n}", "function aVeryBigSum(ar) {\n\tlet total = 0;\n\tfor (let i = ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
replace terms in text according to replFn
function replaceKW( text, term, replFn ) { var match, matches = []; while (match = term.exec(text.data)) { matches.push(match); } for (var i = matches.length - 1; i >= 0; i--) { match = matches[i]; // cut out the text node to replace text.splitText(match.index); ...
[ "function replaceAll(str, term, replacement) {\n\t\t\t\treturn str.replace(new RegExp(escapeRegExp(term), 'g'), replacement);\n\t\t\t}", "function replaceAll(str, term, replacement) {\nreturn str.replace(new RegExp(escapeRegExp(term), 'g'), replacement);\n}", "replaceAll(findTerm, replaceWith, caseSensitive = t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Enter a parse tree produced by LUFileParserimportDefinition.
enterImportDefinition(ctx) { }
[ "initiateReferenceTree() {\n this.referenceTree = new ReferenceTree_1.ReferenceTree();\n Object.keys(this.sourceFilesManager.toJSON()).forEach((filePath) => {\n const sourceFile = this.program.getSourceFile(filePath);\n if (!sourceFile) {\n return;\n }\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
calculate width as ascii is width 1, korean is width 2.
function textWidth(text) { if (!text){ return 0; } len = 0; for(i=0; i<text.length;i++) { len += text.charCodeAt(i) < 128 ? 1 : 2; } return len; }
[ "function charDisplayWidth(c) {\n if (c >= 0x1100 &&\n (c <= 0x115f || c == 0x2329 || c == 0x232a ||\n (c >= 0x2e80 && c <= 0xa4cf && c != 0x303f) || /* CJK ... Yi */\n (c >= 0xac00 && c <= 0xd7a3) || /* Hangul Syllables */\n (c >= 0xf900 && c <= 0xfaff) || /* CJK Compatibility Ideographs */\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Iterates over the repoData and sets local state for total stars and total forks which are then passed down to the dashboard component to be used in the fork and stars containers
count () { let sumOfstars = 0 let sumOfforks = 0 this.props.repoData.map((repo) => { sumOfstars += repo.stargazers_count sumOfforks += repo.forks_count }) this.setState(() => { return { totalStars: sumOfstars, totalForks: sumOfforks } }) }
[ "function repos() {\n document.getElementById(\"numberOfRepos\").innerHTML = \"\";\n\n if (reposData.length == 0) {\n document.getElementById(\"numberOfRepos\").innerHTML =\n gitData.login + \" has no repositories\";\n endLoader();\n }\n if (reposData.length > 0) {\n for (var i = 0; i < reposData....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
pausing scroller vertical or horizontal version date: March 2005 (revised GeckoTableFix) Arguments: id of content layer (inside wn), width and height of scroller (of wn, that is), number of items (repeat 1st one at end!), axis ("v" or "h"), set up mouse events? (boolean)
function dw_scroller(id, w, h, num, axis, bMouse) { this.id=id; this.el = document.getElementById? document.getElementById(id): null; if (!this.el) return; this.css = this.el.style; this.css.left = this.x = 0; this.css.top = this.y = 0; this.w=w; this.h=h; this.num=num; this.axis=axis||"v"; ...
[ "function UpdateScrollThumbs()\n{\n UpdateVerticalScrollVisual();\n UpdateHorizontalScrollVisual();\n}", "function ListBox(parent, name, x, y, w, h, min = 1, max = 0, show = true)\n{\n\t/* --------------------------------------------------------------------------------------\n\tvalidate parameters \n\t-------...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
initialiseShellUX() Initialises Shell UX, like moduledrawer
function initialiseShellUX() { if (hasShellBeenInitialised) { // Shell already initialised, bye return; } hasShellBeenInitialised = true; updateBootStatus("org.webshell.shell:initialiseShellUX"); $(".drawertoggle").click(toggleModuleDrawer); $("#shutdownbutton").click(os.shutdown); $("#lockbutton").click(o...
[ "function initShell() {\n\n\tupdateBootStatus(\"org.webshell.shell:initShell\");\n\n\tif (!settingUp) { // As long as the shell isn't in setup mode, start regular processes\n\t\tbootLogo.delay(1500).addClass(\"fadeout\"); // Fade out logo\n\t\t$(\".wallpaper,.lockscreen,.modulecontainer,.dwm,.authentication,.openta...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Retrieve an array of stylesheets on this page
function getStylesheets() { return document.querySelectorAll(stylesheetSelector); }
[ "function getStyleSheets() {\n var metas = document.getElementsByTagName('link');\n var stylesheets = '';\n for (i=0; i<metas.length; i++) {\n if (metas[i].getAttribute(\"rel\") == \"stylesheet\") {\n stylesheets += '<link rel=\"stylesheet\" href=\"'+metas[i].getAttribute(\"href\")+'\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Checks the ledger for one or more items with the given name.
has(...itemNames) { if (this.lastResult === false) return this; //do nothing this.workingList = this.ledger.findAllItemsWithName(...itemNames); this.lastResult = (this.workingList.length > 0); return this; }
[ "function containsItem(items, item) {\n for (let i of items) {\n if (i.name === item.name)\n return true;\n }\n return false;\n}", "function findItemsByName() {\n var itemName = arguments[0],\n response,\n $selectedItems = ins...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
FUNZIONI funzione per generare numeri random
function genaratoreNumeriRandom(numero) { return Math.floor(Math.random() * numero) +1; }
[ "function genNumber(){\n return Math.round( Math.random() * 9 + 1 );\n }", "function randomint(num){ return Math.floor(Math.random()*num);}", "function generarNumero() {\n return Math.floor(Math.random() * 15);\n}", "function generaNumero() {\r\n var numeroGenerato = Math.floor(Math.random()*5)+...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Extract a token from the header and return its embedded user pool id
function getUserPoolIdFromRequest(event) { var token = event.headers['Authorization']; var userPoolId; var decodedToken = tokenManager.decodeToken(token); if (decodedToken) { var pool = decodedToken.iss; userPoolId = pool.substring(pool.lastIndexOf("/") + 1); } return userPoolId;...
[ "function extractUserID(jwtToken){\n\tvar payload = jwt.decode(token);\n return payload.user_id;\n}", "function getUserIdByToken(token) {\n var id = objectId(token.id);\n return id;\n}", "tokenFromHeader (request) {\n\t\tif (request.headers.authorization) {\n\t\t\tlet match = request.headers.authorizat...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
A single update step for the streaks, involves
function update(streaks) { for (let i=0; i<streaks.length; i++) { streak = streaks[i]; streak.line.scale += 0.05; streak.x += streak.w * maxLineStart * 0.1; streak.y += streak.h * maxLineStart * 0.1; streak.line.translation.set(streak.x, streak.y); const maxX = width / 2; const maxY = hei...
[ "function streaks(){ \n\n\tstreak++;\n\twriteout (\"streakcounter\", streak);\n}", "function calculateWinStreakAdjustment({ streak }) {\n //make adjustment value negative or positive depending on whether the streak\n //is a loss streak or win streak\n let multiplier = streak.isWinStreak ? 1 : -1;\n return mul...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Desaturate image (remove color) Call the saturate function
desaturate() { this.saturate(-1); }
[ "desaturate() // eslint-disable-line no-unused-vars\n {\n this.saturate(-1);\n }", "desaturate() {\n this.saturate(-1);\n }", "function saturate(color, amount) {\n return desaturate(color, -amount);\n}", "function saturateHigh(img){\r\n// saturatePixel(img: Image, i: Number, j: Number): Pixe...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Contains functions for the properties mode / Starts or stops the properties mode
function setPropMode(active) { propMode = active; if (!active) { hidePropMenu(); unmarkPropTargets(); } else { setControlMode('none'); addType = 0; } }
[ "changeMode(mode) {\n\t\tconst { id } = this.handle.api;\n\t\tlet value;\n\n\t\tswitch (mode) {\n\t\t\tcase 'auto':\n\t\t\t\tvalue = 0;\n\t\t\t\tbreak;\n\n\t\t\tcase 'sleep':\n\t\t\t\tvalue = 1;\n\t\t\t\tbreak;\n\n\t\t\tcase 'favorite':\n\t\t\t\tvalue = 2;\n\t\t\t\tbreak;\n\n\t\t\tcase 'none':\n\t\t\t\tvalue = 3;\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
center the side menu based on window height
function centerMenu() { navHeight = nav.offsetHeight; winHeight = window.innerHeight; contentHeight = winHeight - (navHeight + header.offsetHeight); // check window width if (window.innerWidth > 1205) { // check window height // change the layout .....
[ "function createMarginForMenu() {\n var contentHeight = $('.menu__list').height();\n $('.menu__list').css({marginTop: ($(window).height() - contentHeight)/2-47});\n }", "function small_device_position() {\n $('.ui.horizontal.segments').css('height', $(window).height() - 49);\n $('.u...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
createSOR function: Takes the clicked points and calculates// the new points for every 10 degree rotation of the polyline//
function createSOR(){ for (var angle=10; angle<=360; angle+=10){ var theta = ((angle * Math.PI) / 180); var currentLine = shape[0]; polyLine = []; for (var i = 0; i < currentLine.length; i++) { var coordIterator = currentLine[i]; var x = (Math.co...
[ "function createSOR(gl, canvas){ \r\n for (var angle=10; angle<=360; angle+=10){\r\n var theta = ((angle * Math.PI) / 180);\r\n var currentLine = shape[0];\r\n polyLine = [];\r\n\r\n for (var i = 0; i < currentLine.length; i++) {\r\n var coordIterator = currentLine[i];\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
For window minimise button
function onWindowMinimise() { console.log('window minimise'); win.minimize(); }
[ "function onWindowMinimise_pref() { \n console.log('window minimise'); \n win_prefs.minimize();\n}", "function minimizeWindow(){\r\n\t\t$(selectors.find_guide_step).show();\r\n\t\t$(selectors.scroll_buttons).hide();\r\n\t\t$(selectors.redirect).hide();\r\n\t\t$(selectors.resume).hide();\r\n\t\t$(selectors.r...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Name: Glide() Purpose: the purpose of this function is to move the picture in a gliding effect Parameters: N/A Return: N/A
function Glide() { $( "#target" ).animate({paddingTop:"-=310px", paddingLeft:"-=400px"}).animate({paddingTop:"+=310px", paddingLeft:"+=400px"}); }
[ "function slideOldImageOut(newFileName, id) { \n\t//slurp.play ();\n\tglass.load();\n\tglass.play ();\n\tvar drink_img = document.querySelector ('.drink_img');\n\tdrink_img.style.marginRight=\"-400px\";\n\tvar pos = -400; \n\n\tvar int = setInterval (moveImage, 50);\n\tfunction moveImage () {\n\t\tif(pos < -2500) {...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Uploads asset for a release if it's not already uploaded, Otherwise calls deleteAsset.
uploadAsset (assetIndex) { if (assetIndex >= this.filteredAssets.length) { console.log('Assets uploaded successfully...') return } const asset = this.filteredAssets[assetIndex] console.log('Uploading ' + asset) // Check if it's uploaded. const assetId = this.getAssetId(assetIndex) ...
[ "deleteAsset (assetId, assetIndex) {\n console.log('Deleting ' + this.filteredAssets[assetIndex])\n this.octo.repos.deleteReleaseAsset({\n owner: this.config.owner,\n repo: this.config.repo,\n asset_id: assetId\n }).then(result => {\n console.log('Deleted successfully...')\n this.d...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
gets the last nonreadonly, notintheproccessofremoval tag
getLastTag(){ var lastTag = this.DOM.scope.querySelectorAll(`${this.settings.classNames.tagSelector}:not(.${this.settings.classNames.tagHide}):not([readonly])`); return lastTag[lastTag.length - 1]; }
[ "getLastTag(){\r\n var lastTag = this.DOM.scope.querySelectorAll(`.${this.settings.classNames.tag}:not(.${this.settings.classNames.tagHide}):not([readonly])`);\r\n return lastTag[lastTag.length - 1];\r\n }", "getLastTag() {\n var lastTag = this.DOM.scope.querySelectorAll(`${this.settings.cla...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
16. Takes a parameter `n` and returns an array with `n` numbers. The numbers in the array should increase from 1 to `n`.
function nArray(n){ const nArr = Array.from(Array(n)) nArr.forEach(function(_, index){ this[index] = index + 1; }, nArr) return nArr; }
[ "function arr(n){\n var newArr = [];\n for(var i = 0; i < n; i++){\n newArr.push(i);\n }\n return newArr;\n}", "function arr(n) {\r\n var newArr = [];\r\n for (var i = 0; i < n; i++) {\r\n newArr.push(i);\r\n }\r\n return newArr;\r\n}", "function newArray(n) {\n const array = []...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
If a (historical) tag without "v" prefix exists, use that.
function forgivingTag (tag, tags) { if (tag[0] !== 'v') tag = 'v' + tag if (tags.indexOf(tag) >= 0) return tag const unprefixed = tag.replace(/^v/, '') if (tags.indexOf(unprefixed) >= 0) return unprefixed return tag }
[ "static async generateTagVersion() {\n let tag = await this.getTag();\n\n if (tag.charAt(0) === 'v') {\n tag = tag.slice(1);\n }\n\n return tag;\n }", "tag(version) {// const snap = this.snap();\n // const tag = new Tag(version, snap);\n // this.tags.set(tag);\n }", "function tagsToUpda...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
A Path is a list of particles
function Path() { this.particles = []; this.hue = random(100); }
[ "function Path() {\n this.particles = [];\n this.hue = random(100);\n}", "function Path(){\n\tthis.particles = [];\n\tthis.hue = random(r, g, b);\n\tr = random(255);\n\tg = random(255);\n\tb = random(255);\n\n}", "function Path(points) {\n if (Object.prototype.toString.call(points) === '[object Array]') {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This sample demonstrates how to Lists the metric values for a resource.
async function getMetricForMetadata() { const subscriptionId = process.env["MONITOR_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; const resourceUri = "subscriptions/b324c52b-4073-4807-93af-e07d289c093e/resourceGroups/test/providers/Microsoft.Storage/storageAccounts/larryshoebox/blobServices/d...
[ "async function getMetricForData() {\n const subscriptionId =\n process.env[\"MONITOR_SUBSCRIPTION_ID\"] || \"00000000-0000-0000-0000-000000000000\";\n const resourceUri =\n \"subscriptions/b324c52b-4073-4807-93af-e07d289c093e/resourceGroups/test/providers/Microsoft.Storage/storageAccounts/larryshoebox/blob...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Verifie si un joueur est en deplacement
function checkTirEnCours() { tirEnCours = false; equipes.forEach((e) => { e.joueurs.forEach((j) => { if (j.vitesse > 0) tirEnCours = true; }); }); }
[ "seMordQueue() {\n let tete = this.getTete();\n let count = 0\n for (let i = 0; i < this.positions.length; i++) { //recherche de la tête dans le serpent\n const element = this.positions[i];\n if (element.superpose(tete)) {\n count++;\n }\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Trigger scan when user comes from mobidul. and triggerScan is requested (e.g. from Menu)
function _checkTriggerScan () { if ( StateManager.comesFrom( StateManager.MOBIDUL ) && !!StateManager.getParams().triggerScan ) { scan(); } }
[ "function startedScan() {\n\n}", "function _startScan() {\n SpecialBle.setConfig(config)\n SpecialBle.startBLEScan();\n }", "function _startScan() {\n SpecialBle.setConfig(config)\n SpecialBle.startBLEScan(SERVICE_UUID);\n }", "function onScanClick() {\n\n var\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Applies style attributes to links to user pages depending on the type of user. styleObj: Collection of styles applied to the different user levels
function styleUserLevels( styleObj ) { if( recursion ) return; //The cached API queries are a fallback for DText-generated links etc... var userCache = MS_getValue( "styleUserLevels.cache" ) || { saveName: "styleUserLevels.cache", expires: refreshDays*24*3600 }; var refreshDays = 3; MS_observe...
[ "styleForUser(user) {\n return {fontWeight: 'bold', color: this.colorForUsers[user.color]};\n }", "function applyStyles(Node, styleObject){\n\t\tvar style = Node.style;\n\t\tObject.keys(styleObject).forEach(function(styleName){\n\t\t\tstyle[styleName] = styleObject[styleName];\n\t\t});\n\t}", "function addU...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
3. Write a function that creates an object that represents a project. Each project is described by: description, programming language, git repository, boolean status that says if the project is in development or not. Add a method that prints out the project's repository, a method that checks if the project is written i...
function Project(desc, language, url, dev) { this.description = desc; this.programingLanguage = language; this.gitRepository = url; this.development= dev; this.printRepository = function () { console.log(url); }; this.isJavaScript = function () { ...
[ "function Project($description, $language, $gitRepository, $developmentStatus) {\n this.description = $description;\n this.language = $language;\n this.gitRepository = $gitRepository;\n this.developmentStatus = $developmentStatus;\n\n this.projectRepository = function () {\n console.log(this.g...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
===============================================Create Receipt For Bill and Print===========================
function printBill(cal,items){ let message; let receiptItem = []; items.forEach((el,key) => { receiptItem.push({no: key, item: el.name, qty: el.quantity, cost: el.total_price}); }); const output = receipt.create([ { type: 'text', value: [ Bold()+' DesiChulhaa(Baner)'+Normal(),...
[ "function printReceipt() {\n\n if (_claimedPrinter == null) {\n WinJS.log(\"Claimed printer instance is null. Cannot print.\", \"sample\", \"error\");\n }\n else {\n var job = _claimedPrinter.receipt.createJob();\n job.printLine(\"======================\");\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
The constructor captures top left and bottom right cell indexes.
constructor(topLeft, bottomRight, name='') { this.topLeft = topLeft; this.bottomRight = bottomRight; this.name = name; this.length = this.cells().length; }
[ "function Cell(top, bottom, left, right, index, id, posn, state) {\n\tthis.top = top;\n\tthis.bottom = bottom;\n\tthis.left =left;\n\tthis.right = right;\n\tthis.index=index;\n\tthis.id = id;\n\tthis.posn = posn;\n\tthis.state = state;\n}", "constructor() {\n /* 1-3 is top row, 4-6 is mid row, 7-9 is bottom ro...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
bindResizeEvents() used to bind resizeEvents
function bindResizeEvents() { $(window).on('resize', function(e) { if (resizeTimeOut !== false) clearTimeout(resizeTimeOut); resizeTimeOut = setTimeout(function() { resize($(this).width()); }, 200); }); }
[ "_setupResize () {\n this._resizeEvent = this.resize ? this.resize : this.resizeCanvas\n this._events['resize'] = {event: this._resizeEvent, context: window}\n }", "function bindResize() {\n $(window).resize(function () {\n sizeScrollable();\n });\n }", "bindEvents(){\r\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Deletes a site script.
deleteSiteScript(id) { return __awaiter(this, void 0, void 0, function* () { yield this.clone(SiteScripts$1, "DeleteSiteScript").execute({ id: id }); }); }
[ "function siteDelete(siteId) {\n\t$.ajax({url: 'api/sites/' + siteId,\n\t\t\tmethod: 'DELETE'})\n\t\t\t.fail(function(data){$('p.error').removeAttr(\"hidden\")\n\t\t\t\t .append(data.responseText)})\n\t\t\t.done(function(data){\n\t\t\t\t\tupdateSiteList();\n\t\t\t\t\t$('div.displayzone')...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
custom data filter for our transactions. YNAB has a debt master category and an internal master category the internalMasterCategory contains things like "Split Transaction (Multiple Categories...)" and starting balances. The starting balances that are negative are actually important to this report in order to match YNA...
filterTransaction(transaction) { // can't use a promise here and the _result *should* if there's anything to worry about, // it's this line but im still not worried about it. const categoriesViewModel = ynab.YNABSharedLib.getBudgetViewModel_CategoriesViewModel()._result; const ma...
[ "filterTransactions(e, type) {\n let transactions;\n type === 'all' ?\n transactions = this.props.data.getTransactions :\n transactions = this.props.data.getTransactions.filter(transaction => {\n let acc;\n if (type === 'type') {\n acc = e.target.text === 'Debit' ? 'depository' : 'credi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
When the user searches by the tags on mobile
function searchByTagsMobile() { // FIND WAY TO CALL THIS FROM MOBILE var tags = []; $.each($("input[name='type']:checked"), function(){ tags.push($(this).val()); }); postData = { tagids: tags, } $.ajax({ url: 'index.html', type: 'POST', dataType:...
[ "searchTag() {\n if (this.typeahead !== true) {\n return false;\n }\n\n if (this.oldInput != this.input || (!this.searchResults.length && this.typeaheadActivationThreshold == 0) || this.typeaheadAlwaysShow) {\n this.searchResults = [];\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
find the index number of a layer in the comp by name
function findNumberOfLayerByName(LayerName,theComp) { for (var i = theComp.numLayers; i >= 1; i--) { theLayer = theComp.layer(i); if (theLayer.name == LayerName) { return(i) }; } }
[ "function getIndexByName(layerName) {\r for (var i = 0; i < numberOfLayers; i++) { \r var customName = layerName; //layerName should be string\r var myLayer = app.activeDocument.layers[i].name;\r if (customName == myLayer) {\r return i;\r }\r }\r}", "getLayer(name) {\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get list from storage according to nickname
function getListFromStorage() { var listArray = JSON.parse(window.localStorage.getItem(nickname)); return listArray; }
[ "function getList() {\n if (storage.get(ListName) != null) {\n masterList = storage.get(ListName);\n showList(masterList);\n }\n}", "function retrieveSongList() {\n\t\treturn _.pluck(instance.indexfile.songs, 'path');\n\t}", "list() {\n return this.ready.then(db => {\n const transaction = db.tra...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Need to draw a link upon user creating link between 2 nodes Given a link and linktype, draw the deafult link
function drawDefaultLink(link, linktype){ switch(linktype){ case "Refinement": if(link.prop("sublink-type")){ var val = link.prop("sublink-type").split("|"); if(val[0] == 'or'){ link.attr({ '.connection': {stroke: '#000000', 'stroke-dasharray': '0 0'}, '.marker-source': {'d': 'M 0 0'}, ...
[ "function drawDefaultLink(link, linktype){\n\tswitch(linktype){\n\t\tcase \"Refinement\":\n\t\t\tlink.attr({\n\t\t\t '.connection': {stroke: '#000000', 'stroke-dasharray': '0 0'},\n\t\t\t '.marker-source': {'d': 'M 0 0'},\n\t\t\t '.marker-target': {stroke: '#000000', 'stroke-width': 1, \"d\": 'M 10 0 L 10 10 M 1...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Given a query, computes a "queryKey" suitable for use in our queryToTagMap_.
function syncTreeMakeQueryKey_(query) { return query._path.toString() + '$' + query._queryIdentifier; }
[ "function get_key(query) {\n return 'q:' + hash(query)\n}", "function syncTreeMakeQueryKey_(query) {\n return query._path.toString() + '$' + query._queryIdentifier;\n}", "function syncTreeMakeQueryKey_(query) {\r\n return query._path.toString() + '$' + query._queryIdentifier;\r\n}", "function getByKey(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Preload the user model and the users roles This makes the initial page rendering (especially the navigation) much smoother
async afterModel() { const currentUser = this.currentUser; const user = await currentUser.getModel(); if (user) { await user.roles; } }
[ "function loadRoles() {\n if (!loggedIn) return next();\n if (cacheRoles && session.user.roles) return next();\n\n // As a security precaution, reset the user's roles.\n session.user.roles = [];\n Membership.all({\n where: {\n userId: session.user.id\n }\n }, \n function getMemberships(err, member...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
05. Last K Numbers Sequence
function lastKNumbersSequence(n, k) { let res = [1]; for (var i = 1; i < n; i++) { res.push(res.slice(Math.max(0, i - k), Math.max(i, res.length - k)) .reduce((a, b) => a + b)); } console.log(res.join(" ")); }
[ "function lastKNumbersSequence(n, k) {\n let result = [1];\n \n for (let i = 1; i < n; i++) {\n\n let current = result.slice(k * - 1).reduce((a, b) => a + b);\n\n result[i] = current;\n }\n\n console.log(result.join(' '));\n}", "function lastKNumberSequence(n, k) {\r\n let arr = [1...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Apply syntaxcoloring styles to an array of Ranges. ranges array of Ranges to receive coloring. Each Range should have a "matchingRule" property referring to its syntax rule. modifies DOM nodes addressed by ranges returns void
function applyRules(ranges) { // iterate through ranges backwards, since splitting // a node breaks any ranges after it for (i = ranges.length-1; i >= 0; --i) { var r = ranges[i]; // make a copy of the range text, // with a styled SPAN around it documentFragment = r.cloneContents(); nodesToA...
[ "function syntaxColor(node, rules) {\n if (!isSyntaxColoring()) {\n return;\n }\n // rip out the text from node & put it back\n \n var ranges = findPatterns(node, rules);\n //debug(ranges);\n //for (p in ranges) //debug(ranges[p]);\n \t//debug(ranges[p]);\n \tapplyRules(ranges);\n \n}", "matchAddRange...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
API test for 'SetVgsConfig', Setting VPN Gate Server Configuration
function Test_SetVgsConfig() { return __awaiter(this, void 0, void 0, function () { var in_vgs_config, out_vgs_config; return __generator(this, function (_a) { switch (_a.label) { case 0: console.log("Begin: Test_SetVgsConfig"); in_...
[ "async function vpnServerConfigurationCreate() {\n const subscriptionId = process.env[\"NETWORK_SUBSCRIPTION_ID\"] || \"subid\";\n const resourceGroupName = process.env[\"NETWORK_RESOURCE_GROUP\"] || \"rg1\";\n const vpnServerConfigurationName = \"vpnServerConfiguration1\";\n const vpnServerConfigurationParamet...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function that generates a random cocktail from an API call
async function randomCocktail() { setSubmitButtonMessage(false); const response = await fetch( "https://www.thecocktaildb.com/api/json/v1/1/random.php" ); const data = await response.json(); const { idDrink, strDrink, strIngredient1, strIngredient2, strIngredient3...
[ "async function random() {\n //new rounds of randomness only occur every ~30 seconds, so we can cache this response\n let response = await fetch(\n new Request('https://drand.cloudflare.com/public/latest'),\n {\n cacheTtl: 30,\n cacheEverything: true,\n }\n )\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Handle DOM Change for FF 3+, Chrome
function HandleDOM_Change () { // Call the Chinese character conversion program StranBody() // Call the Chinese character conversion program for e-shelf record var e = document.getElementById("demoLibId"); if(e != null && e.contentWindow.document.body !== null){ StranBody(e.contentWindow.document.bo...
[ "function HandleDOM_Change () {\n\t\t} //end HandleDom_change()", "function updateonchange()\r\n{\r\n document.addEventListener(\"DOMNodeInserted\", nodechanged, false);\r\n ////document.addEventListener(\"DOMSubtreeModified\", subtreemodified, false);\r\n document.addEventListener(\"DOMAttrModified\", attrmod...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
A simple directed graph
function DirectedGraph() { this.vertices = {}; }
[ "function DirectedGraph(){\n\tthis._isBidirectional = false;\n\tthis._nodes = new LinkedList();\n\tthis._edges = new LinkedList();\n\tthis._matrix = null;\n}", "function Graph() {\n this.adjacencyList = {};\n}", "function DirectedGraphNode(label) {\n this.label = label;\n this.neighbors = []; //Array of Dire...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
The challenge requires us to zeroFill the integers, so we need to make a function for that we pass to it the integer that we want to zeroFill.
function zeroFill(i){ //check if the i is more or equal to than 10, if so just return the same int. if(i>=10){ return i; } //if less than 10, then zero fill. if(i<10){ //add a 0 to the string and return it. return 0 + i.toString(); } }
[ "function fill_by_zeros(integer, zeros_count){\n return integer - (integer % (Math.pow(10,zeros_count)))\n}", "static Zero(n) {\r\n return Vector.Fill(n, 0);\r\n }", "function fillZero(array, size) {\n\t\tfor (let i = 0; i<size; i++) {\n\t\t\tarray[i] = 0;\n\t\t}\n\t\treturn array;\n\t}", "function res...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Recursively create a MOStruct
function makeStruct(def) { if (typeof def !== 'object' || Object.keys(def).length == 0) { return def; } const name = Object.keys(def)[0]; const values = def[name]; const structure = MOStruct.structureWithName_memberNames_runtime(name, Object.keys(values), Mocha.sharedRuntime()); Object.keys(values).ma...
[ "_createTypeTree() {\n let typeTree = A();\n\n typeTree.pushObjects([\n FdAttributesTree.create({\n text: this.get('i18n').t('components.fd-visual-edit-control-tree.tree.type').toString(),\n type: 'class',\n id: 'simpleTypes',\n children: this.get('model.simpleTypes'),\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function that checks if a form exists in the overlayContent. If it does we will set the action attribute to the supplied url.
function checkForForm() { var form = overlayContent.find('form'); if (form.length > 0) form.attr('action', opts.url) }
[ "function FormExists(url)\n {\n var http = new XMLHttpRequest();\n http.open('HEAD', url, false);\n http.send();\n return http.status!=404;\n }", "function post_usingExistingForm(targetUrl, params) {\r\tdocument.getElementById('tags_form_action2020').value = params['action2020'];\r\tdocument...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Helper function to create a shallow wrapper around SearchPanel
function createWrapper(props) { return shallow( <SearchPanel id="xyz" fetchSearch={() => {}} searchService={{ id: 'http://example.com/search' }} windowId="window" {...props} />, ); }
[ "function createWrapper(props) {\n return shallow(\n <SearchPanel\n id=\"xyz\"\n windowId=\"window\"\n {...props}\n />,\n );\n}", "function createWrapper(props) {\n return render(\n <SearchPanel\n id=\"xyz\"\n fetchSearch={() => {}}\n searchService={{ id: 'http://example....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Check whether the applicant is in acceleration class or not If she/he is, disable the YES checkbox
function checkAccelerationClassForYESEligibility() { toggleYESEligibility($('#in_acceleration_class').is(':checked')); }
[ "get enableAntics() {\n /* This is now disabled. */\n return false;\n /*return this.getValue(\"EnableForce\") && $(\"#cbForce\").is(\":checked\");*/\n }", "function activateDistance(){\n if (document.getElementById(\"positioncheckbox\").checked) {\n document.getElementById(\"distancelimit\").d...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Ends game and submits name
function endGame() { var target = document.querySelector('#playerName'); var form = document.createElement('form'); var div = document.createElement('div'); var label = document.createElement('label'); var field = document.createElement('input'); var submit = document.createElement('button'); ...
[ "function end() {\n game.end();\n console.log('End!!, thank you for playing');\n }", "endGame() {\r\n const winner = this.getNextPlayer().id;\r\n alert(\"Congratulations Warrior \" + winner + \" Won the fight!\");\r\n }", "function submitName(){\r\n\t\tname = input.value.charAt(0).toUppe...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Cleans suffix from the input.
cleanSuffix(suffix) { if (!suffix) { return this; } this.input = this.input.replace(new RegExp(`[-_]?${suffix}$`, 'i'), ''); return this; }
[ "function clear_suffix() {\n if ($.trim(suffix) != '' && clearSuffix) {\n var array = obj.val().split(suffix);\n obj.val(array[0]);\n }\n }", "removeSuffix(value,suffix){\n let newString = this.finish(value,suffix);\n ret...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets the trait id and inserts into the table in the database
static storeCorgiTrait({corgiId, traitType, traitValue}) { return new Promise((resolve, reject) => { TraitTable.getTraitId({traitType,traitValue}) .then(({traitId})=> { pool.query( `INSERT INTO corgiTrait("traitId", "corgiId") VALUES($1, $2)`, [traitId, corgiId]...
[ "insert (tableName, data) {\n this.createTable(tableName)\n let table = this.tables[tableName]\n data.id = ++table.lastId\n table.inserts.push(data)\n this.writes++\n return data.id\n }", "async insert() {\n const { rows } = await db.query('INSERT INTO gender(type) VALUES ($1) RETURNING ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates a new favorite for the current user
async create(req, res, next) { try { // NOTE NEVER TRUST THE CLIENT TO ADD THE CREATOR ID req.body.userId = req.userInfo.sub; let newFavorite = await favoriteService.create(req.body); res.send(newFavorite); } catch (error) { next(error); } }
[ "static async createFavorite({ username, favoriteQuote }) {\n //send text\n await sendSms(\n process.env.FAVORITE_HANDLER_NUMBER,\n `New favorite received: ${(username, favoriteQuote)}`\n );\n\n //store the favorite\n const favorite = await Favorite.insert(username, favoriteQuote);\n ret...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
updates the card sizes based on 'width' and relocates the originX and originY values based on the passed x and y values.
updateSize(width, xPos, yPos){ this.cardWidth = width; this.cardHeight = width*1.5; this.originX = xPos; this.originY = yPos; }
[ "updateDimensions() {\r\n {\r\n let offset = this.elem.offset();\r\n let x = offset ? offset.left : 0;\r\n let y = offset ? offset.top : 0;\r\n this.position = { x: x, y: y };\r\n }\r\n let size = this.elem.width();\r\n if (!size) {\r\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
localStorage: allows you to access a local Storage object. localStorage is similar to 'sessionStorage'. The only difference is that, while data stored in localStorage has no expiration time, data stored in sessionStorage is cleared when the browsing session ends that is, when the browser is closed ;) JSON.stringify(): ...
function init(){ board = [[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0]]; var randomTile = getRandomTile(); var i = randomTile.x; var j = randomTile.y; board[i][j] = Math.random() > 0.8 ? 4 : 2; randomTile = getRandomTile(); var i2 = randomTile.x; var j2 = rando...
[ "function saveGame() {\r\n\tlocalStorage.setItem(\"Bread\", bread);\r\n\tlocalStorage.setItem(\"Eggs\", eggs);\r\n\tlocalStorage.setItem(\"Gold\", gold);\r\n\tlocalStorage.setItem(\"Demand\", demand);\r\n\tlocalStorage.setItem(\"Inflation\", inflation);\r\n\tlocalStorage.setItem(\"Clicks\", clicks);\r\n\tlocalStora...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }