query
stringlengths
9
34k
document
stringlengths
8
5.39M
negatives
listlengths
19
20
metadata
dict
endregion region Renderer endregion region Events Called when user clicks somewhere in the grid. Expand/collapse node on icon click.
onElementClick(event) { const me = this, target = event.target, cellData = me.grid.getEventData(event); // Checks if click is on node expander icon, then toggles expand/collapse. Also toggles on entire cell if expandOnCellClick is true if ( target.classList.contains('b-tree-expander') || ...
[ "onElementClick(event) {\n const\n me = this,\n target = event.target,\n cellData = me.grid.getCellDataFromEvent(event),\n clickedExpander = target.closest('.b-tree-expander');\n\n // Checks if click is on node expander icon, the...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Create the matrix3d style property from a matrix array
matrixArrayToCssMatrix(array) { return 'matrix3d(' + array.join(',') + ')'; }
[ "function matrix3d(a1, b1, c1, d1, a2, b2, c2, d2, a3, b3, c3, d3, a4, b4, c4, d4) {\n return Object(__WEBPACK_IMPORTED_MODULE_0__utils__[\"a\" /* cssFunction */])('matrix3d', [a1, b1, c1, d1, a2, b2, c2, d2, a3, b3, c3, d3, a4, b4, c4, d4]);\n}", "function convertArrayTo3dMatrix(array) {\n if (array.length...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
hideMenu( topName, index )
function hideMenu( index ) { index = (index == '[object Event]') ? openMenuName : index; var objMenu = objMenuArray.items[index]; objMenu.hide(); }
[ "function hideMainMenu() {\n showHide('main-nav', 0);\n}", "function hideMenus() {\n\tfor (var i =0; i < menus.length; i++) {\n\t\t// There is only a need to hide the Top menus.\n\t\tif (menus[i].mBarTop == \"true\") {\n\t\t\tvar menu = document.getElementById(menus[i].elemId);\n\t\t\tmenu.style.visibility = \...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Attach or Upload Documents for Linking
function linkUploadDoc(selectedItems) { var modalInstance = $modal.open({ templateUrl: 'app/matter/matter-details/link-upload-document/link-upload-document.html', controller: 'linkUploadDocCtrl as linkUpDocCtrl', keyboard: false, size: 'lg', ...
[ "function linkUploadDoc(selectedItems) {\n var modalInstance = $modal.open({\n templateUrl: 'app/matter/matter-details/link-upload-document/link-upload-document.html',\n controller: 'linkUploadDocCtrl as linkUpDocCtrl',\n keyboard: false,\n size...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Set map view to the previous pin in the pin array
previousPin() { if(this.state.pins_array.length>0) { const map = this.refs.map.leafletElement map.doubleClickZoom.disable(); setTimeout(function () { map.doubleClickZoom.enable(); }, 1000); var temp = this.state.current_pin_index - 1 if (temp <= 0) { temp = 0...
[ "function backToOrigin(){\n map.setView([42.378076, -72.519946], 16);\n}", "function goBacktoUCL(){\r\nmymap.map('mapid').setView([51.524257,-0.134503], 16);\r\naddPoint();\r\n}", "function prev_route(){\n\tif (route_index <= -1)\n\t\t\treturn;\n\t\troute_list[route_index].removeFrom(mymap);\n\t\troute_index...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
endOfDay :: Date > Date
endOfDay(d) { d.setHours(23, 59, 59, 999); return d; }
[ "validateEndDate(start_time, end_time){\n let start_date = new Date(start_time);\n let end_date = new Date(end_time);\n if(start_date.getFullYear() == end_date.getFullYear()){\n if(start_date.getMonth() == end_date.getMonth()){\n if(start_date.getDate() == end_date.get...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
List games Rendering all information into "cache" gamestring, then RETURN that will be printed
function renderGames() { gamesString = ""; state.games.forEach(function (games, index) { gamesString += `<div> Game: ${games.title} Platform: ${games.platform} <span onclick='editGame(${index})'>[Edit Game]</span> <span onclick='destroyGame(${index})'>[Delete Game]</span> </div>`...
[ "function loadGameList() {\n\t\t$games.empty();\n\t\t\n\t\t//do a get request to /games\n\t\t$.get(\"/games\", function(data) {\n\t\t\tconsole.log(\"did GET to /games, got back:\", data);\n\t\t\t\n\t\t\t//if the array returned is empty, just put \"no games\"\n\t\t\tif (data.length == 0) {\n\t\t\t\t$games.append(\"n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Builds & shows the ADD DEVICE dialog creating chips for each device in ALL_DEVICES and attaching them to the corresponding section (mobile, tablet, desktop).
showAddDeviceDialog_() { const dialog = buildAddDeviceDialogTemplate(this.element); // Find the sections for the different screen sizes, where chips will be attached. const sections = ['mobile', 'tablet', 'desktop'].reduce((obj, section) => { obj[section] = dialog.querySelector( `.i-amphtml-s...
[ "function addDevice(device) {\n // Create an Option object\n let opt = document.createElement(\"option\");\n\n // Assign text and value to Option object\n opt.text = device.name;\n opt.value = JSON.stringify(device);\n\n // Add an Option object to Drop Down List Box\n document.getElementById(\"sctDeviceList\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get an array of vertical sequences that are considered winning moves.
function getVerticalWinners(board) { let results = []; for(let row = 0; row <= 2; row++) { for(let column = 0; column <= board[row].length - 1; column++) { if(board[row][column] === colors.red && board[row+1][column] === colors.red && board[row+2][column] === colors.red && board[ro...
[ "function getVerticalMoves(x, y, yMoves, pieceMoves){\r\n const yMovesArray = [];\r\n for(let num of pieceMoves){\r\n //Checking if the possible move is not out of bounds of board\r\n if((yMoves.indexOf(y)+num >= 0) && (yMoves.indexOf(y)+num <=7)){\r\n yMovesArray.push(x+yMoves[yMoves...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Draws the graph of the thrown bottle by simulating gravity.
function drawThrownBottle() { timePassedSinceThrow = new Date().getTime() - lastThrowStarted; let gravity = Math.pow(9.81, timePassedSinceThrow / 200); throwBottle(timePassedSinceThrow, gravity); }
[ "function drawMotionGraph() {\n if (position.y < 0.0 || time == totalTime) {\n runable = false;\n }\n\n if (runable) {\n context.clearRect(0, 0, width, height);\n index++;\n\n context.fillStyle = '#efefef';\n context.fillRect(base.x, base.y, width - 110, height - 140);\n\n context.strokeStyle =...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Server messages are of the form: "short_metadata_len|metadata_json|data"
function parse_server_msg(data) { var metadata_len = new DataView(data, 0, 2).getUint16(0); var byte_array = new Uint8Array(data); var raw_metadata = byte_array.subarray(2, 2 + metadata_len); var media_data = byte_array.subarray(2 + metadata_len); /* parse metadata with JSON */ var metadata = null; if (...
[ "function processServerData(msg) {\n var str = msg.toString('utf8');\n if (str[0] == '{') {\n try { command = JSON.parse(str) } catch (e) { obj.parent.parent.debug(1, 'Unable to parse JSON (' + obj.remoteaddr + ').'); return; } // If the command can't be parsed, ignore it.\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Check if the edge going from n1 to n2 crosses (without a connection node) any edge on way. Return the cross point if so.
function findEdgeToWayCrossCoords(n1, n2, way, graph) { var crossCoords = []; var nA, nB; var segment1 = [n1.loc, n2.loc]; var segment2; var nodes = graph.childNodes(way); for (var j = 0; j < nodes.length - 1; j++) { nA = nodes[j]; nB = nodes[j + ...
[ "function crosses(r1, r2) {\n return (xCrosses(r1, r2) || xContains(r1, r2)) &&\n (yCrosses(r1, r2) || yContains(r1, r2));\n}", "function doesCross( fromDoor, toDoor ) {\n var path1 = fromDoor + \":\" + toDoor;\n var path2 = toDoor + \":\" + fromDoor;\n var retVal = false;\n for( var step in rooms...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gives the node a path state.
travel() { if(this.state) this.state = Node.PATH; }
[ "updatePath() {\n this.isPath = true;\n const eventName = \"node-\" + this.row + \"-\" + this.col + \"-path\";\n sendEvent(eventName);\n }", "function getNodeState(node) {\n\t\treturn data.nodes[node].state\n\t}", "getNodeState () {\n return this._state;\n }", "drawState(){\n if(this.ge...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
load portfolio single content
function utInitPortfolioContent( postID , callback ) { if( !postID ) { return; } var $portfolio = $('#ut-portfolio-detail-' + postID), ajaxURL = utPortfolio.ajaxurl; $.ajax({ type: 'POST', url: ajaxURL, data: {"action":...
[ "function getPortfolio() {\r\n portfolioEl.innerHTML = \"\";\r\n fetch(\"http://studenter.miun.se/~aslo1900/dt173g_projekt_rest/portfolio.php\")\r\n .then(response => response.json())\r\n .then(data => {\r\n data.forEach(portfolio => {\r\n portfolioEl.innerHTML +=\r\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Set menus size ms = Integer, size in px
function setMenuSize (ms) { let menuSize = ms + "px"; MyRBkmkMenuStyle.width = menuSize; MyRShowBkmkMenuStyle.width = menuSize; MyRFldrMenuStyle.width = menuSize; MyBBkmkMenuStyle.width = menuSize; MyBResBkmkMenuStyle.width = menuSize; MyBFldrMenuStyle.width = menuSize; MyBResFldrMenuStyle.width = men...
[ "function DDLightbarMenu_SetSize(pSize)\n{\n\tif (typeof(pSize) == \"object\")\n\t{\n\t\tif (pSize.hasOwnProperty(\"width\") && pSize.hasOwnProperty(\"height\") && (typeof(pSize.width) == \"number\") && (typeof(pSize.height) == \"number\"))\n\t\t{\n\t\t\tif ((pSize.width > 0) && (pSize.width <= console.screen_colu...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
handle clock with date
function startClockTime() { var today = new Date(); // get current date // extract year, month, day from current date var dateTimeFormat = new Intl.DateTimeFormat('en', { year: 'numeric', month: 'short', day: '2-digit' }); var [{ value: month },,{ value: day },,{ value: year }] = dateTimeFormat.formatToPar...
[ "function getDate() {\nvar d = new Date();\nvar t = d.toLocaleTimeString();\nclock.innerHTML = t;\n\t}", "function digitalClock(date) {\n // call the time\n timer(date.times);\n // call the date\n calendar(date.dates);\n}", "function updateClock(){\n\tlet dt = new Date();\n\t\n\tlet month = ((\"0\"+...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Show the contest cost data according to the actual contest cost returned from server.
function updateContestCostData() { if (!mainWidget.softwareCompetition.projectHeader.projectCategory || mainWidget.softwareCompetition.projectHeader.projectCategory.id < 0) { return; } var prizeType = $('input[name="prizeRadio"]:checked').val(); var projectCategoryId = mainWidget.softwareCompet...
[ "function showTceCost(costByCountryAndTollSystem, costs, length, basetime, traffictime) {\n\n var HTML = [];\n \t\t\t// /***********************************************\n\n \t\t\t// Publishing route total cost\n\n \t\t\t// ***********************************************/\n\n HTML = [...HTML, <p sty...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get current footer height
_getFooterHeight() { const layoutFooter = this.getLayoutFooter() if (!layoutFooter) return 0 return layoutFooter.getBoundingClientRect().height }
[ "function getFooterHeight(){\n\treturn $('footer').height();\n}", "function getFooterHeight(){\n return $('footer').outerHeight();\n}", "function getFooterHeight(){\n return $('footer').outerHeight();\n}// getFooterHeight", "function getFooterHeight(){\n return $('footer').height();\n}", "function ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Centralized logic Returns a URL friendly slug
function createSlug(value) { return value .replace(/[^a-z0-9_]+/gi, "-") .replace(/^-|-$/g, "") .toLowerCase(); }
[ "slugify() {\n this.slug = slug(this.name);\n }", "retrieveSlug () {\n return window.location.pathname.split('/')[2]\n }", "slugify() {\n\t\treturn str.trim().replace(/[^A-Za-z0-9]+/g, \"-\").toLowerCase();\n\t}", "function createSlug(value){\n return value\n .replace(/[^a-z0-9_]+/gi, \"-\")\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Longterm TODO: Technically, Match doesn't compare ordered sets but unordered sets, so for an implementation that wouldn't penalize prosodic scrambling we'd need to sort sParent.children and pParent.children before comparing them. TODO: what about null syntactic terminals?? these need to be filtered out of the syntactic...
function matchSP(sParent, pTree, sCat) //Assign a violation for every syntactic node of type sCat in sParent that doesn't have a corresponding prosodic node in pTree, //where "corresponding" is defined as: dominates all and only the same terminals, and has the corresponding prosodic category //Assumes no null syntacti...
[ "function sortChildren(children){children.sort(compareChildren);}", "function recursiveVisitMismatchedChildren(obj1,obj2){\n var divergences = [];\n var children1 = obj1.children;\n var children2 = obj2.children;\n var numChildren1 = children1.length;\n var numChildren2 = children2.length;\n var children1Se...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Checks for hex color
function isHexColor(color) { return string.regex(/^#([a-fA-F0-9]{6}|[a-fA-F0-9]{3})$/)(color) }
[ "isHexColor(hex){\n return typeof hex === 'string' && \n hex.charAt(0) === '#' &&\n hex.length === 7 &&\n !isNaN(Number('0x' + hex.substring(1)));\n }", "function tagDialog_isHexColor(theColor)\n{\n var pattern = new RegExp(\"\\[a-fA-F0-9\\]\\{\"+theColor.length...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
_pfa Position From Arguments: Given a list of arguments a, determine if the arguments represent individual x, y and/or z coordinates, or a Pos object. Prototype: Pos _pfa(Object a[ ]) Arguments: a ... The list of arguments Results: A Pos object.
function _pfa(a) { if (a.length) { // XXX: How should we flag an error? if (a.length > 3) return null; // Assume 2 or more array elements specify x, y and maybe z coordinates. if (a.length > 1) return new Pos(a[0], a[1], a.length > 2 ? a[2] : null); // Assume a[0] is a valid Pos object. ...
[ "function absPos(o) {\r\n var x, y, z;\r\n if (arguments.length > 2) {\r\n x = arguments[1];\r\n y = arguments[2];\r\n z = arguments[3];\r\n } else if (arguments.length == 2) {\r\n x = arguments[1].x;\r\n y = arguments[1].y;\r\n z = arguments[1].z;\r\n }\r\n return new Pos(absX(o, x), absY(o,...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns the treeDataObjects contained in this node.
get_treeDataObjects() { return this.treeDataObjects; }
[ "get dataTree () {\n return this._dataTree\n }", "function getTrees() {\n return trees\n }", "getNodes(tree)\r\n {\r\n var nodeList = [];\r\n\r\n for (let i = 0; i < tree[\"children\"].length; i++) \r\n {\r\n nodeList = nodeList.concat(this.getLeafHashes(tree[\"c...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Set the tile click function.
setTileOnClick(x, y, func) { // bounds checking if (x >= 0 && x < this._width && y >= 0 && y < this._height) this.getTile(x, y).onClick = func; }
[ "function tileClick() {\n\tmoveOneTile(this);\n}", "function tileClicked(event) {\n\tselectTile(event.target);\n}", "function tile_tap(event) { root.tile_tap(event.currentTarget.id) }", "function clickTile() {\n let tileId = this.getAttribute(\"data-id\");\n let image = this.getAttribute(\"src\");\n let ti...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Return the ReviewReplyEditorView with the given context type and ID. Args: contextType (string): The type of object being replied to (such as ``body_top`` or ``diff_comments``) contextID (number, optional): The ID of the comment being replied to, if appropriate. Returns: RB.ReviewRequestPage.ReviewReplyEditorView: The ...
getReviewReplyEditorView(contextType, contextID) { return this._reviewView.getReviewReplyEditorView(contextType, contextID); }
[ "getReviewReplyEditorView(contextType, contextID) {\n if (contextID === undefined) {\n contextID = null;\n }\n\n return _.find(this._replyEditorViews, view => {\n const editor = view.model;\n return editor.get('contextID') === contextID &&\n ed...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Reduces the parents siblings by the sum of the child's siblings and the child.
function reduceSiblings(parent, child) { var childSiblings = child.siblings; while (parent != null) { parent.siblings = parent.siblings - childSiblings - 1; parent = parent.parent; } }
[ "function collapseSiblings(d /*: Node */) {\n var parent = d.parent\n if (parent) {\n parent.children = _.filter(parent.children, function(d2 /*: CENode */) {\n return d2 === d\n })\n parent.loadedChildren = false\n }\n }", "function ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
REMOVE KEY VALUE FROM OBJECT
function remove({ key, obj }) { // REMOVE THE KEY delete obj[key] return obj; }
[ "function destructivelyDeleteFromObjectByKey(object,key){\ndelete object.key;\nreturn object;\n}", "function destructivelyDeleteFromObjectByKey(object, key){\n delete object[key];// modifies the original object\n return object;//returns object without the delete key/value pair\n}", "function destructivelyDele...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Draws input: 4 and 4 left: 4 singles (dashed) right:
function addFour(dash){ ctx.beginPath(); if (dash){ ctx.setLineDash([5]); } single(); ctx.lineTo(0, height-(rows*step)-(step/4)); ctx.stroke(); ctx.moveTo((width/2), height-((rows-1)*step)); ctx.lineTo(0, height-(rows*step)-step*2/4); ctx.stroke(); ctx...
[ "_draw_digit(center_x, center_y, digit){\n const FG = this.config.color,\n BG = this.config.background_color,\n width = this.config.digit_width,\n height = this.config.digit_width * this.config.HW_ratio,\n half_stroke = this.config.stroke_w...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
In "multiple" mode sets positions of carousel items in relation to the active slide.
_handleMultipleMode(newIndex) { const that = this; if (that.displayMode !== 'multiple') { return; } const item = that._items[newIndex], itemWidth = item.offsetWidth, containerWidth = that.$.container.offsetWidth, itemsContaine...
[ "_handleMultipleMode(newIndex) {\n const that = this;\n\n if (that.displayMode !== 'multiple') {\n return;\n }\n\n const item = that._items[newIndex],\n itemWidth = item.offsetWidth,\n containerWidth = that.$.container.offsetWidth,\n itemsConta...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Will execute up to `MAX_PARALLEL_DIALS` dials
run() { if (!this.isRunning) return; if (this._dialingQueues.size < this.switch.dialer.MAX_PARALLEL_DIALS) { let nextQueue = { done: true // Check the queue first and fall back to the cold call queue }; if (this._queue.size > 0) { nextQueue = this._queue.values().next(); ...
[ "run () {\n if (this._dialingQueues.size < this.switch.dialer.MAX_PARALLEL_DIALS && this._queue.size > 0) {\n let nextQueue = this._queue.values().next()\n if (nextQueue.done) return\n\n this._queue.delete(nextQueue.value)\n let targetQueue = this._queues[nextQueue.value]\n this._dialing...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Takes a synchronous storage interface and wraps it with an async interface.
function asyncStorage(storage) { return { getItem: key => { return Promise.resolve(storage.getItem(key)); }, setItem: (key, val) => { return Promise.resolve(storage.setItem(key, val)); }, removeItem: key => { return Promise.resolve(storage.removeItem(key)); } }; }
[ "function isSynchronous(storageAPI) {\r\n return storageAPI.type() === Type.SYNC;\r\n}", "function AsyncFromSyncIterator(iterator) {\n this._i = iterator\n}", "useAsync() { \n return new Promise((resolve, reject) => { \n try {\n resolve(this.use())\n }\n catch (err) { \n reje...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
code TODO: sp2hpCtrl | controller_by_user controller by user
function controller_by_user(){ try { } catch(e){ console.log("%cerror: %cPage: `sp2hp` and field: `Custom Controller`","color:blue;font-size:18px","color:red;font-size:18px"); console.dir(e); } }
[ "function controller_by_user(){\n\t\ttry {\n\t\t\t\n\t\t\t\n\t\t} catch(e){\n\t\t\tconsole.log(\"error: page storie_singles => custom controller\");\n\t\t\tconsole.log(e);\n\t\t}\n\t}", "function controller_by_user(){\n\t\ttry {\n\t\t\t\n\t\t\t\n\t\t} catch(e){\n\t\t\tconsole.log(\"error: page winner_singles => c...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns a path to a test fixture file. Invoke it the same as path.join().
function fixturePath() { for (var _len = arguments.length, pathParts = Array(_len), _key = 0; _key < _len; _key++) { pathParts[_key] = arguments[_key]; } return _path2.default.join.apply(_path2.default, [__dirname, '..', 'fixtures'].concat(pathParts)); }
[ "get fixture_path(){\n return path.join(this.base_path, this.test_dir, this.fixture_dir, ...args)\n }", "function fixturesPath() {\n var path = null;\n if (jasmine.ConsoleReporter) {\n path = '../../spec/javascripts/fixtures';\n } else {\n path = '/assets/fixtures';\n }\n return path;...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
update we update a and b points
update() { this.follow(); this.calculateB(); }
[ "update() {\n this._hasPoints = true; // assuming points have been updated manually\n this._updateProjection();\n }", "_updatePrevPoints() {\n equalizePoints(this.prevP1, this.p1);\n equalizePoints(this.prevP2, this.p2);\n }", "_updateStartPoints() {\n equalizePoints(this.startP1, this.p1);\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Put object selected properties in the inputs
function setPropertiesToInput() { let name = document.getElementById('name') let width = document.getElementById('width') let height = document.getElementById('height') let stroke = document.getElementById('stroke') let fill = document.getElementById('fill') let transform = document....
[ "function inputToObject(inputHandle, object, property) {\n let value = $(inputHandle).val();\n object[property] = value;\n}", "function updateInputs(object) {\r\n\tdocument.getElementById(\"X\").value = object.position.x;\r\n\tdocument.getElementById(\"Y\").value = object.position.y;\r\n\tdocument.getElemen...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Before the component gets mounted, it will send an action the the TaskStore to fetch the tasks from Firebase
componentWillMount() { TasksStore.on("change", this.getIsFetchingTasks); TasksStore.on("change", this.getTasks); TasksActions.loadTasks(); }
[ "componentDidMount() {\n this.loadTasks()\n }", "componentDidMount() {\n this.retrieveCurrentTask();\n }", "componentDidMount() {\n this.loadTasks();\n console.log(this.state.tasks);\n }", "componentDidMount(){\n\t\tthis.props.navigation.setParams({ onAddItem: this.onAddItem})\n\t\t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Removes all the book classes from the page
function removeAll() { const elements = document.getElementsByClassName("book"); while(elements.length > 0){ elements[0].parentNode.removeChild(elements[0]); } }
[ "function clearClass(){\n\t\tvar howMany = howManyPages(counter);\n\t\tfor(i = 1; i <= howMany; i++) {\n\t\t\t$('.student-item').removeClass('page' + i);\n\t\t}\n}", "resetClasses() {\n document.getElementById(\"old-page\").classList.remove(\"pageturner\");\n document.getElementById(\"new-page\").cl...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
sample function to delete the mock data from database IS NOW DEPRECATED
function deleteMockData() { deleteDay('05/20/2021'); deleteMonthlyGoals('12/2021'); deleteYearlyGoals('2020'); deleteSettings(); //deleting something that isn't there actually doesn't throw an error deleteYearlyGoals('2020'); }
[ "function deleteTest() {\n client.delete({\n index: \"\",\n type: \"\",\n id: \"\"\n });\n}", "function deleteData() {\n\t\n}", "function cleanUp_deleteTestRows() {\n var url = req.localFullBaseURL; // http://localhost:8080/rest/default/iRefRJdb/v1/purgeTestData\n var story...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Implement a GET Endpoint to retrieve a block by hash, url: "/stars/hash:[HASH]"
getStarBlockByHash() { let self = this; self.app.get("/stars/hash:HASH", (req, res) => { self.blockchain.getBlockByHash(req.params.HASH.slice(1)).then((result) => { res.send(result); }).catch((err) => { if (err.notFound) { res.s...
[ "getStarBlockByHash() {\n this.app.get(\"/stars/hash/:hash\", (req, res) => {\n this.Blockchain.getBlockByHash(req.params.hash).then((block) => {\n res.send(JSON.parse(block));\n }).catch(function (error) {\n console.log(\"Failed!\", error);\n })...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
check chinese only, and nothing to alert
function chinese_check_only(v) { var ck = /[^\x00-\xff]/; if (v=="" ||ck.test(v)) { return 1; } return 0; }
[ "function isChinese(value) {\n var len = value.length;\n var cnChar = value.match(/[^\\x00-\\x80]/g);\n return cnChar !== null;\n }", "function isCJKUnifiedIdeographs(bechecked) {\n return /^[\\u4E00-\\u9FFF]+$/.test(bechecked);\n }", "function hasChinese(char) {\n return /[\\u2E80-\\u2E9...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Prevents the user from highlighting the text in the Fnn Textboxes This is done so that they have to physically type the fnn in twice. They can't copy/paste it
function FnnTextHighlightingHandler(objEvent) { objEvent.target.selectionStart = objEvent.target.selectionEnd; objEvent.preventDefault(); }
[ "function NonAddableFieldTextChanged(e) {\n\tchangeValueOfNonAddableField(userDataInArrays, clickedTextField.id, clickedTextField.text);\t// editProfileHelper.js\n}", "function UnbInsertText(what, replace)\r\n{\r\n\tif (replace == null) replace = 0;\r\n\t\r\n// changes for pragmaMx\r\n\tif (openerdoc) {\r\n\t\tcu...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
if there isn't at least one activity chosen indicate this if there isn't a payment method selected indicate this loop through all typed forms if name field and is blank indicate this else if email field and wrong format indicate this else if payment form is Credit Card and wrong format if card number field if card numb...
function validateForms() { var typedForms = document.querySelectorAll('input'); var designMenu = document.getElementById('design'); var designLabel = document.querySelector('.shirt').lastElementChild; var designChoice = designMenu.options[designMenu.selectedIndex].text; var paymentMethod = document.getElement...
[ "function processPaymentForms(){\n\n\t// array defining fields which are required\n\tvar requiredFields = [\"firstName\",\"surName\",\"addressLine1\", \"addressLine2\",\"city\",\"zipCode\",\"country\",\"cardName\",\"cardNumber\",\"cvv\",\"monthPicker\",\"yearPicker\"];\n\n\t// if one of the above fields is missing,...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
this method execute on user submit, addressing the ServiceApi with the url + url query params and json body depends on the method type. success callback will be called asynchronously when the response is available. error callback called asynchronously if an error occurs or server returns response with an error status.
executeOnSubmit(method, jsonBody = null) { return this.ServiceApi[method](this.url, jsonBody); }
[ "function PostService(data, url, async, callBack) {\n\n\t\t$.ajax({\n\t\t\ttype: 'post',\n\t\t\turl: url,\n\t\t\tdataType: 'json',\n\t\t\tdata: data,\n\t\t\tsuccess: function(msg) {\n\n\t\t\t\treturn callBack(msg);\n\t\t\t},\n\t\t\terror: function(error) {\n\n\t\t\t\tconsole.log(error);\n\t\t\t}\n\t\t});\n\t}", "...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Updates image position/size with respect to |this.rotation_|, |this.frameSize_| and |this.imageOriginalSize_|.
updateImage_() { const {width: frameW, height: frameH} = this.frameSize_; const {width: rawImageW, height: rawImageH} = this.imageOriginalSize_; const style = this.image_.attributeStyleMap; let rotatedW = rawImageW; let rotatedH = rawImageH; if (ROTATIONS[this.rotation_] === Rotation.ANGLE_90 |...
[ "_resize() {\n const scale = this.model.get('scale');\n const origW = this._$origImage.data('initial-width') * scale;\n const origH = this._$origImage.data('initial-height') * scale;\n const newW = this._$modifiedImage.data('initial-width') * scale;\n const newH = this._$modifiedI...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Adds a subscriber to the subscription subscriber: A subscriber (see Subscriber.js for details)
addSubscriber(subscriber) { // add the subscriber instance to the subscribers Array property this.subscribers.push(subscriber); // set the subscription of the subscriber instance to this subscription subscriber.subscription = this; return subscriber; }
[ "addSubscriber(subscriber: any): void {\n if (this.findSubscriber(subscriber) === -1) {\n this.subscribed.push(subscriber);\n }\n }", "addSubscriptions(subscribers) {\n this.subscribers = {\n ...this.subscribers,\n ...subscribers\n };\n }", "subscribe(sub, handler) {\n this.s...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Parse OAuth Echo Headers: 'XVerifyCredentialsAuthorization' 'XAuthServiceProvider'
function parseOAuthHeaders(oAuthEchoHeaders) { var credentials = oAuthEchoHeaders['X-Verify-Credentials-Authorization']; var apiUrl = oAuthEchoHeaders['X-Auth-Service-Provider']; return { apiUrl: apiUrl, credentials: credentials }; }
[ "function parseOAuthHeaders(oAuthEchoHeaders) {\n var credentials = oAuthEchoHeaders['X-Verify-Credentials-Authorization'];\n var apiUrl = oAuthEchoHeaders['X-Auth-Service-Provider'];\n\n return {\n apiUrl: apiUrl,\n credentials: credentials\n };\n }", "function parseOAuthHeaders(oAuthEchoH...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get minor key properties in a given tonic
function minorKey(tnc) { const pc = (0, _core.note)(tnc).pc; if (!pc) return NoMinorKey; const alteration = distInFifths("C", pc) - 3; return { type: "minor", tonic: pc, relativeMajor: (0, _core.transpose)(pc, "3m"), alteration, keySignature: (0, _core.altToAcc)(alteration), natural: Nat...
[ "function minorKey(tonic) {\n const alteration = distInFifths(\"C\", tonic) - 3;\n return {\n type: \"minor\",\n tonic,\n relativeMajor: transpose(tonic, \"3m\"),\n alteration,\n keySignature: altToAcc(alteration),\n natural: NaturalScale(tonic),\n harmonic: Ha...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Xpath for Meeting Card All Race List Tab Race Runner Toggle Button
get meetingRaceList_RaceRunnerToggle() {return browser.element("//android.widget.ScrollView/android.view.ViewGroup/android.widget.ScrollView/android.view.ViewGroup/android.view.ViewGroup[1]/android.view.ViewGroup");}
[ "get meetingAll_RaceList_1stHrose() {return browser.element(\"//android.widget.ScrollView/android.view.ViewGroup/android.view.ViewGroup[2]/android.widget.Button/android.view.ViewGroup[2]/android.widget.Button[1]\");}", "get raceRunnerToggleON() {return browser.element(\"//android.widget.ScrollView/android.view.Vi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
setBodyPaddings reset paddings on body node to 0 when nav is unfixed
resetBodyPaddings(){ let body = document.body; body.style.paddingTop = 0; body.style.paddingBottom = 0; }
[ "function settleBodyPadding(){\n var Body = document.getElementById(\"myFullBody\");\n var NavBar = document.getElementById(\"myNavBar\");\n Body.style.paddingTop = (NavBar.clientHeight+10)+\"px\"; // Assigning the top padding to the client height (height + vertical padding) of the Nav-Bar.\n return 0;\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
random event 0 normal 1 x2 2 slow 3 big 4 venom 5 cute
function randomEvent(){ if(x2able && !powerX2 && !x2Show && random(100) < powerUpChance){ x2Show = true; return 1.0; }else if(slowable && !powerSlow && !slowShow && random(100) < powerUpChance){ slowShow = true; return 2.0; }else if(currentScore > bigThuTriggerScore && random(100) < bigThuChance){ return 3...
[ "function sampleEvent(){\n\n if (Math.random() >= 0.5){\n\n return \"BUY\";\n\n }\n\n return \"SELL\";\n }", "function dogOneRandomEventMove(){\n if (dogOneCurrentStep == 3 || dogOneCurrentStep == 6 || dogOneCurrentStep == 9 || dogOneCurrentStep == 12 || dogOneCurrentStep == ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
check whether there is a road going from the current place to the destination, and if not, it returns the old state since this is not a valid move.
move(destination) { if (!roadGraph[this.place].includes(destination)) { return this; // create a new state with the destination as the robot’s new place. } else { // create a new set of parcels—parcels that the robot is carrying (that are at the robot’s current place) need to be moved along t...
[ "move(destination) {\n // Return the same state if destination is invalid\n if (!roadGraph[this.place].includes(destination)) {\n return this;\n } else {\n // If the parcels are in the same place as the robot, they move with it\n // to the destination. If the pa...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Simulate this text being entered by the user.
simulateKeyboardText(text) { for (let ch of text) { if (ch === "\n" || ch === "\r") { ch = "Enter"; } this.keyEvent(ch, true); this.keyEvent(ch, false); } }
[ "async enterText(value) {\n value = typeof value === 'undefined' ? await RandomUtils.generateRandomString() : value;\n await this.stringField.enterText(value);\n this.inputValue = value;\n if (this.checkYourAnswersValue === null) {\n this.checkYourAnswersValue = value;\n }\n this.label = awai...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Populate the UpdateSidebar with the current values from the document This is called from a button on the UpdateSidebar page
function getDataUpdateSidebar() { var paragraphs = body.getParagraphs(); var e2 = paragraphs[2]; var e3 = paragraphs[3]; var e4 = paragraphs[4]; var e2Text = e2.getText(); var e2TextSplit = e2Text.match(/^(.*)\sVersion\s(\d\.\d+)$/); var initialdocname = e2TextSplit[1]; var initialdocver = e2TextSpli...
[ "function updateFromSidebar() {\n\n let city = $(this).attr(\"dataCity\");\n\n updatePage(city);\n \n}", "function initializeSidebar() {\n google.script.run\n .withSuccessHandler(updateEmailAddresses)\n .getEmailAddressDisplay();\n \n google.script.run\n .withSuccessHandler(updateTemplateFile)\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Cpmprueba si existe la partida en la BBDD
existePartida(idPartida, callback) { this.pool.getConnection((err, connection) => { if (err) { callback(err); return; } connection.query( "SELECT id " + "FROM partidas " + "WHERE id = ? ", ...
[ "isPartNameInBom( partName ){\n var matches = this.getPartByName( partName )\n if( matches ) return true \n return false\n }", "function sanitizeCourseCode(ins){\n const chkr = datab.find(p => p.catalog_nbr == ins);\n\n //if exists in database\n if (chkr) {\n return true;\n }\n el...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
password validation, requires 6 chars at least, contains a lowercase, contains uppercase, has a number /[AZ]/; is to check for ONE instance of a uppercase if you want all do /[AZ]/g;
function validate(password) { var upperCaseVal= /[A-Z]/; var lowerCaseVal =/[a-z]/; var numVal= /[0-9]/; if (password.length<=5){ return "need 6 characters or more" } // uses my uppercase reg ex as a test criterion to scan for at least one uppercase if (upperCaseVal.test(pass...
[ "function validate(password) {\n return /^(?=.*?[A-Z])(?=.*?[a-z])(?=.*?[0-9])[A-Za-z0-9]{6,}$/.test(password);\n //Look ahead to see if there is at least one uppercase\n //One lowercase and one number. Make sure at least 6 \n //characters long\n}", "function regexValidate(password) {\n// (?=.*[a-z]) a lowerc...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
A ServiceRequest is passed into the service call.
function ServiceRequest(values) { assign(this, values); }
[ "_sendServiceRequest(setup) {\n return this._dev.transferIn(setup).then(data => {\n return proto.parseReply(data);\n });\n }", "fetchServiceRequestDetails(serviceRequest) {\n var url = Config.OPEN311_SERVICE_REQUEST_BASE_URL + serviceRequest.id + Config.OPEN311_SERVICE_REQUEST_PARAMETERS_URL;\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Chama a funcao que formata o perfil das campanhas
function perfilCampanha(idCampanha) { formatarPerfil(idCampanha); }
[ "function modificarPerfil(){\r\n\r\n}", "function verificaCampiVuoti() {\n\t\n\t// Recupero il valore del campo fldNome\n\tvar fldNome = document.getElementById('fldNome').value;\n\tif(fldNome.length==0)\n\t{\n\t\tmostraAvviso('campo Nome obbligatorio','fldNome');\t\n\t}\n\n\tvar fldCognome = document.getElementB...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
calls the generate squares function, creates a canvas, pushes each square to the boardsuares array, returns the canvas
function setupGame(){ generateHTMLBoardSquares(); var [c,canvas] = createCanvas(); const squareElements = document.getElementsByClassName("board-square"); for (var i = 0; i<squareElements.length; i++) { const element = squareElements[i]; const square = new BoardSquares(element); boardSquares.push...
[ "function createSquares(){\n let sqrWidth = canvas.width / ((DIM_X*2)+1);\n let sqrHeight = canvas.height / ((DIM_Y*2)+1);\n let index = 1;\n for (let i = 1; i <= DIM_X*2; i+=2){\n let x = sqrWidth * i;\n for (let j = 1; j <= DIM_Y*2; j+=2){\n let y = sqrHeight * j;\n squares[ind...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
DOM: Create an array of icons from string arguments
function createIcons(...icons) { return icons.reduce((array, icon) => { array.push($('<i>').addClass(`fas fa-${icon}`)); return array; }, []); }
[ "function createIconArray() {\n let iconArray = [];\n\n for (let icon of ICONS) {\n iconArray.push(`icon ion-${icon}`);\n iconArray.push(`icon ion-${icon}`);\n }\n return iconArray;\n}", "function iconCreator(array, container) {\n container.innerHTML = '';\n array.forEach((element) => {\n c...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
progInc = setInterval(incrementProg, 1000); progInc = incrementProg(testend);
function incrementProg(testend) { progressbar.setAttribute('data-progress', progress); //set value to attribute counter.textContent = waittime[jk]- parseInt(testend, 10); if(testend>0){ var mn=100/waittime[jk]; progress=progress+mn; setPie(pr...
[ "function launch() {\n\tcont=1;\n\tt1=setInterval(\"beginp()\",iter);\n}", "function start() {\n intervalId = setInterval(decrement, 1000);\n}", "function runTimer() {\n interval = setInterval(updateTimer, 1000);\n}", "function start() {\n time = 5;\n intervalId = setInterval(count, 1000);\n cloc...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Set the url for a list of NFT image features and return the updated asset index
function set_image_urls(parcel, assets, asset_index, image_ids) { for (i = 0; i < image_ids.length; i++) { let image = parcel.getFeatureById(image_ids[i]) var permalink = assets[asset_index++].permalink image.set({ url: permalink }) } return asset_index }
[ "static async buildAssetIndex(urlList, special = null) {\n let assets = []\n let assetsPacks = []\n \n const cloudEnabled = game.settings.get(\"moulinette-core\", \"enableMoulinetteCloud\")\n const showShowCase = game.settings.get(\"moulinette-core\", \"showCaseContent\")\n \n // build tiles' i...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Reveal the hidden children of play
function reveal_play_children() { reveal_by_class("play", "block"); }
[ "function hideAllChildren() {\r\n for (var i = 1; i < scene.children.length; i++) {\r\n scene.children[i].children[0].children[0].visible = false;\r\n }\r\n}", "function hide_all_but_first(parent) {\n //TODO: connect this and identical in videos.js\n let musicWrap = document.getElementById(pare...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
check input length (for username and password)
function checkInput(input) { if (input.value.length < 5 || input.value.length > 16) return false; return true; }
[ "function helper_username_password_length() {\n let username = document.getElementById(\"username\").value;\n let password = document.getElementById(\"password\").value;\n return ensure_str_size(username, 3, 30) && ensure_str_size(password, 3, 30);\n}", "checkLength(password)\n {\n var minimumLength ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
TODO: Should return old status of bit 7 THEN clear. data should be value at address 0x2002.
onStatusRead(data) { this._nes.write(0x2002, data & 0xef); // Clear bit 7 on read. this._vramAddr = 0; this._nmiOccurred = false; }
[ "function YCellular_clearDataCounters()\n {\n var retcode; // int;\n\n retcode = this.set_dataReceived(0);\n if (retcode != YAPI_SUCCESS) {\n return retcode;\n }\n retcode = this.set_dataSent(0);\n return retcode;\n }", "function resetToDat...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Enter a parse tree produced by LUFileParsernewRegexDefinition.
enterNewRegexDefinition(ctx) { }
[ "parse () {\n this._ast = Parser.parse(this.regex)\n }", "visitNewRegexDefinition(ctx) {\n\t return this.visitChildren(ctx);\n\t}", "parse(inputString){\n let matchInformationNodes = this.runningGrammar.match(inputString)\n let matchInformationTree = new Tree(matchInformationNodes)\n this._rawMatc...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Posts information to VictorOps that generates alerts that show up in the timeline
function postToVictorOps (event, context, payload) { return new Promise((resolve, reject) => { const {ALERT_HOST, messages, VICTOROPS_TWILIO_SERVICE_API_KEY} = context; const {CallSid, CallStatus, CallDuration, TranscriptionStatus, TranscriptionText} = event; const {callAnsweredByHuman, detailedLog, goToV...
[ "async function sendAlert(alert) {\n try {\n const response = await axios.post('https://events.pagerduty.com/v2/enqueue', alert);\n\n if (response.status === 202) {\n console.log(`Successfully sent PagerDuty alert. Response: ${JSON.stringify(response.data)}`);\n } else {\n core.setFailed(\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Given a collection of directives, returns the string value for the deprecation reason.
function getDeprecationReason(directives) { var deprecatedAST = directives && (0, _find2.default)(directives, function (directive) { return directive.name.value === _directives.GraphQLDeprecatedDirective.name; }); if (!deprecatedAST) { return; } var _getArgumentValues = (0, _values.getArgumentValues)...
[ "function getDeprecationReason(node) {\n var deprecated = getDirectiveValues(GraphQLDeprecatedDirective, node);\n return deprecated && deprecated.reason;\n }", "function getDeprecationReason(node) {\n var deprecated = Object(_execution_values__WEBPACK_IMPORTED_MODULE_12__[/* getDirectiveValues */ \"...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
get all offered worklist items and start to work on a random one
function workOnOfferedWorklistItems() { $.ajax({ type: 'GET', url: '/api/worklist/items?id=' + participantUUID + '&itemState=' + ITEM_STATE.offered, success: function(data) { var worklistItems = data; console.log("Task count: " + taskCounter + " errorCounter: " + erro...
[ "function beginRandomWorklistItem(worklistItems) {\n var item = getRandomElementFrom(worklistItems);\n changeItemState(item.id, ITEM_STATE.executing);\n}", "function getItems() {\n\t\t\n\twhile(selitems.length < 6) {\n\t\tvar item = allitems[Math.floor(Math.random() * allitems.length)];\n\t\t\n\t\tif(!hasIt...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Exercise 3: Write a function called showFirstAndLast which accepts an array of strings and returns a new array with only the first and last character of each string. Test Case: Test Case 1: showFirstAndLast(['colt','matt', 'tim', 'udemy']) Test Case 2 :showFirstAndLast(['hi', 'goodbye', 'smile']) Result: Test Case 1: [...
function showFirstAndLast(arr){ var arrStr=[]; arr.forEach(z => arrStr.push(z[0]+z[z.length-1])); return arrStr ; }
[ "function showFirstAndLast(arr){\n let firstAndLastArray = [];\n let newWord = \"\";\n\n arr.forEach(function(word){\n newWord = word[0] + word[word.length-1];\n firstAndLastArray.push(newWord);\n });\n return firstAndLastArray;\n}", "function showFirstAndLast(arr) {\n var newArr =...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Queries db for this sockets users statistics
function getUserStats(stats, socket) { db.all('SELECT wins, kills, totalPoints FROM users WHERE user=?', [stats.user], (err, rows) => { if (err) { printLog(err.message); return; } var done = false; rows.forEach((row) => { if (row.user = stats.user) { stats.wins = row.wins; stats.kills = row.ki...
[ "function stats(req, res) {\n\n if (connected_username){\n var query_str = \"select * from Stats order by connection_date desc\";\n run_query(con, query_str, req, res, handler_stats)\n }else{\n res.writeHead(302, {Location: \"/login/\"});\n res.end();\n }\n}", "function getSta...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This function should toggle the dropdown. If the dropdown classList contains the "closed" class, it should remove it. If the dropdown classList doesn't contain the "closed" class, it should add it.
function toggleDropdown() { // code goes here if (dropdown.classList.contains("closed")) { dropdown.classList.remove("closed") } else { dropdown.classList.add("closed") } }
[ "function toggleDropdown() {\n // code goes here\n if (dropdown.classList.contains(\"closed\")) {\n dropdown.classList.remove(\"closed\");\n } else {\n dropdown.classList.add(\"closed\");\n }\n}", "function toggleDropdown() {\n // code goes here\n if (dropdown.classList.contains(\"clos...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
extract the primary source from a source map (i.e., the source for the first instruction, found between the second and third colons)
function extractPrimarySource(sourceMap) { if (!sourceMap) { //HACK? return 0; //in this case (e.g. a Vyper contract with an old-style //source map) we infer that it was compiled by itself } return parseInt(sourceMap.match(/^[^:]*:[^:]*:([^:]*):/)[1] || "0"); }
[ "function extractPrimarySource(sourceMap) {\n return parseInt(sourceMap.match(/^[^:]+:[^:]+:([^:]+):/)[1]);\n}", "findSourceMapUrl(contents) {\n const lines = contents.split('\\n');\n for (let l = lines.length - 1; l >= Math.max(lines.length - 10, 0); l--) {\n const line = lines[l].tri...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
WHEN I view the timeblocks for that day THEN each timeblock is color coded to indicate whether it is in the past, present, or future
function setTimeColor(item) { //Set block to past if (item.time < now) { return "past"; } //Set block to present else if (item.time == now) { return "present"; } //Set block to future else { return "future"; } }
[ "function colorTimeBlocks(){\n //loop through every block that was displayed to the screen\n for (var i=0; i<day.length; i++){\n //get current block associated with the timeObject in the day array\n var curBlock = $(\"#block\"+i);\n\n // // setting past if it is lower than the current tim...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Accepts a URL and array of cookies. It will then mark them as "after" class cookies and set their "is_part_of_account_cookieset" to false. This is useful to test if EXPANDSTATE is properly working.
function mark_as_insignificant_cookies(url, cookies_array) { var my_domain = get_domain(url.split("/")[2]); var all_cookies = pii_vault.aggregate_data.session_cookie_store[my_domain].cookies; for (var c in all_cookies) { if (cookies_array.indexOf(c) != -1) { all_cookies[c].is_part_of_account_cook...
[ "function detect_account_cookies(current_url, \n\t\t\t\tcookie_names, \n\t\t\t\topt_config_cookiesets,\n\t\t\t\topt_config_forceshut,\n\t\t\t\topt_config_skip_initial_states,\n\t\t\t\topt_start_params,\n\t\t\t\topt_open_new_window) {\n // This returns an object with keys: domain + path + \":\" + cookie_name and\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
NOTE: Given the constraints and goals on this project, this method is not going to recordkeep or verify changes. It will change the vote as called by subtracting 1 from old and adding 1 to new. Its only validation will be to prevent a vote count from going negative and that votes are for valid keys.
voteChange(oldKey, newKey) { // To validate user-submitted data, the "key" from the client socket.emit // should match a valid key to vote for in this.counts. if (Object.prototype.hasOwnProperty.call(this.counts, oldKey) && Object.prototype.hasOwnProperty.call(this.counts, newKey) ) { if (...
[ "function update(){\n var vote_water = water.current;\n var vote = vote_water.vote;\n if( vote.expired() )return;\n try{\n \n var was_vote = vote_water.added_vote_value;\n var was_orientation = was_vote && was_vote.orientation;\n var was_delegation = was_vote && was_vote.delegation;...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Calls `onAuthorized` function if provided or show element
function onAuthorizedAccess() { if (angular.isFunction(permission.onAuthorized)) { permission.onAuthorized()($element); } else { PermissionStrategies.showElement($element); } }
[ "function onAuthorizedAccess() {\n if (angular.isFunction(permission.onAuthorized)) {\n permission.onAuthorized()($element);\n } else {\n var onAuthorizedMethodName = $permission.defaultOnAuthorizedMethod;\n PermPermissionStrategies[onAuthorizedMethodName]($element);\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
getting data from people.json
async function getPeople(){ const { data } = await axios.get('https://gist.githubusercontent.com/robherley/5112d73f5c69a632ef3ae9b7b3073f78/raw/24a7e1453e65a26a8aa12cd0fb266ed9679816aa/people.json'); return data; }
[ "async function getPeople() {\n const { data } = await axios.get('https://gist.githubusercontent.com/robherley/5112d73f5c69a632ef3ae9b7b3073f78/raw/24a7e1453e65a26a8aa12cd0fb266ed9679816aa/people.json');\n return data;\n}", "async function getPeople(){\n const { data } = await axios.get('https://gist.git...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sets up show/hide listener
function setupShowHideLHandler() { // Setup expansion/visibility listener $showModelEnergyGraph.change(function() { if (this.checked) { addEventListeners(); $modelEnergyGraphContent.show(100); } else { removeEventListeners(); $modelEnergyGraphContent.h...
[ "onHide() {}", "function showHideEvent() {\n \n\n}", "onShown() {\r\n // Stub\r\n }", "_registerDisplayListeners () {\n this.display = caller('display', {postMessage: window.parent.postMessage.bind(window.parent)})\n this.hide = caller('hide', {postMessage: window.parent.postMessage.bind(wi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
ToDo: LEt's look back at the if/else version of our isItANumber function. Let's refactor our if/else as a ternary operator.
function isItANumber(parameter) { // if (isNaN(parameter) === false) { // return "That's a number!" // } else { // return "That's not a number..." // } return (isNaN(parameter)) ? "That's not a number..." : "That's a number!"; }
[ "function isItANumber(parameter) {\n // if (isNaN(parameter) === false) {\n // return \"That's a number!\"\n // } else {\n // return \"That's not a number...\"\n // }\n return (isNaN(parameter)) ? \"That's not a number...\" : \"That's a number!\";\n}", "isANumber(thing) {\n return typ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Decrease items from wrapper
decreaseItem(decrease = this.options.decrease) { this.setIndexesByDirection(false) Array.from(this.expander.children).forEach((ctx, i) => { if (i > (this.options.show - 1) && i > this.lastIndex && i <= (this.lastIndex + decrease)) { new Animate(ctx, i, this.la...
[ "DecreaseStep() {\n this.list[this.currentItem].step--;\n }", "function decreaseItems() {\n\tlet element = document.querySelector('#items-to-add')\n\tlet itemsTotal = parseInt(element.innerHTML)\n\tif (itemsTotal !==0) {\n\t\titemsTotal--\n\t\telement.innerHTML = itemsTotal\n\t}\n}", "removeIt...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets an installed integration by its `id`.
getIntegrationById(integrationId) { return this._integrations[integrationId]; }
[ "getIntegrationById(integrationId) {\n return this._integrations[integrationId];\n }", "getIntegrationById(integrationId) {\n return this._integrations[integrationId];\n }", "static get(name, id, state, opts) {\n return new Integration(name, state, Object.assign(Object.assign({}, opts), { id:...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
The following function is the countdown timer for the quiz and will redirect the user to the ScriptProcessorNode.html page if time reaches 00. It will also store the score of 0 locally.
function countDown() { startingTime--; document.getElementById("timer").innerHTML = "Timer: " + startingTime; if (startingTime <= 0) { window.localStorage.setItem('finalScore', startingTime); location.assign("scores.html"); } }
[ "function finishQuiz() {\n var scoreDisplay = document.getElementById(\"final-score\");\n clearInterval(timerInterval);\n \n hideID(\"question-page\");\n timerDiv.style.visibility = \"hidden\";\n scoreDisplay.textContent = currentTime;\n initialInput.value = \"\";\n showID(\"complete-page\");\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
template for button tooltip
get tooltipTemplate() { return html`<simple-tooltip id="tooltip" for="button" ?hidden="${!this.currentTooltip && !this.currentLabel}" position="${this.tooltipDirection || "bottom"}" >${this.currentTooltip || this.currentLabel}</simple-tooltip >`; }
[ "get buttonTemplate() {\n return this.toggles\n ? html` <button\n id=\"button\"\n aria-pressed=\"${this.isToggled ? \"true\" : \"false\"}\"\n class=\"simple-toolbar-button\"\n ?disabled=\"${this.disabled}\"\n ?controls=\"${this.controls}\"...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Create and drop a fireball object.
dropFireball(path) { var fireball = new Fireball(this.center, this.radius * 0.3); fireball.drop(path); return fireball; }
[ "function dropFireball () {\n\t\t\tvar fireball = fireballs.create((Math.random()*640), -30, 'fireball');\n\t\t\tfireball.scale.setTo(2, 2);\n\t\t\tfireball.body.gravity.y = 200;\n\t\t}", "function dropBall() {\n // console.log('dropBall called')\n /* add a Ball at the top center of the canvas to the list of ba...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
find the middle node in a Linked List
findTheMiddleNode() { var tempLL = this; var middlePoint = Math.floor(tempLL.length/2); var currentNode = tempLL.head; for (var i = 0; i < tempLL.length; i++) { if (i === middlePoint) { return currentNode; break; //eslint-disable-line } if (currentNode.next) { ...
[ "function findMiddleElement(list) {\n let counter = 0;\n let node = list.head;\n while (node.next !== null) {\n counter++;\n node = node.next;\n }\n let midIndex = Math.round(counter / 2);\n return findNode(list, midIndex);\n}", "function middle(list) {\n if (!this.head) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This function updates the isSeenCell on parse to the given boolean
function updateIsSeen(bool, id){ var idBase = id.replace(/seenButton_/g, ""); var cellId = "seenCell_" + idBase; var titleId = "titleCell_" + idBase; if(bool){ //If movie was seen updateSeenIcon(true, cellId); updateIsSeenOnParse($("#" + titleId).html(), true); }else{ ...
[ "function setFlag(elCell) {\r\n var clickedIndex = getCellCoord(elCell.className)\r\n var currCell = gBoard[clickedIndex.i][clickedIndex.j];\r\n // if cell exposed - nothing to do\r\n if (currCell.isShown) return;\r\n //if flagged set on mine\r\n if (currCell.isMine) gGame.markedCount++;\r\n /...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
this function attempts to determine the range operator on the semver range. this will only handle the simple cases of a semver starting with '^', '~', '>', '>=', '<=', or an exact version. "exotic" semver ranges will not be handled.
function getRangeOperator(version): string { const result = basicSemverOperatorRegex.exec(version); return result ? result[1] || '' : '^'; }
[ "function getRangeOperator(version) {\n const result = basicSemverOperatorRegex.exec(version);\n return result ? result[1] || '' : '^';\n}", "static _minVersion (range) {\n let s = range.split(' ')[0]\n while (s) {\n if (semver.valid(s)) {\n break\n }\n s = s.substring(1)\n }\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates a database check. Can be used on entity property or on entity. Can create checks with composite columns when used on entity.
function Check(nameOrExpression, maybeExpression) { var name = maybeExpression ? nameOrExpression : undefined; var expression = maybeExpression ? maybeExpression : nameOrExpression; if (!expression) throw new Error("Check expression is required"); return function (clsOrObject, propertyName) { ...
[ "enterCheckColumnConstraint(ctx) {\n\t}", "function Check(nameOrExpression, maybeExpression) {\n var name = maybeExpression ? nameOrExpression : undefined;\n var expression = maybeExpression ? maybeExpression : nameOrExpression;\n if (!expression)\n throw new Error(\"Check expression is required\"...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
write a function named generateZeroToTwenty the functon does not require input parameters the output is an array of integers from 0 to 20
function generateZeroToTwenty() { var integers = []; for (var i = 0; i < 20; i++) { integers.push(i); } return integers; }
[ "function generateTwentyToZero(){\n\tvar num = 20;\n\tvar newArray = [];\n\twhile (num >= 0){\n\t\tnewArray.push(num)\n\t\tnum = num -1;\n\t}\n\treturn newArray;\n}", "function generateTwentyToZero(){\n var array = [];\n for(var i = 20; i >= 0; i--){\n array.push(i);\n }\n return array;\n}", "function ge...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Validate game data and if successful, send it to server
function validate_game_data() { switch (page) { case 'reconfig_game': var form = get_form_data('#reconfig_game_form'); break; case 'create_game': var form = get_form_data('#create_game_form'); break; default: return false; } if (check_field_empty(form.nam...
[ "function validateGameFormat(data) {\n debug.extend('validateGameFormat')('Validating...');\n if (!data.hasOwnProperty('id')) {\n debug.extend('validateGameFormat')('Validation Error: game does not have a \"id\" field.');\n throw new CiborgError(null,\n 'Validation...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
send Alert using SMS Text message through clickaTell SMS Gateway
function sendAlert() { console.log("Sending SMS Alert message"); var xhr = new XMLHttpRequest(); var alertMessage = "TrusTee Warn ! Temperature "+T+"°C reached on TTController number "+ID+". Please check it now !"; xhr.open("GET", "https://platform.clickatell.com/messages/http/send?apiKey=1g_OYHPZQp...
[ "function OnSMSAlert()\n{\n}", "function sendSms(id, text){\n const client = teletype('localhost',4242)\n client.exec(\"subscriber id \"+id+\" sms sender id 1 send \"+text)\n .then(response => {\n client.close();\n })\n .catch(function(error) {\n console.log(error);\n })\n}", "function s...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Compares the given line of text to those that are identified as invalid majors.
function isValidMajor(text) { const nonmajorList = ["(CE)", // The Records office has not been consistent with Continuing Education "CE", // indications on a student's record. Hence we need to have both of these. "(UG)", ...
[ "function checkSimplerLines(visionLine) {\n var isNewLine = true;\n var x = Math.abs(visionLine[0]);\n var y = Math.abs(visionLine[1]);\n // If x or y is 0, than the other coordinate must be 1 or else there exists a simpler line\n // for example: 2,0 is a duplicate of the simpler 1,0\n if ((x === ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Finds the best fly. Pretty self explanitory...
function findBestFly() { var max = -1; for (i = 0; i < popSize; i++) { if (fly[i].getFitness() > max) { max = fly[i].getFitness(); bestIndex = i; } } }
[ "function findBestMove(p1, hand, pile) {\n var p1_plays = playableCards(p1, pile);\n var playable = playableCards(hand, pile);\n for (var i = 0; i < playable.length; i++) {\n if (playable[i].distance == 2) {\n return playable[i];\n }\n }\n for (var i = 0; i < playable.length;...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Formats the ActiveDirectoryConfiguration based on the message properties
function formatConfig (msg) { const adConfig = { url: node.url, baseDN: node.baseDN, username: cUsername, password: cPassword } // set attributes if defined if (msg.ad_attributes) { // Validates the Object format (required for IBMi platform) adConf...
[ "function cfnStudioComponentActiveDirectoryConfigurationPropertyToCloudFormation(properties) {\n if (!cdk.canInspect(properties)) {\n return properties;\n }\n CfnStudioComponent_ActiveDirectoryConfigurationPropertyValidator(properties).assertSuccess();\n return {\n ComputerAttributes: cdk....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Retrieve the caller of a function.
function CallStack_getCaller( fn ) { if( fn.caller !== undefined ) return fn.caller; if( fn.arguments !== undefined && fn.arguments.caller !== undefined ) return fn.arguments.caller; return undefined; }
[ "function getCallerFromStack() {\n\t\t\treturn getStack(4,1);\n\t\t}", "function getCaller() {\n var stack = getStack();\n\n // Remove superfluous function calls on stack\n stack.shift(); // getCaller --> getStack\n stack.shift(); // omfg --> getCaller\n\n // Return caller's caller\n return stack[0];\n}", ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
The object.hasOwnProperty method has a number of hazards. So we wrap it in the owns function.
function owns(object, string) { return object && typeof object === 'object' && Object.prototype.hasOwnProperty.call(object, string_check(string)); }
[ "function hasOwnProp(obj, name) { \n var t = typeof obj;\n if (t !== 'object' && t !== 'function') { \n return false; \n }\n return myOriginalHOP.call(obj, name);\n }", "function hasOwnProperty(obj,prop){return Object.prototype.hasOwnProperty.call(obj,prop);}", "function hasOwn(obj, key) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
outcome/ Save reminders into an ArchieML file
function saveReminders(cb) { let pfx = `This is your Reminder File. Every pair of lines below represent (a) a reminder time in cron format (cron: xxxx) (b) a message to ping you with at the appropriate time (message: xxxx) You can add, remove, and edit reminders in this file and then ask your avatar to load...
[ "function reminderFile() {\n return path.join(u.dataLoc(), 'eskill-alarm.txt')\n}", "function saveToFile() {\r\n if (trk) {\r\n trk.add(getTicks(), JZZ.MIDI.smfEndOfTrack());\r\n // sync so we can write during process exit\r\n fs.writeFileSync(\"./recordings/\" + Date.now() + \".mid\", ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
add forum watch enable/disable functions
function initForumWatch(isWatched) { $('#chProjectForum').attr('checked', isWatched); $('.watchForumOptions').show(); // add listener so it could trigger watch/unwatch $('#chProjectForum').click(function(){ forumWatchCheckBoxListener(this); })...
[ "enableWatcher () {\n this.watcherEnabled = true;\n }", "enable() { ... }", "_watchEnabledDidChange() {\n if (this.get('_watchEnabled')) {\n this._startWatch();\n } else {\n this._stopWatch();\n }\n }", "function setupFeatureFlags() {\n if(config.flags.blocks) {\n BLO...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
I also propose an optional default function that scans all input or textarea elements inside the target element, and builds a key value pair
function findAllInput(elt){ var dict={}; var inputElts = elt.find(":input"); //get all input elements within the target element inputElts.each(function(idx, input){ input = $(input); var name = input.attr("name"); var checked = input.prop('checked'); if( checked === undefined ){ //this is ...
[ "function getInputElementsValue(inputElementArray) {\n var inputElementsMap = new Map();\n Array.from(inputElementArray).map(function (inputElement) {\n if (inputElement.className.includes(\"startIndexOf\")) {\n inputElementsMap.set(\"startIndexOf\", inputElement.value)\n } else if (i...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
To check if a field is on an editable page. Arguments 1 fieldId id of the field to check 2 System variable mcEditablePages Returns True if field on an editable page False otherwise Samople Call: SP_FieldIsOnEditablePage('txtCAPARef',mcEditablePages);
function SP_FieldIsOnEditablePage(fieldId, mcEditablePages) { var pageList = new String(mcEditablePages).split(','); var isOnEditablePage = false; if (SP_Trim(pageList) != '') { for(i=0; i<pageList.length; i++) { var pageId = (SP_Trim(pageList[i])*1)+1; if(pageId < 10) { pageId = "mcPage_00"+pageId...
[ "function SP_EnablePageFields(mcEditablePages)\n{\n\tvar pageList = new String(mcEditablePages).split(\",\");\n\n\tif(SP_Trim(pageList) != \"\")\n\t{\n\t\tfor(i=0; i<pageList.length; i++)\n\t\t{\n\t\t\tvar pageId = (SP_Trim(pageList[i])*1)+1;\n\t\t\tif(pageId < 10)\n\t\t\t{\n\t\t\t\tpageId = \"mcPage_00\"+pageId;\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }