query
stringlengths
9
34k
document
stringlengths
8
5.39M
negatives
listlengths
19
20
metadata
dict
Artboard bounds helper (used above):
function getArtboardBounds(artboard) { var bounds = artboard.artboardRect, left = bounds[0], top = bounds[1], right = bounds[2], bottom = bounds[3], width = right - left, height = top - bottom, props = { left : left, top : top, width ...
[ "function getArtboardBounds(artboard) {\n \n var bounds = artboard.artboardRect,\n \n left = bounds[0],\n top = bounds[1],\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Given an A1 reference, return the formatted value of the corresponding cell.
getFormattedCell(cellRef) { const val = this._getCellValue(cellRef); const cell = this.sheet.getCell(cellRef); const format = cell && cell.get('format'); return format ? format.format(val) : val; }
[ "getFormattedRange(rangeRef) {\n return this.sheet.mapRange(\n rangeRef,\n this.getFormattedCell.bind(this)\n );\n }", "_formatCellValue(row, column, cell, value) {\r\n if (value === undefined) {\r\n value = row.data[column.dataField];\r\n }\r\n\r\n if (column.form...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
EXECUTAR E DESECUTAR POCAO
executarPocao() { let tempoPocaoResta = null; //quanto tempo a pocao fica ativo ateh desaparecer de novo (em milisegundos) let pocaoMudaPers; //soh obrigatorio para pocoes que tenham desexecutar switch (this._codPocao) { case TipoPocao.DiminuirTamanhoPers: tempoPocaoResta = 7500; pocaoMudaPers = true;...
[ "function ejecutarSegundoPunto(){\n leerDatos();\n recibirDatos();\n llenarTodosLosCampos();\n}", "ejecutar(ctx){\n return new resultado(this.valor, \"entero\");\n }", "function ejecutarPago(valorServicio, servicio){\n if(haySaldoDisponible(valorServicio)){\n reducirSaldo(va...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
this allows a folder to have a special identity. E.g., you might want to associate an identity with a particular newsgroup, or for IMAP shared folders in the other users namespace, you might want to create a delegated identity readonly attribute nsIMsgIdentity customIdentity;
get customIdentity() { return null; }
[ "function setFolderId(nativeFolder, folderPL) {\n let anyFolderId = nativeFolder.distinguishedFolderId;\n let isDistinguished = true;\n if (!anyFolderId) {\n isDistinguished = false;\n anyFolderId = nativeFolder.folderId;\n if (!anyFolderId) {\n log.warn(\"folder has no Id\");\n throw Cr.NS_ER...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Calls this._stop() and sends stop message to the controller participant
stop() { if(!this.controller) { return; } this._sendRemoteControlEvent(this.controller, { type: EVENT_TYPES.stop }); this._stop(); }
[ "stop() {\n\t\tthis.ipc.server.stop();\n\t}", "stop()\r\n {\r\n try \r\n {\r\n this.client.destroy();\r\n this.sub.stop();\r\n } \r\n catch (error) {} \r\n }", "stop() {\n if (this.debug) {\n console.log('stopping chair');\n }\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get existing Menu controller instance or initialize a new one
function getOrCreateMenuController(tag) { if (!Api.cache[tag]) { Api.cache[tag] = new ProxyMenuController(tag) } return Api.cache[tag] }
[ "get menuController() {\n return getOrCreateMenuController('ion-menu-controller')\n }", "get(menu) {\r\n return menuController.get(menu);\r\n }", "function MenuController() {\n\t\tthis.menuItems = new Array();\n\t\tthis.log = LogUtil.createLogger(\"MenuController\");\n\t}", "function MenuControl...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
end function RemoveFromInventory(itemId: int)
function DropItem(itemId: int) { inventoryItemCount--; }
[ "removeItemFromInventory(item) {\n let index = this.inventory.indexOf(item);\n if (index > -1) {\n this.inventory.splice(index, 1);\n }\n }", "function removeFromInventory(item) {\r\n\r\n //If classname of item can be found in inventory, reduce nr of that type of items by...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Init Divided Header Menu
function eltdfInitDividedHeaderMenu() { if (eltdf.body.hasClass('eltdf-header-divided')) { //get left side menu width var menuArea = $('.eltdf-menu-area'), stickyArea = $('.eltdf-sticky-holder'), menuAreaWidth = menuArea.width(), stickyArea...
[ "function edgtfInitDividedHeaderMenu(){\n if(edgtf.body.hasClass('edgtf-header-divided')){\n\t //get left side menu width\n\t var menuArea = $('.edgtf-menu-area, .edgtf-sticky-header'),\n\t\t menuAreaWidth = menuArea.width(),\n\t\t menuAreaSidePadding = parseInt(menuArea.children(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Bind hooks for each module integration
bindHooks() { // }
[ "_initHooks() {\n for (let hook in this.opts.hooks) {\n this.bind(hook, this.opts.hooks[hook]);\n }\n }", "_bindUtilHooks() {\n // initial events: when an update button is clicked\n this.cartChangeHooks.forEach((hook) => {\n utils.hooks.on(hook, (event) => {\n this._s...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Append the provided path to this URL's existing path. If the provided path contains a query, then it will be added to this URL as well.
appendPath(path) { if (path) { let currentPath = this.getPath(); if (currentPath) { if (!currentPath.endsWith("/")) { currentPath += "/"; } if (path.startsWith("/")) { path = path.substring(1); ...
[ "function addPath(uri, path) {\n\t\turi = uri.split(\"?\")[0].split(\"#\")[0];\n\t\tif (uri.substr(-1) !== '/') {\n\t\t\turi += '/';\n\t\t}\n\n\t\t// remove special characters from the string (e.g., '/', '..', '?')\n\t\tvar lastSegment = path.replace(/[^\\w\\s\\-_]/gi, '');\n\t\treturn uri + encodeURIComponent(last...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Translate language string, try both the provided translation key, as the lower case version
translate(translation_key){ let languages = this.getLanguages(), translation_key_lcase = translation_key.toLowerCase(), result = (translation_key in languages) ? languages[translation_key] : (translation_key_lcase in languages) ? languages[translation_key_lcase] : null, default_language = utils_daterange_i18...
[ "function localize(key) {\n const language = l10n.locale.slice(0, 2);\n let result = '';\n // Attempt to find a match for the current locale\n if (l10n.strings[l10n.locale])\n result = l10n.strings[l10n.locale][key];\n // If none is found, attempt to find a match for the language\n if (!res...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
name: string, Name of the button destinationSelector: jquery selector of the toolbar, ex editortoolbar, toolsleft or toolsright options: (optional) object onclick: function called when button is clicked position: string, where to add tab, possible values: last, first buttonid: string, id to give to the button Returns: ...
function addButton(name, destinationSelector, options){ options = (options) ? options : {}; var onclick = options.onclick || null; var position = options.position || 'last'; var buttonid = options.buttonid || name; if($(destinationSelector).exists()){ button = $('<button id="'+buttonid+'">'+...
[ "addButton(config){\r\n var button = new ToolbarButton($(this._getToolButtonMarkup(config)));\r\n this._buttons.push(button);\r\n this.dom.append(button.dom);\r\n }", "function addDownloadButtonClassic(){\n\t\tvar form = window.document.getElementById('courseFormActions');\n\t\tconsole.log...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
the show/__BRE__hide_modal functions rely on jquerry
function __BRE__show_modal(modal_id){$('#'+modal_id).modal('show');}
[ "static showTheModal() {\n $exampleFaceModal.modal('show');\n $exampleFaceModal.data(KEY_OF_THE_MODAL_WITH_THE_FACE_SWAPPING, true);\n }", "function modalDisplay(){\n $(\"#exampleModal\").modal(\"show\");\n $(\"#okDelModalBtn\").hide();\n $(\"#startModalBtn\").hide();\n $(\"#checkModa...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Consult license.html in the documentation directory for licensing information. Creates a new delete action. Parameters: element: The element from which this action was created. bind: The action's bind. at: An XPath expression evaluated to determine location of the element to delete.
function XFormDeleteAction(element, bind, at) { assert(bind != null, "delete: bind is null"); assert(at != null, "delete: at is null"); XFormAction.call(this, element); this.bind = bind; this.at = at; }
[ "function deleteElement(element) {\n\tmanager.deleteElement(element);\n}", "function deleteCard(element) {\n var id = element.form.elements[0].value;\n console.log(id);\n var req = new XMLHttpRequest();\n var url = \"/delete/\" + id;\n req.open(\"DELETE\", url, true);\n req.addEventListener('loa...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Initialize the background switcher
function init() { body = $('body'); switcher = $('#bottomBar a.backgroundSwitcher'); backgroundList = $('.backgroundList', switcher); activeBackground = $('.activeBackground', switcher); backgroundList.hide(); switcher.click(function() { backgroundList.fadeToggle(100); }); var i...
[ "function init(){\r\n body = $(\"body\");\r\n backgroundList = $('#backgroundList');\r\n activeBackground = $(\"#activebackground\");\r\n switcher = $('a.backgroundswitcher');\r\n\r\n backgroundList.hide();\r\n switcher.click(function() {\r\n backgroundList.fadeToggle(100);\r\n });\r\n\r\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets whether a value matches the current date filter.
_matchesFilter(value) { const filter = this._getDateFilter(); return !filter || filter(value); }
[ "function isToday (value) {\n\tvar todayDay = (\"0\" + new Date().getDate()).slice(-2), //01-31\n\t todayMonth = (\"0\" + (new Date().getMonth() + 1)).slice(-2), //01-12\n\t todayYear = new Date().getFullYear(), //four digits\n\t finalDate = todayYear+'-'+todayMonth+'-'+todayDay;\n\n\tif(value == finalDate...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates a new runnable instance from the given function
function toRunnable(fun){ return new java.lang.Runnable({ run: function(){ fun(); } }); }
[ "taskFromFn(fn, args, config) {\n let t = new Task_1.Task(config);\n t.run = fn.bind(t, ...args);\n t.rtjs = this;\n return t;\n }", "function createTask(target, args) {\n return function() {\n target.apply(null, args)\n }\n}", "constructor(fnToRun, secondsToWait) {\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
positionFood() Set the food's position properties to random numbers within the canvas dimensions
function positionFood() { food.x = random(0,width); food.y = random(0,height); food.vx = random(-food.maxSpeed,food.maxSpeed); food.vy = random(-food.maxSpeed,food.maxSpeed); }
[ "function positionFood() {\n food.x = random(0, width);\n food.y = random(0, height);\n}", "function positionFood() {\n donuts.x = random(0,width);\n donuts.y = random(0,height);\n}", "_randomPosForFood(){\n this.food.x = Math.round(Math.random()*(CONSTANTS.CANVAS_WIDTH-CONSTANTS.RECT_WIDTH)/CONSTANT...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
API test for 'EnumL3Table', Get routing table on virtual L3 switch
function Test_EnumL3Table() { return __awaiter(this, void 0, void 0, function () { var in_rpc_enum_l3table, out_rpc_enum_l3table; return __generator(this, function (_a) { switch (_a.label) { case 0: console.log("Begin: Test_EnumL3Table"); ...
[ "async function createRouteTable() {\n const credential = new DefaultAzureCredential();\n const client = createNetworkManagementClient(credential);\n const subscriptionId = \"\";\n const resourceGroupName = \"rg1\";\n const routeTableName = \"testrt\";\n const options = {\n body: { location: \"westus\" },\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
append a cell to the row pass content as a string include which kind of cell (header or data) and array to store ids
function addCell(content, whichRow, whichKind, array){ var cell = document.createElement(whichKind); cell.innerHTML = content; whichRow.appendChild(cell); array.push(cell); cell.id = "newCell" + (array.length - 4); }
[ "function insert_cell(rowObject,cell_number,cell_data){\n var cell_id = rowObject.insertCell(cell_number);\n cell_id.innerHTML = cell_data;\n}", "function appendRow() {\n    var tbl = document.getElementById('E_Table'), // table reference\n        row = tbl.insertRow(tbl.rows.length), rowx;\n    // insert t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Param "colsToCombine" expected to be in following format: Array of strings, each string representing a column name from a table on this page First column is the one that should contain the stacked text from the other columns The columns are in the order that the text is desired to be stacked (i.e. the second specified ...
function CombineTableColumns(colsToCombine, colsToCombineBlankSeparatorLine, tableContainerDiv, hiddenClassName) { // If column array contains less than one column, nothing to do if((!colsToCombine) || (colsToCombine.length < 2)) { return; } var curJTable = $(tableContainerDiv).child...
[ "function combineColumns(){\n //group all selected columns\n var colGroups = groupSelectedColumns();\n //combine columns horizontaly\n combineColumnsHorizontal(colGroups);\n\n}", "function columnate(...columnGroupOpts) {\n const columnGroups = columnGroupOpts.map(([label, list]) => ({\n label,\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
============================================================================== /Get all existing Polls by id (without answers) callback(err,data) /Data structure : polls:[poll] ==============================================================================
function getAllPolls(callback){ Poll.find({},function(err,polls){ if(err){ callback(err); } callback(null,polls); }); }
[ "async function getPolls() {\n // Link to polls endpoint\n fetch('/host/event/' + id + '/polls', {\n method: 'GET',\n headers: {\n \"Authorization\": \"Bearer \" + cookies['access_token'],\n }\n }).then((response) => response.json())\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Factor := number | variable | unop Expression | ( Expression )
function parseFactor() { var tok = tokens[position++]; if (tok.match(/^\.?\d/)) { return new Number(tok); } else if (tok.match(/^[\w$]/)) { return new Variable(tok); } ...
[ "factor() {\n let node\n if (this.token.type === UniqueTokens.ADD.type) {\n const token = this.token\n this.eat('ADD')\n return new UnaryOperator(token.value, this.factor())\n } else if (this.token.type === UniqueTokens.SUB.type) {\n const token = this.token\n this.eat('SUB')\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
ReadTrade returns the trade stored in the world state with given id.
async ReadTrade(ctx, id) { const tradeJSON = await ctx.stub.getState(id); // get the trade from chaincode state if (!tradeJSON || tradeJSON.length === 0) { throw new Error(`The trade ${id} does not exist`); } return tradeJSON.toString(); }
[ "async DeleteTrade(ctx, id) {\n const exists = await this.TradeExists(ctx, id);\n\n if (!exists) {\n throw new Error(`The trade ${id} does not exist`);\n }\n\n return ctx.stub.deleteState(id);\n }", "async ReadOrder(ctx, id) {\n const OrderJSON = await ctx.stub.get...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Moves the ball to the given X and Y position
function moveBallTo(xPosition, yPosition) { ballX = xPosition; ballY = yPosition; ballLastX = xPosition; ballLastY = yPosition; }
[ "function moveBall(){\n\t\tballX += ballXM;\n\t\tballY += ballYM;\n\t}", "function moveBall(x, y) {\r\n ball.css({\r\n left: x,\r\n bottom: y\r\n });\r\n }", "function ballMove() {\n\treadyBall.x += 5;\n\treadyBall.y += 5;\n}", "function updateBallPosition() {\n ball.x += ball.speedX;\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Return the rule stack depth where the nearest error rule can be found. Return FALSE when no error recovery rule was found.
function locateNearestErrorRecoveryRule(state) { var stack_probe = stack.length - 1; var depth = 0; // try to recover from error for (;;) { // check for error recovery rule in this state if (TERROR.toString() in table[state]) { return depth; ...
[ "function locateNearestErrorRecoveryRule(state) {\n var stack_probe = stack.length - 1;\n var depth = 0;\n\n // try to recover from error\n for(;;) {\n // check for error recovery rule in this state\n if ((TERROR.toString()) in table[state]) ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This function takes in the item Index (when used within the map function within the render method). It then compares the current active state against the items index to see if it is already active. If it is set the active state back to null, if not then set the active state to the current item index.
activeSelect(e,itemIndex) { this.state.active === itemIndex ? this.setState({active: null}) : this.setState({active: itemIndex}) }
[ "updateActiveLink() {\n if (!this._items) {\n return;\n }\n const items = this._items.toArray();\n for (let i = 0; i < items.length; i++) {\n if (items[i].active) {\n this.selectedIndex = i;\n this._changeDetectorRef.markForCheck();\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
TODO Build out styles for the portfolio form
render() { return ( <form onSubmit={this.handleSubmit} className="portfolio-form-wrapper"> <div className="two-column"> <input type="text" name="name" placeholder="Portfolio Item Name" value={this.state.name} onChange={this.handleCh...
[ "function portfolioModal(projectID) {\n for (let i=0; i<portfolio.length; i++) {\n if (parseInt(projectID) === parseInt(portfolio[i].projectID)) {\n var project = portfolio[i];\n\n // update project title\n $(\"p.modalTitle\").text(project.projectName);...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Schedules an automated export of the drawing after a certain amount of frames
function scheduleAutoExport(frameNumber, action, additionalText) { if (frameCount === frameNumber) { if (action === "noLoop") { exportDrawing("png", "noLoop", additionalText); } else { exportDrawing("png", "", additionalText); } } }
[ "function saveAsGif() {\n // var count = 0;\n // saveFrames(\"out\", \"png\", 1, frameArray.length, data => {\n // var x = document.createElement(\"IMG\");\n // x.setAttribute(\"src\", data[count].imageData);\n // x.setAttribute(\"width\", \"960\");\n // x.setAttribute(\"height\", \"350\");\n // x....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
For schemauml conversions done with client libraries
async function clientUmlConvert() { setLoading(true); setProgressPercent(20); try { // We do "serverSchemaInfo" first, so that the server validates // the user ShEx before processing anything. We don't use this data though. const schemaInfo = await serverSchemaInfo(); // Get the raw...
[ "function BpmnDiagrams(){//Code conversion for Bpmn Shapes\n//Start Region\n/** @private */this.annotationObjects={};//constructs the BpmnDiagrams module\n}", "function convertOutMesgStyles(){\n\n }", "function convertInMesgStyles(){\n\n }", "function getModelXML2() {\n\tvar enc = new mxCodec();\n\tv...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Filters a previously found list of items to ones without the given property set to one of the the given values (or without the given property altogether).
without(prop, ...val) { if (this.lastResult === false) return this; //do nothing if (!this.workingList || !this.workingList.length) { this.lastResult = false; return this; } if (val.length === 1 && Array.isArray(val[0])) val = val[0]; let props = prop.split('.'); let vals = new Set(val); let list = ...
[ "function excludeItems2(items, excludes) {\n return excludes.reduce((arr, pair) => arr.filter(item => item[pair.k] !== pair.v), items);\n}", "function where(list, properties) {\n \n return filter(list, function(obj){\n \n for(var p in properties){\n \n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets or Sets the preferred width type for selected table.
get preferredWidthType() { return this.preferredWidthTypeIn; }
[ "@api\n tableWidth() {\n this._tableWidth = JSON.parse(\n JSON.stringify(super.widthsData.tableWidth)\n );\n return this._tableWidth;\n }", "get preferredWidth() {\n return this.preferredWidthIn;\n }", "get width() {\n return findElement(this, 'table').offsetWi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
slice through points at given Z and return polygons
async slice(zs, options) { const opt = this.setOptions(options); if (!Array.isArray(zs)) { throw "slice zs parameter must be ab array"; } // sort Z and offset when on a flat const flatoff = util.numOrDefault(opt.flatoff, 0.01); zs = zs.sort((a,b) => a-b).map...
[ "slice(sliceZ) {\n\t\tlet slicedVertices = [];\n\t\tlet intersectionVertex = null;\n\t\tfor (let i = 0; i < this.vertices.length; i++) {\n\t\t\t// If a vertex is behind the image plane, then it doesn't appear\n\t\t\t// on the image plane. However, line segments connected to that\n\t\t\t// vertex could still appear ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Update buttons for a given slider
function updateButtons($slides){ var buttonsEl = $slides.get(0).parentElement.previousElementSibling; var margin = (parseInt($slides.css('marginLeft')) * -1); var width = parseInt($slides.css('width')); var $prevButton = $(buttonsEl.children[0]); var $nextButton = $(buttonsEl.children[1]); if ...
[ "function updateButtons () {\n\n self.$btnItems.each(function (index) {\n\n var $this = $(this),\n $button = $this.find('button'),\n $percent = $this.find('.percent'),\n voteTotal = getTotalVotes(),\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Validate temporary form on dashboard to get user presence
function validate_dashboard_presence() { var form = get_form_data('#check_presence_form'); if (check_field_empty(form.user_nick, 'User nick')) return false; var dataObj = { "content" : [ { "session_id" : get_cookie() }, { "nick" : form.user_nick } ] ...
[ "function landingExistingUserSubmit () {\n\t\t\tGLOB.clientRef.push( { \n\t\t\t\t\"msgType\": \"landingExistingUserForm\",\n\t\t\t\t\"passcode\" : $('#landingExistingUserPasscode').val(),\n\t\t\t\t\"TOSCheckbox\" : $('#landingExistingUserTOSCheckbox').prop( \"checked\" )\n\t\t\t} ); \n\t\t\t// Disable user control...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Does the filter observe an acceptedPackets parameter?
get hasAcceptedPackets() { return this.hasOwnProperty('acceptedPackets'); }
[ "function printDiscardedPackets() {\n console.log(discardedPackets);\n}", "get didReceiveChange()\n {\n for (let i=0; i<this.receiveCompareBuffer.length; i++)\n {\n if (this.receiveCompareBuffer[i] != this.receivePacket._buffer[i])\n return true;\n }\n r...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Updates the window history with the current view for SPA mode
function updatePushStateWithCurrentView() { if (!isSpa() || isNative()) {return;} let current_view = getUrlInputParameter("view"); if (current_view !== null) { window.history.pushState(root_history_index, null, getServerRootPath()+'?view='+current_view); window.history.replaceState(root_history_index, null, loca...
[ "function _updateWindowState() {\n\n window.history.replaceState({},\n 'MainWindow',\n window.location.pathname + \"?\" + UrlParams.toString());\n }", "updateHistoryState() {\n if (this.getContext() && this.getContext().isC...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
12) Unique pay hours
function payHoursCounter() { var uniqueHours = ["Generic Name"]; for (var i = 0; i < dataArray.length; i++) { for (var j = 0; j < uniqueHours.length; j++) { if (uniqueHours[j] == dataArray[i].properties.PAY_POLICY) { break; } if (j == uniqueHours.len...
[ "function setHours() {\n if (hourNow >=11) {\n hour = hourNow - 12\n }\n else {\n hour = hourNow;\n }\n if (minNow > 30) {\n\t\thour++;\n }\n return arrHours[hour];\n}", "function noPayHoursCounter() {\n\n var uniqueHours = [\"Generic Name\"];\n\n for (var i = 0; i < dataArray.length; i++) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets an article record from a server and processes it to html according to the value of the forEdit parameter. Assumes existence of the urlBase global variable with the base of the server url (e.g. " availability of the Mustache.render() function and Mustache templates with id="templatearticle" (if forEdit=false) and i...
function fetchAndProcessArticle(targetElm, artIdFromHash, offsetFromHash, totalCountFromHash,forEdit) { const url = `${urlBase}/article/${artIdFromHash}`; fetch(url) .then(response =>{ if(response.ok){ return response.json(); }else{ //if we get server erro...
[ "function fetchAndProcessArticle(targetElm, artIdFromHash, offsetFromHash, totalCountFromHash,forEdit) {\r\n const url = `${urlBase}/article/${artIdFromHash}`;\r\n\r\n fetch(url)\r\n .then(response =>{\r\n if(response.ok){\r\n return response.json();\r\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Compiles svg sprite sheet
function compileSprite() { build.logger('Building icons sprite', '[Started]', 'Adding SVG sources'); const SVG = new SVGSprite(spriteConfig); addIconFiles(SVG); SVG.compile(processCompile); build.logger( 'Building icons sprite', '[Finished]', build.cLog(`Check: ${iconsOutputPath}`, 'info') ); ...
[ "function sprite() {\n return gulp.src('.temp/icons/**/*.svg',)\n .pipe(svgSprite({\n mode: {\n symbol: {\n // inline: true,\n // prefix: '#Icon-XYZ', \n example: false,\n sprite: 'sprite.svg',\n dest: ''\n }\n }\n }))\n .pipe(gulp.dest(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Return an SVG path displaying the given histogram arr, with width being per element and height being the total height of the graph.
function sparkLinePath(arr, width, height) { var max = 0; for (var i = 0; i < arr.length; i++) { if (arr[i] > max) max = arr[i]; } var scale = max > 0 ? height / max : 1; // Full documentation here: https://www.w3.org/TR/SVG/paths.html#PathData // Basics: // 0,0 is the top left corner // Comm...
[ "function appendSvg(div) {\n return d3.select(div.get(0)).append('svg')\n .selectAll('div')\n .data(self.binCounts)\n .enter()\n .append('rect')\n .attr('y', function(d) { return height - d / yScale; })\n .attr('height', function(d) { return d / yScale; })\n .at...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Internal implementation of the `resetStyleDomains` method.
_resetStyleDomains() {}
[ "resetStyleDomains() {\n this.__notify(EV.BEFORE_STYLE_DOMAINS_RESET);\n this._resetStyleDomains();\n this.__notify(EV.STYLE_DOMAINS_RESET);\n\n return this;\n }", "resetDomains() {\n this.$rootScope.$broadcast(this.events.tabDomainsRefresh);\n }", "reset() {\n this.setDomainFilt...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Model for a "History" element : primary key'd by (username, recipe_name, dateCreated) Also Model for "Rating" element, primary key'd by username, recipe_name, rating
function HistoryModel(username, recipe_name, datecreated, rating){ this.username = username; this.recipe_name = recipe_name; this.datecreated = datecreated; this.connection = null; this.parser = null; this.sortField = null; this.sortBy = null; this.limit = null; this.fields = {"...
[ "function HistoryModel(){\n // hash of items, Key: id, Value: Item\n this.item_map = {};\n // Current results per page\n this.pageSize = 150;\n }", "function RatingModel(username, recipe_name, rating){\n this.username = username;\n this.recipe_name = recipe_name;\n this.rating = ra...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Renders the AWS CloudFormation properties of an `AWS::CodeDeploy::DeploymentGroup.LoadBalancerInfo` resource
function cfnDeploymentGroupLoadBalancerInfoPropertyToCloudFormation(properties) { if (!cdk.canInspect(properties)) { return properties; } CfnDeploymentGroup_LoadBalancerInfoPropertyValidator(properties).assertSuccess(); return { ElbInfoList: cdk.listMapper(cfnDeploymentGroupELBInfoProper...
[ "function loadBalancerResourcePropsToCloudFormation(properties) {\n if (!cdk.canInspect(properties)) {\n return properties;\n }\n LoadBalancerResourcePropsValidator(properties).assertSuccess();\n return {\n Listeners: cdk.listMapper(loadBalancerResourceListenersProp...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get sidebar css selectors
function getCssSelectors() { const selectors = [ { id: 'root', classList: ['root'], lvl: 0, children: [] } ] const rootEl = document.getElementById('root') const walker = (nodes, selectors) => { for (let node of nodes) { if (node.nodeType !== 1) continue if (node.tagName === 'use') continue...
[ "_querySelectors() {\r\n\t\t// Container\r\n\t\tthis.sideBar = $('#side-bar');\r\n\r\n\t\t// Step Options\r\n\t\tthis.editSideOptions = $('#edit-side-options');\r\n\t\tthis.colorSchemeContent = $('#color-scheme-content');\r\n\t\tthis.fontStyleContent = $('#font-style-content');\r\n\t\tthis.navigationContent = $('#n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
normalize to and update document hidden property
function updateState() { if (property !== 'hidden') { document.hidden = $support.pageVisibility ? document[property] : undefined; } }
[ "_updateInternalProperties() {\n this.selection = AutoNumericHelper.getElementSelection(this.domElement);\n this.processed = false;\n }", "function setHiddenProp(target, prop, value) {\n\t if (!Object.hasOwnProperty.call(target, prop)) {\n\t Object.defineProperty(target, prop, {\n\t enum...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function to edit td data on click.
function editTableData(event) { // event.preventDefault(); // event.stopPropagation(); this.textContent = prompt("Edit this cell:"); }
[ "function inlineEdit() {\n\t$(\"td\").on('dblclick', function (event) {\n\t\t$(this).prop('contenteditable', true);\n\t});\n}", "function ad_clickEditCell(_tableId, _item, _path) {\n console.log('ad_clickEditCell: path = ' + _path + ', item = ' + _item); \n \n let table = document.getElementById(_tableId);\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
functon finds entity with OSC message and returns the OSC messsage back
function sendOSCMessage(component, address, tag, args) { var osc_message = component.el.components['osc-lookup'].parse(address, tag, args); component.el.components['osc-manager'].send(osc_message); console.log(osc_message) }
[ "findMessageById(num){\n return this.messages.get(num)\n \n }", "function findMessage(message){\n for(var i = 0; i < service.messages.length; i++) { \n if(service.messages[i].data == message.data){\n return i;\n }\n \n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Configure the chart model with the passed options
function configure(chart, options, chartType){ if (chart && options){ angular.forEach(chart, function(value, key){ if (key[0] === '_'); else if (key === 'dispatch') { i...
[ "function chartOptions() {\n\n\t\t// Options\n\t\tvar options = {\n\t\t\tdefaults: {\n\t\t\t\tglobal: {\n\t\t\t\t\tresponsive: true,\n\t\t\t\t\tmaintainAspectRatio: false,\n\t\t\t\t\tdefaultColor: (mode == 'dark') ? colors.gray[700] : colors.gray[600],\n\t\t\t\t\tdefaultFontColor: (mode == 'dark') ? colors.gray[700...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
changeSpot 1. Create an interver : true, 2. Edit an interview : false
function bookInterview(id, interview, changeSpot) { const appointment = { ...state.appointments[id], interview: { ...interview } //Appointment/index.js function save -> const interview = {student: name, interviewer} }; const appointments = { ...state.appointments, [id]: appoint...
[ "function bookInterview(id, interview,update) {\n //Updates local state\n const appointment = {\n ...state.appointments[id],\n interview: { ...interview }\n };\n const appointments = {\n ...state.appointments,\n [id]: appointment\n };\n setState({\n ...state,\n appointments\n });\n if(upda...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Reads a partial from a file and register it.
registerPartialFromFile(name, file) { this.registerPartial(name, new fs.File(file).text); }
[ "registerPartialFromFile(name, file) {\n this.registerPartial(name, new fs.File(this.src, file).text);\n }", "function readPartial(partial) {\n var p = partial.replace(/_/g, '/') + '.html',\n content = '';\n\n try {\n content = fs.readFileSync(p, 'utf8');\n } catch(e) {\n log.error(e);\n task.h...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Inserts the masthead main ICON links into the masthead (inside a rightfloat container), and moves the search div into the container also. Also caches the signin icon selector for updating with user state.
function addIconsToMasthead () { // Add the new right-align container and put the icons and the search container into it. mastheadLinklist.iconsonly.$el = $('<div class="ibm-masthead-rightside">'+ mastheadLinklist.iconsonly.html + '</div>').prepend($("#ibm-search-module")).insertAfter("#ibm-menu-links"); $profile...
[ "function addIconBar(movie_id, movie_title, movie_title_orig) {\r\n var iconbar;\r\n if ($('[class^=TitleBlock__TitleContainer]').length) {\r\n iconbar = getIconsLinkArea();\r\n // reference + remove \"Reference View\" txt and a link to settings\r\n } else if ($('.titlereference-header div script').length) {...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
> false E. getTwoLengths Write a function getTwoLengths that accepts two parameters (strings). The function should return an array of numbers where each number is the length of the corresponding string. console.log(getTwoLengths("Hank", "Hippopopalous")); => [4, 13]
function getTwoLengths(str1,str2){ let strLengths = []; strLengths.push(str1.length, str2.length); return strLengths; }
[ "function getTwoLengths(str1,str2){\n return [str1.length,str2.length];\n }", "function getTwoLengths(string1, string2) {\n length1= string1.length;\n length2 = string2.length;\n console.log([length1, length2])\n}", "function wordLengths(str){\n // TODO: your code here \n var string1 = str.split(\" \...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Functions get a random index for an array from 0 to maxIndex (not inclusive)
function getRandomIndex(maxIndex) { return Math.floor(Math.random() * maxIndex); }
[ "function getRandomIndex(maxIndex) {\n\treturn Math.floor(Math.random() * maxIndex);\n}", "getRandomIndex() {\n\t\treturn Math.floor(Math.random() * (indexArr.length - 1));\n\t}", "getRandomIndex(min, max) {\n return Math.floor(Math.random() * (max - min + 1) + min);\n }", "function getRandomIndex(usedInd...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns a function that updates state for the field, tracked by fieldName
function setFieldState(fieldName) { return (newValue, newError) => { interactedWith = true // Reset form errors if they exist setFormErrorState('') // Update values state setFieldValuesState((fieldValuesStatePrevious) => ({ ...fieldValuesStatePrevious, [fieldName]: ne...
[ "update(field) {\n\t\treturn e => this.setState({\n\t\t\t[field]: e.currentTarget.value\n\t\t});\n\t}", "updateField(value, field) {\n // here we are creating a new copy of the state so that we aren't mutating the state before we\n // update it\n const newState = Object.assign({}, this.state);\n\n // ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
The actual callout called by Electron to handle spellchecking
handleElectronSpellCheck(text) { if (!this.currentSpellchecker) return true; if (isMac) { return !this.isMisspelled(text); } this.spellCheckInvoked.next(true); let result = this.isMisspelled(text); if (result) this.spellingErrorOccurred.next(text); return !result; }
[ "enableSpellCheck() {\n\t\tthis.mainWindow.webContents.on('context-menu', (event, params) => {\n\t\t\tconst menu = new Menu();\n\n\t\t\tif (\n\t\t\t\tparams.dictionarySuggestions != null &&\n\t\t\t\tparams.dictionarySuggestions.length > 0\n\t\t\t) {\n\t\t\t\t// Add each spelling suggestion\n\t\t\t\tfor (const sugge...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Find Cart Line Item By Variant Id ============================================================
function findCartItemByVariantId(variantId) { return cart.lineItems.filter(function (item) { return item.variant_id == variantId; })[0]; }
[ "function findCartItemByVariantId(variantId) {\n return cart.lineItems.filter(function (item) {\n console.log(item.variant_id, variantId)\n return (item.variant_id === variantId);\n })[0];\n}", "function findCartItemByVariantId(variantId,props) {\r\n return cart.lineItems.filter(function (item) {\r\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
updateDescribe() updates the describe property of state
updateDescribe(describe){ this.setState({describe: describe}) }
[ "function updateTags(){\n\tWRAP_STATE.describeTags = WRAP_STATE.tagStack.reduce(function(a, b){\n\t\treturn a.concat(b);\n\t}, []);\n\tWRAP_STATE.hasDescribeTags = (WRAP_OPTIONS.tagsAny)? \n\t\thasAnyTags(WRAP_STATE.describeTags): \n\t\thasAllTags(WRAP_STATE.describeTags);\n}", "async updateState(state) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
saves credentials of the login form
function saveCredentials() { var username = document.getElementById("username").value; var password = document.getElementById("password").value; var creds = { user: username, pass: password }; var store = JSON.stringify(creds); localStorage.setItem("AtmosphereLogin", store); }
[ "function save() {\n window.localStorage.login = getElementById(\"login\").value;\n window.localStorage.pswd = getElementById(\"password\").value;\n }", "function saveCredentials(){\n localStorage.setItem(\"userAuthenticated\", userAuthenticated);\n localStorage.setItem(\"us...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Attaches a policy to this role.
attachInlinePolicy(policy) { try { jsiiDeprecationWarnings.aws_cdk_lib_aws_iam_Policy(policy); } catch (error) { if (process.env.JSII_DEBUG !== "1" && error.name === "DeprecationError") { Error.captureStackTrace(error, this.attachInlinePolicy); ...
[ "addToRolePolicy(statement) {\n this.role.addToPolicy(statement);\n }", "attachInlinePolicy(policy) {\n this.attachedPolicies.attach(policy);\n policy.attachToRole(this);\n }", "addToRolePolicy(statement) {\n if (!this.role) {\n return;\n }\n this.role....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates a mediasoup Consumer for the given mediasoup Producer.
async _createConsumer({ consumerPeer, producerPeer, producer }) { logger.debug( '_createConsumer() [consumerPeer:"%s", producerPeer:"%s", producer:"%s"]', consumerPeer.id, producerPeer.id, producer.id ); const router = this._mediasoupRouters.get(producerPeer.routerId); // Optimization: // - Cre...
[ "function producer() {\n var Producer = vrt.producer.constructor;\n return (new Producer(require('../package.json').configure.consumer)).start();\n}", "async createConsumer(consumer_transport_id, producer_id, rtpCapabilities) {\n let consumerTransport = this.transports.get(consumer_transport_id)\n\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
takes a username and a movie, user: String, movie: Object puts the movie into user.watched
function insertMovieIntoWatched(user, movie) { findOne(user, function (err, account) { if (err) throw err; console.log('this user is', user) account.watched.unshift(movie); account.save(); // console.log(account.watched); // console.log('adding movie: ', movie) // console.log('to Watched ...
[ "function addWatched(user, video) {\n user.watched.push(video)\n userService.update(user.id, user)\n .then(function (response) {\n dataVm.user = response;\n }, function (error) {\n console.log(error);\n });\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Create and append the pagination links Creating a function that can do this is a good approach The setPageLinks uses the getPageCount to get an updated count for how many pages is needed. This is then used to genereate the button elements and append them to the right elements.
function setPageLinks() { //clears Button div $(buttonsUl).empty(); getPageCount(); for (var i = 1; i <= pageCount; i++) { let buttonLi = document.createElement('li'); let buttonLink = document.createElement('a'); buttonLink.href = '#'; buttonLink.textContent = i; //Append the a element to ...
[ "function appendPageLinks() {\r\n // Remove all page link items\r\n while (paginationButtonUL.firstChild) {\r\n paginationButtonUL.removeChild(paginationButtonUL.firstChild);\r\n }\r\n // Refresh the page links with the current page activated.\r\n for (let i = 1; i <= currentPageCount; i++) {\r\n const p...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
hides the easy nums after the time dictated in the functions above.
function hideKey() { $numberDisplay.addClass('hiddener'); }
[ "function hideNumbers(){\n\t\t\n\t\tif(g_objNumbers)\n\t\t\tg_objNumbers.stop().fadeTo(g_temp.fadeDuration, 0);\n\t}", "function unEditableNumberShow() { \n\tclearStyle();\n\tfor (let i = 0; i < 9; i++) {\n\t\tfor (let j = 0; j < 9; j++) {\n\t\t\tif (arrayBackUp[i][j] > 0) {\n\t\t\t\tel(\"#c\" + i + j).style.colo...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Metodo para registrar al vehiculo
function registrar() { let btnRegistrar = document.getElementById("btnRegistrar"); let cliente = document.getElementById("cboCliente").value; let vehiculo = document.getElementById("cboVehiculo").value; let serie = document.getElementById("txtSerie").value; let numero = document.getElementById("tx...
[ "function registrar () {\r\n var inicio = Date.now(); // almacenar hora actual de la maquina en miliseg\r\n var placaReg = document.getElementById(\"placas\"); // almacena input de placas\r\n placas1.push(new vehiculo(placaReg.value, inicio, 0)); \r\n // almacena el valor de lo que está dentro de la pla...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Insert props block in state
componentWillReceiveProps(props) { this.setState(...this.state, { block: props.block }); }
[ "handleAddAdditionalProperties() {\n this.setState((cState) => ({\n additionalProperties: [\n ...cState.additionalProperties,\n {\n key: '',\n value: '',\n },\n ],\n }));\n }", "modifyBlock(iB...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Configure throttling, if maxTPS is set
_configureThrottling() { if (this.options.maxTPS && this.options.maxTPS > 0) { const minTime = parseInt(1000 / this.options.maxTPS); if (minTime > 0) { this.rate_limiter = new Bottleneck({ minTime }); this._processMatchedSqsMessage = this.rate_limiter.wrap...
[ "function Throttling() {\n /**\n * 上一次的执行时间\n *\n * @type {number}\n * @memberof Throttling\n */\n this.last_time = null;\n /**\n * 执行的时间间隔\n *\n * @private\n * @type {number}...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Render attachments list and attach event handlers1 Assumes mediaList is already populated
function renderAttachmentsList() { var i, html = '', dnLinkStart, dnLinkEnd, item, imgUrl, shortName, descStr; Y.log('Loaded data on ' + mediaList.length + ' attached files', 'info', NAME); // inj...
[ "function renderAttachmentsList() {\n\n var\n defaultExists = false,\n html = '<option value=\"\"></option>',\n i;\n\n for (i = 0; i < mediaList.length; i++) {\n html = html + '<option value=\"' + mediaList[i]._id + '\">' + mediaList[i].name + '</option>';\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns a formatted version of the duration, which is assumed to be no longer than ~hours.
formatDuration(duration) { const hours = Math.floor(duration / 3600); const minutes = Math.floor(duration / 60) % 60; const seconds = duration % 60; return `${hours}:${('0' + minutes).substr(-2)}:${('0' + seconds).substr(-2)}`; }
[ "function formatDuration(duration) {\r\n const digits = [];\r\n digits.push(duration.hours ? helpers_1.padTimeNumber(duration.hours) : '00');\r\n digits.push(duration.minutes ? helpers_1.padTimeNumber(duration.minutes) : '00');\r\n digits.push(duration.seconds ? helpers_1.padTimeNumber(duration.seconds)...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates a PCS (Points Cloud System) object
function PointsCloudSystem(name, pointSize, scene, options) { /** * The PCS array of cloud point objects. Just access each particle as with any classic array. * Example : var p = SPS.particles[i]; */ this.particles = new Array(); /** * The PCS total number o...
[ "function createPisces(options) {\n var id = '';\n if (typeof options === 'string') {\n id = options;\n }\n // resuse instance if id option specified\n if (id) {\n return pisces.ctx.cache(id);\n }\n // or create new pisces instance\n return new Pisces(options);\n }", "function P...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Define a callback for the onEnd event
onEnd(callback) { this.onEndCallback = callback; }
[ "onEnd (callback){\r\n this.onEndHandler = callback;\r\n }", "onEnd () {}", "onend() {\n if (this.done)\n return;\n this.done = true;\n this.parser = null;\n this.handleCallback(null);\n }", "onCloseEnd() { }", "function End () {}", "function EndListener...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Helper function for generating one new temporary name. If isLbl is true, the new name is to be used as a label and should not be entered into the tmps array.
function genTmp(isLbl) { var name = tmp_prefix + (tmpCount++); if(!isLbl) tmps[tmps.length] = new ast.VariableDeclarator(new ast.Identifier(name), null); return name; }
[ "function createName() {\n return [randomIndex(firstName), randomIndex(lastName)].join(\" \");\n }", "function createTempVariable(recordTempVariable) {\n var name = createIdentifier(\"\");\n name.autoGenerateKind = 1 /* Auto */;\n name.autoGenerateId = nextAutoGenerateId;\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Applies all the plugins to the display data
applyPlugins() { if (!this.isAttached || !this.data) { return; } let localData = this.getDataCopy(); if (this.hasFilter()) { localData = this.doFilter(localData); } if (this.sortKey && this.sortOrder !== 0) { this.doSort(localData, t...
[ "function renderPlugins() {\n // Display and hide position types\n dispatchPositionOptions();\n\n // Check Locale Autodetect status\n checkIntegrationLocaleAutodetect();\n\n // Render form plugins\n EsatChromeExtension.Forms.renderPlugins();\n\n updateQuestionnaireSe...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Add the passed address data to the address array for look up later.
function addToAddresses(address, publicKey, privateKey) { addresses.push(new addressRec(address, publicKey, privateKey)); }
[ "function appendAddressData(data, address) {\n var foundAddress = addresses.find(function (element) {\n return element.address === address;\n });\n\n if (foundAddress) {\n data.address = foundAddress.address;\n data.private = foundAddress.privateKey;\n data.public = foundAddress...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Buscar al vehiculo por su PLACA
function buscarVehiculo(cplaca) { let resultado = baseVehiculo.filter(fila => fila.placa == cplaca); for (const vehiculo of resultado) { return vehiculo; } }
[ "function vehiculoMasCaro(vehiculos){\n let masCaro = vehiculos[0] , i = 0;\n let num = vehiculos.length;\n while(vehiculos.length-1>i){\n if(masCaro.precio <= vehiculos[i].precio){\n masCaro = vehiculos[i];\n }\n i++;\n }\n return masCaro;\n}", "filtrarResultados(re...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Check a string whether consists of halfcorner characters.
function isHalfCorner(str) { for(var i=0;i<str.length;i++) { if(!isHalfCornerChar(str.charAt(i))) return false; } return true; }
[ "function isHalfLetterEx(strSub)\n{\n\t/*if ((char < 'a' || char > 'z') && (char <'A' || char > 'Z'))\n\t{\n\t\treturn false;\n\t}*/\n\tif( !(strSub<=\"~\" && strSub>=\" \") ||\n\t\t\t strSub==\"'\" ||\n\t\t\t strSub==\"%\" ||\n\t\t\t strSub==\"?\")\n\t{\n\t\treturn false;\n\t}\n\treturn true;\n}", "function c...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Delete a specific beta build localization associated with a build.
function deleteBetaBuildLocalization(api, id) { return api_1.DELETE(api, `/betaBuildLocalizations/${id}`) }
[ "function deleteBetaAppLocalization(api, id) {\n return api_1.DELETE(api, `/betaAppLocalizations/${id}`)\n}", "function getBuildIDForBetaBuildLocalization(api, id) {\n return api_1.GET(api, `/betaBuildLocalizations/${id}/relationships/build`)\n}", "function removeAccessForBetaGroupsForBuild(api, id, body)...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Display a list of links to authors
author() { const author = this.props.notice.AUTR; if (!author) { return null; } // Split authors and create links to both single author and all authors. if (author.match(/;/)) { const links = author .split(";") .map(a => a.trim()) .map(a => ( <a href={`/...
[ "authors() {\n const authors = this.state.notice.AUTR;\n if (!authors || !Array.isArray(authors) || !authors.length) {\n return <div />;\n }\n const links = authors\n .map(a => a.trim())\n .map(a => (\n <a href={`/search/list?auteur=[\"${a}\"]`} key={a}>\n {a}\n </a...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
al hacer click dentro del canvas dibuja un circulo rojo y lo une con el anterior si es que existe
function clickCanvas(e){ if(cerrado == false){ var eX = e.layerX; var eY = e.layerY; let circulo = new Circulo(eX, eY, 10, "0", "100%", 50, false); circulo.dibujarCirculo(); poligono.addCirculo(circulo); poligono.trazarLinea(eX, eY); console.log("Coordenada en x: " + eX); console.log("Coordenada en y:...
[ "function clicCanvas(e){\n\t// position de la souris / document\n\tvar xSourisDocument = e.pageX; \n var ySourisDocument = e.pageY;\n\t// position du canvas / document\n\tvar xCanvas = monCanvas.offsetLeft;\n\tvar yCanvas = monCanvas.offsetTop;\n\t// position du clic / canvas\n\txSourisCanvas = xSourisDocument -...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Write a function called partition which accepts an array and a callback and returns an array with two arrays inside of it. The partition function should run the callback function on each value in the array and if the result of the callback function at that specific value is true, the value should be placed in the first...
function partition(arr, callback) { return arr.reduce(function(acc, next){ if(callback(next)) { acc[0].push(next); } else { acc[1].push(next); } return acc; }, [[],[]]) }
[ "function partition(arr, partitioner) {\n let newArr = [];\n let trueArr = [];\n let falseArr = [];\n for (let i = 0; i < arr.length; i++) {\n if (partitioner(arr[i], i, arr) === true) {\n trueArr.push(arr[i])\n } else {\n falseArr.push(arr[i])\n }\n }\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
All possilble pairwise combos from a list
function combinations (list) { var i, j, l = list.length, combos = []; if (0 === l) { return combos; } // i is the main index we are looping over // j is the index of the paired items we are looping over i = l - 1; while (i + 1) { ...
[ "function combinations(list){\n var combinations = []; //All combinations\n var combination = []; //Single combination\n var quantity = (1 << list.length);\n for (var i = 0; i < quantity ; i++){\n combination = [];\n for (var j=0;j<list.length;j++) {\n if ((i & (1 << j))){ \n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Checks whether a passed character is a numeral.
function isNumeral(ch) { const Ascii_0 = 48; const Ascii_9 = 57; let code = ch.charCodeAt(0); return Ascii_0 <= code && code <= Ascii_9; }
[ "function isNumber(character){\n return !isNaN(character);\n}", "function isNumber(char) {\n\t\treturn !isNaN(Number(char));\n\t}", "function isDigit(character)\n{\n return (1 == character.length) && (!isNaN(parseInt(character), 10));\n}", "function is_digit(char) {\n return /[0-9]/i.test(char);\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Set the type of all textblocks (partly) between `from` and `to` to the given node type with the given attributes.
setBlockType(from2, to = from2, type, attrs = null) { setBlockType$1(this, from2, to, type, attrs); return this; }
[ "function setBlockType(nodeType, attrs) {\n return function (state, dispatch) {\n var ref = state.selection;\n var from = ref.from;\n var to = ref.to;\n var applicable = false;\n state.doc.nodesBetween(from, to, function (node, pos) {\n if (applicable) {\n return false;\n }\n\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates a new grid. Loops through layer fields and creates grid columns Grid with selection and columnhider extensions
function createGrid(fields) { var columns = fields.filter(function(field, i) { if (gridFields.indexOf(field.name) !== -1) { return field; } }).map(function(field) { if (field.name === "APN" || field.name === "JURISDICTION" || field.nam...
[ "function createBuildingFeatureGridPanel() {\n\t\t\t//retrieve the entities from the building datasource\n\t\t\tvar entities = buildingsDataSource.entities\n\t\t\t//create store\n\t\t\tvar entityStore = Ext.create('CesiumExt.data.store.EntityStore', {\n\t\t\t\tcesiumEntityCollection: entities\n\t\t\t});\n\t\t\t\n\t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Postbattle check Give rewards, experience, etc.
postBattleState(params) { const { battle, enemy } = params; this.screen.switchScreen(GameState.postBattle); const experience = enemy.experience; store.dispatch(receiveExperience('player', experience)); // generate an appropriate reward and emit reward data const item = Item.createRandomItem(...
[ "function C012_AfterClass_Amanda_TestSubmit() {\n\tif (Common_PlayerOwner != \"\") {\n\t\tOverridenIntroText = GetText(\"AlreadyOwned\");\n\t} else {\n\t\tif (ActorIsRestrained()) {\n\t\t\tOverridenIntroText = GetText(\"UnrestrainFirst\");\n\t\t} else {\n\t\t\tif (ActorIsChaste()) {\n\t\t\t\tOverridenIntroText = Ge...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Give an array of objects, sort by one of the keys in the object
function sortArrayByObjectKey( options, array ) { let defaultSettings = { type: 'quick', order: 'ascend', objectKey: '', secondObjectKey: '' }; let settings = Object.assign( defaultSettings, options ); let obj...
[ "function sortArrayOfObjects(array, firstProp, secondProp) {\r\n array.sort(function (a, b) {\r\n if (a.firstProp > b.firstProp) {\r\n return 1;\r\n }\r\n else if (a.firstProp < b.firstProp) {\r\n return -1;\r\n }\r\n else if (a.secondProp > b.secondProp) ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Add event to Redis stream
stream() { if (!redis.isConnected){ throw Error('Failed to stream event. DB disconnected'); } this.logger.log(`Streaming new event "${this.message}" at ${moment(this.timestamp).format('YYYY-MM-DD HH:mm:ss.SSS')}`); redis.addToQueue(config.EVENTS_STREAM_NAME, null, ['timesta...
[ "addEvent(e) {\n this.stream.addEvent(e);\n }", "addEvent(event) {\n // call write repo to save to event store\n writeRepo.enqueueEvent(event, function(offset) {\n handler.sendEvent(event, offset);\n });\n }", "addEvent(event) {\n // call write repo to save to event store\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This is the file where you will write the Truncate Words function and related code.
function truncateWords(longText, numWords) { var truncatedText = longText // Split string by space to get array of words. var words = longText.split(" "); // Calculate how many words need to be removed. var countWordsInText = words.length; var countWordsToRemove = countWordsInText - numWords; ...
[ "function truncateWords(originalText, wordLimit) { // function that truncates string of words at inputed index value number and outputs remaining words with ellipses to signal truncation. Also ouputs orginial text inputed and the word count used for truncation.\n \"use strict\";\n if (wordLimit == undefined)\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Show search history on sidebar
function history() { sidebar.toggleHistory(); }
[ "function showRevHistorySidebar() {\n var ui = HtmlService.createHtmlOutputFromFile('RevisionsSidebar')\n .setTitle('Revision history');\n SpreadsheetApp.getUi().showSidebar(ui);\n}", "function createSidebarFromHistory() {\n\tgetCityWeatherAndForecastByName(searchHistory[searchHistory.length - 1]);\n\tsear...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
groupByWord group words together using nest. Used to get counts for barcharts.
function groupByWord(words) { return d3.nest() .key(function (d) { return d.word; }) .rollup(function (v) { return v.length; }) .entries(words) .sort(function (a, b) {return b.value - a.value;}); }
[ "function groupByWord(words) {\n return d3.nest()\n .key(function (d) { return d.word; })\n .rollup(function (v) { return v.length; })\n .entries(words)\n .sort(function (a, b) { return b.value - a.value; });\n }", "function groupByWord(words) {\n return d3.nest()\n .key(function(d...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
ajax handlers / / handler_ajax_populate_forms() / populate form drop down list with data / from request
function handler_ajax_populate_forms(){ if(xmlHttp.readyState == 4 && xmlHttp.status == 200){ populate_list_from_xml(xmlHttp.responseText, 'form_list'); } }
[ "function ajax_populate_forms(){\n\tcreate_http_request();\n\tvar post_params = \"ajax_action=get_form_list\";\n\t// call method to sent the request\n\tsend_http_request(handler_ajax_populate_forms, \"POST\", target_url, post_params);\n}", "function ajax_populate_spec_field(){\n\tcreate_http_request();\n\tvar typ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Set table left column fixed
function fixLeft() { var table = $(settings.table); // var fixColumn = settings.left; settings.leftColumns = $(); var tr = table.find("tr"); tr.each(function (k, row) { solverLeftColspan(row, function (cell) { ...
[ "function fixLeft () {\n\t\t\tvar rows = $(settings.table).find(\"tr\");\n\t\t\tvar collect = $();\n\n\t\t\trows.each(function(k, r) {\n\t\t\t\tsolveLeftColspan(r, function(cell) {\n\t\t\t\t\tcollect = collect.add(cell);\n\t\t\t\t});\n\t\t\t});\n\n\t\t\tif(collect.length > 0) {\n\t\t\t\tcollect.css('position', 'rel...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Leaves all voice channels
function leave_voice(channels, message) { var voice_channels = channels.findAll('type', 'voice'); voice_channels.forEach(function(voice_channel, index, array) { voice_channel.leave(); }); }
[ "function leaveChannels() {\n Howl.get('channels').map(Howl.leave)\n}", "clearChannels() {\n for (let channel of this.channels) {\n channel.deleteChannel();\n }\n }", "end() {\n for (const dispatcher of this.subscribers) this.delete(dispatcher);\n const index = this.client.v...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
rewrites list of songs on the songnotify page
function refreshSongNotifyPage(query) { var list; var cache; var fn; var args; var acc = []; if (query == "notify") { list = current["event"].songs; cache = cachedSongs; fn = sendNotifications; args = [current["event"].id]; } else { list = cachedB...
[ "function updatePlaylist(){\n\tvar songs = JSON.parse(sessionStorage.getItem(\"songs\"));\n\t$(renderPlaylist(songs));\n}", "function addSongsToViewMusic() {\n songHolder.innerHTML = \"\";\n for (var i = 0; i < songs.length; i++) {\n var currentStringClean = songs[i].replace(/[|;$!%@\"<()+,*]/g, \"\");\n curr...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function to draw HSL circle
function hslCircleDrawing(event){ var imageData = colorCanvas.getContext('2d').getImageData(event.offsetX, event.offsetY, 1, 1); colorCanvas = document.getElementById('color-canvas'); colorctx = colorCanvas.getContext('2d'); //outline white board of HSL circle colorctx.strokeStyle = 'white'; ...
[ "calcHSL() {\r\n let r = this.r/255;\r\n let g = this.g/255;\r\n let b = this.b/255;\r\n let max = Math.max(r, g, b)\r\n let min = Math.min(r, g, b);\r\n let h, s, l = (max + min) / 2;\r\n if(max == min){\r\n h = s = 0; // achromatic\r\n } else {\r\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Used to Decrease Opacity
function decreaseOpacity(ele, del) { var val = 1; var op = setInterval(function () { ele.style.opacity = val; val = val - del; if (val <= 0) { clearInterval(op); } }, 10); }
[ "update() {\n this.alphaFadeOutValue -= 0.05\n }", "function Opacity () {\n this.value = 1;\n this.isActive = false;\n this.dirty = false;\n}", "updateOpacity() {\n // to be overridden by plugins\n }", "function restoreOpacity() {\n $(this).fadeTo(0, 1);\n }", "functio...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
NOTE This method will be responsible for checking if the user has the resources, and if they do increasing the pickaxe purchased count, and decreasing the cheese resources by the appropriate amount.
function BuyPickaxe() { let price = clickUpgrades.pickaxes.price; if (cheese >= price) { cheese -= price; clickUpgrades.pickaxes.quantity++; clickUpgrades.pickaxes.price += Math.floor(price * 0.2); // Updates Rover Items document.getElementById('pickaxe-Count').innerText = clickUpgrades.pickaxes...
[ "function decreaseSupplies()\r\n{\r\n gameVars.ship.supplies -= 0.02*gameVars.ship.supplies;\r\n if(gameVars.ship.supplies <= 1 && gameVars.unlim_game == false)\r\n die(2);\r\n}", "function freeMaxPurchase() {\n\t\t\tgameScript = cc.director.getScene().getChildByName(\"Canvas\").getComponent(\"GameScene\").s...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
infect the spread field of an infected human
function infectInfectedSpreadField(field, perc, map) { field.forEach((coords) => { infect(perc, coords, map); }); }
[ "function infuse(weapons) {\n var mainWeapon = weapons[0];\n weapons.shift();\n weapons.forEach(function (fodder, index, array) {\n var diff = fodder.light - mainWeapon.light;\n if (diff > 0) {\n var threshold = THRESHOLD['main'][mainWeapon.rarity] + THRESHOLD['fodder'][fodder.rari...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
get all public usernames (people in the class, admin and scientists)
async allPublicUsernames(parent, args, ctx, info) { if (!ctx.request.userId) { throw new Error("You must be logged in to do that!"); } const me = await ctx.db.query.profile( { where: { id: ctx.request.userId, }, }, `{ id studentIn { id network{id classes{id...
[ "listUsernames () {\n const users = this._loadUsers()\n return Object.keys(users)\n }", "getUserNames() {\n return this.users.map(user => user.name);\n }", "async allUsernames(parent, args, ctx, info) {\n if (!ctx.request.userId) {\n throw new Error(\"You must be logged in to do that!\"...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Adds a new SP.FieldCalculated to the collection
addCalculated(title, formula, dateFormat, outputType = FieldTypes.Text, properties) { const props = { DateFormat: dateFormat, FieldTypeKind: 17, Formula: formula, OutputType: outputType, }; return this.add(title, "SP.FieldCalculated", extend...
[ "addField (point, mass, decay) {\n this.fields.push (new Field(point, mass, decay));\n return this;\n }", "addField() {\n this.lFields.push(new SField());\n }", "function computeField(fieldName, fieldList, callback){\n fieldList = _.flatten([fieldList]);\n var length = fieldList.length;\n\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }