query
stringlengths
9
34k
document
stringlengths
8
5.39M
negatives
listlengths
19
20
metadata
dict
Checks if the navigation stack is empty
function isEmpty () { return _navigationStack.length === 0; }
[ "function checkNav() {\n var nav = document.getElementById(\"NavigationMenu\");\n if (typeof(nav) !== 'undefined' && nav !== null) {\n return checkNavigation = true;\n }\n else {\n return checkNavigation = false;\n }\n}", "isEmpty() {\n // the heap has a mark in the top of heap...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
get food API and add images, rating in html
function getfoodAPI() { fetch(url) .then(function (r) { return r.json(); }) .then(function (data) { $('.RecipePicture').empty() $('.DrinkPicture').empty() for (i = 0; i < 10; i++) { foodID = data.matches[i].id; Dish = data.matches[i].recipeName; var imgDiv =...
[ "function renderImage(response) {\n\n //getting the link of the first item in the response\n const imageLink = response.items[0].link\n\n //creating an image element with the src as the above imageLink\n //and width and heright of 200rem\n const image = document.createElement('img')\n image.setAtt...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Determine whether the given properties match those of a `PublicAccessBlockConfigurationProperty`
function CfnAccessPoint_PublicAccessBlockConfigurationPropertyValidator(properties) { if (!cdk.canInspect(properties)) { return cdk.VALIDATION_SUCCESS; } const errors = new cdk.ValidationResults(); if (typeof properties !== 'object') { errors.collect(new cdk.ValidationResult('Expected an...
[ "function CfnMultiRegionAccessPoint_PublicAccessBlockConfigurationPropertyValidator(properties) {\n if (!cdk.canInspect(properties)) {\n return cdk.VALIDATION_SUCCESS;\n }\n const errors = new cdk.ValidationResults();\n if (typeof properties !== 'object') {\n errors.collect(new cdk.Validat...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Tests if two dates are equal.
function isDateEqual(a, b) { return ( a instanceof Date && b instanceof Date && a.getFullYear() === b.getFullYear() && a.getMonth() === b.getMonth() && a.getDate() === b.getDate() ); }
[ "function sameDate(date1, date2) {\n return (date1.getDate() === date2.getDate()\n && date1.getMonth() === date2.getMonth()\n && date1.getFullYear() === date2.getFullYear()\n );\n}", "function sameDate(dateA, dateB) {\n return dateA.getUTCFullYear() === dateB.getUTCFullYear() &&\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get an existing JavaAppLayer resource's state with the given name, ID, and optional extra properties used to qualify the lookup.
static get(name, id, state, opts) { return new JavaAppLayer(name, state, Object.assign(Object.assign({}, opts), { id: id })); }
[ "static get(name, id, state, opts) {\n return new Key(name, state, Object.assign(Object.assign({}, opts), { id: id }));\n }", "static get(name, id, state, opts) {\n return new ServiceLinkedRole(name, state, Object.assign(Object.assign({}, opts), { id: id }));\n }", "static get(name, id, stat...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
GET /teams/:id/delete render deleteteam page.
static async delete(ctx) { const team = await Team.get(ctx.params.id); if (!team) ctx.throw(404, 'Team not found'); const context = team; await ctx.render('teams-delete', context); }
[ "function checkRequestDeleteTeams (req, res, next) {\r\n\tvar params = {};\r\n\tif (!req.params.hasOwnProperty('id')) {\r\n\t\treturn next(apiErrors.GENERIC_ERROR_REQUEST_FORMAT_ERROR, req, res);\r\n\t}\r\n\tparams.id = req.params.id\r\n\treturn {params: params, query: null, body: null};\r\n}", "delete(req, res) ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Update everyone's list of videos
function syncVideoList() { io.sockets.emit('videoListSync', videoList); }
[ "function loadVideoList() {\n state.videos.forEach((video) => {\n\n // create a new video option for the video selection list\n const opt = document.createElement(\"option\");\n opt.value = video.id;\n opt.text = `${video.id}: ${video.title.substring(0, 30)}${video.title.length > 30...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Write a function `copyMachine(element, num)` that takes in an element and a number it should return an array of length `num` that is filled with `element`. Examples: copyMachine('candy', 0); // => [] copyMachine('candy', 2); // => [ 'candy', 'candy' ] copyMachine('bread', 4); // => [ 'bread', 'bread', 'bread', 'bread' ...
function copyMachine(element, num) { let newArray = []; for(let i = 0; i < num; i++) { newArray.push(element) } return newArray }
[ "function initArray(length, makeElement) {\n const arr = new Array(length);\n for (let i = 0; i < length; i++)\n arr[i] = makeElement(i);\n return arr;\n}", "function pushNumberToArray() {\n number = Array(4).fill(0).map(makeARandomNumber);\n }", "function arrayOfMultiples (num, length...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
An overlay for a rectangle annotation.
function RectangleOverlay(options) { options = options || {}; options.type = 'rect'; if( typeof(options.data) === 'object' ) options.data.type = 'rect'; this._init(options || {}); }
[ "function RectangleExtended(pos, id, angle, news) {\n var w = 20;\n var h = 20;\n this.fabricRect = new fabric.Rect({\n left: Math.round(pos.x - w/2),\n top: Math.round(pos.y - h/2),\n width: w,\n height: h,\n angle: angle,\n fill: '#e0e0e0',\n opacity: 0.8,...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Find the array entry matching the given predicate. If none match, create a default entry and push it into the array. In either case, the entry will be returned. The predicate receives one parameter: the entry. THIS MODIFIES THE ARRAY.
function findOrCreate(arr, predicate, construct) { const index = arr.findIndex((entry) => predicate(entry)); if (index >= 0) { return arr[index]; } const newEntry = construct(); arr.push(newEntry); return newEntry; }
[ "getFirstEntry(name, filter = () => true) {\n return this.getEntries(name)\n .filter(filter)\n .shift();\n }", "function find(arr, searchValue){\n\treturn arr.filter(i=>{\n\t\treturn i===searchValue;\n\t})[0];\n}", "function findKey(record, predicate) {\n for (const a in recor...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns whether this object represents the same term as the other
equals(other) { // If both terms were created by this library, // equality can be computed through ids if (other instanceof Term) return this.id === other.id; // Otherwise, compare term type and value return !!other && this.termType === other.termType && this.value === other.value; }
[ "function equivalent(x,y){\n\tif(JSON.stringify(clone(x)) == JSON.stringify(clone(y))){\n\t\treturn true;\n\t}\n\telse{\n\t\treturn false;\n\t}\n}", "function doTermsOverlap(sTerm1, sTerm2) {\n if (sTerm1 == \"1-2\" || sTerm2 == \"1-2\") return true;\n else return sTerm1 == sTerm2;\n }", "equal...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Serialize as JSON No need to serialize the whole walks list. Just need their IDs
function getJson([...lists], [...schedule]) { return JSON.stringify({ lists: lists.map(list => { const walks = []; // Denormalize for serializing list.walks.forEach(walk => walks.push(+walk.id)); return Object.assign({}, list, { walks }); }), schedule: schedule.reduce((p, [walk, ...
[ "_serialize() {\n return JSON.stringify([\n this._id,\n this._label,\n this._properties\n ]);\n }", "saveToJSON () {\n\t\tlet digimonJSON = JSON.stringify(this);\n\n\t\treturn digimonJSON;\n\t}", "function targetsJSON() {\n let targetTokens = getTargetedTokens();\n if(!targetTokens || ta...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Visit `node` with the given `fn`
function visit(node, fn) { return node.nodes ? mapVisit(node.nodes, fn) : fn(node); }
[ "function AddFunctionNodes(node){\n if(her.length > 0){\n nodesFunctions.push(node);\n }\n }", "visitStandard_function(ctx) {\n\t return this.visitChildren(ctx);\n\t}", "static dfs(currentNode,fn,params)\n {\n if(!currentNode)return;\n fn(currentNode,params);\n this.dfs(cu...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Validate a RUN command
function validateRun (data, command) { // no additional validation necessary return true; }
[ "_validateAndParseCommandArguments() {\n const validationErrors = this._validateCommandArguments();\n\n if (validationErrors.length > 0) {\n _forEach(validationErrors, (error) => {\n throw error;\n });\n }\n }", "function validateParry (data, command) {...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
MalwareFamilyService // ////////////////////////// The function, used as object, to handle the malware family service request and response
function MalwareFamilyService(malwareFamilySectionObj) { if(malwareFamilySectionObj.disabled) { return; } this.name = MALWARE_FAMILY_KEY; this.url = MALWARE_FAMILY_URL; this.retryCounter = 0; // default init this.requestType = 'POST'; this.malwareFamilySectionOb...
[ "function ServerBehavior_setFamily(family)\n{\n this.family = family;\n}", "verifyManifoldRequest(req, res, next) {\n verifier.test(req, req._buffer.toString('utf8')).then(next, err => {\n // Verification issue\n logger.warn(`Failed to verify manifold request: %s`, err);\n // Response taken fro...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Update the display of all known themes given their offsets:
function updateColorThemeDisplay() { // template string for the color swatches: const makeSpanTag = (color, count, themeName) => ( `<span style="background-color: ${color};" ` + `class="color_sample_${count}" ` + `title="${color} from d3 color scheme ${themeName}">` + '&nbsp;</span>' ...
[ "_onThemeChanged() {\n this._changeStylesheet();\n if (!this._disableRedisplay)\n this._updateAppearancePreferences();\n }", "function updateLook() {\n if (gURLBar.focused) {\n reset(1);\n return;\n }\n // compute the width of enhancedURLBar first\n partsWidth = 0...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
function chaining to see if all 3 rows are completely filled prior to declaring a tie game.
function allFilled(){ console.log("REACHED"); if(isEmptyRow("square0","square1", "square2") && isEmptyRow("square3","square4", "square5")&& isEmptyRow("square6","square7", "square8") && !gameOver){ tie = true; endGame("tied"); } }
[ "function checkRowForWin() {\n var i, totalCount = 1;\n var leftSideComplete = false;\n var rightSideComplete = false;\n var cells = [];\n var row, col;\n \n for(i = 1; i < _config.col; i++){\n \n if (_config....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
sendAlice send the message in Alice's messagebox to Bob's messagebox. Eve will intercept the message.
function sendAlice() { let message = document.getElementById("aliceMessage").value; document.getElementById("bobMessage").value = message; document.getElementById("aliceMessage").value = ""; eveIntercept(message, "Bob"); }
[ "function sendBob() {\n let message = document.getElementById(\"bobMessage\").value;\n document.getElementById(\"aliceMessage\").value = message;\n document.getElementById(\"bobMessage\").value = \"\";\n eveIntercept(message, \"Alice\");\n }", "function encryptAlice() {\n let...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
indcpaRejUniform runs rejection sampling on uniform random bytes to generate uniform random integers modulo `Q`.
function indcpaRejUniform(buf, bufl) { var r = new Array(384).fill(0); // each element is uint16 (0-65535) var val0, val1; // d1, d2 in kyber documentation var pos = 0; // i var ctr = 0; // j // while less than 256 (the length of the output array: a(i,j)) // and if there's still elements...
[ "function indcpaGenMatrix(seed, transposed, paramsK) {\r\n var a = new Array(3);\r\n var output = new Array(3 * 168);\r\n const xof = new SHAKE(128);\r\n var ctr = 0;\r\n var buflen, offset;\r\n for (var i = 0; i < paramsK; i++) {\r\n\r\n a[i] = polyvecNew(paramsK);\r\n var transpose...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns a URLfriendly version of a string. Example: "North Dakota" > "northdakota"
function urlify(string) { return string.toLowerCase().split(/\s+/).join('-'); }
[ "function slugifyUrl(url) {\n\t\t\treturn Util.parseUrl(url).path\n\t\t\t\t.replace(/^[^\\w]+|[^\\w]+$/g, '')\n\t\t\t\t.replace(/[^\\w]+/g, '-')\n\t\t\t\t.toLocaleLowerCase();\n\t\t}", "function getLinkRewriteFromString(str)\n\t{\n\t\tstr = str.toUpperCase();\n\t\tstr = str.toLowerCase();\n\t\t\n\t\t/* Lowercase ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
================================================================================================ NAVIGATION METHODS /================================================================================================ / Function: setPageID Sets a PPSspecific variable to the content location when delivered via PPS. Paramete...
function setPageID(nodeId) { if (PPS) { window.parent.page = nodeId; } }
[ "function setPageNumber() {\n\tvar selectedData = CLUB.selectedData,\n\t\tpageData = CLUB.pageData,\n\t\tpageSize = pageData.pageSize,\n\t\tselectedDataLength = selectedData.length,\n\t\tnoOfPages;\n\tif(selectedDataLength % pageSize) {\n\t\tnoOfPages = Math.floor(selectedDataLength / pageSize) + 1;\n\t} else {\n\t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
modified from Calculates and draws xaxis ticks and labels, and vertical gridlines for the given interval.
draw(interval) { this._context.translate(this._traceBox.x, this._traceBox.y); const tickMarks = this._ticks(interval); const tickValues = tickMarks.ticks; const tickFormat = tickMarks.params.formatter; this._context.beginPath(); for (const tick of tickValues) { const xPos = Math.round(thi...
[ "_ticks(interval) {\n // We use the first interval passed to the XAxis object to initialize\n // this._timeZone and this._tickReferenceTime, to avoid needing to pass a\n // timeZone to the constructor.\n if (!this._timeZone) {\n this._timeZone = interval.start.tz();\n this._tickReferenceTime ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Allowing or disallowing the mouse/swipe scroll in a given direction. (not for keyboard)
function setIsScrollAllowed(value, direction, type){ switch (direction){ case 'up': isScrollAllowed[type].up = value; break; case 'down': isScrollAllowed[type].down = value; break; case 'left': isScrollAllowed[type].left = value; break; case 'r...
[ "__patchWheelOverScrolling() {\n this.$.selector.addEventListener('wheel', (e) => {\n const scrolledToTop = this.scrollTop === 0;\n const scrolledToBottom = this.scrollHeight - this.scrollTop - this.clientHeight <= 1;\n if (scrolledToTop && e.deltaY < 0) {\n e.preventDefault();\n } els...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Delete ADFS Identity Provider
deleteIdentityprovidersAdfs() { return this.apiClient.callApi( '/api/v2/identityproviders/adfs', 'DELETE', { }, { }, { }, { }, null, ['PureCloud OAuth'], ['application/json'], ['application/json'] ); }
[ "deleteIdentityprovidersGsuite() { \n\n\t\treturn this.apiClient.callApi(\n\t\t\t'/api/v2/identityproviders/gsuite', \n\t\t\t'DELETE', \n\t\t\t{ },\n\t\t\t{ },\n\t\t\t{ },\n\t\t\t{ },\n\t\t\tnull, \n\t\t\t['PureCloud OAuth'], \n\t\t\t['application/json'],\n\t\t\t['application/json']\n\t\t);\n\t}", "deleteIden...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
The transition hooks are attached to the vnode as vnode.transition and will be called at appropriate timing in the renderer.
function resolveTransitionHooks(vnode, props, state, instance) { const { appear, mode, persisted = false, onBeforeEnter, onEnter, onAfterEnter, onEnterCancelled, onBeforeLeave, onLeave, onAfterLeave, onLeaveCancelled, onBeforeAppear, onAppear, onAfterAppear, onAppearCancelled } = props; const key = String(vnode...
[ "function Transition() {}", "function BasicTransition() {}", "function FadeInTransition() {}", "function SlideVerticallyTransition() {}", "_updateAttributeTransition() {\n const attributeManager = this.getAttributeManager();\n\n if (attributeManager) {\n attributeManager.updateTransition();\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
addListEvent(comparelist1, data1, "list1", "rect", "text", "id1");
function addListEventLeft(comparelist, data, selector, listeningElement, otherlisteningElement, lineId) { comparelist.selectAll(selector + " " + listeningElement) //i.e, "#list1 rect" or #list1 text .data(data) .on("click", function (d, i) { var $s_rect = $(listeningElement + "[id='" + d.id + "']...
[ "function addlistmouseevents(firstlist){\r\n\tfirstlist.roothtmldivelement.onmousemove=function(event){\r\n\t\tif(firstlist.orientation==\"verticle\"){\r\n\t\t\tif(firstlist.state==1){\r\n\t\t\t\tfirstlist.xoffset=firstlist.xdown-event.pageX;\r\n\t\t\t\tfirstlist.yoffset=firstlist.ydown-event.pageY;\r\n\t\t\t\tvar ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Patch the definition of a component with directives and pipes from the compilation scope of a given module.
function patchComponentDefWithScope(componentDef, transitiveScopes) { componentDef.directiveDefs = function () { return Array.from(transitiveScopes.compilation.directives) .map(function (dir) { return getDirectiveDef(dir) || getComponentDef(dir); }) .filter(function (def) { return !!def; }); }; ...
[ "enhanceNgApp(moduleNode){\n // Add a reference to the dom node\n this.ngApp.$element = moduleNode;\n\n // Add a method to obtain services from this.ngApp\n this.ngApp.getService = (service)=>{\n return this.injector.get(service);\n }\n }", "function onComponentModify(event) {\n var block ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This function sets up a new board of size 8x8. Fills first three rows with player 1 pieces alternating diagonally. Fills last three rows with other player's pieces alternating diagonally. Leaves two rows blank. Returns the new board array.
function setUpBoard(){ var board = []; // iterate over each row index for (var i = 0; i < 8; i++) { // create array for each new row var newRow = []; // iterate over each column index for (var x = 0; x < 8; x++) { // if first three rows ...
[ "function fillBoard() {\n for (var i = 0; i < 8; i++) {\n game.board[i] = fillRow(i);\n };\n}", "function makeBoard() {\n for (let y = 0; y < HEIGHT; y++) {\n const row = [];\n for (let x = 0; x < WIDTH; x++) {\n const cell = null;\n row.push(cell);\n }\n board.push(row);\n }\n }", ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
OBJECTS///// /sun shade handle constructor
function SunShadeHandle( xPositionPct ) { this.x = xValFromPct(xPositionPct); this.y = sunShadeY; }
[ "function createSunShadeHandle( xPositionPct ) {\n sunShadeHandles.push( new SunShadeHandle( xPositionPct ) );\n sunShadeHandleCount++;\n return sunShadeHandles[sunShadeHandles.length-1];\n}", "function stamp(shape, size, shade){\n this.shape = shape;\n this.size = size;\n\tthis.shade= shade;\n}", "mak...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Return true if we are on the home view
function isHome() { return "home" == gadgets.views.getCurrentView().name_; }
[ "get isHome () {\n return this.room.name === this._mem.rooms.home;\n }", "function isHomePage() {\n\tvar p = window.location.pathname.toLowerCase();\n\tif (!p || p == '/') return true;\n\tvar m = p.match(/^\\/([^\\.]+)\\.(.*)$/);\n\treturn m && m.length == 3 \n\t\t? \n\t\t\t$.inArray(m[1], ['default', '...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function for starting the battle timer
function startBattleTimer() { // Swap button document.getElementById('startButton').remove(); document.getElementById('attackButton').classList.remove('d-none'); document.getElementById('retreatButton').classList.remove('d-none'); // Add battle log entry document.getElementById("battleLog")...
[ "function battleTimer() {\n battleCountdown--;\n // $(\"#battle-timer\").html(\"<h3>\" + \"Battle in: \" + battleCountdown + \"</h3>\");\n $(\"#battle-timer\").html(\"<h3>Battle!</h3><h3>\" + battleCountdown + \"</h3>\");\n if (battleCountdown === 0) {\n stopBattleTimer();\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Create a new reminder list item for a string.
function createReminderItem(reminderString) { var reminderItem = $('<li></li>'); reminderItem.text(reminderString); var doneLink = createDoneLink(reminderItem); reminderItem.append(doneLink); return reminderItem; }
[ "function runAddReminder() {\n var reminderString = getReminderInput();\n var reminderItem = createReminderItem(reminderString);\n addReminderItemToList(reminderItem);\n clearReminderInput();\n}", "function createItem() {\n\t\tvar clInput = document.querySelector('#cl-item'),\n\t\t\tchecklistText = clInput.va...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
draw flights between departure and arrival airport and animate them
function drawFlights(summary, airportCode) { // referenced www.tnoda.com if (airportCode) { summary = summary.filter(item => { return (item.arrival === airportCode || item.departure === airportCode) }); } const flights = groups.flights; // flights.attr("opacity", 1); ...
[ "function dreamFlightPath(x, y, zx, zy, colour) {\n var ax = 200 + x;\n var ay = 700 + (y - 150);\n var bx = 255 + (zx - 100);\n var by = 500 + (zy - 400);\n controls = \tmap.set(\n \t\tmap.circle(x, y, 15).attr('fill', '#fff'), map.circle(zx, zy, 15).attr('fill', '#FFF...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
send a new brick from the left or right of the screen and move the stack down
function sendBrick() { // move the stack down $('.catContainerOuter, .brick').animate({ top: '+=20' }); // create a new brick var startingSide = Math.random() > 0.5 ? '-' : ''; var speed = Math.max(1000, Math.floor(Math.random() * 2000) + 2000 - (score * 20)); var additi...
[ "sailAway() {\n // making the boat sail to the right \n this.x ++\n // if the boat sails off the screen\n // bring it back from the left\n if (this.x > 400) {\n this.x = - this.w;\n }\n }", "function moveDown (){\n\t\tunDraw();\n\t\tcurre...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
NLDate_getLastDayOfMonth: returns the last day of the month in the dDate
function NLDate_getLastDayOfMonth(dDate) { var m = dDate.getMonth(); var days = NLDate_pnDaysInMonths[m]; if(m == 1) // feb -- handle possible leap year { var y = dDate.getYear(); if ( (y% 400 == 0) || ((y % 4 == 0) && (y % 100 != 0)) ) days++; } return days; }
[ "function getMonthLastDate(year, month) {\n return new Date(year, month + 1, 0, 23, 59, 59, 999);\n}", "function LastLastSunday(){\r\n var d = new Date();\r\n d.setDate(d.getDate() - d.getDay() - 7);\r\n return d.getDate();\r\n}", "function DateTimeDayMonth() { }", "findLastMonday() {\n let prevM...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
sorts the files in the list into two lists that are displayed on each side of the screen
function sortFiles() { var sortedFiles = { personal: [], academy: [], }; files.forEach((file) => { sortedFiles[file.type].push( <grid item key={file.id} onDragStart={(event) => onDragStart(event, file.name)} draggable className="dra...
[ "function sortLists() {\n\t\t// Loop all ul, and for each list do initial sort\n\t\tvar ul = $(\".subpageListContainer ul\");\n\t\t$.each(ul, function() {\n\t\t\tsortList($(this), false);\n\t\t});\n\t}", "function makeListsSortable() {\n\t\t// Get all lists\n\t\tvar ul = $(\".subpagelistContainer ul\");\n\t\t\n\t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Helper function It does remove a button from an toolbarset. It's better than leaving it disabled as it will avoid questions about why some button is always disabled.
function RemoveButtonFromToolbarSet(ToolbarSet, CommandName) { if (!ToolbarSet) return; for ( var x = 0 ; x < ToolbarSet.length ; x++ ) { var oToolbarItems = ToolbarSet[x] ; // If the configuration for the toolbar is missing some element or has any extra comma // this item won't be valid, so skip...
[ "function removeVisualiserButton(){\r\n\teRem(\"buttonWaves\");\r\n\teRem(\"buttonBars\");\r\n\teRem(\"buttonBarz\");\r\n\teRem(\"buttonCircleBars\");\r\n\teRem(\"buttonCirclePeaks\");\r\n\tremoveSliderSelector();\r\n}", "clearToolbar() {\n this.innerHTML = \"\";\n this.__buttons = [];\n this.short...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
TODO rename to getAverageImageColor
getAverageImageColor(image) { let ctx = document.createElement('canvas').getContext('2d'); ctx.canvas.width = CANVAS_WIDTH; ctx.canvas.height = CANVAS_WIDTH * image.height/image.width; // ctx.canvas.height = ctx.canvas.width * (image.height/image.width); ctx.drawImage(image, 0,...
[ "function getImagesPixelsAverage(images){\n \n Object.keys(images).forEach(function(index) {\n images[index].colorM = colorPixelsAverage(images[index].img) \n });\n}", "function greenColor(){\n if(fgImg==null){\n alert(\"Image not loaded\");\n }else{\n for(var pixel of greenImg.values()){\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Adjust the monthly period and load the monthly charts
function loadMonthlyPeriod (previous) { if (previous === true) { chartsMonthlyPeriod += 1; } else { chartsMonthlyPeriod -= 1; } loadMonthlyCharts(); }
[ "function loadMonthlyCharts () {\n\tchartsCurrentLevel = chartsLevel.monthly;\n\tchartsCurrentDays = 30;\n\tchartsDateFormat = '%b %e';\n\n\t// reset the charts weekly period\n\tchartsWeeklyPeriod = 0;\n\n\t// taking care of weird situations when the period might be out of bounds\n\tif (chartsMonthlyPeriod < charts...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates a function that calls the function of the same name on each member of the supplied set.
function makeIteratorFunction(f, set) { return function() { var result = []; for ( var i = 0; i < set.length; i++) { result.push(set[i][f].apply(set[i][f], arguments)); } return result; }; }
[ "eachSet(context, setFunc, values) {\n for (const key in context) {\n if (values) {\n if (typeof values[key] !== 'undefined') {\n setFunc(context[key], values[key]);\n }\n }\n else {\n setFunc(context[key]);\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This sample demonstrates how to Retrieves the properties of a Confidential Ledger.
async function confidentialLedgerGet() { const subscriptionId = process.env["CONFIDENTIALLEDGER_SUBSCRIPTION_ID"] || "0000000-0000-0000-0000-000000000001"; const resourceGroupName = process.env["CONFIDENTIALLEDGER_RESOURCE_GROUP"] || "DummyResourceGroupName"; const ledgerName = "DummyLedgerName"; const ...
[ "getLOD() {\n return this.LOD;\n }", "function getAnnotationsInDoc() {\n var documentProperties = PropertiesService.getDocumentProperties();\n DocumentApp.getUi().alert('Annotations in the Document Properties: ' + documentProperties.getProperty('ANNOTATIONS'));\n //DocumentApp.getUi().alert('Annotations_ty...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Set position for partner
positionPartner() { let space = BoxHorizontalSpace; let rghLimit = this._rightLimit - space - (this.width); if (!this.partner) { // no partner this.x = Math.min(this.x, rghLimit); this.x = Math.max(this.x, this._leftLimit); return; } this.partn...
[ "expandPartner() {\n if (!this.person || !this.person.marriedPartner)\n return;\n if (!this._partnerBox) {\n this._partnerBox = new PersonBox(this.person.marriedPartner);\n }\n this._partnerBox._partnerBox = this;\n this.positionPartner();\n }", "moveTo(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets a array containing of all the planets and moons URLs
function getPlanetsLinks(){ var planetList = $('.planetlink'); var moonList = $('.moonlink'); var planetLinkList = []; // iterate all planets for (const planet of planetList){ planetLinkList.push(planet.getAttribute("href")); } // iterate all moons for (const moon of moonList)...
[ "_createUrls () {\n\t\tvar urls = {};\n\n\t\t//set up all the urls required\n\t\turls.idea = '/' + this.props.idea.idea_id + '/';\n\t\turls.category = '/';\n\t\turls.status = '/' + window.userInfo.company + '/ideas/?status=' + this.props.idea.status.id;\n\n\t\tconsole.log(\"props...\");\n\t\tconsole.log(this.props....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
skipPrevious : PlayList > PlayList
skipPrevious() { const { selectedSongIdx } = this.state const songIdx = selectedSongIdx < 1 ? (this.countTracks() - 1) : selectedSongIdx -1 this.selectSong(songIdx) this.play(songIdx) }
[ "skipNext() {\n const { selectedSongIdx } = this.state\n const isAtLoopPoint = selectedSongIdx >= this.countTracks() - 1 ||\n selectedSongIdx < 0\n\n const songIdx = isAtLoopPoint ? 0 : (selectedSongIdx + 1)\n\n this.selectSong(songIdx)\n this.play(songIdx)\n }", "func...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Set the amount of time the ticker scrolls
function SetScrollDuration(size, type) { var time = size / 12; var duration = time + 's'; if(type === "news") { $("#news-ticker").children("*").css("-webkit-animation-duration", duration); } }
[ "function setSpeed(speed) {\n marqueeInterval = speed;\n}", "function i2uiSetBreadcrumbsScrollSpeed (speed) {\r\n breadcrumbs.speed = speed;\r\n}", "function GADGET_RSS_Auto_Scroll()\n{\t\n\tvar Page = System.Gadget.Settings.read(\"Page\");\n\tGADGET_RSS_Feed_Disp(Page+1);\n}", "function startCountdownTimer...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Accounts Integration callbacks ends here storeAccountDetails() This function is used to store corresponding account data in local storage before redirecting to the Details page. inputs:
function storeAccountDetails(accountObj){ localStorage.konyAccountDetails = JSON.stringify(accountObj); //storing the corresponding account details in localstorage window.location.href = "accountDetails.html"; //redirecting to details page }
[ "function createAccount()\n{\n let nameRef = document.getElementById(\"name\");\n let emailIdRef = document.getElementById(\"emailId1\");\n let password1Ref = document.getElementById(\"password1\");\n let password2Ref = document.getElementById(\"password2\");\n if(password1Ref.va...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
creates a basic vec3 expression
function vec3(comp1, comp2, comp3) { return new expr_1.BasicVec3(...vecSourceList(...[comp1, comp2, comp3].map((c) => expr_1.wrapInValue(c)))); }
[ "function createVector3(pos, ll, dotSize, color, dataIndex){\n\t\n\tvar vec3=pos;\n\tvec3.ll=ll;\n\tvec3.color=color;\n\tvec3.pointSize=dotSize;\n\tvec3.dataIndex=dataIndex;\n\treturn vec3;\n\t\n}", "function AddVectorNormal(v,n){\r\n\t\t\treturn (new Vector3D(v.ux+n.nx, v.uy+n.ny, v.uz+n.nz));\r\n\t\t}", "stat...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Detach the container from DOM
function detach() { var parent = container.parentNode; if (parent) { parent.removeChild(container); } }
[ "detach() {\n const parentNode = this._container.parentNode;\n\n if (parentNode) {\n parentNode.removeChild(this._container);\n\n this._eventBus.fire('propertiesPanel.detach');\n }\n }", "destroyElement() {\n if (this.dom) {\n this.dom.remove();\n }\n }", "clear()...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Exit a parse tree produced by Java9ParsertypeArguments.
exitTypeArguments(ctx) { }
[ "exitTypeArgumentList(ctx) {\n\t}", "exitUnannPrimitiveType(ctx) {\n\t}", "exitTypeParameters(ctx) {\n\t}", "exitParenthesizedType(ctx) {\n\t}", "exitNumericType(ctx) {\n\t}", "exitTypeParameterModifier(ctx) {\n\t}", "exitNullableType(ctx) {\n\t}", "exitTypeTest(ctx) {\n\t}", "exitFormalParameters(c...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
function compiling the userPreferences and converting into a password string including and/or excluding preferences based on confirmation prompts if no types of characters are confirmed (if user hits cancel on all confirmation prompts) this will create an invalid/undefined password
function generatePassword() { var useableCharactersArray = []; getUserPreferences(); var lowerArray = []; var upperArray = []; var numberArray = []; var specialCharsArray = []; if (userPreferences.useLowerCase) { lowerArray = Array.from(lowercaseAlphabet); for (var i = 0; i < lowercaseLength; i++...
[ "function getUserInput() {\n var pwLength = prompt(\"Please select a password length between 8 and 128\");\n if(pwLength < 8 || pwLength > 128) {\n alert(\"Your password needs to be at least 8 and no more than 128 characters\")\n } else {\n var lowerChar = confirm(\"Do you want lower case letters?\");\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Set caret to a specific character for the sort GRADE ascending state
function view_setGradeSortStateCaretUp() { $("#gradeSortStateCaret").html(upCaret); }
[ "function view_toggleGradeSortStateCaret(state) {\n\n view_setSortStateDirty(); // Reset sort state indicators\n\n if (state === 0) {\n view_setGradeSortStateCaretDown();\n } else if (state === 1) {\n view_setGradeSortStateCaretUp();\n }\n}", "function view_setGradeSortStat...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Does this employee have the required fields?
function requiredEmployeedFields(employeeData) { return employeeData.name && employeeData.position && employeeData.wage; }
[ "hasRequiredFields(required, params){\n return required.every(entry => find(params, param => Object.keys(param)[0] == entry.name) !== undefined );\n }", "checkRequiredFieldsFilled()\n {\n var bool = true;\n var requiredFields = this.state.textfields.filter(obj => obj.key.required === true)\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
newInfo has its sorted field (filled out recursively).
static mergeColumnInfo(columnInfo, newInfo) { columnInfo.primitiveCount += newInfo.primitiveCount; columnInfo.objectCount += newInfo.objectCount; for (let item of newInfo.sorted) { let key = item.key; let obj = columnInfo.structure[key]; if (obj === undefined)...
[ "function buildSorted (obj) {\n\n\tif (newUser.searchArray.length === 0) {\n\t\tnewUser.searchArray.push(obj);\n\t\treturn;\n\t}\n\tfor (var i=0; i<newUser.searchArray.length; i++) {\n\t\tif (newUser.searchArray[i][\"date\"] < obj[\"date\"]) {\n\t\t\tnewUser.searchArray.splice(i,0,obj);\n\t\t\treturn;\n\t\t} else i...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Imports the environment from codeqlEnvJsonFilename if not already present
function importTracerEnvironment(config) { if (!("ODASA_TRACER_CONFIGURATION" in process.env)) { const jsonEnvFile = path.join(config.tempDir, codeqlEnvJsonFilename); const env = JSON.parse(fs.readFileSync(jsonEnvFile).toString("utf-8")); for (const key of Object.keys(env)) { pro...
[ "get environment() {\n if (this._enviornment)\n return Promise.resolve(this._enviornment);\n return fs.readFile(this.environmentPath).then((file) => __awaiter(this, void 0, void 0, function* () {\n let localEnvironment = jsonc.parse(file.toString());\n if (!localEnviro...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns the full name for this song with parsed markdown, if any. This is just a shortcut for: ```js Imd.MarkDownToHTML(this.details.artist) + " " + Imd.MarkDownToHTML(this.details.title) ```
parseName() { return ionMarkDown_1.Imd.MarkDownToHTML(this.details.artist) + " - " + ionMarkDown_1.Imd.MarkDownToHTML(this.details.title); }
[ "function artistName(song){\n output+= ` <p class=\"author lead d-flex\"><strong>${song.title} </strong>&nbsp; Album by &nbsp;<span> ${song.artist.name}</span> <button class=\"btn btn-success ml-auto\" data-artist =\"${song.artist.name}\" data-songtitle=\"${song.title}\">Get Lyrics</button></p>`;\n }", ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function responsible for selecting a project direcotry, ensuring that it has the appropriate structure and the then adding any contents to the map.
async function connectProjectFolder() { //Allow the user to select a directory (requests read access) projectDirectoryHandle = await window.showDirectoryPicker(); document.getElementById("connect-folder-button").innerHTML = `connected to: ${projectDirectoryHandle.name}`; //Creates the directory struct...
[ "function projectPopulator(id) {\n var selector;\n if (id== \"project\"){\n selector= document.getElementById(\"project\");\n }else {\n selector= document.getElementById(\"dProject\");\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get the next sync task with the earliest creation date that has not started yet
async function getNextSyncTask() { const result = await query(` PREFIX ext: <http://mu.semte.ch/vocabularies/ext/> PREFIX dct: <http://purl.org/dc/terms/> PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> PREFIX adms: <http://www.w3.org/ns/adms#> SELECT ?s ?created WHERE { ?s a ext:SyncTask ;...
[ "async function scheduleSyncTask() {\n const result = await query(`\n PREFIX ext: <http://mu.semte.ch/vocabularies/ext/>\n PREFIX dct: <http://purl.org/dc/terms/>\n PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>\n PREFIX adms: <http://www.w3.org/ns/adms#>\n\n SELECT ?s WHERE {\n ?s a ext:SyncT...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Log into specified CF installation.
function login (consoleCredentials, cb) { // cf login --skip-ssl-validation -a https://api.v3.pcfdev.io -o cfdev-org -s cfdev-space -u user -p pass const consoleApp = consoleCredentials['consoleApp'] log('logging into cf') const args = [ 'login', '--skip-ssl-validation', '-a', consoleApp.cfapi, '-...
[ "static login() {\n const doc = navigationDocument.documents[navigationDocument.documents.length - 1]\n const e = doc.getElementsByTagName('textField').item(0)\n const user = encodeURIComponent(e.getAttribute('data-username'))\n const pass = encodeURIComponent(e.getFeature('Keyboard').text)\n\n const...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Array of Bad movies since year 2000
function getBadMoviesSince2000(badMovies){ let badMoviesSince2000 = badMovies.filter((badMovie) => { return badMovie.year >= 2000; }) console.log("Bad movies since 2000 are :"); console.log(badMoviesSince2000); titlesOfBadMoviesSince2000(badMoviesSince2000); }
[ "function filterByDebut (year) {\n let arr = []\n for (const i of players)\n {\n if (i.debut == year)\n {\n arr.push(i)\n } \n }\n return arr\n}", "function filter_movies_year(search, movieList){\r\n let filtered = [];\r\n\r\n for(let movieId in movieList){\r\n let currRelease = movieLis...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
check if file is ready
function isFileReady ( state ) { return ( !state || state === 'loaded' || state === 'complete' || state === 'uninitialized' ); }
[ "function checkComplete() {\r\n if (sectionLoaderState.filesLoaded >= sectionLoaderState.filesToLoad.length) complete();\r\n}", "function checkFinished () {\n console.log(fileLoadCount+\" files loaded\")\n if (fileLoadCount == fileLoadThreshold) {\n console.log(\"basicFileLoader - callback: \"+cFunc.n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This is a function for postV3ProjectsIdStar
postV3ProjectsIdStar(incomingOptions, cb) { const Gitlab = require('./dist'); let defaultClient = Gitlab.ApiClient.instance; // Configure API key authorization: private_token_header let private_token_header = defaultClient.authentications['private_token_header']; private_token_header.apiKey = 'YOUR API KEY'...
[ "postV3ProjectsForkId(incomingOptions, cb) {\n const Gitlab = require('./dist');\nlet defaultClient = Gitlab.ApiClient.instance;\n// Configure API key authorization: private_token_header\nlet private_token_header = defaultClient.authentications['private_token_header'];\nprivate_token_header.apiKey = 'YOU...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets a value indicating whether the creep is retired.
get isRetired () { return this._creep.ticksToLive < (this._creep.body.length * CREEP_SPAWN_TIME + C.RETIREMENT); }
[ "get isReadyForRestart() {\n if (this.updateStagingEnabled) {\n let errorCode;\n if (this.update) {\n errorCode = this.update.errorCode;\n } else if (this.um.readyUpdate) {\n errorCode = this.um.readyUpdate.errorCode;\n }\n // If the state is pending and the error code is n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Logs provided arguments with a timestamp if this.verbose is true. TODO: refactor into separate base class
vlog(/* all arguments are passed to console.log */) { if (this.config.verbose) { console.log(new Date().toString(), ...arguments) } }
[ "function log() {\n if (!started)\n started = Date.now();\n var elapsed = Math.round((Date.now() - started) / 1000);\n console.log.\n bind(undefined, '[' + elapsed + 's]').\n apply(undefined, arguments);\n}", "_log() {\n let args = Array.prototype.slice.call(arguments, 0);\n\n if (!args....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Visit a parse tree produced by PlSqlParsercpu_cost.
visitCpu_cost(ctx) { return this.visitChildren(ctx); }
[ "visitNetwork_cost(ctx) {\n\t return this.visitChildren(ctx);\n\t}", "docosts1(u,cost) {\n\t\tlet l = this.left(u); let r = this.right(u);\n\t\tlet mc = cost[u];\n\t\tif (l) {\n\t\t\tthis.docosts1(l,cost);\n\t\t\tmc = Math.min(mc, this.#dmin[l]);\n\t\t}\n\t\tif (r) {\n\t\t\tthis.docosts1(r,cost);\n\t\t\tmc = Mat...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Tracks a promise, sets the prop when loaded, handles load count
_watchPromise(propName, promise) { const asyncProp = this.asyncProps[propName]; if (asyncProp) { asyncProp.pendingLoadCount++; const loadCount = asyncProp.pendingLoadCount; promise.then(data => { data = this._postProcessValue(asyncProp, data); this._setAsyncPropValue(propName...
[ "_withProgress(promise) {\n var _this = this;\n this.incrementProperty('__loadingCounter');\n if (Ember.isPresent(promise)) {\n return promise.finally(function () {\n if (!_this.get('isDestroyed')) {\n _this.decrementProperty(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
need to output the number of hours for each job that will get me the same pay as before. need to output all possible whole number hour combonations a function that will take the pay rate of one job and multiply it by a number of hours (x), starting at 1 then increment the number of hours until 60, and add that number t...
function calcCombinedHours() { var holdValue; while (x = 1; x++; x > 60) var y = 60 - x; holdValue = (aspiraPay * x) + (platesPay * y); console.log(holdValue); }
[ "function cost (mins) { \n \n let charge = 0;\n let hour = 0;\n \n while(mins > 5){\n\n if(mins <= 65 && hour == 0){\n charge = 30;\n break;\n } else if(hour == 0){\n charge += 30;\n mins = mins - 60;\n hour++;\n } else {\n charge += 10;\n mins = mins - 30;\n }\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Adding a gloss button
function glossbutton_ontap(evt){ evt=evt||window.event; var target=fdjtUI.T(evt); var passage=getTarget(target); if ((Codex.mode==="addgloss")&& (Codex.glosstarget===passage)) { fdjtUI.cancel(evt); Codex.setMode(true);} else if (passage) { ...
[ "function drawMapButton() \n{\n fill(0);\n rect(buttonX, buttonY, buttonWidth, buttonHeight);\n fill(255);\n text('Click here to change mappings', buttonX + 7, buttonY + 20);\n}", "drawExtraUI() {\n // draw the button for canceling ability if an ability is being used if it has not been used partly\n if ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Whenever async props are changing, we need to make a copy of oldProps otherwise the prop rewriting will affect the value both in props and oldProps. While the copy is relatively expensive, this only happens on load completion.
_freezeAsyncOldProps() { if (!this.oldAsyncProps && this.oldProps) { // 1. inherit all synchronous props from oldProps // 2. reconfigure the async prop descriptors to fixed values this.oldAsyncProps = Object.create(this.oldProps); for (const propName in this.asyncProps) { Object.def...
[ "_updateUniformTransition() {\n // @ts-ignore (TS2339) internalState is alwasy defined when this method is called\n const {\n uniformTransitions\n } = this.internalState;\n\n if (uniformTransitions.active) {\n // clone props\n const propsInTransition = uniformTransitions.update();\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
date: 3.1.17 title: object drills review foo => 'bar' answerToUniverse => 42 olly olly => 'oxen free' sayHello => a function that returns the string 'hello'
function createMyObject() { return{ foo:'bar', answerToUniverse: 42, "olly olly": 'oxen free', sayHello: function(){ return 'hello'; } }; }
[ "function intro(o) {\n console.log('Hi my name is ' + o.firstName + \n ' and my lastname is ' + o.lastName +\n ' and my age is ' + o.age);\n}", "function practice(ninja, weapon, technique) {}", "function myTodo(todo) {\n console.log(todo.title + ' : ' + todo.text);\n}", "fu...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
the method return static middleware for different server
getMW (path, opts) { // declare let mw = null // get server type of web server const serverType = this.ServerType.toLowerCase() switch (serverType) { case Constants.ServerOfExpress: { // get class of express const express = require('express') // get static module from expres...
[ "getMiddleware() {\n var ref;\n const manifest = this.getMiddlewareManifest();\n const middleware = manifest == null ? void 0 : (ref = manifest.middleware) == null ? void 0 : ref[\"/\"];\n if (!middleware) {\n return;\n }\n return {\n match: getMiddlew...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
boldText Set the text to bold or unbold and set storage
function boldText() { document.execCommand('bold', false, ''); browser.storage.local.set({ key: txtArea.innerHTML }); }
[ "static set boldLabel(value) {}", "static set whiteBoldLabel(value) {}", "static set miniBoldLabel(value) {}", "function _editTextFontWeight ( /*[Object] event*/ e ) {\n\t\te.preventDefault();\n\t\tvar activeObject = cnv.getActiveObject();\n\t\tif ( this.checked ) {\n\t\t\tactiveObject && activeObject.set({fo...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns the value the override point will have if there is no override set on this instance.
getDefaultValue() { if (!this.__symbolInstance) { return this.getResolvedValueOnDetachedSymbol() } return this.__symbolInstance.sketchObject.defaultValueForOverridePoint( this._object ) }
[ "getValueSetOnInstance() {\n if (!this.__symbolInstance) {\n return null\n }\n var overrideValues = this.__symbolInstance.sketchObject.overrideValues()\n for (var i = 0; i < overrideValues.length; i++) {\n if (\n overrideValues[i].overridePath().isEqual(this._object.overridePath())\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Idea: Start with the first odd number that is <= sqrt(n), then work downwards (skipping over the even numbers) until the first prime factor is found this one will be the largest.
function determineLargestPrimeFactor(n) { let num = Math.ceil(Math.sqrt(n)) - 1; if (num % 2 === 0) { num--; } while (num > 0) { if (n % num === 0 && isPrime(num)) { return num; } num -= 2; // we can skip even numbers } return 0; }
[ "function solve(n) {\n let currentSquareRoot = 1;\n let previousSquareRoot = 1;\n\n while (currentSquareRoot ** 2 - previousSquareRoot ** 2 < n) {\n if (isPerfectSquare(currentSquareRoot ** 2 + n)) {\n return currentSquareRoot ** 2;\n }\n\n previousSquareRoot = currentSquareRoot;\n currentSquare...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
A function which returns an array of agents, which are in neighboring latticecells
getNeighbors(col, row){ var res = []; //left border if(col > 0){ this.agentController.ocean.lattice[col-1][row].forEach( (agent) =>{ res.push(agent); }); } //right border if(col < (100/ocean.latticeSize)-1){ this.agentController.ocean.lattice[col+1][row].forEach( (agent...
[ "getNeighborsOnOff(y, x) {\n const results = [];\n for (let i = y - 1; i <= y + 1; i++) {\n for (let j = x - 1; j <= x + 1; j++) {\n // When getting neighbors for the first or last row/column on a non-infinite board, many\n // neighbors are non-existent so for our purposes, assume they are ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Since the prompt specifically asks us to use a third stack, I'll assume that we should leverage polymorphism. I was considering instanceof checks to handle array and list implementations for each stack, since that would save us space, but the prompt specifically wants us to use a stack. So, I'll compare top elements of...
function compareStacks(stack1, stack2) { let compare = []; // stores the values as we pop each stack let restore; // used for returning the stacks to their original state let match = true; // return value, arbitrarily defaults to true while (stack1.top() === stack2.top() && !stack1.isEmpty()) { // as long as bo...
[ "function tasks_stack() {\r\n let stackdata = new Stack(1);\r\n stackdata.push(4);\r\n stackdata.push(8);\r\n stackdata.push(9);\r\n stackdata.push(10);\r\n stackdata.push(11);\r\n\r\n stackdata.parse_llist();\r\n let out = stackdata.pop();\r\n let out1 = stackdata.pop();\r\n let out2 ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Draws the variables of the memory model.
function drawVars(location, vars) { vars.forEach(function (variable) { var value = determineVar(variable); var html = "<div class='variable'>" + "<div class='variableLabel'><p>" + variable.name + "</p></div>" + "<div id='" + variable.id + "' class='variableValue'><p>" + valu...
[ "function drawModel(model) {\n clearCanvas();\n vm.currentModel = JSON.parse(model);\n var environment = JSON.parse(vm.currentModel.value);\n // Draw first the nodes\n $.each(environment.nodes, function(index, node) {\n element = createElement(node.elementId, node);\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Find first number under 50
function under50(num) { return num < 50; }
[ "function arrayLessThan100(arr) {\n\treturn arr.reduce((x, i) => x + i) < 100;\n}", "function locatePageInBucket(pageNum){\n var pageInBucket = (pageNum) % 5;\n return pageInBucket;\n }", "function GetTopBooks(n, criterion) {\n\n}", "function isGreaterThan20(num){\r\n if(num>20){\r\n return true\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Read a multiline string by calculating the depth of `=` characters and then appending until an equal depth is found.
function readLongString(isComment: boolean): ?string { let level = 0; let content = ""; let terminator = false; let character; const firstLine = line; const firstLineStart = lineStart; const from = index; ++index; // [ // Calculate the depth of the comment. while ("=" === input.charAt(index + leve...
[ "function fixPerLine(item)\n{\n if( item.value.match(/\\r\\n/) )\n {\n var strings = item.value.split(\"\\r\\n\");\n\n item.value = '';\n\n for( var i = 0; i < strings.length; i++ )\n {\n if( strings[i] != '' )\n {\n strings[i] = strings[i].repl...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Adds html element to body after prevElement attribute is the html attribute of html element attrValue is the attribute value of html document
function addElement(prevElement, element, attribute, attrValue) { if (prevElement != "") { prevElement.after(element); if (attribute != "" || attrValue != "") { let attr = document.createAttribute(attribute); attr.value = attrValue; element.setAttributeNode(attr);...
[ "setHtml(element, html){\n element.html(html);\n }", "createHTMLElement(parent){\n let htmlElement=document.createElement(this.htmlTagName);\n this.parent=parent;\n this.parent.appendChild(htmlElement);\n this.htmlElementId=getUniqueId(parent,this.htmlTagName);\n htmlElement...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
show hide the author
function showHideAuthor () { //chair description is hidden here chairText.style.display=displayNone; if (authorDisplay.style.display === displayNone || authorDisplay.style.display === "") { authorDisplay.setAttribute("class", "grid-item slide-left"); authorDisplay.style.display = displayB...
[ "function _updateAuthor()\n {\n MODEL.instance.author(_authorField.value);\n }", "function sortAuthor() {\r\n closeBookDetailsIfVisible();\r\n removeCurrentSelection();\r\n $('.bookshelf').isotope({ sortBy : \"author\" });\r\n getCurrentSelection();\r\n AuthorSortIc...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
END INIT RESET LISTS
function resetLists(){ log("resetLists()","info"); images_listForInsert = Array(); compass_listForInsert = Array(); }
[ "function initialize() {\n // console.time('List init');\n if (options.optimize) {\n _knockout2.default.options.deferUpdates = true;\n }\n rows().forEach(function (row) {\n row.items().forEach(function (item) {\n item.dispose && item.dispose();\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
check if against has same value for any key in matcher
function matchesAny (matcher, against) { var keys = Object.keys(matcher); for (var i = 0; i < keys.length; i++) { if (matcher[keys[i]] === against[keys[i]]) { return true; } } return false; }
[ "function partialMatchKey(a, b) {\n return partialDeepEqual(a, b);\n}", "function attrMatch(searchKey,Itm) {\n for(let x in searchKey)//loop through each attribute of the search object\n if(searchKey[x]!==Itm[x])// and compare them to the matching attr in the item\n return false// if even a ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Load list of Hose Types
function loadHoseTypes() { $.get("/api/general/hoseTypes" ).done(function (data) { var hoseType = $("#hoseType"); $.each(data.hoseTypes, function (index, element) { hoseTypes[element.id] = element; hoseType.append($("<option/>", {text: element.name, value: element.id})) ...
[ "function initTypes() {\n // Boolean for production/file supplied/online or not\n var online = false;\n var json_raw_data = null;\n var var_types_url = null;\n if (online) {\n // Retrieve from dataverse API\n } else {\n // Read from local'\n var_types_url = \"../../data/preprocess_4_v1-0.json\";\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Add a new webview to the collection.
add(uri, webviewPanel) { const entry = { resource: uri.toString(), webviewPanel }; this._webviews.add(entry); webviewPanel.onDidDispose(() => { this._webviews.delete(entry); }); }
[ "addViews(views) {\n for (let i = 0; i < views.length; i++)\n this.addView(views[i]);\n }", "addEntryView(entryView) {\n const entry = entryView.model;\n\n this._entryViews.push(entryView);\n this._entryViewsByID[entry.id] = entryView;\n this.model.addEntry(entry);\n\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Detect Phone Numbers and turn them into clickable links for mobile.
function detectPhoneNumbers(str){ var expression = /\b\(?\d{3}\)?[-\s.]?\d{3}[-\s.]\d{4}\b/i; var regex = new RegExp(expression); var split = str.split(" "); for(var i=0; i< split.length; i++){ var text = split[i].split(".").slice(1).join(".").split("-")[0]; if(split[i].match(regex)){ ...
[ "_linkPhone(options, callback) {\n Meteor.call(prefix + '_linkPhone', options, ensureCallback(callback));\n }", "function convertPhone(phone) {\n const numbers = phone.match(/\\d/g);\n console.log(numbers)\n let fixedPhone\n if (numbers.length === 8) {\n fixedPhone...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Attach the given ComponentPortal to this PortalOutlet using the ComponentFactoryResolver.
attachComponentPortal(portal) { portal.setAttachedHost(this); // If the portal specifies an origin, use that as the logical location of the component // in the application tree. Otherwise use the location of this PortalOutlet. const viewContainerRef = portal.viewContainerRef != null ? ...
[ "function attachOnDOM(){\n\tdocument.getElementsByTagName('body')[0].appendChild(getComponent())\n}", "function Portal({ container, children }) {\n const [mountNode, setMountNode] = useState(null);\n\n useEffect(() => {\n setMountNode(container ? container.current : document.body);\n }, [container]);\n\n i...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Clear all the file entries from list that can be uploaded files or added in upload queue.
clearAll() { if (Object(_syncfusion_ej2_base__WEBPACK_IMPORTED_MODULE_0__["isNullOrUndefined"])(this.listParent) && !(this.isBlazorSaveUrl || this.isBlazorTemplate)) { if (this.browserName !== 'msie') { this.element.value = ''; } this.filesData = []; ...
[ "clear() {\n\t\tthis.watchList.forEach((item) => this.remove(item.uri));\n\t\tthis.watchList = [];\n\n\t\tchannel.appendLocalisedInfo('cleared_all_watchers');\n\t\tthis._updateStatus();\n\t}", "function handleDeleteUpload() {\n setFiles([])\n deleteFile(document)\n handleDocumentDelete(document)\n fil...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns whether or not the dapp should attempt to auto login with the Authenticator app. Auto login will only occur when there is only one Authenticator that returns shouldRender() true and shouldAutoLogin() true.
shouldAutoLogin() { return false; }
[ "shouldAutoLogin() {\n return false;\n }", "checkUnrecognizedAutoFill() {\n if (this.state.username !== \"\" || this.state.password !== \"\") {\n return false;\n }\n let username = this.props.testBlankUsername\n ? this.props.testBlankUsername\n : this.usernameField.value;\n let pass...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
compute loss factor (LF) for oxidized beta acids (oBA), for a specific hop addition, using: . overall loss factor for fermentation, . nonIAA loss factor for krausen, . overall loss factor for finings, . overall loss factor for filtering, . overall loss factor for age Assume that pH and OG have little effect on oBA.
function compute_LF_oBA(ibu, hopIdx) { var LF_oBA = 0.0; LF_oBA = compute_LF_ferment(ibu) * compute_LF_nonIAA_krausen(ibu) * compute_LF_finings(ibu) * compute_LF_filtering(ibu) * compute_LF_age(ibu); if (SMPH.verbose > 5) { console.log("oBA LOSS FACTOR = " + LF_oBA...
[ "function compute_LF_oAA(ibu, hopIdx) {\n var LF_oAA = 0.0;\n var oAA_LF_boil = 0.0;\n\n // enforce that oAA_LF_boil is same as IAA loss factor\n oAA_LF_boil = SMPH.IAA_LF_boil;\n\n LF_oAA = oAA_LF_boil *\n compute_LF_OG_SMPH(ibu, hopIdx) *\n compute_LF_oAA_pH(ibu) *\n compute_LF_...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Tugas 2. Buatlah sebuah fungsi bernama calculateMultiply(), yang mengembalikan nilai berupa hasil kali dari dua parameter yang dikirim.
function calculateMultiply(num1, num2){ return num1 * num2 }
[ "function multiplicacion(a, b) {\n //tu codigo debajo\n let resultado = a * b;\n return resultado;​\n}", "function product (a, b){\n return a*b;\n}", "function multiplizieren(a,b) {\r\n return a * b ;\r\n}", "function MULTIPLY() {\n for (var _len10 = arguments.length, values = Array(_len10), _key10 = ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
this is a recursive function that combines n columns of m rows into the nm possible permutations permutations is the input subgroups arranged into columns to be combined (ex [head1, head2], [body1, body2], [hands1, hands2]). the output from the example above is [[head1, body1, hands1], [head1, body1, hands2], [head1, b...
function combineSubarrays(permutations) { let combinationsFromThisLayer = []; // combinations from this layer of recursion. let tmpCombinations = []; // check if there are any variatns in this subarray if (permutations.length == 1) { return permutations[0]; } // if in the bottom layer, simply return the last array ...
[ "function permutations(cmaps, used, l) {\r\n\t\t\t\tif (cmaps.length == 0 || l >= mat.length) {\r\n\t\t\t\t\treturn cmaps;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tvar rvmaps = [];\r\n\t\t\t\tfor(var r = 0; r < mat[l].length; ++r) {\r\n\t\t\t\t\tif (!used[r] && mat[l][r].length > 0) {\r\n\t\t\t\t\t\tused[r] = true;\r\n\t\t\t\t\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sets the application menu. It is hidden on all platforms except macOS because otherwise copy and paste functionality is not available.
function setApplicationMenu() { if (process.platform === 'darwin') { const template = [ { label: app.name, submenu: [ { role: 'services', submenu: [] }, { type: 'separator' }, { ro...
[ "function setAppMenu() {\n let menuTemplate = [\n {\n label: appName,\n role: 'window',\n submenu: [\n {\n label: 'Quit',\n accelerator: 'CmdorCtrl+Q',\n role: 'close'\n }\n ]...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Subtract two coordinates from teach other Each value from vertex1 is substracted from vertex2 and returned as a new SingleVertex
static subCoordinates (vertex1, vertex2) { return new SingleVertex( vertex1.getXCoord() - vertex2.getXCoord(), vertex1.getYCoord() - vertex2.getYCoord(), vertex1.getZCoord() - vertex2.getZCoord() ); }
[ "static vSub(a,b) { return newVec(a.x-b.x,a.y-b.y,a.z-b.z); }", "subtract(otherVector) {\n return new Vector4(this.x - otherVector.x, this.y - otherVector.y, this.z - otherVector.z, this.w - otherVector.w);\n }", "sub(other, out) {\n out.x = this.x - other.x;\n out.y = this.y - other...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
An event handler recording that a modification has been made
function handleModifiedEvent(event) { setModified(true); }
[ "add_change(func) {\n this.add_event(\"change\", func);\n }", "changed() {\n ++this.revision_;\n this.dispatchEvent(EventType.CHANGE);\n }", "onSelectionEdited(func){ return this.eventSelectionEdited.register(func); }", "function setChanged (){\n\t\tformModified = true;\n\t}", "function fie...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Clone a cell model.
function cloneCell(model, cell) { switch (cell.type) { case 'code': // TODO why isn't modeldb or id passed here? return model.contentFactory.createCodeCell({ cell: cell.toJSON() }); case 'markdown': // TODO why isn't modeldb or id passed he...
[ "copy() {\n return new Cell(this.x, this.y);\n }", "clone () {\n\n var newBoard = new GameBoard(this.size);\n\n var i,j;\n\n for (i=0; i<this.size; i++) {\n\n for (j=0; j<this.size; j++) {\n\n newBoard.set(this.get(i, j), i, j);\n }\n }\n\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
build game stage array according to border size
function createGameStageArray(){ let borderSize = getBoardSize(); let rows = borderSize[0]; let cols = borderSize[1]; for(let row=0;row<rows;row++){ gameStageArch[row] = []; for(let col=0;col<cols;col++){ gameStageArch[row][col] = false; } } }
[ "function createplat(){\n platforms.push(\n {\n x: 0,\n y: 200,\n width: 200,\n height: 15\n },\n {\n x: 100,\n y: 300,\n width: 200,\n height: 15\n },\n {\n x: 300,\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets the view properties of the trigger and overlay, including whether they are clipped or completely outside the view of any of the strategy's scrollables.
_getScrollVisibility() { // Note: needs fresh rects since the position could've changed. const originBounds = this._getOriginRect(); const overlayBounds = this._pane.getBoundingClientRect(); // TODO(jelbourn): instead of needing all of the client rects for these scrolling containers ...
[ "get positionTargetConfig() {\n const { viewHeight, viewWidth, viewOffsetTop, viewOffsetLeft } = this.viewAreaInfo;\n let left;\n let top;\n if (this.fullScreen) { /* keep it for caching only to not break other algorithms */\n return {\n rect: {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets or sets the needle breadth.
get needleBreadth() { return this.i.b9; }
[ "get needleOutline() {\n return brushToString(this.i.hy);\n }", "function needleBaseOutline(svg, chartHeight, offset, needleColor, centralLabel, outerNeedle) {\n // Different circle radiuses in the base of needle\n var innerGaugeRadius = centralLabel || outerNeedle ? chartHeight * 0.5 : chartHeigh...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Create a new ExtraLineItem
function createExtraLineItem(options={}) { let fields = extraLineFields({ order: options.order, }); if (options.currency) { fields.price_currency.value = options.currency; } constructForm(options.url, { fields: fields, method: 'POST', title: '{% trans "Add ...
[ "function createCreditNoteDetailLine()\n{\n\ttry\n\t{\n\t\t// create credit note line\n\t\tcreditNoteRecord.selectNewLineItem('item');\n\t\tcreditNoteRecord.setCurrentLineItemValue('item', 'item', COMMISSIONITEMINTID); \n\t\tcreditNoteRecord.setCurrentLineItemValue('item', 'amount', comTotal);\n\t\tcreditNoteR...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Instantiates a Smart Array.
function SmartArray(capacity){/** * The active length of the array. */this.length=0;this.data=new Array(capacity);this._id=SmartArray._GlobalId++;}
[ "static array(v, dynamic) {\n throw new Error(\"not implemented yet\");\n return new Typed(_gaurd, \"array\", v, dynamic);\n }", "function light_array_creator(light_constructor){\n arr = [];\n for(i = 0; i < 1000; i++){\n arr.push([])\n for(j = 0; j < 1000; j++){\n arr[i].push(new li...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }