query
stringlengths
9
34k
document
stringlengths
8
5.39M
negatives
listlengths
19
20
metadata
dict
Gets the expiring dates of the tasks and transforms it into javascript format
function get_dates(){ //resets the arrays to empty them, in order to refill them from scratch dates=[]; dates_id=[]; //gets the expiring dates from the html in the SQL format and the IDs of their HTML elements var sql_dates=document.querySelectorAll(".date"); sql_dates.forEach(function(element, index){ dates.pu...
[ "function getExpirationDate(){\n\t\n\tlet current_time = new Date();\n\tlet expiration_date = new Date(current_time.setMonth(current_time.getMonth()+1));\n\tlet ed_formatted = expiration_date;\n\tlet dd = String(ed_formatted.getDate()).padStart(2, '0');\n\tlet mm = String(ed_formatted.getMonth() + 1).padStart(2, '0...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
The function used to create a match. It checks to verify that the data the user imported is infact valid data for a match to be created on, and then uses this data to host a match and call an AJAX POST request to send the match's data to the SQL database.
function createMatch(){ var date = $('#date').val(); var time = $('#time').val(); var userSport = localStorage.getItem('userSport'); var matchMade = {}; console.log(date, time); if(date === 'Day' || time === 'Time') { window.alert('...
[ "function createMatchAPI(match){\n console.log('createMatchAPI')\n postRequest(hostMatchReturn, createURL, match);\n}", "@action\n create_match() {\n try {\n // check if the current match is valid.\n this.is_valid(this.curr_match);\n } catch (error) {\n }\n console.log(this.curr_match);\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function to hide all the content
function hideAllContent() { $("#overview").hide(); $("#tips").hide(); $("#sample1").hide(); $("#sample2").hide(); $("#sample3").hide(); }
[ "function hideAllContent() {\n $(\"#overview\").hide();\n $(\"#resources\").hide();\n $(\"#examples\").hide();\n $(\"#tipsandtricks\").hide();\n }", "function hideAll() {\n $('#built-in-content').hide();\n $('#create-form-panel').hide();\n $('#log-in-panel').hide();\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
It contains all the song titles and ids of the current playList needed for the sorting
function PlayListSongsToOrder(){ /** * It's the id of the playList */ this.playlistId = null; /** * It's an array that contains song element. This attribute will be used to fill the table for the reorder */ this.songs = new Array(); /** ...
[ "_createSongTitles() {\n for (var i = 0; i < this.playList.length; i++) {\n this.playList[i].element.innerHTML = this._getSongTitle(i);\n }\n }", "function _composeSongList() {\n for(var i = 0; i < 2; i++) {\n songList.push([songs[i].name,songs[i].artist]);\n }...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Whether the specified file is part of sbbangular.
function isSbbAngularSpecFile(path) { return path.slice(-8) === '.spec.js' && path.indexOf('node_modules') === -1; }
[ "get isBsFile() {\n const lowerSrcPath = this.srcPath.toLowerCase();\n return lowerSrcPath.endsWith('.bs') && !lowerSrcPath.endsWith('.d.bs');\n }", "get isBrsFile() {\n return this.srcPath.toLowerCase().endsWith('.brs');\n }", "get isTypdefFile() {\n return this.srcPath.toLowe...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
proccess all explosions with each game loop
function handleExplosions() { for (explosion in explosionHolder) { explosionHolder[explosion].draw(); explosionHolder[explosion].kill(); } }
[ "function updateExplosions() {\n for(var i = sceneElements.explosions.length - 1; i >= 0 && sceneElements.explosions[i] instanceof Explosion; i--) {\n sceneElements.explosions[i].updateExplosion();\n if(sceneElements.explosions[i].done) {\n delete sceneEle...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Assets When a gm is present (instance creation), we need to do a threeway merge between constructor options, instance options and parent options.
function mergeAssets(parentVal, childVal, gm, key) { var res = Object.create(parentVal || null); if (childVal) { // process.env.NODE_ENV !== 'production' && assertObjectType(key, childVal, gm) return extend(res, childVal); } else { return res; } }
[ "_setOptions(options) {\n if (options.draw.shapefile){\n if (options.draw.shapefile == true){\n options.draw.shapefile = this.options.draw.shapefile;\n } else {\n Object.assign(options.draw.shapefile, this.options.draw.shapefile);\n }\n }\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Controls Switch Between Work and Play States
function switchStates(){ player.playVideo(); if (clockState===0){ num1 = parseInt($("#playDigit1").html()); num2 = parseInt($("#playDigit2").html()); num3 = 0; num4 = 0; $("#number1").html(num1); $("#number2").html(num2); $("#number3").html(num3); $("#number4").ht...
[ "function switchWorkTime() {\n if (working) {\n return;\n }\n \n working = true;\n console.log(working);\n toggleButtons();\n currentTime = workTime;\n displayTime();\n }", "fu...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Set component duration percent in inputs.
function setComponentDurationPercent() { componentActivityDuration.ORIGIN.components.forEach(componentDuration => { // not all component affected, check service section ORIGIN or DESTINATION if (componentDuration.service_section === 'ORIGIN') { const componentRow = pricingWrapper.find(`.row-component[data-c...
[ "setPercent(percent) { this._behavior('set percent', percent); }", "_setValuePercent() {\n const dif = ((this.value - this.min) / (this.max - this.min)) * 100;\n this.el.style.setProperty('--valuePercent', `${dif}%`);\n }", "set_duration(duration) {\n this.duration = duration / 60;\n this.d...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
mark all tasks as done (To Complete)
function AllDone(){ }
[ "function tasksComplete() {}", "function doneTasks() {\n\n\t\tif (doneTasksBuffer.length === 0) {\n\t\t\treturn;\n\t\t}\n\n\t\tlet title = (doneTasksBuffer.length === 1) ?\n\t\t\t'Task finished' :\n\t\t\tdoneTasksBuffer.length + ' tasks finished'\n\n\t\tnotify('done', title, doneTasksBuffer.join(', '));\n\n\t\tdo...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
jslint indent: 2, plusplus: true, sloppy: true Generate uniformly distributed random numbers Gives a random number on the interval [min, max). If discrete is true, the number will be an integer.
function runif(min, max, discrete) { if (min === undefined) { min = 0; } if (max === undefined) { max = 1; } if (discrete === undefined) { discrete = false; } if (discrete) { return Math.floor(runif(min, max, false)); } return Math.random() * (max - min) + min; }
[ "function rand(min,max) {}", "function randint(range) {return Math.floor(Math.random() * Math.floor(range))}", "function randomNumberGenerator(min, max) {return Math.floor(Math.random() * (max - min + 1) ) + min;}", "function getRandom(min,max){return Math.floor(Math.random()*(max+1-min))+min;}////", "funct...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Create data training date
createTrainingDate(payload) { return this.request.post('/create-training-date', _objectSpread({}, payload)); }
[ "function createDate() {\n tehDate = new Date();\n }", "function train() {\n const CREATE_OPTIONS = {\n 'MODEL_TYPE': 'ARIMA',\n 'TIME_SERIES_TIMESTAMP_COL': DATETIME_COLUMN,\n 'TIME_SERIES_DATA_COL': DATA_COLUMN,\n };\n\n const project = getConfiguration()[0];\n const dataset = createDatas...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
CARD details (model, product name, product description) markup
function cardDetailsMarkup(data) { const name = data.NAME; const lastIndex = name.lastIndexOf(' '); const croppedName = name.substring(0, lastIndex); const capitalizeWord = data.DESCRIPTION.charAt(0).toUpperCase() + data.DESCRIPTION.slice(1); const template = ` <span class="details__model">Model:${data...
[ "function CardInfo(image,sellerInfo,heading,pricing,general,description,resaleURL,propertyId){\n this.image = image;\n this.sellerInfo = sellerInfo;\n this.heading = heading;\n this.pricing = pricing;\n this.general = general;\n this.description = description;\n this.resaleURL = resaleURL;\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Given an array of matches as returned by findMatches, return a descriptor for the handler hierarchy specified by the route.
function computeHandlerProps(matches, query) { var props = { ref: null, key: null, params: null, query: null, activeRouteHandler: returnNull }; var childHandler; reversedArray(matches).forEach(function (match) { var route = match.route; props = Route.getUnreservedProps(route.props)...
[ "function computeHandlerProps(matches, query) {\n var props = {\n ref: null,\n key: null,\n params: null,\n query: null,\n activeRouteHandler: returnNull\n };\n\n var childHandler;\n reversedArray(matches).forEach(function (match) {\n var route = match.route;\n\n props = Route.getUnreserved...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Parse assignment expressionObj Call parseBinaryExpression if expression type is binary or call geType if it is a Literal
function parseExpression(expressionObj) { if(expressionObj['type'] === "AssignmentExpression" && expressionObj['operator'] === '=') { if(expressionObj['right'].type === 'BinaryExpression') { inferredTypeRightObj = evaluateBinaryExpression(expressionObj['right']); lookupTypeLeftObj = l...
[ "_parseExpressionStatement() {\n var _a, _b;\n let leftExpr = this._parseTestOrStarListAsExpression(\n /* allowAssignmentExpression */\n false,\n /* allowMultipleUnpack */\n false,\n 2,\n () => localize_1.Localizer.Diagnostic.expectedExpr()\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This function figures out which post we want to downvote and then calls downvote
function handlePostDownVote() { var currentPost = $(this) .parent() .parent() .data("post"); downVotePost(currentPost.id, currentPost.category); }
[ "async function downVoteAction(votes, voter, postId){\n\n // Check if user already voted before and where\n let isUserInUpVoteList;\n let isUserInDownVoteList;\n try {\n isUserInUpVoteList = (votes[0].upVotes.indexOf(voter) > -1);\n isUserInDownVoteList = (votes[0].downVotes.indexOf(voter)...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
However, this function is not rarely used so it will not happen frequently Return local memory object
function memory() { return this._memory = this._memory || {}; }
[ "function memory(){return this._memory=this._memory||{}}", "function memory() {\n\t return this._memory = this._memory || {};\n\t}", "function Memory () {\n}", "get value() {\n // See https://github.com/whatwg/html/issues/5380 for why not `new SharedArrayBuffer()`\n return new WebAssembly.Memory({ ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
> Take all the cowboys spawned during the turn and put them in the appropriate arrays
updateSpawnedCowboys() { for (const cowboy of this.spawnedCowboys) { this.game.cowboys.push(cowboy); cowboy.owner.cowboys.push(cowboy); } this.spawnedCowboys.length = 0; }
[ "function loadBuoys() {\n buoys = [];\n buoysTickCount = [];\n buoysActive = [];\n bellDurations = [];\n\n if (map.buoys == undefined) {\n map.buoys = [];\n return;\n }\n\n var buoyGeometry = new THREE.ConeBufferGeometry(0.5, 2.5, 100);\n\n for (var ii = 0; ii < map.buoys.length; ii++) {\n var buoy...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Filter + Sort Patients = Set patientsFiltered
function updatePatientsVisible() { vm.cohort = osApi.getCohort(); var align = vm.align.name; var sort = vm.sort.name; var filter = vm.filter.name; var events = vm.events.filter(function(e) { return e.selected; ...
[ "function updatePatients() {\r\n let fullPatients = App.models.patients.getPatients();\r\n\r\n self.patients = _.filter(fullPatients, self.filters);\r\n }", "static filterPersons() {\n const personsFiltered = [];\n for (const person of Nacarta.persons) {\n if (!Nacarta.co...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Iteratively animate items and listen to the end of animation for animating the next index is the index of current item to animate in items listItems is array of item
function animateItemIter(index, listItems) { var li = listItems[index], className = "", nextIter; //console.log("str: ", index); nextIter = function() { // detach as it's a one time event li.removeEventListener("transitionend", nextIter, false); animateItemIter(index + 1, listItems); }; /...
[ "function AnimateItem() {\n\n\t\t$('.has-animation').each(function() {\n\t\t\t$(this).appear(function() {\n\t\t\t\t$(this).delay($(this).attr('data-delay')).queue(function(next){\n\t\t\t\t\t$(this).addClass('animate-in');\n\t\t\t\t\tnext();\n\t\t\t\t});\n\t\t\t});\n\t\t});\n\n\t}", "function animateMenuItems() {\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This sample demonstrates how to The operation to update a capacity reservation.
async function capacityReservationUpdateMinimumSetGen() { const subscriptionId = process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}"; const resourceGroupName = process.env["COMPUTE_RESOURCE_GROUP"] || "rgcompute"; const capacityReservationGroupName = "aaaaaaaaaaaaaaaaaaaaaaaaaa"; const capacityReserva...
[ "async function capacityReservationUpdateMaximumSetGen() {\n const subscriptionId = process.env[\"COMPUTE_SUBSCRIPTION_ID\"] || \"{subscription-id}\";\n const resourceGroupName = process.env[\"COMPUTE_RESOURCE_GROUP\"] || \"rgcompute\";\n const capacityReservationGroupName = \"aaaaaaaaaa\";\n const capacityRese...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
returns a string. base path of the js folder in the build
function getJSPath() { return getAssetsPath() + config.build.jsPath; }
[ "function $getJsDir() {\n\treturn $app().mergeEngine.jsDir + \"/\";\n}", "function localBase() {\n if (window.dojoLocalBaseFromJSLocation) {\n var scripts = document.getElementsByTagName(\"script\"),\n src = scripts[scripts.length-1].src;\n return src.replace(/\\/[^/]*$...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
End JSValidatorConfig class. ========================================================================== JSValidatorValidatorConfig is a class that defines a pluggable validator that JSValidator can make use of. ==========================================================================
function JSValidatorValidatorConfig() { var id = null; var src = null; var clazz = null; this.getId = function() { return id; } this.setId = function(inID) { id = inID; } this.getSrc = function() { return src; } this.setSrc = function(inSRC) { src = inSRC; } this.getClass = f...
[ "function JSValidatorConfig() {\n\n var validators = new Object();\n var messages = new Object();\n var forms = new Object();\n\n this.addValidator = function(inValidatorConfig) {\n validators[inValidatorConfig.getId()] = inValidatorConfig;\n }\n this.getValidators = function() {\n return validators;\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Setting up sub links. The ifstatement makes sure I get the right ID even if I click on the spantags inside the atag.
setupSubLinks() { for (let subLink in this.subLinks) { this.subLinks[subLink].addEventListener("click", (e) => { let linkID = e.target.id; if (linkID === "") { linkID = e.target.parentNode.id; } let subViewToShow = linkID.slice(0, -5); this.showSubView(subView...
[ "subLink(o,s){\n const fn = Template.overview.fn;\n const route = gtd.routeItem( 'overview', s );\n return fn.routingBegin(o,s,route) + fn.routingPara(o,s,route) + fn.routingEnd(o,s,route);\n }", "function RMTLinkAsSub_onClick() {\n RMTLinkAsSubDerived(\"Sub\");\n}", "function addLink...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Placement and Speed for initial Bombs
function initbombpos() { for (let i =0; i < numberofbombs; i++) { bombacceleration[i] = random(0.02, 0.03); bombvelocity[i] = random(5, 10); bombposX[i] = random(0.5, width); bombposY[i] = random(-20, -0.5); } }
[ "setInitialBowlerPosition() {\n\t\tthis.startBowlPosX = config.width * 0.55;\n\t\tthis.startBowlPosY = config.height * 0.35;\n\t}", "function boat(x,y, des_speed, ox, oy, width, height, max_speed, image_index, reward_fame, mine_drop)\r\n{\r\n\tthis.x \t\t\t\t= x;//current x coordinate\r\n\tthis.y \t\t\t\t= y;//cu...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This snippet came from LayoutTests/webaudio/dynamicscompressorsimple.html in It can determine if emphasis/deemphasis is disabled in the browser. Then it sets the value to drc.emphasis_disabled in the config.
function get_emphasis_disabled() { var context; var sampleRate = 44100; var lengthInSeconds = 1; var renderedData; // This threshold is experimentally determined. It depends on the the gain // value of the gain node below and the dynamics compressor. When the // DynamicsCompressor had the pre-emphasis fi...
[ "generateEmphasisStyle(emphasize) {\n // If emphasize is undefined (or true), we use full saturation\n const style = {\n saturation: 1\n };\n // only if emphasize is explicitly false to we use saturation of .7\n const method = this.object.properties.emphasisMethod || th...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sort the users list
function sortUsersList() { let i, users, shouldSwitch; let list = document.getElementById("users-list"); let switching = true; while (switching) { switching = false; users = list.getElementsByClassName("list-group-item"); for (i = 0; i < (users.length - 1); ++i) { shouldSwitch...
[ "function sortUsers() {\n users.sort((a, b) => {\n if (a.name < b.name) {\n return -1;\n }\n if (a.name > b.name) {\n return 1;\n }\n return 0;\n });\n}", "sortUsers(input) {\n //compare method for sort function that sorts on given input key\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get the number of weeks the script has been running for.
function getWeekNumber() { if (USE_HARDCODED_WEEK_NUMBER) { return WEEK_NUMBER } var callingfunction = 'Utils.getWeekNumber()' var todaysWeekNumber = getActualWeekNumber(new Date())[1] // [YYYY, MM] var properties = PropertiesService.getScriptProperties() var weekStarted = properties.getProperty(P...
[ "function getWeekNumber_() {\n return Number(Utilities.formatDate(new Date(), \"GMT\", \"w\"));\n}", "function getwk() {\n\tvar curr = new Date;\n\ttoday = moment(curr).format('MM-DD-YYYY');\n\tvar wkno = moment(today).week();\n\tif (wkno % 2 == 0){\n\t\tweekno = wkno - 1;\n\t}\n\telse{\n\t\tweekno = wkno;\n\t}\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Set the district of a voting precinct
function setPrecinctDistrict(precinctID, district) { precinctDistricts[precinctID] = district; }
[ "function assignToDistrict(feature, district) {\n if (district == feature.properties.district) return;\n var pop = feature.properties[populationField]\n var dems = feature.properties[democratsField]\n var reps = feature.properties[republicansField]\n if (feature.properties.district != null) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
untracked() returns an array of lines listing the files not being tracked by Gitlet.
function untracked() { return fs.readdirSync(files.workingCopyPath()) .filter(function(p) { return index.toc()[p] === undefined && p !== ".gitlet"; }); }
[ "function untracked() {\n const index = Index.toc();\n return fs.readdirSync(Files.workingCopyPath())\n .filter(p => index[p] === undefined && p !== '.gitlet');\n }", "async getUnstagedFiles(): Promise<String[]> {\n\t\treturn this.executeLines('git', ['diff-files', '--name-only']);\n\t}", "s...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
erase a square area in the canvas
function eraseSquare(ctx, x, y, size = 1) { ctx.clearRect(x - size / 2, y - size / 2, size, size); }
[ "function eraseSquare(x, y) {\n paintSquare(x, y, constants.GAME_BOARD_COLOR, []);\n}", "function clearArea() {\r\n ctx.clearRect(0, 0, ctx.canvas.width, ctx.canvas.height);\r\n}", "function erase() {\n context.clearRect(0, 0, w, h);\n document.getElementById(\"canvasimg\").style.display = \"none\";\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Heart of the logic for printing data from the Colleague server. Does so by downloading data via a given URL and putting it into an iframe and calling the browser's print() function.
function quickPrint(fileUrl) { // In case we have some residual window, clean it up! cleanUp(); // Make the iframe... $("<iframe>", { id: "dataWindow", frameborder: 0 }).appendTo("body"); var iframe = $("#dataWindow"); // Get the data... $.get(fileUrl, function(data) ...
[ "function quickprintAdjusted(fileUrl) {\n // In case there's residual data from last time, clean things up...\n cleanUp();\n\n // Make the iframe...\n $(\"<iframe>\", {\n id: \"dataWindow\",\n frameborder: 0\n }).appendTo(\"body\");\n var iframe = $(\"#dataWindow\");\n\n // Get t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
/text block popup / contacts map init
function contactsMapInit(mapWrap){ if($('#'+mapWrap).length!=0){ function initialize() { var myLatlng = new google.maps.LatLng(cordX,cordY); var myOptions = { zoom: 15, center: myLatlng, draggable: true, ...
[ "function initContact()\n{\n\t$(\"#map\").goMap(\n\t{ \n \t\tlatitude : 44.433094,\n \t\tlongitude : 26.175533,\n\t\tzoom : 17\n });\n}", "function initMap() {\n definePopupClass();\n\n map = new google.maps.Map(document.getElementById('map'), {\n center: {lat: -31.7541639, lng: -52.3174417},\n zoom: 17,...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
wrapper on simpleSort, cast val1 and val2 into Date object before passing to simpleSort
function dateSort(val1, val2){ return simpleSort(Date.parse(val1), Date.parse(val2)); }
[ "function CreateAbstractDateJavascriptComparator() {\n return (val, val2) => {\n let v1 = (new Date(val).toISOString());\n let v2 = (new Date(val2).toISOString());\n if (v1 == v2)\n return 0;\n if (v1 < v2)\n return -1;\n return 1;\n };\n}", "function...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Skips the hello message of renderers that are created after this is run.
function skipHello() { saidHello = true; }
[ "function skipHello() {\n saidHello = true;\n }", "function skipHello() {\n\t saidHello = true;\n\t}", "function skipHello() {\n saidHello = true;\n}", "function skipHello(){saidHello=true;}", "function skipHello() {\n saidHello = true;\n}", "function pauseRender() {\n shouldRender = f...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function add to populate the no of user dropdown
function populateUserDropDown(noOfUser){ document.getElementById("inputNoOFUser").innerHTML = ""; var noOfUserSelect = document.getElementById("inputNoOFUser"); var defaultOptn = document.createElement("option"); defaultOptn.text = "Select No of User"; defaultOptn.value = ""; defaultOptn.className = "for...
[ "function initUserList() {\n var thisUser = W.loginManager.getLoggedInUser();\n var selectUser = getId(highlightEditor.getSelectId());\n var usrOption = document.createElement('option');\n var usrText = document.createTextNode(thisUser.userName + \" (\" + thisUser.rank + \")\");\n usrOption.setAttrib...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Check whether this object overlaps a point.
function overlapsPoint(x, y) { return !( this.x + this.boundingBox.left >= x || this.x + this.boundingBox.right <= x || this.y + this.boundingBox.top >= y || this.y + this.boundingBox.bottom <= y ); }
[ "function overlap(pointOne, pointTwo) {\n\t\n\t// Return whether they overlap\n\treturn pointOne.x === pointTwo.x && pointOne.y === pointTwo.y;\n\t\n}", "containsPoint(point) {\n return this.x <= point.x && this.y <= point.y && this.maxX >= point.x && this.maxY >= point.y;\n }", "function overlap(obj1, obj2...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Stop the peerconnection server, will not stop the transport created by it
stop() { //Chheck not stopped alrady if (!this.endpoint) //Do nothing return; //Don't listen for stopped event this.endpoint.off("stopped",this.onendpointstopped); //For all transports for (const transport of this.transports) //Stop them transport.stop(); //Close ns this.ns.close()...
[ "stop(){\n if(this.server)\n this.server.close();\n }", "stop()\n {\n this.server.close();\n }", "stop() {\n if (this.server) this.server.close();\n }", "stop() {\n if (this.server === undefined) {\n return;\n }\n this.server.close();\n }", "stop() {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Set up key properties and return the Stream encryption property from the user's configuration.
parseEncryption(props) { var _a; // if encryption properties are not set, default to KMS in regions where KMS is available if (!props.encryption && !props.encryptionKey) { const conditionName = 'AwsCdkKinesisEncryptedStreamsUnsupportedRegions'; const existing = core_1.Sta...
[ "parseEncryption(props) {\n // default to unencrypted.\n const encryptionType = props.encryption || StreamEncryption.UNENCRYPTED;\n // if encryption key is set, encryption must be set to KMS.\n if (encryptionType !== StreamEncryption.KMS && props.encryptionKey) {\n throw new E...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
compare date function return date comparision i.e. fromdate is less than todate
function compareDate(fromDate, toDate) { var dt1 = parseInt(fromDate.substring(0, 2), 10); var mon1 = parseInt(fromDate.substring(3, 5), 10); var yr1 = parseInt(fromDate.substring(6, 10), 10); var dt2 = parseInt(toDate.substring(0, 2), 10); var mon2 = parseInt(toDate.substring(3, 5), 10); var yr2 = parseInt...
[ "function iesvn_CompareDate(fromDate, toDate) {\n if ((fromDate == \"\") || (toDate == \"\")) {\n return null;\n }\n var arrFromDate = fromDate.split(\"/\");\n var arrToDate = toDate.split(\"/\");\n if (arrFromDate.length != 3 || arrToDate.length != 3) {\n\t \t//alert(\"Error, common.js, metho...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns a shuffled order of all stimuli in each category.
function initializeTestingStimuli(){ for (var i=0; i<3; i++){ var toRemove = eval("category"+(i+1)); testingStimuli = testingStimuli.concat(toRemove); } if (debug) console.log("Testing stimuli: "+testingStimuli); testingStimuli = shuffle(testingStimuli); if (debug) console.log("Shuffled testing stimuli: "+tes...
[ "function shuffleCategory() {\n var element = document.querySelector('#grid');\n var shuffleInstance = new Shuffle(element, {\n itemSelector: '.category.shuffle-item--visible'\n });\n shuffleInstance.filter();\n}", "function order(){\n\t/* Probability table for how likely each category is to follow another...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
setupharry() Initialises harry position and health
function setupharry() { harryX = 4*width/5; harryY = height/2; harryHealth = harryMaxHealth; }
[ "function setupgaren() {\n\tgarenX = 4 * width / 5;\n\tgarenY = height / 2;\n\tgarenHealth = garenMaxHealth;\n\n}", "function SetupHQBuilding() {\n\tvar HQ : Tower = new Tower();\n\tHQ.configState[0, 0] = 0;\n\tHQ.configState[0, 1] = 0;\n\tHQ.configState[0, 2] = 0;\n\tHQ.configState[1, 0] = 1;\n\tHQ.configState[1...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get Array of Images from the directory folder
function getImagesFromDirectory(dirPath) { let allImages = []; let files = fs.readdirSync(dirPath); for (const file of files) { allImages.push(file); } return allImages; }
[ "function getImagesFromDirectory(dirPath){\n let allImages = [];\n let files = fs.readdirSync(dirPath);\n\n for (const file of files) {\n allImages.push(file);\n }\n return allImages;\n}", "function getImages(dir, images) {\n var images = images || [];\n let files = fs.readdirSync(dir)...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Iterates through EC2 objects and calls
function iterateEC2ObjectsAndCall(data, entities, callback, callbackArgs) { if (entities.length > 0) { var entity = entities.shift() var recurse = entities.length for (let i in data[entity]) { if (recurse) { iterateEC2ObjectsAndCall(data[entity][i], eval(JSON.stri...
[ "getAllHosts(storeNode) {\n for (let regionOfInterest of Object.values(regions)) {\n\n let ec2 = new AWS.EC2(this.configParams(regionOfInterest));\n\n ec2.describeInstances((err, data) => {\n if (err) console.log(err);\n else {\n for (let i...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
DELETE The lazy way uid is a hex string (not a buffer)
function deleteUid(uid, collection) { var keys = Object.keys(collection) for (var i = 0; i < keys.length; i++) { if ( keys[i] === uid ) { delete collection[keys[i]] } } }
[ "function deleteUser(uid) {\n\tlocalStorage.removeItem(uid);\n\tvar iduser = 'user_' + uid.replace(/\\+/, '');\n\tif ($('#' + iduser).length) $('#' + iduser).remove();\n}", "async deleteUserByID(userID) {}", "function deleteUser() {\n firebase\n .database()\n .ref('users/1234')\n .remove();\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
in certain web apps, like mailchimp node refers to the editor inside iframe while `window` refers to top level window so selection and other methods do not work hence the need to get the `node's window`
function getNodeWindow(node){ return node.ownerDocument.defaultView; }
[ "get editorWindow() {}", "function windowFor(node) {\n if (node.self) {\n return node;\n }\n if (node.ownerDocument) {\n node = node.ownerDocument;\n }\n if (node.defaultView) {\n return node.defaultView;\n }\n if (node.parentWindow) {\n return node.parentWindow;\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
rd_BatchVectorToShape_localize() Description: This function localizes the given string variable based on the current locale. Parameters: strVar The string variable's name. Returns: String.
function rd_localize(strVar){ if(app.isoLanguage === "en_US"){ return strVar["en"]; }else if(app.isoLanguage === "de_DE"){ return strVar["de"]; } }
[ "function rd_BatchLayerConverter_localize(strVar)\r\n\t{\r\n\t\treturn strVar[\"en\"];\r\n\t}", "function rd_MasksToShapes_localize(strVar)\r\n {\r\n return strVar[\"en\"];\r\n }", "function rd_RenderLayers_localize(strVar)\n\t{\n\t\treturn strVar[\"en\"];\n\t}", "function rd_Rampart_localize(str...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
checks if a proposed player vote is possible within rules of game
playerVoteLegal(voting, voted) { if (!voting.alive || !voted.alive) return false; switch (this.gameState) { // mafia can vote for anyone, even themselves (unless they are the only one left) case MAFIA_TIME: return voting.role === Player.MAFIA && (this.numMafia > 1...
[ "missionVoteChecker() {\n this.missions.addVotes(this.mission, this.round, this.votesRound);\n let yes = 0;\n\n this.votesRound.forEach((v) => {\n if (v === 1) yes++;\n });\n\n if (yes * 2 > this.players) {\n this.chat.afterVote(this.mission + 1, this.round + 1, true);\n return true;\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
sorting by Zip code
function sortByZip() { for(var j=0;j<getData.length-1;j++) { for(var k=0;k<getData.length-1-j;k++) { if(getData[k].zip>getData[k+1].zip) { var temp1=getData[k]; getData[k]=getData[k+1]; getData[k+1]=temp1; } } } print(); }
[ "sortByZip(){\n const tempList = [...this.addressBook[this.currentAddressBookName]]\n this.displayContacts(tempList.sort((a, b) => parseInt(a.zip) - parseInt(b.zip)))\n }", "function SortByZip()\n{\n let sortedArray = addressBook;\n sortedArray.sort((a,b) => a.zip.toLowerCase().localeCompar...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Assigns an initial order value for each node by performing a DFS search starting from nodes in the first rank. Nodes are assigned an order in their rank as they are first visited. This approach comes from Gansner, et al., "A Technique for Drawing Directed Graphs." Returns a layering matrix with an array per layer and e...
function initOrder(g) { var visited = {}, simpleNodes = _.filter(g.nodes(), function(v) { return !g.children(v).length; }), maxRank = _.max(_.map(simpleNodes, function(v) { return g.node(v).rank; })), layers = _.map(_.range(maxRank + 1), function() { return []; }); function dfs(v) {...
[ "function initOrder(g){var visited={},simpleNodes=_.filter(g.nodes(),function(v){return!g.children(v).length}),maxRank=_.max(_.map(simpleNodes,function(v){return g.node(v).rank})),layers=_.map(_.range(maxRank+1),function(){return[]});function dfs(v){if(_.has(visited,v))return;visited[v]=!0;var node=g.node(v);layers...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
gather the first letter of every gigVoice object keys, remove any duplicates and display them in alpha DOM location.
function extractFirstLetter(words) { //store all found letters to letters array variable. var letters = []; //loop through gigVoice object and push first character of each object key to letters array. words.forEach(function(l) { letters.push(l.charAt(0)); }); ...
[ "function drawAlgoNames(){\n let buff = 3;\n for(let x = 0; x < algos.length; ++x){\n drawLetters(algos[x].name, 0, 1 + x * (buff+tc.length), false);\n }\n}", "displayAll() {\n for (var i = 0; i < Object.getOwnPropertyNames(this).length; i++) {\n this.displayKey(Object.getOwnProp...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
addViking receives Viking Object, fills array and return void
addViking(Viking) { this.vikingArmy.push(Viking); }
[ "addViking(Viking) {\n this.vikingArmy.push(Viking);\n }", "function addVoter(username) {\n votes.push({ Username: username, Votes: 0 });\n}", "addVoter(voter) {\n this._voters.push(voter);\n }", "function add_to_avaengers_arr() {\n\n\n\n}", "function addToObject(layerId, vk, theItem) {\n\t\t\t\tif...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Primary function, that first grabs transactions from the pool then takes those transactions and creates a block with them then tells the p2pServer to synchronize the chains to include the new block and to clear the transaction pool of the transactions that were incorporated within the block
mine() { //method that determines which transactions are valid const validTransactions = this.transactionPool.validTransactions(); //include a reward for the miner validTransactions.push( Transaction.rewardTransaction(this.wallet, Wallet.blockchainWallet()) ); //create a block consisting...
[ "makeBlock(){\n const self = this\n\n console.log('[blockServer][makeBlock] make block')\n console.log('[blockServer][makeBlock] pool size : ' + self.pool.length)\n var encryptTx = [] ;\n _.forEach(self.pool, function(tx){\n\n var encrypted = publickey.encrypt(tx, 'base64');\n encryptTx.p...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Extend an object with an extension
function extend( obj, extension ){ for ( var key in extension ){ obj[key] = extension[key]; } }
[ "function extend(obj, extension) {\n for (var key in extension) {\n obj[key] = extension[key];\n }\n return obj;\n}", "function extend( extension, obj ){\n for ( var key in extension ){\n obj[key] = extension[key];\n }\n}", "function extend( obj, extension ){\n for ( var key in extension...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
With this function, simply add the attribute: rel="external" to the href tag for window popups
function externalLinks() { if (!document.getElementsByTagName) return; var anchors = document.getElementsByTagName("a"); for (var i=0; i<anchors.length; i++) { var anchor = anchors[i]; if (anchor.getAttribute("href") && anchor.getAttribute("rel") == "external") { anchor.onclick = function() {return l...
[ "function externalLinks() \n{\n\tif (!document.getElementsByTagName) return;\n \n\tvar anchors = document.getElementsByTagName(\"a\");\n\t\n\tfor (var i=0; i<anchors.length; i++) \n\t{\n\t\tif(anchors[i].getAttribute(\"href\"))\n\t\t{\n\t\t\tif(anchors[i].getAttribute(\"rel\") == \"external\")\n\t\t\t{\n\t\t\t\tanc...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Create a thunk that will build up endpoints from an ordered set of path segments, registering the endpoints at all stages along the way. Each endpoint must have a corresponding JSON file in the mocks directory.
function extendingEndpoints() { var segments = Array.prototype.slice.call(arguments, 0); return function () { var path = ''; segments.forEach(function (pathSegment) { path = path + pathSegment; createEndpointFromPath(path); console.log(' registered path %s', path); }); } }
[ "setupMockEndpoints () {\n console.warn('%c ✨You are mocking api requests.',\n 'background: gray; color: white; display: block; padding: 0.25rem;')\n\n this.mock\n // .onGet('/meshes').reply(200, {\n // items: [\n // {\n // mtls: {\n // ca: {\n // ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
The constructor accepts a hex private key for the sender, a hex public key for the recipient, and a number amount. It will use these to set a number of properties, including a Secp256k1 signature. Properties: source: the public key derived from the provided private key recipient: the provided public key for the recipie...
constructor(privateKey, recipient, amount) { // Enter your solution here }
[ "constructor(privateKey, recipient = null, amount) {\n if (recipient === null) {\n this.source = null;\n this.recipient = getPublicKey(privateKey);\n } else {\n this.source = getPublicKey(privateKey);\n this.recipient = recipient;\n }\n\n this.amount = amount;\n this.signature = s...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
gotDelete function noDelete This method is called if there is no script to delete the Blog.
function noDelete() { alert("UserInfo: script deleteBlogXml.php not found on server"); }
[ "function deleteThisPost(){\n handleDelete(post)\n }", "function deleteBlog(e) {\n e.preventDefault();\n\n console.log('+');\n blog.deleteBlog();\n}", "function handleBlogDelete(){\n\t\tvar currentBlog = $(this)\n\t\t.parent()\n\t\t.parent()\n\t\t.data(\"blog\");\n\t\tdeleteBlog(currentBlog.i...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns an individual annotation extracted from the specified section tag
function getImageAnnotation(section) { var markerType = section.attr("data-marker-icon"); var title = section.attr("data-title") || section.find("h1").html(); var info = extractGeoInfo(section); if (info) { info.content = section; info.title = title; i...
[ "_annotationsAt(e){return this._annotationsBySectionIndex[e]}", "function tagDetails(annotation) {\n return annotation.body.reduce((details, fragment) => {\n switch (fragment.type) {\n case 'TextualBody':\n case 'Text':\n details['label'] = fragment['value'];\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
find states with only one action, a reduction
function findDefaults (states) { var defaults = {}; states.forEach(function (state, k) { var i = 0; for (var act in state) { if ({}.hasOwnProperty.call(state, act)) i++; } if (i === 1 && state[act][0] === 2) { // only one action in state and it's a reduc...
[ "function reduceSingle(reducer, state, action) {\r\n return reducer(state, action);\r\n }", "stateFor(action) {\n let stores = Object.keys(this.stores)\n .filter(key => Store.taskFor(this.stores[key], action))\n\n return stores.reduce((memo, key) => {\n memo[key] = this.get(key)\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
serverUri String This value is only specified if the EndpointDescription has a gatewayServerUri. This value is the applicationUri from the EndpointDescription which is the applicationUri for the underlying Server. The type EndpointDescription is defined in 7.10.
function _serverEndpointsForCreateSessionResponse(server, serverUri) { serverUri; // unused then // The Server shall return a set of EndpointDescriptions available for the serverUri specified in the request. // It is recommended that Servers only include the endpointUrl, securityMode, // securityPol...
[ "get mapServerUri() {\n return this.i.mapServerUri;\n }", "function _getEndpointUri(endpoint) {\n return _endpoint.gebo + _endpoint[endpoint];\n }", "getServerUrl() {\n const {\n host,\n port\n } = this.serverConfig;\n return `//${host || 'localhost'}:${port}`;\n }", ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
The Res context is the workhorse of the implementation. This is the thing that actually interprets the program.
function ResContext(prgmText, namespace, logger = defaultLogger) { this.origText = prgmText; this.origNamespace = namespace; this.blockStack = new ResBlockStack(); this.blockStack.push(new ResBlock(prgmText)); this.namespace = namespace.copy(); this.logger = logger; this.stackStack = [[]]; Object.define...
[ "function ArtificialContext() {}", "visitProgram(ctx) {\n\t return this.visitChildren(ctx);\n\t}", "function InterpreterResult() {\n\t\t\t/**\n\t\t\t * Time of the interpretation.\n\t\t\t *\n\t\t\t * @type {date}\n\t\t\t * @private\n\t\t\t */\n\t\t\tthis._timestamp = '';\n\n\t\t\t/**\n\t\t\t * Interpreted data...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
F. Find the Euclidean norm of a vector;
function norm(v) { var v1 = v[0]; var v2 = v[1]; var result = Math.sqrt(v1*v1 + v2*v2); return result; }
[ "function vector_norm(V){\n var sum2 = 0;\n V.forEach(e => sum2 += e*e);\n return Math.sqrt(sum2);\n}", "function _norm(vector) {\n\t return Math.sqrt(_ss.sum(_.map(vector, function (x) {\n\t return x*x;\n\t })));\n\t}", "function norm(x) {\n\n return Math.sqrt(vectorDot(x, x));\n\n}", "fun...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Tests behavior of implicit sessions when they are disabled via a test flag.
function runTestDisabled() { const conn = MongoRunner.runMongod(); // Commands run without an explicit session should not use an implicit one. const coll = conn.getDB("test").getCollection("foo"); inspectCommandForSessionId(function() { assert.commandWorked(coll.insert({x: 1})); }, {shouldI...
[ "function runTestTransitionToDisabled() {\n const conn = MongoRunner.runMongod();\n\n // Existing implicit sessions should be erased when the disable flag is set.\n const coll = conn.getDB(\"test\").getCollection(\"foo\");\n const implicitId = inspectCommandForSessionId(function() {\n assert.comm...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
START of RDMLX routines evtRoutine1 Com_owner.Initialize
function evtRoutine1( sender, parms ) { var rtn = Lansa.evtRoutine( this, COM_OWNER, "#Com_owner.Initialize", 6 ); // // EVTROUTINE Handling(#Com_owner.Initialize) // rtn.Line( 6 ); { } // // ENDROUTINE // rtn.Line( 12 ); rtn.end(); }
[ "function evtRoutine1( sender, parms )\n {\n var rtn = Lansa.evtRoutine( this, COM_OWNER, \"#Com_owner.Initialize\", 24 );\n\n //\n // EVTROUTINE Handling(#Com_owner.Initialize)\n //\n rtn.Line( 24 );\n {\n\n }\n\n //\n // ENDROUTINE\n //\n rtn.Line( 25 );\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns true if the given filename can be validated. A file is considered to be validatable if the extension is `.html` or if a transformer matches the filename. This is mostly useful for tooling to determine whenever to validate the file or not. CLI tools will run on all the given files anyway.
canValidate(filename) { /* .html is always supported */ const extension = path__default["default"].extname(filename).toLowerCase(); if (extension === ".html") { return true; } /* test if there is a matching transformer */ const config = this.getConfigFor(filen...
[ "canValidate(filename) {\n /* .html is always supported */\n const extension = path_1.default.extname(filename).toLowerCase();\n if (extension === \".html\") {\n return true;\n }\n /* test if there is a matching transformer */\n const config = this.getConfigFor(f...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Goes through the directory, and adds each file it finds recursively
_addFilesFromDirectory(directory, path) { let dirReader = directory.createReader(); let errorHandler = (error)=>$3ed269f2f0fb224b$var$__guardMethod__(console, "log", (o)=>o.log(error) ) ; var readEntries = ()=>{ return dirReader.readEntries((entries)=>{ ...
[ "addDirectory(directory, prefix = this.config.prefix) {\n let files = fs.readdirSync(directory);\n this._debug('Adding directory: ' + directory);\n for (let file of files) {\n let fullPath = path.resolve(directory, file);\n let fileStats = fs.lstatSync(fullPath);\n if (fileStats.isDirectory(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Change the displayed tweet to the next one every 3 seconds
function populateTplTimer(tweets) { setInterval(function(){ populateTpl(tweets)}, 3000); // Update this timer to change how often you want the tweets to update }
[ "function scheduleNextTweet() {\n tweetIndex++;\n console.log(`Schedule tweet ${tweetIndex}`);\n tweetList[tweetIndex]();\n\n if (tweetList[tweetIndex + 1]) {\n console.log(\"Waiting a bit...\");\n setTimeout(scheduleNextTweet, getRandomInt(1500, 4000));\n } else {\n console.log(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Grab the URL for a order by id.
function get_order_url(db, ts, orderID) { "use strict"; return [lnt_url_base, "db_" + db, "v4", ts, "order", orderID].join('/'); }
[ "function orderUrl(req, orderId) {\n return selfUrl(req).replace(req.originalUrl, `/orders/${orderId}`);\n}", "function getOrderId() {\n const url = new URL(window.location.href);\n const searchParams = new URLSearchParams(url.search);\n if (searchParams.has('id')) {\n const id = searchParams.get('id');\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This method will return the k most common elements in the case of a tie it will select the first occuring element. Time Complexity: O(n log n) Space Complexity: O(n)
function top_k_frequent_elements(list, k) { const hash = {}; for (let i = 0; i < list.length; i++) { let numToStr = list[i].toString(); hash.hasOwnProperty(numToStr) ? hash[numToStr] += 1 : hash[numToStr] = 1; } let result = Object.entries(hash).sort((a,b) => b[1] - a[1]) .map(...
[ "function kMostFrequent(array, k){\n \n}", "function top_k_frequent_elements(list, k) {\n if(list.length < 1) return list;\n\n const elements = {}\n list.forEach((num) => {\n elements[num] = (elements[num]+1) || 1 ;\n });\n\n countArray = []\n answer = []\n\n for (const key in elements) {\n countA...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Checks to see if the blob pair can rotate left
canRotateLeft() { if(!this.rotateLKey.isDown || this.rotateLock) { return false; } if(this.pairIsVertical) { if(this.puyo1y > this.puyo2y) { if(this.puyo1x == this.cols-1) { return false; } if(this.grid[t...
[ "isLeft() { return !this._isRight; }", "function isAtLeft(){\n return currentBlock.some(index => (currentPosition + index )% width === 0)\n }", "function canRotate(direction) {\n if (currentIndex === 0) return true\n const nextRotation = currentRotations[direction]\n const storedPosition = cu...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
is this collider going to overlap with other given force
isOverlapRaycast(other, force) { return !this.gameObject.noClip && this._getRect(this.gameObject.position.x + force.x, this.gameObject.position.y + force.y).isOverlap(other.getRect()); }
[ "collide(other) {\n // Return false if this agent isn't active\n if (!this.active) {\n return false;\n }\n\n // Calculate the distance between this agent and the other agent\n let d = dist(this.x,this.y,other.x,other.y);\n\n // If the distance is less that their two radii, they overlap\n i...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Push Turkish Words to turkishWordList
turkishList(sentence){ let expense = { turkish: sentence.turkish, english: sentence.english } this.wordList.push(expense) console.log(this.wordList) }
[ "takeFromLocalStorage(){\n const lists = this.getWordToLocalStorage()\n lists.forEach(list => {\n this.addWord(list)\n })\n }", "insertWord(wordCapsulated){\n this.wordList.push(wordCapsulated) //add the new word capsulated\n }", "loadWordList() {\n // let wordL...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Chapter 10 Sidney and Jennifer Revenge Starts the fight 2 VS 1
function C010_Revenge_SidneyJennifer_StartFight() { // Sets the fight difficulty var SidneyDifficulty = "Hard"; var JenniferDifficulty = "Normal"; if (ActorSpecificGetValue("Jennifer", ActorSubmission) < 0) JenniferDifficulty = "Hard"; // Launch the double fight C010_Revenge_SidneyJennifer_IntroText = ""; Do...
[ "function C010_Revenge_AmandaSarah_StartFight() {\n\t\t\n\t// Sets the fight difficulty\n\tvar AmandaDifficulty = \"Normal\";\n\tvar SarahDifficulty = \"Easy\";\n\tif (ActorSpecificGetValue(\"Amanda\", ActorSubmission) < 0) AmandaDifficulty = \"Hard\";\n\tif (ActorSpecificGetValue(\"Sarah\", ActorSubmission) < 0) S...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Update the DOM positions of the before/after proxy positioning containers for the groups.
updatePosContainerPositions() { const chart = this.chart; // If exporting, don't add these containers to the DOM. if (chart.renderer.forExport) { return; } const rendererSVGEl = chart.renderer.box; chart.container.insertBefore(this.afterChartProxyPosContainer,...
[ "updateProxyElementPositions() {\n Object.keys(this.groups).forEach(this.updateGroupProxyElementPositions.bind(this));\n }", "updateGroupProxyElementPositions(groupKey) {\n const group = this.groups[groupKey];\n if (group) {\n group.proxyElements.forEach((el) => el.refreshPositi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Updates the feeStatistics for the available networks
async fetchFees ({ commit, getters }) { let networks = getters['all'] let updatedNetworks = cloneDeep(networks) if (networks) { let i for (i = 0; i < updatedNetworks.length; i++) { let network = updatedNetworks[i] try { let feeStats = await Client.fetchF...
[ "updPoolFees(){\n\t\tconst poolfeesList = this.poolFeesPayout;\n\t\tlet addAddrs = [];\n\t\tlet oldBalance = 0;\n\n\t\tif(poolfeesList.length){\n\t\t\t//Get full fees balance from old addresses\n\t\t\tthis.db.any(\"SELECT sum(balance) as total FROM poolfees\")\n\t\t\t.then(rdata => {\n\t\t\t\t//If not old balanses\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
populate a filter with all the relevant options found in this dataset
generateFilterOptions(filter) { // get the unique values that this filter can have let filterValues = this.data.rows.map((row) => filter.path(row)); let isBoolean = filterValues.length && typeof filterValues[0] == 'boolean'; // make sure 'undefined', null, and '' are not counted separa...
[ "onDataFiltered(filteredData){\n this.availableFilters.forEach(filter => {\n let allAvailableValues = filteredData.map(function(product){\n return product[filter.name];\n });\n let availableOptions = filter.options.filter(function(option){\n return...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Determine whether the given properties match those of a `RegexPatternSetReferenceStatementProperty`
function CfnRuleGroup_RegexPatternSetReferenceStatementPropertyValidator(properties) { if (!cdk.canInspect(properties)) { return cdk.VALIDATION_SUCCESS; } const errors = new cdk.ValidationResults(); if (typeof properties !== 'object') { errors.collect(new cdk.ValidationResult('Expected a...
[ "function CfnWebACL_RegexPatternSetReferenceStatementPropertyValidator(properties) {\n if (!cdk.canInspect(properties)) {\n return cdk.VALIDATION_SUCCESS;\n }\n const errors = new cdk.ValidationResults();\n if (typeof properties !== 'object') {\n errors.collect(new cdk.ValidationResult('Ex...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
When contenttype is selected, no need to wait for lupicka to be clicked. Fire the overlay right away.
function open_overlay_on_ct_selection() { var ct_id = $(this).val(); if ( ! ct_id ) return; var content_type = id2ct(ct_id); var $id_input = get_corresponding_input($(this)); open_overlay(content_type, function(id, extras) { $id_input.val(id); $in_input.tr...
[ "function overlay_click() {\n update_overlay_element(currently_selected_match_box_text, '', null, overlay_clicked_class, overlay_initial_class);\n }", "function clickOnSelectedContentScript() {\r\n if (selectedContentScript)\r\n $(`#contentscript-menu .jstbox[name='${selectedContentScript}']...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
kicks off the ruby build process.
async function buildRuby(rubyVersion) { core.startGroup(`Build Ruby ${rubyVersion}`) await exec.exec(`ruby-build --verbose ${rubyVersion} ${rubyPath(rubyVersion)}`) core.endGroup() }
[ "function main() {\n generateBuildFile()\n}", "function buildAll() {\n\tconsole.log(\"Building files...\")\n\t// buildTypescript()\n}", "function build() {\n const start = Date.now();\n let fullBuildDir = path.join('/tmp/app', BUILD_DIR);\n console.log('Executing build');\n cmd(BUILD_CMD, {\n cwd: ful...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Generate a reset code and send to user
function generateResetCode(username, callback) { userService.getUser(username, null, function (err, result) { if (result.length === 1) { userService.generateToken(username, function (err, result) { if (result) { var expires = moment().add(1, 'hour'); ...
[ "function sendResetRequest() {\n\tvar data = new Object();\n\tdata.t = \"reset\";\n\tdata.checkin = currDate;\n\tdata.checkout = invMaxDate;\n\tcreateandSendMessage(data);\n\toldRoomCount = 0;\n\tnewRoomCount = 0;\n}", "clearResetCode() {\n this.data.reset_code.clearCode();\n this.encryptResetCode()...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This method is overridden to append the default extension if the file does not exist and to append index.html if the file is a directory.
serveFile(filename,exists,request,response) { if(!exists) { if (!response) { return false; } request.uri.pathname = request.uri.pathname + '.' + this.defaultExt request.uri.path = request.uri.path + '.' + this.defaultExt request.uri.href = request.uri.href + '.' + this.defaultE...
[ "function appendFileExtension(filename,extension) {\r\n\tvar extension_position=filename.length-extension.length;\r\n\tvar current_extension=filename.slice(extension_position);\r\n\tif(current_extension.toLowerCase()!=extension.toLowerCase()) {\r\n\t\tfilename+=extension;\r\n\t}\r\n\treturn filename;\r\n}", "func...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Same as 'string'.codePointAt(pos), but works in older browsers.
function codePointAt(string, pos) { var first = string.charCodeAt(pos), second; if (first >= 0xD800 && first <= 0xDBFF && pos + 1 < string.length) { second = string.charCodeAt(pos + 1); if (second >= 0xDC00 && second <= 0xDFFF) { // https://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae...
[ "function codePointAt(string, pos) {\n var first = string.charCodeAt(pos),\n second\n if (first >= 0xd800 && first <= 0xdbff && pos + 1 < string.length) {\n second = string.charCodeAt(pos + 1)\n if (second >= 0xdc00 && second <= 0xdfff) {\n // https://mathiasbynens.be/notes/javascript-encoding#surro...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
exists ====== Checkes to see if a file exists Parameters `filepath` (String) The absolute filepath to check Returns `fileExists` (Boolean) True if the filepath exists, false if otherwise
function exists(filepath) { return fs.existsSync(filepath); }
[ "function doesFileExist (filepath) {\n return fs.existsSync(filepath)\n}", "function exists (filePath) {\n return fs.access(filePath)\n .then(() => true)\n .catch(() => false)\n}", "async exists (filepath, options = {}) {\n try {\n await this._stat(filepath);\n return true\n } catch (err...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
create a delete button inside of a row in a table that then deletes the car from the garage by grabbing its index from within the array and using that position to remove one element (the car)
function createDeleteRowButton(garage, car) { let btn = document.createElement("button"); btn.className = "btn btn-danger"; btn.innerHTML = "Remove Car"; btn.onclick = () => { let index = garage.cars.indexOf(car); garage.cars.splice(index, 1); drawDOM(); }; return btn; }
[ "deleteCar(car) {\n let index = this.cars.indexOf(car);\n this.cars.splice(index, 1);\n }", "function btn_del_tr(index) {\n $(index).parent().parent().remove();\n GenerarArregloPagos();\n CalcularCambio();\n}", "function deleteRow() {\n this.closest(\"tr\").remove();\n\n rowIndex...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns whether or not the extension (suffix) of the current document is prohibited
function suffixCheck () { const prohibitedTypes = [ /\.xml$/, /\.pdf$/, ]; const currentUrl = window.location.pathname; for (const type of prohibitedTypes) { if (type.test(currentUrl)) { return false; } } return true; }
[ "function suffixCheck() {\n const prohibitedTypes = [/\\.xml$/, /\\.pdf$/];\n const currentUrl = window.location.pathname;\n for (const type of prohibitedTypes) {\n if (type.test(currentUrl)) {\n return false;\n }\n }\n return true;\n}", "function validateExtension(){\n var ext = obj.val().sp...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
TODO: could use reduce instead of forEach and then not need variable dayFolders
function findAvailableDays() { const startDir = '.'; let dayFolders = []; const files = fs.readdirSync(startDir); files.map(file => path.join(startDir, file)) .filter(file => fs.statSync(file).isDirectory()) .filter(file => file.substring(0, 3) === 'day') .forEach(function (file...
[ "function buildFolders() {\n if (helper.foldersInStorage()) {\n helper.importFoldersFromStorage();\n } else {\n const now = Date.now();\n const allTasks = helper.folderFactory(\"All Tasks\",now.toString());\n const starredTasks = helper.folderFactory(\"Starred\",(now+1).toString())...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Construct a form to "complete" (finish) a build order
function completeBuildOrder(build_id, options={}) { constructForm(`{% url "api-build-list" %}${build_id}/finish/`, { fieldsFunction: function(opts) { var ctx = opts.context || {}; var fields = { accept_unallocated: {}, accept_overallocated: {}, ...
[ "function newBuildOrder(options={}) {\n /* Launch modal form to create a new BuildOrder.\n */\n\n var fields = buildFormFields();\n\n // Specify the target part\n if (options.part) {\n fields.part.value = options.part;\n }\n\n // Specify the desired quantity\n if (options.quantity) {...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
calculatePGNum Calculate the recommended number of PGs for a given pool based on it's osd count and replication factor.
function calculatePGNum(osdcount, size, pgmax) { var pgnum = roundUpToNextPowerOfTwo(osdcount * 100 / size); if (pgnum > pgmax) { pgnum = pgmax; } return pgnum; }
[ "function computeMinPoolSize(pool) {\r\n // assert(pool instanceof go.Group && pool.category === \"Pool\");\r\n var len = MINLENGTH;\r\n pool.memberParts.each(function(lane) {\r\n // pools ought to only contain lanes, not plain Nodes\r\n if (!(lan...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
presignedPostPolicy can be used in situations where we want more control on the upload than what presignedPutObject() provides. i.e Using presignedPostPolicy we will be able to put policy restrictions on the object's `name` `bucket` `expiry` `ContentType` `ContentDisposition` `metaData`
presignedPostPolicy(postPolicy, cb) { if (this.anonymous) { throw new errors.AnonymousRequestError('Presigned POST policy cannot be generated for anonymous requests') } if (!isObject(postPolicy)) { throw new TypeError('postPolicy should be of type "object"') } if (!isFunction(cb)) { ...
[ "presignedPostPolicy(postPolicy) {\n var date = Moment.utc()\n var region = getRegion(this.params.host)\n var dateStr = date.format('YYYYMMDDTHHmmss') + 'Z'\n\n postPolicy.policy.conditions.push(['eq', '$x-amz-date', dateStr])\n postPolicy.formData['x-amz-date'] = dateStr\n\n postPolicy.policy.con...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
create default resource requirements object
function _makeRequirementObj() { return { platformCPUs: undefined, virtualCPUs: undefined, memory: undefined, storage: undefined }; }
[ "function _getResourceRequirements(/*TPRESOURCEREQUIREMENT object*/resourceRequirements)\n\t\t{\n\t\t\tvar req = _makeRequirementObj();\n\t\t\tif(undefined != resourceRequirements) \n\t\t\t{\n\t\t\t\tvar res_count = resourceRequirements.length;\n\t\t\t\tfor(var i = 0; i < res_count; ++i) {\n\t\t\t\t\tvar res_req = ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Placing a library item on the board
function placeLibraryItem(row,col, coords){ forEachCoord(row,col,coords, (refRow,refCol)=>{ addCellToBoardObj(refRow, refCol) }) updateGridElem(state.activeGrid) render(state.activeGrid) }
[ "function place(item, x, y) {\n GAME.grid.place(item, x, y);\n}", "function PackItemOverlay() {}", "function createItem(item, position) {}", "addToBackpack(item) {\n\t\t// TODO #3-5: practice TDD and code this in parts as you write tests\n\t\tif (item.location === \"front pocket\") {\n\t\t\tthis.frontPocket....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function to fill the old link storage object with data
function populateLinkStorageObj(graph) { oldLinks = {}; oldLinksMap = new Map(); for (const link of graph.links) { const sourceA = link.source.assessment; const sourceG = link.source.name; const targetA = link.target.assessment; const targetG = link.target.name; if (...
[ "function populateLinkStorageObj(graph) {\n oldLinks = {};\n oldLinksMap = new Map();\n for (const link of graph.links) {\n const sourceA = link.source.assessment;\n const sourceG = link.source.name;\n const targetA = link.target.assessment;\n const t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Renders a Jade file and sends the response to the client. needs to get the "filepath" template needs to get the "views/layout.jade" layout template needs to render the contents and send back to the HTTP request
function render (filepath, locals) { return function (req, res, next) { debug('rendering template (%s) %j', req.sha, filepath); var body, layout; // ensure "filepath" template is loaded template(filepath)(req, res, onFilepath); function onFilepath (err) { if (err) return next(err); d...
[ "function renderFile(path) {\n var re = /\\.jade$/;\n fs.lstat(path, function(err, stat) {\n if (err) throw err;\n // Found jade file\n if (stat.isFile() && re.test(path)) {\n fs.readFile(path, 'utf8', function(err, str){\n if (err) throw err;\n options.filename = path;\n var fn...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
this function is used to fetch All values for particular category
function fetchAllValuesForCategory(categoryName) { let categoryValueSet = new Set(); var json = fetchParsedJson(); for(var i = 0 ; i < json.length; i++){ for (var key in json[i]) { var columnName = key; var columnValue = json[i][key]; if(categoryName == columnName) { categoryValueSet.add(columnValue)...
[ "getData(category){\n let data = [];\n let subcategories = [];\n let count = this.getCount(category);\n let types = this.getAllPossible(category);\n \n types.forEach((type) => {\n subcategories.push(type.value);\n });\n\n data.push(subcategories);\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sets the priority of the selected tasks to the specified level. If WHAT_CURSOR_APPLIES_TO is 'all' or 'most', then instead applies to the cursor if there is no selection. NOTE: this returns a function so that it can be used conveniently in the keybindings.
function setPriority(level) { return () => { const mutateCursor = getCursorToMutate(); if (mutateCursor) { clickTaskEdit(mutateCursor); withQuery(document, '[data-action-hint="task-actions-priority-picker"]', click); withUniqueClass(document, 'priority_pic...
[ "function selectPriority(level) {\n return () => {\n const actualLevel = invertPriorityLevel(level);\n const allTasks = getTasks('include-collapsed');\n const selected = getSelectedTaskKeys();\n let modified = false;\n for (const task of allTasks) {\n if (getTaskPriority(task) ===...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
update the window title using params in the following precedence 1. titleKey parameter 2. $state.$current.data.pageTitle (current state page title) 3. 'global.title'
function updateTitle(titleKey) { if (!titleKey && $state.$current.data && $state.$current.data.pageTitle) { titleKey = $state.$current.data.pageTitle; } $translate(titleKey || 'global.title').then(function(title) { $window.document.title = title; ...
[ "function updateTitle(titleKey) {\n if (!titleKey && $state.$current.data && $state.$current.data.pageTitle) {\n titleKey = $state.$current.data.pageTitle;\n }\n $translate(titleKey || 'global.title').then(function (title) {\n $window.document.title = t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This gets a list of phones matching the name that the user entered
onSearch(value) { let tempPhones = []; for (let i = 0; i < this.state.phonesTemp.length; i++) { // If the phone's name contains the name entered then add it if (this.state.phonesTemp[i].name.toLowerCase().includes(value.toLowerCase())) { tempPhones.push(this.state...
[ "function getPhones(){\n var phonesFound = knwlInstance.get('accuratePhones');\n\n phonesFound.forEach(function (phone) {\n // Format phone numbers\n phone = phone.replace(/\\s+/g, '');\n if(phone.substring(0,3) == '+44') {\n phone = phone.replace(phone.substring(0,3), '0');\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
this sets the search list array
searchFunction(searchList) { this.setState({ searchListArray: searchList, }); }
[ "function buildSearchArray() {\n $students.each(function () {\n searchArray.push({\n student: this,\n name: $(this).find('h3').html().toLowerCase()\n });\n })\n }", "function resetAndSearch() {\n setStart(0);\n size = null;\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
updateAlignment from scene to node recursively
function updateAlignment(node) { const parent = node.parent; if (parent && Node$1.isNode(parent)) { updateAlignment(parent); } // node._widget will be null when widget is disabled const widget = node.getComponent(Widget); if (widget && parent) { align(node...
[ "function updateAlignment(node) {\n var parent = node.parent;\n\n if (parent && Node.isNode(parent)) {\n updateAlignment(parent);\n } // node._widget will be null when widget is disabled\n\n\n var widget = node.getComponent(Widget);\n\n if (widget && parent) {\n align(node, widget);\n }\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }