query
stringlengths
9
34k
document
stringlengths
8
5.39M
negatives
listlengths
19
20
metadata
dict
Optional function for comparing current guess with previous guess
function previousGuess(former, current, realNum) { if (realNum - current < realNum - former) { feedback.text("You are getting warmer."); } else if (realNum - current > realNum - former) { feedback.text("You are getting colder."); } else { feedback.text("You are at t...
[ "function correctGuess (guess) {\n return guess === winningNumber\n }", "function compareGuesses(humanGuess, puterGuess, targetGuess)\n{\n //figure out the difference between the humanGuess and targetGuess, puterGuess and targetGuess and if it's a tie \n if(Math.abs(humanGuess - targetGuess) < Math.abs(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Memoize the Buffer representation of name We need this to sort the links, otherwise we will reallocate new buffers every time
get nameAsBuffer() { if (this._nameBuf !== null) { return this._nameBuf; } this._nameBuf = Buffer.from(this._name); return this._nameBuf; }
[ "get nameAsBuffer () {\n if (this._nameBuf !== null) {\n return this._nameBuf\n }\n\n this._nameBuf = Buffer.from(this._name)\n return this._nameBuf\n }", "function getBufferName(name,buffers,it){\n\n var tmpName = \"\";\n\n if(it < 1){\n\n\ttmpName = name;\n }else\n\ttmpName = name + \...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Fetch jobs from Github
async function fetchGithub () { let resultCount = 1, page = 1; const allJobs = []; // Fetch all pages while (resultCount > 0) { const res = await fetch(`${baseURL}?page=${page}`); const jobs = await res.json(); console.log("OUTPUT: fetched", jobs.length, 'jobs'); resul...
[ "function pullGitHubJobs() {\n // var one = \"https://jobs.github.com/positions.json?search=887cd2b2-8245-11e8-9ecb-449d24e3b102\";\n $.ajax({\n url: url_gitHub,\n method: 'GET',\n dataType: 'jsonp'\n }).then(function(response) {\n console.log(response)\n for (var i = 0; ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Retrieve the carts items from the cookie.
getCartItems() { let cart = Cookie.get(this.settings.cookie_name); return (cart) ? cart.items : []; }
[ "function getCart(){\n\tif($.cookie('cart') !== undefined){\n\t\treturn JSON.parse($.cookie('cart'));\n\t} else {\n\t\treturn [];\n\t}\n}", "static getCartItems() {\n let cartItems = JSON.parse(localStorage.getItem('cart')) ? JSON.parse(localStorage.getItem('cart')) : [];\n return cartItems;\n }"...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Checks the answer through an options regexp
function checkRegExp(answer) { if (options.exec(answer)) { return Promise.resolve(answer); } else { console.warn(`Answer "${answer}" is invalid.${optionsText}`); return ask(txt, def, options); } }
[ "function processOptions(answer) {\n if (typeof options === 'function') {\n return checkFunction(answer);\n } else if (options instanceof RegExp) {\n return checkRegExp(answer);\n } else if (options.includes(answer)) {\n return Promise.re...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Format dateString to display as HH:MM AM/PM
function getDisplayTimeString(dateString) { var fullDate = new Date(dateString); var hour = fullDate.getHours(); var minute = fullDate.getMinutes(); var AMPM = "AM"; if(hour == 12) { AMPM = "PM"; } else if(12 < hour && hour < 24) { hour = hour - 12; AMPM = "PM"; } else if(hour == 0) { hour = 12; } i...
[ "function formattingTime(str) {\n let formattedTime = str.replace(/:00/g, \"\").replace(/ PM/g, \"pm\").replace(/ AM/g, \"am\")\n\n //check and replace duplicate in row\n if (formattedTime.match(/am.*am/)) { // Check if there are 2 'am'\n formattedTime = formattedTime.replace('am', ''); // Remove th...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
function to compare if 2 cards are the same
isSameCard(card){ if(this.number == card.number && this.suit == card.suit){ return true; } return false; }
[ "isMatch(card_1, card_2) {\n if (card_1.value == card_2.value) {\n return true;\n }\n\n return false;\n }", "function areCardsEqual()\n{\n if(cards[cards_clicked[FIRST_CARD_CLICKED]] === cards[cards_clicked[LAST_CARD_CLICKED]])\n return YES;\n\n return NO;\n}", "f...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Renders the AWS CloudFormation properties of an `AWS::WAFv2::LoggingConfiguration` resource
function cfnLoggingConfigurationPropsToCloudFormation(properties) { if (!cdk.canInspect(properties)) { return properties; } CfnLoggingConfigurationPropsValidator(properties).assertSuccess(); return { LogDestinationConfigs: cdk.listMapper(cdk.stringToCloudFormation)(properties.logDestinat...
[ "function cfnGraphQLApiLogConfigPropertyToCloudFormation(properties) {\n if (!cdk.canInspect(properties)) {\n return properties;\n }\n CfnGraphQLApi_LogConfigPropertyValidator(properties).assertSuccess();\n return {\n CloudWatchLogsRoleArn: cdk.stringToCloudFormation(properties.cloudWatchL...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get default credit card
function getDefaultCreditCard(custnumber, callback) { var sql = `SELECT autoid, tableid, custnumber, carddefault, cardtype, cardnum, exp, cardholder, cc_cid, LTRIM(RTRIM(custtoken)) AS custtoken, LTRIM(RTRIM(paytoken)) AS pay...
[ "async getDefaultCard() {\n let response = await this.fetchPage('anyUserTransfer.htm');\n let card = scrape.defaultCard(response.data)\n return card;\n }", "function credit_By_Default() {\n document.getElementById('payment').value = 'credit-card';\n class_Paypal[0].style.display ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
get disk usage data function and display it
function getDiskUsage(){ $.get(SERVER_ADDRESS+'/diskusage',function(data){ var diskData = JSON.parse(data); $('#disk_usage .bar').css('width',diskData.availablePerc + '%'); $('#disk_usage .bar').html(diskData.availableGB+' GB free'); $('#disk_usage .bar').attr('aria-valuenow',diskDat...
[ "function getDiskUsage() \n{\n try \n {\n PMenablePrivilege(\"UniversalXPConnect\");\n var obj = Components.classes[SystemInfCID]\n .getService(Components.interfaces.ISystemInformation);\n return obj.GetDiskUsage();\n }\n catch (err) \n {\n debugalert(err);\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Update nav with passed path and link text
function updateNav(text, path) { $('#nav').append(' > <a href="' + path + '">' + text + '</a>') }
[ "function addNewLink() {\n var navbar = _$c(navbar)\n navbar.textContent = \"www.stratofyzika.com\"\n}", "function updateNavBar()\n {\n $(\"#list-name\").html(\"+\" + currentList.name);\n $(\"#menu-archive-text\").html(\n currentList.archived ? \"Unarchive\" : \"Archive\"\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns the heading from one LatLng to another LatLng. Headings are expressed in degrees clockwise from North within the range [180,180).
function computeHeading(from, to) { // http://williams.best.vwh.net/avform.htm#Crs var fromLat = toRadians(from.lat); var fromLng = toRadians(from.lng); var toLat = toRadians(to.lat); var toLng = toRadians(to.lng); var dLng = toLng - fromLng; var heading = Math.atan2( Math.sin(dLng) * Math.cos(toLat),...
[ "function GPSHeading(){\n var previousLocation = locationHistory[locationHistory.length-1];\n var previousLocation2 = locationHistory[locationHistory.length-2];\n heading = new google.maps.geometry.spherical.computeHeading(previousLocation, previousLocation2);\n}", "function heading(x,y){\n\treturn Math....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Draw a filled circle with the given size and color to the context.
function drawCircleAndFill(ctx, size, color) { drawCircle(ctx, size); ctx.fillStyle = color; ctx.fill(); }
[ "function drawCircle(ctx, size) {\n ctx.beginPath();\n ctx.arc(size / 2, size / 2, size / 2, 0, Math.PI * 2, true);\n ctx.closePath();\n}", "function drawCircle(cX, cY, cSize, cColor) {\n noStroke();\n fill(cColor);\n ellipse(cX, cY, cSize, cSize);\n}", "function fillCircle(ctx,x,y,r,color){\n\tctx....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Handler for mouseleave events on hover items or their children. This will hide the hover details for the item. Args: evt (Event): The mouseleave event.
_onHoverItemMouseLeave(evt) { $(evt.target).closest('.infobox-hover-item') .removeClass('infobox-hover-item-opened'); }
[ "_onMouseleave(ev) {\n this.unactivate();\n this.get('canvas').draw();\n this.emit('itemunhover', ev);\n return;\n }", "_itemOnMouseLeave() {\n const that = this;\n\n if (!that.ownerListBox) {\n return;\n }\n\n if (JQX.ListBox.DragDrop.Dragging) {\n t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This.state constructor initialises the variabes/arrays: overall_rating, price_rating, quality_rating, clenliness_rating, review_body, locationData, loc_id, loc_name and ButtonState
constructor(props) { super(props); this.state={ overall_rating: "", price_rating: "", quality_rating: "", clenliness_rating: "", review_body: "", locationData: [], loc_id: "", loc_name: "", ButtonState: false, isLoading: true } }
[ "constructor(props) {\n super(props);\n this.state={\n overall_rating: \"\",\n price_rating: \"\",\n quality_rating: \"\",\n clenliness_rating: \"\",\n review_body: \"\",\n locationData: [],\n loc_id: \"\",\n ButtonState: false,\n isLoading: true\n }\n }", "c...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
slides to the CREDITs screen
function creditsScreen() { $box3.animate({left: 0}, 150); // moves the screen into the main container display currentPage = 'creditspage'; }
[ "function showCredits()\n\t{\n\t\tapp.externalJump(app.paths.mediaCreds + '#' + location.href);\n\t}", "function mainMenutoCredits() {\n if (store.getState().lastAction == MENU_CHANGE && store.getState().previousPage == 'MAIN_MENU' && store.getState().currentPage == 'CREDITS') {\n mainSfxController(preloa...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Initiate the image picker
function initializeImagePicker() { $('#selectProjectImages').imagepicker({ selected: onImagePickerOptionChange }); $('#selectProjectImages') .data('picker') .sync_picker_with_select(); }
[ "function initPicker() {\n //so not selected when started\n $(\"select\").prop(\"selectedIndex\", -1);\n\n $(\"select\").imagepicker({\n hide_select : true,\n show_label : true\n })\n }", "function image_picker_noop() {}", "async openPickerAsync() {\n // Request permissions to acc...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
function for updating html to update currentPlayers
function updateCurrentPlayersTable() { //remove all current players $(".player").remove(); //append entry to currentPlayers div for each player in currentPlayers for (i = 0; i < gameInfo.currentPlayers.length; i++ ) { var player = $("<h3 class=\"player\"></h3>").text(gameInfo.currentPlayers[i])...
[ "function updatePlayerInfo() {\n\t\tdocument.getElementById(\"player1name\").innerText = `Name: ${player1.name}`;\n\t\tdocument.getElementById(\"player2name\").innerText = `Name: ${player2.name}`;\n\t\tdocument.getElementById(\n\t\t\t\"player1score\"\n\t\t).innerText = `Score: ${player1.getScore()}`;\n\t\tdocument....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
| startCapture:void () | | Returns a continuous reading every 33ms
startCapture(){ this._writeRegisters(REGISTRY.SYSRANGE_START, 0x02); setInterval( () => { this._readRegisters(REGISTRY.RESULT_RANGE_STATUS, 16, (err, data) => { var _dis = (data.readInt16BE(8) + 10); this.emit('distance', _dis); }); },33); }
[ "function startCapture() {\n initSize();\n initStyle();\n capturing = true;\n startTime = new Date().getTime();\n nextFrame();\n }", "function start_capture(){\n socket.emit('start capture');\n //TODO add a visible timer\n $('#startstopbutton').html('Stop');\n $('...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Determine whether the given properties match those of a `KeySAMPTProperty`
function CfnFunction_KeySAMPTPropertyValidator(properties) { if (!cdk.canInspect(properties)) { return cdk.VALIDATION_SUCCESS; } const errors = new cdk.ValidationResults(); errors.collect(cdk.propertyValidator('keyId', cdk.requiredValidator)(properties.keyId)); errors.collect(cdk.propertyVal...
[ "function CfnFunction_KeySAMPTPropertyValidator(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('Expected an object, but r...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates a new StatsDisplay object. Use this class to create a field in the topleft corner that displays the current frames per second and total number of elements processed in the System.animLoop. Note: StatsDisplay will not function in browsers whose Date object does not support Date.now(). These include IE6, IE7, and...
function StatsDisplay() { 'use strict'; var labelContainer, label; /** * Frames per second. * @private */ this._fps = 0; /** * The current time. * @private */ if (Date.now) { this._time = Date.now(); } else { this._time = 0; } /** * The time at the last frame. * @p...
[ "function StatsDisplay() {\n\n var labelContainer, label;\n\n this.name = 'StatsDisplay';\n\n /**\n * Set to false to stop requesting animation frames.\n * @private\n */\n this._active = true;\n\n /**\n * Frames per second.\n * @private\n */\n this._fps = 0;\n\n /**\n * The current time.\n * ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
NaiveBayes Classifier This is a naivebayes classifier that uses Laplace Smoothing. Takes an (optional) options object containing: `tokenizer` => custom tokenization function
function Bayes(options) { // set options object this.options = {}; if (typeof options !== 'undefined') { if (!options || typeof options !== 'object' || Array.isArray(options)) { throw new TypeError('Bayes got invalid `options`: `' + options + '`. Pass in an object.'); } this.option...
[ "function Naivebayes (options) {\n\t// set options object\n\tthis.options = {}\n\tif (typeof options !== 'undefined') {\n\t\tif (!options || typeof options !== 'object' || Array.isArray(options)) {\n\t\t\tthrow TypeError('NaiveBayes got invalid `options`: `' + options + '`. Pass in an object.')\n\t\t}\n\t\tthis.opt...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get the policy for the user.
function getPolicy(user, context, cb) { request.post({ url: EXTENSION_URL + "/api/users/" + user.user_id + "/policy/" + context.clientID, headers: { "x-api-key": API_KEY }, json: { connectionName: context.connection || user.identities[0].connection, groups: user.group...
[ "function getPolicy(user, context, cb) {\n request.post({\n url: EXTENSION_URL + \"/api/users/\" + user.user_id + \"/policy/\" + context.clientID,\n headers: {\n \"x-api-key\": \"0bce7e8cf6a89bdc2b913d51b39324dbb72fbcbcca1e800c82b30da137faf3b9\"\n },\n json: {\n connectionName: ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
postUpload controller for route POST /files Creates a file or a folder on the path `/temp/files_manager/` containing data. Header params: xtoken: connection token created when user signsin JSON body: name: name of the file type: folder | file | image parentId: id of the parent folder or zero for current folder isPublic...
async function postUpload(req, res) { const key = req.headers['x-token']; // get token from header const userId = await redisClient.get(`auth_${key}`); let user = ''; // find connected user if (userId) user = await dbClient.client.collection('users').findOne({ _id: ObjectId(userId) }); // MIGHT NEED TO GUARD...
[ "function upload(filename, filedata) {\n // By calling the files action with POST method in will perform \n // an upload of the file into Backand Storage\n return $http({\n method: 'POST',\n url : Backand.getApiUrl() + baseActionUrl + objectName,\n params:{\n \"name\": filesActionNam...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Throw exception if `obj` is not a Position object
function requirePosition(obj) { if (!isPosition(obj)) throw AssertionException("Is not a position"); }
[ "function isPosition(obj)\n{\n try {\n return obj.isPosition === true;\n } catch (e) {\n return false;\n }\n}", "static isIPosition(obj) {\n return (obj\n && (typeof obj.lineNumber === 'number')\n && (typeof obj.column === 'number'));\n }", "static isIPos...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
CON ESTE PROCESO ENVIAMSO LOS ARCHIVOS AJAX A LA LIBRERIA DEL ING. WILLY input name archivito
function subirArchivosLibreriaInborca(inpFile){ var x = $("#documentos_cabecera"); var y = x.clone(); y.attr("id", "archivos"+fila); y.attr("name", "archivos"+fila+"[]"); $("#archivos_fila"+fila).html(y); var formData = new FormData(document.getElementById(inpFile)); $.ajax({ ...
[ "function CargarListaCamposArchivador() {\n\n lNombreArchivador = $(\"#DETALLE_PC_NOMBREARCHIVADOR\").val();\n\n $.ajax({\n url: \"../controladores/controladorCI.ashx?op=2100&NOMBREARCHIVADOR=\" + lNombreArchivador,\n method: \"POST\",\n dataType: \"json\",\n async: true,\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
lookup module object from require()d command and derive name if module was not require()d and no name given, throw error
function moduleName (obj) { const mod = __webpack_require__(592)(obj) if (!mod) throw new Error(`No command name given for module: ${inspect(obj)}`) return commandFromFilename(mod.filename) }
[ "function moduleName (obj) {\n const mod = __webpack_require__(147)(obj)\n if (!mod) throw new Error(`No command name given for module: ${inspect(obj)}`)\n return commandFromFilename(mod.filename)\n }", "function moduleName (obj) {\n const mod = __webpack_require__(665963)(obj)\n if (!mod) throw n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Open delete group confirmation popup
deleteGroupClick() { if (gridActionNotify(this.strings, this.props.notifyToaster, this.refs.groupGrid.selectedRows.length, true)) { // pass custom payload with popup let payload = { confirmText: this.strings.DELETE_CONFIRMATION_MESSAGE, strings: this....
[ "function deleteRowGroup(ev, groupName) {\r\n response = confirm('Are you sure you want to delete the group \"' + groupName + '\"?\\nThis cannot be undone.');\r\n if (response) {\r\n $('#deleteRowGroupForm').submit();\r\n }\r\n}", "function cancelDeleteGroup() {\r\n\thideDeleteGroupTooltip(mDelete...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Utility functions Helper function to check the test condition and then write the string into the node with the specified id Disable node if
function writeDescription(test, id, str) { var node = document.getElementById(id); node.innerHTML = test ? str : "N/A"; }
[ "function disable (node) {\n node.disabled = true;\n}", "function disableTargetIf(condition, targetName) {\n findElementsByName(targetName)[0].disabled=condition;\n}", "async seeDisabledAttribute (xpath) {\n const helper = this.helpers['Puppeteer'] || this.helpers['WebDriver']\n let res = await helper...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates a new analyser
function Analyser(scene) { /** * Gets or sets the smoothing * @ignorenaming */ this.SMOOTHING = 0.75; /** * Gets or sets the FFT table size * @ignorenaming */ this.FFT_SIZE = 512; /** * Gets or sets the bar graph ampl...
[ "function createAnalyser() {\n //create analyser node\n analyzer = context.createAnalyser();\n\n analyzer.smoothingTimeConstant = 0.3;\n //set size of how many bits we analyse on\n analyzer.fftSize = 2048;\n}", "function createAnalyser() {\n //create analyser node\n analyzer = context.createAnalyser();...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns a list of all enabled tasks relative to a given model
function getModelTasks(modelName) { var res = []; for(var id in instanceMap){ if(modelName == instanceMap[id].modelName){ for(var task of getInstanceTasks(id)) res.push(task); } } return res; }
[ "function getEnabled(modelName) {\n var res = new Set();\n for (var instanceId in instanceMap) {\n if (modelName == instanceMap[instanceId].modelName) {\n for (var taskId of instanceMap[instanceId].enabledSet) res.add(taskId);\n }\n }\n return res;\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
The https:// URL of this bucket.
get bucketUrl() { return this.urlForObject(); }
[ "getURL() {\n return Meteor.absoluteUrl(UploadFS.config.storesPath + '/' + this.name, {\n secure: UploadFS.config.https\n });\n }", "function getURL(){\r\n var dprefix;\r\n dprefix = (useSSL) ? \"https://\" : \"http://\";\r\n \r\n return dprefix + NEWSBLUR_DOMAIN;\r\n}", "getURL...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
finding how many weeks are in a current month
function findWeeksInMonth () { var startingDay = 1; // setting a first day of the month var daysInStartingWeek = 7 - startingDay; // count days in the first week var daysLeft = daysInMonth - daysInStartingWeek; // substracting 1 week var weeksLeft = Math.floor(daysLeft/7); // count how many full weeks left in a mo...
[ "function getWeeksInMonth(newMonth)\n {\n var targetYear = newMonth.year;\n var targetMonth = newMonth.month + 1;\n \n if (newMonth.epoch == \"BC\")\n targetYear = -targetYear;\n \n var cal = getCalendarFromDate(targetYear, targetMonth, 1);\n \n va...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Table creating func. Builds table using for loops to go through every X/Y value Outputs the table with status.
function buildTable(xLT, xRT, yTop, yBottom) { var x, y, table = ""; for (y = yTop - 1; y <= yBottom; y++) { table += "<tr>"; if (y == yTop - 1) { table += "<td> * </td>"; for (x = xLT; x <= xRT; x++) { table += "<td>" + x + "</td>"; } ...
[ "function fillTable(table, x, y) {\n\n let row = document.createElement('tr')\n let th = document.createElement('th')\n row.appendChild( th )\n\n for( let i = 1; i <= y; i++ ) {\n let th = document.createElement('th')\n th.appendChild( document.createTextNode( `Y=${ i }` ) )\n row.a...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
read config file to get the object
async getCfgFromFile() { const obj = await utils.readJSONFromFile(this.cfgPath); return new CfgObject(obj); }
[ "read () {\n this.configObj = JSON.parse(fs.readFileSync(this.configPath, 'utf8'))\n }", "read() {\n this.exists()\n if (!this.validate()) {\n }\n const config = JSON.parse(fs.readFileSync(this.configPath))\n return config\n }", "function read() {\n\tconfig = JSON.parse(fs.readFileSync(CONFI...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
mem() Returns a memory address (well, just a number actually) that is not in use in the dbpf file yet. This allows us to insert content in a dbpf file while ensuring that the memory address of it won't conflict with another entry.
mem() { let ref = this.$mem++; while (this.memRefs.has(ref)) { ref = this.$mem++; } return ref; }
[ "function membyte(step, addr){\n if (step in memo_table){\n if (addr in memo_table[step]){\n return memo_table[step][addr];\n }\n } else {\n memo_table[step] = {};\n }\n let t = trace[step].memwrite;\n if (Object.keys(t).includes(addr.toString())){\n memo_table[...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Load account, watch events and load leases in state when component mounts
componentDidMount() { this.props.web3.eth.getCoinbase((err, account) => { this.setState({ account: account }) this.props.leasesContract.deployed().then((smartLeaseInstance) => { this.smartLeaseInstance = smartLeaseInstance this....
[ "account_event() {\n event.subscribe('account', (e) => {\n this.account = e.payload\n if(this._mounted && typeof window !== 'undefined') this.forceUpdate()\n })\n\n /*\n subscribe to the 'account'-event\n if the component is mounted\n (componentWillMount sets _mounted to true;\n comp...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
You may only resubmit a submissions that was voted out. If the submission is in any other state, reject the resubmission
async function doResubmit(res, user, payload, GameDatabases, Trans) { try { let submission = await GameDatabases.getSubmissionByUserID(Trans, user.user_id); // Sanity check that we have a submission if(!submission){ errorResponse(res, "Resubmission failed", ...
[ "function validateRebateResubmitDenial(form) {\n\t\tif (form.RequestResubmitted.checked == true) {\n\t\t\tif (form.ResubmissionDenied.disabled == true) {\n\t\t\t\t// enable ResubmissionDenied and restore from backup\n\t\t\t\tform.ResubmissionDenied.disabled = false;\n\t\t\t\tform.ResubmissionDenied.selectedIndex = ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
helper function for interleave interleaves a single object of arrays
function interleaveObj(obj) { // find all keys in the object var keys = Object.keys(obj); // find longest stored array var maxLen = keys.reduce(function(max, key) { if (obj[key].length > max) return obj[key].length; else return max; }, 0); var mergedData = []; // defined outside the loop to satisfy the lin...
[ "function interleave(array1, array2){\nvar combined = [];\n for (var i = 0; i < array1.length; i++) {\n combined.push(array1[i]);\n combined.push(array2[i]);\n }\nreturn combined;\n}", "function interleave(array1, array2) {\n let newArray = [];\n let arrayIndexLength = array1.length - 1;\n for (let i =...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Destroys all tanks, putting them in the destroyed tanks pool for reuse
function destroyAllTanks() { for (var tankId in activeTanks) { if (activeTanks.hasOwnProperty(tankId)) { destroyTank(tankId); } } }
[ "_destroy() {\n const stack = [];\n if (this._root) {\n stack.push(this._root);\n }\n while (stack.length > 0) {\n const tile = stack.pop();\n\n for (const child of tile.children) {\n stack.push(child);\n }\n\n // TODO - Use this._destroyTile(tile); ?\n tile.destroy(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Centers the image on map
function centerMap() { var sets = $['mapsettings']; var $this = sets.element; var location = new Point(($this.innerWidth()/2)-(sets.resolutions[sets.zoom-1].width/2),($this.innerHeight()/2)-(sets.resolutions[sets.zoom-1].height/2)); setInnerDimentions(location); }
[ "center(){\r\n this.#map.fitBounds(this.#bounds);\r\n }", "function calculateCenter() {\n center = map.getCenter();\n }", "function centerMap() {\n getLocation()\n }", "CenterMap()\r\n\t{\r\n\t\tlet countiesXCenter = (this.countiesMax.x - this.countiesMin.x) / 2.0;\r\n\t\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
If there is no state change before the timeout, invoke resolve otherwise reject.
then(resolve, reject) { this.resetState(); this.reject = reject; this.state = setTimeout(() => { try { resolve(); } catch (error) { this.onError(error); } }, this.timeout); }
[ "resolve(value) {\n if (this.state !== DeferredState.PENDING)\n throw new Error(`cannot resolve ${DeferredState[this.state].toLowerCase()}`);\n this._resolve(value);\n this._state = DeferredState.RESOLVED;\n }", "function waitForFoo(resolve, reject) {\n if (done)\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get scope.hours in 24H mode if valid
function getScopeHours ( ) { var hours = parseInt( scope.hours, 10 ); var valid = ( scope.showMeridian ) ? (hours > 0 && hours < 13) : (hours >= 0 && hours < 24); if ( !valid ) { return; } if ( scope.showMeridian ) { if ( hours === 12 ) { hours = ...
[ "function getHoursFromTemplate() {\n\t var hours = +$scope.hours;\n\t var valid = $scope.showMeridian ? hours > 0 && hours < 13 :\n\t hours >= 0 && hours < 24;\n\t if (!valid || $scope.hours === '') {\n\t return undefined;\n\t }\n\n\t if ($scope.showMeridian) {\n\t if (hours === 12) {\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
accumulate data in the 'incoming' region into 'accu'
accumulate( accuIndex, weight ) { // note: happily accumulating nothing when weight = 0, the caller knows // the weight and shouldn't have made the call in the first place const buffer = this.buffer, stride = this.valueSize, offset = accuIndex * stride + stride; let currentWeight = this.cumulativeWeigh...
[ "accumulate(accuIndex,weight){// note: happily accumulating nothing when weight = 0, the caller knows\n// the weight and shouldn't have made the call in the first place\nconst buffer=this.buffer,stride=this.valueSize,offset=accuIndex*stride+stride;let currentWeight=this.cumulativeWeight;if(currentWeight===0){// acc...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
method to reset work loop to a fiber of given component
function resetLoopToComponentsFiber(fiber) { const { root, nodeInstance } = fiber; // mark component as dirty, so it can be rendered again nodeInstance[BRAHMOS_DATA_KEY].isDirty = true; // set the alternate fiber as retry fiber, as root.retryFiber = fiber; }
[ "reset() {\n let loop;\n for( let i = 0; i < this.loops.i; i++ ){\n for( let j = 0; j < this.loops.j; j++ ){\n loop = this.loops.mat[i][j];\n if( loop !== undefined ){\n // remove loop\n this.e.scheduler.remove(loop);\n // disable renderer\n this.e.render...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Manage FF context menu integration onHidden event
function onHiddenContextMenuHandler () { myMenu_open = false; // This sidebar instance menu closed, do not interpret onClicked events anymore }
[ "function onHiddenContextMenuHandler () {\r\n // Reset remembered bnId if any\r\n lastMenuBnId = undefined;\r\n}", "function addListenerHiding(win) {\n var win = viewFor(win);\n cmNode = win.document.getElementById('contentAreaContextMenu')\n cmNode.addEventListener('popupshowing', function(e){\n menuItem...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
! Function : WebSocketIFSendSimpleRequest
function WebSocketIFSendSimpleRequest (InRequest) { var d; var request; request = {}; d = new Date(); request.packettype = "request"; request.packetid = WebSocketIFGetNextID(); request.time = d.getTime(); request.type = InRequest; ...
[ "function\nWebSocketIFSendSimpleRequest(InRequest)\n{\n var request = {};\n\n request.packettype = \"request\";\n request.packetid = WebSocketIFGetNextID();\n request.time = 0;\n request.type = InRequest;\n request.body = \"\";\n\n WebSocketIFSendGeneralRequest(request);\n}", "fun...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
helper to generate a random date
function randomDate(start, end) { return new Date(start.getTime() + Math.random() * (end.getTime() - start.getTime())).toLocaleDateString(); }
[ "function getRandomDate() {\n\treturn today.subtract(Math.floor(Math.random() * 525600), 'minutes').format('YYYY-MM-DD hh:mm:ss');\n}", "function randDate() {\n \n var month = monthConvert(((Math.random() * 12) + 1) | 0);\n var day = ((Math.random() * 30) + 1) | 0;\n\n return month + \" \" + day + \", 2019\";...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Renders the AWS CloudFormation properties of an `AWS::Serverless::SimpleTable.ProvisionedThroughput` resource
function cfnSimpleTableProvisionedThroughputPropertyToCloudFormation(properties) { if (!cdk.canInspect(properties)) { return properties; } CfnSimpleTable_ProvisionedThroughputPropertyValidator(properties).assertSuccess(); return { ReadCapacityUnits: cdk.numberToCloudFormation(properties....
[ "function tableResourceProvisionedThroughputPropertyToCloudFormation(properties) {\n if (!cdk.canInspect(properties)) {\n return properties;\n }\n TableResource_ProvisionedThroughputPropertyValidator(properties).assertSuccess();\n return {\n ReadCapacityUnits: cdk.n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Helper function to install a getter/setter accessor property.
function InstallGetterSetter(object, name, getter, setter) { %CheckIsBootstrapping(); SetFunctionName(getter, name, "get"); SetFunctionName(setter, name, "set"); %FunctionRemovePrototype(getter); %FunctionRemovePrototype(setter); %DefineAccessorPropertyUnchecked(object, name, getter, setter, DONT_ENUM); %...
[ "function InstallGetter(object, name, getter, attributes) {\n %CheckIsBootstrapping();\n if (typeof attributes == \"undefined\") {\n attributes = DONT_ENUM;\n }\n SetFunctionName(getter, name, \"get\");\n %FunctionRemovePrototype(getter);\n %DefineAccessorPropertyUnchecked(object, name, getter, null, attri...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Highlights all selction text on the current page.
function highlightAllTextOnPage(tabId, datawakeInfo) { var post_data = JSON.stringify({ team_id: datawakeInfo.team.id, domain_id: datawakeInfo.domain.id, trail_id: datawakeInfo.trail.id, url: tabs.activeTab.url }); var post_url = addOnPrefs.datawakeDeploymentUrl + "/selection...
[ "function highlightAll()\n\t{\n\t\thighlightBlocks(document.body);\n\t}", "function highlight() {\n const lastLength = selectedNodes.length;\n const range = getRange();\n\n // is range if null then the selection is invalid\n if (range == null) return;\n\n const start = {\n node: range.startContainer,\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Preprocesses the C32 document
function process(c32) { c32.section = section; return c32; }
[ "function DocumentPretranslating() {\n _classCallCheck(this, DocumentPretranslating);\n\n DocumentPretranslating.initialize(this);\n }", "function process_pre_sections() {\n for(var i=0; i<pre_sections.length; ++i) {\n var section_cnt = 0;\n for(var j=0; j<pre_sections[i][0]; ++j) {\n //multipl...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get details about a specific tasklist.
async getTasklist(input = { tasklistId: '0' }) { return await this.request({ name: 'tasklist.get', args: [input.tasklistId], page: Page.builder(input.pagination) }); }
[ "function getTasksOnList(listId) {\n gapi.client.request({\n 'path': '/tasks/v1/lists/' + listId + '/tasks',\n 'callback': printTasks.bind(null, listId)\n });\n}", "function listTaskLists() {\n var taskLists = Tasks.Tasklists.list();\n if (taskLists.items) {\n for (var i = 0; i < taskLists.items.leng...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
assign click events on click dodSuperDeal find a and update window.location
function DelegateClick_dodSuperDeal(){ var offerUnit = document.getElementsByClassName('dodSuperDealUnit_ev'); for(var i=0; i < offerUnit.length; i++){ offerUnit[i].addEventListener('click', function(e){ //console.log('offerUnit clicked!'); var windowWidth = window.innerW...
[ "function handleClick(d, i) {\n window.location = \"index.php?us_state=\"+this.id+\"/\";\n }", "function init_href_click_event(){\n\t\t$('.hotel-detail-href').unbind('click');\n\t\t$('.hotel-detail-href').click(function(){\n\t\t\t$.ajax({\n\t\t\t\turl: this.href.replace(/hotels\\/[0-9]*\\?/,\"hotels/c...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Redraws all dependencies if a rows height changed, as detected in onTranslateRow
onChangeTotalHeight() { // redraw all dependencies if the height changes. Could be caused by resource add/remove. // in reality not all deps needs to be redrawn, those fully above the row which changed height could be left // as is, but determining that would likely require more processing than redrawing ...
[ "onChangeTotalHeight() {\n if (this.client.isEngineReady) {\n // redraw all dependencies if the height changes. Could be caused by resource add/remove.\n // in reality not all deps needs to be redrawn, those fully above the row which changed height could be left\n // as is, b...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Use a binary search to find the index of the codeword corresponding to this symbol.
findCodewordIndex(symbol) { let first = 0; let upto = this.SYMBOL_TABLE.length; while (first < upto) { let mid = (first + upto) >>> 1; // Compute mid point. if (symbol < this.SYMBOL_TABLE[mid]) { upto = mid; // repeat search in bottom half. } else if (symbol > this.SYMBOL_TABLE[mid...
[ "_indexOf(symbol) {\n if (symbol) {\n symbol = symbol.toUpperCase();\n for (let i = 0; i < this._items.length; i++) {\n /* eslint-disable-next-line eqeqeq */\n if (this._items[i].symbol == symbol) {\n return i;\n }\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Types: / A Snake initially of length 1 at position x y in cell coordinates, moving in given direction The head of a snake is a cell. Its body consists of a list of other cells
function Snake(x, y, dir) { this.head = new Cell(x, y); this.body = []; // array of Cell this.dir = dir; this.nextdir = dir; this.belly = 0; // the amount of food currently eaten this.score = 0; // Return length of this snake this.len = function() { return 1 + this.body.length; }; // Increase snake lengt...
[ "setSnakeHead(pos, direction) {\n const cell = this.getCell(pos);\n cell.classList.add(SNAKE_BODY_CLASS, SNAKE_HEAD_CLASS);\n if (direction === UP) {\n cell.classList.add(SNAKE_UP_CLASS);\n } else if (direction === DOWN) {\n cell.classList.add(SNAKE_DOWN_CLASS);\n } else if (direction === L...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Master Words IgnoreList / getIgnoreKeywords_allWords() Concat together the masterlist of handchosen, commonwords for exclusion.
function getIgnoreKeywords_allWords() { var ignorekeywords = []; ignorekeywords = ignorekeywords.concat(getIgnoreKeywords_allWords_symbolWords()); ignorekeywords = ignorekeywords.concat(getIgnoreKeywords_allWords_numberWords()); ignorekeywords = ignorekeywords.concat(getIgnoreKeywords_allWords_A_Words()); ...
[ "function getListOfAllWords() {\n var completeArray = newWords.concat(learningWords, masteredWords);\n return JSON.stringify(completeArray);\n}", "function getIgnoreKeywords_allWords_X_Words() {\n\t\treturn [\n\t\t];\n\t}", "function getIgnoreKeywords_allWords_R_Words() {\n\t\treturn [\n\t\t\t'rarely',\n\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Convert the transaction to the format to be imported
convert(transactions) { var transactionsToImport = []; // Filter and map rows for (var i = 0; i < transactions.length; i++) { //We take only the complete rows. var transaction = transactions[i]; if (transaction.length < (this.currentLength)) continue; if ((transaction[this.c...
[ "convert(transactions) {\n var transactionsToImport = [];\n\n // Filter and map rows\n for (var i = 0; i < transactions.length; i++) {\n //We take only the complete rows.\n var transaction = transactions[i];\n if (transaction.length < (this.colBalance + 1))\n continue;\n if ((tra...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
A function for testing float packing/unpacking.
function testPack2Floats() { var tests = [ vec2(0.0, 3.0), vec2(20.0, 0.2), vec2(1.0, 1.0), vec2(1.0, 0.0), vec2(0.0, 1.0), ]; for(var i = 0; i < tests.length; i++) { var orig = tests[i]; var packed = pack2Floats(orig[0], orig[1]); var unp...
[ "function _float(data) {\n return number(data) && data % 1 !== 0;\n }", "function _float(data) {\n return number(data) && data % 1 !== 0;\n}", "function isFloat (s)\r\n\r\n{ if (isEmpty(s)) \r\n if (isFloat.arguments.length == 1) return defaultEmptyOK;\r\n else return (isFloat.arguments[1] ==...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Compile a single token value to a register, examples: 1, "string", local, global
compileSingleTokenToRegister(opts, result) { let program = this._program; result.dataSize = 1; if (opts.identifier && opts.identifier.getType) { this.setLastRecordType(opts.identifier.getType().type); } if (opts.expression.tokens[0].cls === t.TOKEN_NUMBER) { program.addCommand($.CMD_SET, $.T_NUM_L, this._scope.getStack...
[ "compileSingleTokenToRegister(opts, result) {\n let program = this._program;\n result.dataSize = 1;\n if (opts.identifier && opts.identifier.getType) {\n this.setLastRecordType(opts.identifier.getType().type);\n }\n if (opts.expression.tokens[0].cls === t.TOKEN_NUMBER) ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Clamps a value between a minimum and a maximum.
function clamp(value, min, max) { return Math.max(min, Math.min(max, value)); }
[ "function clamp(value, min, max) {\n return value < min ? min : (value > max ? max : value);\n }", "function clamp(value, min, max) {\n return value < min ? min : (value > max ? max : value);\n }", "function clamp$1(value, min, max) {\n return Math.max(min, Math.min(max, value));\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
To stay backwards compatible with puppeteer's (and our) default export after adding `addExtra` we need to defer the check if we have a puppeteer instance to work with. Otherwise we would throw even if the user intends to use their nonstandard puppeteer implementation.
get pptr() { if (this._pptr) { return this._pptr; } // Whoopsie console.warn(` Puppeteer is missing. :-) Note: puppeteer is a peer dependency of puppeteer-extra, which means you can install your own preferred version. - To get the latest stable version ...
[ "async function givePage(){\n const browser = await puppeteer.launch({headless: false})\n const page = await browser.newPage();\n return page;\n}", "setup() {\n return __awaiter(this, void 0, void 0, function* () {\n if (this._options.browser)\n this._browser = this._opti...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Set the church that will benefit from the sharing.
function setBenefitingChurch(org, closeFancybox) { $.cookie('supporting_church', JSON.stringify(org)); currentOrganization = org; var ogImage = $('meta[property="og:image"]').attr('content'); var shareURL = location.protocol + '//' + location.host + location.pathname + '?gamify_token=' + org.gamify_toke...
[ "function assignChores() {\n\n makeChores();\n distributionCheck();\n displayChoreAssignments(); \n assignChoresEvents(); \n }", "function cc_js_set_share (value)\n{\n cc_js_share = value;\n cc_js_modify();\n}", "set reach(value){\n this._reach = value;\n }", "function setRandomSp...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
removeOverlay(false) will not restore the scollbar afterwards
removeOverlay(showScroll = true) { if (this.overlay) { Object(_util_helpers__WEBPACK_IMPORTED_MODULE_1__["addOnceEventListener"])(this.overlay.$el, 'transitionend', () => { if (!this.overlay || !this.overlay.$el || !this.overlay.$el.parentNode || this.overlay.value) return; this.overla...
[ "removeOverlay() {\n _store_global__WEBPACK_IMPORTED_MODULE_3__[\"dispatch\"].ui.showOverlay(false);\n const $el = OverlayService.getElement();\n $el.parentNode && $el.parentNode.removeChild($el);\n }", "removeOverlay(showScroll = true) {\n if (this.overlay) {\n addOnceEventLis...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
function to add a dot (".") to the number.
function addDot() { for (var i = 0; i < number.length; i++) { if(number.charAt(i) === ".") return; }; number += "."; displayF(number); }
[ "function addDots(n)\r\n{\r\n\tn += '';\r\n\tvar rgx = /(\\d+)(\\d{3})/;\r\n\twhile (rgx.test(n)) {\r\n\t\tn = n.replace(rgx, '$1' + '.' + '$2');\r\n\t}\r\n\treturn n;\r\n}", "addDot() {\n let lastOperation = this.getLastOperation();\n if (typeof lastOperation === 'string' && lastOperation.indexOf('...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Delete DataType from FinanceCube
function deleteFinanceCubeDataType(dataTypeId) { var selectDataTypes = $scope.separate; var financeCubeDataTypes = $scope.financeCube.dataTypes; for (var i = 0; i < financeCubeDataTypes.length; i++) { if (financeCubeDat...
[ "function deleteDataType( dataType ) {\n if ( dataType ) {\n debug && console.log( \"JSONData.deleteDataType: Deleting all \" + dataType + \" objects\" );\n _.each( getObjectsByDataType( dataType ), function( objectInList ) {\n if ( objectInList.webId ) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sets push in to false on the elevio library. See:
disablePushin() { get(this, '_elevio').pushin = 'false'; }
[ "enablePushin() {\n get(this, '_elevio').pushin = 'true';\n }", "togglePush() {\n if (this.isPushEnabled) {\n this.unsubscribe()\n } else {\n this.subscribe()\n }\n }", "function handlePusher() {\n setPusher();\n }", "function togglePushPin() {\n $('.infobox .pushpin-b...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Find the venue expense
function findVenue(expense) { return expense.type === 'Venue'; }
[ "function getExpenseList(){\n\t\treturn Expenses.index()\n\t}", "static expense() {\r\n return {\r\n total: 0,\r\n list: [],\r\n length: 0\r\n }\r\n }", "getExpenses () {\n\t\treturn this.expenses;\n\t}", "function getExpenses(evt){\n\tlet choice = this.value;\n\tlet earnings...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function to Load all Contacts Records.
function loadRecords() { var promiseGetContacts = SinglePageCRUDService.getContacts(); promiseGetContacts.then(function (pl) { $scope.Contacts = pl.data }, function (errorPl) { $scope.error = 'failure loading Contact', errorPl; }); }
[ "function loadContacts() {\n fetch(\"api/contact\")\n .then((r) => {\n r.json().then((json) => {\n const tbody = document.querySelector(\"tbody\");\n // Clear the table\n while (tbody.firstChild) {\n tbo...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates a new function in the module's table and returns its pointer. Note that only actual WebAssembly functions, i.e. as exported by the module, are supported.
function newFunction(fn) { if (typeof fn.original === "function") fn = fn.original; var index = table.length; table.grow(1); table.set(index, fn); return index; }
[ "function addWasmFunction(func) {\r\n var table = wasmTable;\r\n var ret = table.length;\r\n table.grow(1);\r\n table.set(ret, func);\r\n return ret;\r\n}", "function addWasmFunction(func) {\n var table = Module['wasmTable'];\n var ret = table.length;\n table.grow(1);\n table.set(ret, func);\n return re...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function to loop every frame of the mainLoop. If the checks (checkbottom and checkbottombox) fail, run reset()
mainLoop() { this.y++; this.frame ++; if (this.checkBottom(this.y) && this.checkBox(this.x, this.y)){ this.render(); } else { this.y --; this.frame--; this.reset(); } }
[ "reset() {\n this.message.style.display = \"none\";\n this.board.reset();\n this.allCheckers.forEach(checker => {\n checker.removeAttribute(\"tabindex\");\n checker.style.transitionDuration = \"1.75s\";\n checker.style.top = \"100vh\" // drops checker off screen...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function for loading a stream plot in content div
function loadStreamPlot( object_id, stream_id ){ // Create plot container var streamPlot = $( '<div class="plot-container" id="plot-'+object_id+'-'+stream_id+'">'+ '</div>' ); // Load Highcharts streamPlot.highcharts({ chart: { type: 'spline' }, title: { text: 'Plot Title' }, subtitle: { text: 'Plot Subt...
[ "function showSocialStream() {\n $.get(\"views/fragments/socialstream.home.php\", function (data) {\n $(\".social-stream-widget\").html(data);\n });\n }", "function loadStreamIcon( object_id, stream_id ){\n // Add Icon\n var streamIcon = $(\n '<div class=\"col-sm-2 data-select\" '+\n '...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns the week template node ready for injection.
static getWeekNode() { return document.querySelector('[data-template-calendar-week]') .content .cloneNode(true) .querySelector('[data-calendar-week]'); }
[ "function generateWeekNode() {\n var week_node = document.createElement('div');\n week_node.className = WEEK_CLASS;\n return week_node;\n }", "function buildWeekNode() {\n\t\t\t\tnode = document.createElement('ul');\n\t\t\t\tnode.classList.add('cm_week');\n\t\t\t\treturn node;\n\t\t\t}", "static getDa...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Variable hoisting actually makes this work. I thought it would have to be split into two lines. ======================================================= DG: I'd prefer to have the lists at the top context rather than buried inside a function! However, that would require creating handlers for every configuration since th...
function createHandlerList() { var config = chooseConfig(); // @FIXME/dg: If we get a third configuration, change to something more efficient than if/else if (config === 'desktop') { return { 'toggleTo:input': handlerFactory('setFocus:input'), // Toggling from step mode to input just finished 'togg...
[ "function globals_list() {\n\n}", "createAppsLists() {\n this.hostIds = this.getUniqueHostIds();\n\n this.hostIds.forEach((id) => {\n const appsList = new AppsList(id, this.getTopAppsByHost(id));\n this.appsLists.push(appsList);\n this.listContainer.appendChild(appsL...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Adds data labels to each of the cells in the table. This is so they can be used to create the responsive table.
function addDataLabelAttributes(tableHeadingsArray){ "use strict"; let tableBody = document.querySelector("#bodyRows"); let numberOfRows = tableBody.rows.length; for(let i=0; i<numberOfRows; i++){ let row = tableBody.rows[i]; let numberOfCells = row.cells.length; for(let j=0; ...
[ "function populateTableLabels() {\n Object.entries(currentLabeledIDs).forEach(entry => {\n populateCountTableLabels(entry[0], entry[1]);\n populateMessageTableLabels(entry[0], entry[1]);\n });\n}", "function ApexDataLabels() { }", "addColumnLabels() {\n for (let i = 0; i < this.n_days; i++) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Parse the card and assign to to sum or aces
function parseCard(slicedCard) { if (slicedCard === "A") { person.aces++; } else if (slicedCard === "J" || slicedCard === "Q" || slicedCard === "K") { person.sum += 10; } else { person.sum += parseInt((slicedCard), 10); } }
[ "function parseCard(card) {\r\n\tvar suiteVal = {}\r\n\tvar cardId = card.id;\r\n\tvar color;\r\n\tvar cardInfo = cardId.split(\"_\");\r\n\tif (cardInfo[0] == \"diamonds\" || cardInfo[0] == \"hearts\") {\r\n\t\tcolor = 0;\r\n\t} else {\r\n\t\tcolor = 1;\r\n\t}\r\n\tvar val = parseInt(cardInfo[1]);\r\n\tsuiteVal[\"c...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function revisePlan It will be called when clicking 'Revised Plan' process in event tab on techspec screen.
function revisePlan() { var url = "revised"; var htmlAreaObj = _getWorkAreaDefaultObj(); var objAjax = htmlAreaObj.getHTMLAjax(); var objHTMLData = htmlAreaObj.getHTMLDataObj(); sectionName = objAjax.getDivSectionId(); //alert("sectionName " + sectionName); if(objAjax && objHTMLData) { if(!isV...
[ "function remove_plan(date, index){\n\t\tself.editplan = null;\n\t\tself.cyear.remove_plan(date, index);\n\t}", "function editPlan(planId, e) {\n\te.preventDefault();\n\tvar plan = getTravelPlanById(planId);\n\tvar listActivities = plan.activities;\n\tvar listGuests = plan.guests;\n\t$(\"#myNotes\").val(plan.note...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns the last name of the user.
get lastName(){ return this._user.last_name; }
[ "function getLastName() {\n\t\t\treturn JSON.parse(atob(getToken().split('.')[1])).lastName;\n\t\t}", "get lastName(){\n\t\treturn this.user.last_name;\n\t}", "function getLastNames() {\n return users.map(function (user) {\n return user.name.split(' ')[1];\n })\n}", "function getLastName() {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
function _hiLightTopOfSebTree(eTR) this function hilights the first node on a sub tree, internal use only
function _hiLightTopOfSebTree(eTR) { var eTBody=eTR.cells(1).firstChild.firstChild; eTBody.rows(0).cells(1).fireEvent("onclick"); }
[ "function _hiLightBottomOfSebTree(eTR)\n\t{\n\t\tvar eTBody=eTR.cells(1).firstChild.firstChild;\n\t\tvar eTRBottom=eTBody.rows(eTBody.rows.length-1);\n\t\tif(eTRBottom.style.display !='none')\n\t\t\t_hiLightBottomOfSebTree(eTRBottom);\n\t\telse\t\n\t\t\teTBody.rows(eTBody.rows.length-2).cells(1).fireEvent(\"onclick...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Send raw binary data to the given peer. There must be a direct connection to the peer.
sendRaw(peerId, binaryData) { let connection = this.getConnection(peerId); if (connection && connection.channel) { if (connection.channel.readyState === 'open') { connection.channel.send(binaryData); } else { console.log('cannot send: ' + connection.channel.readyState + ' ' + peerId); } } else { ...
[ "async sendRaw (peerAddr, amount, rawBuf) {\n let plugin = peerAccounts.getAccount(peerAddr);\n return plugin.sendData(formatDataPacket(amount, rawBuf));\n }", "send(data, peer) {\n if (data instanceof Object) {\n data = JSON.stringify(data);\n }\n if (!(typeof data == 'string' || data instan...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Find Style object based on title
function findPreferredStyle(styleName, styles) { var styleLen = styles.length; for(var i = 0; i<=styleLen; i++) { console.log(styles[i]); var name = styles[i].title; if(name === styleName) { return styles[i]; } } return null...
[ "function getStyleSheetByTitle(title) {\n for (var i = 0; i < document.styleSheets.length; i++) {\n var sheet = document.styleSheets[i];\n if (sheet.title && sheet.title == title) return sheet;\n }\n return null;\n }", "function lookup_style(styles, stylename) {\n\t\tvar stylebase = stylename....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Parse a vega schema url into library and version.
function default_1(url) { var regex = /\/schema\/([\w-]+)\/([\w\.\-]+)\.json$/g; var _a = regex.exec(url).slice(1, 3), library = _a[0], version = _a[1]; return { library: library, version: version }; }
[ "function default_1(url) {\n var regex = /\\/schema\\/([\\w-]+)\\/([\\w\\.\\-]+)\\.json$/g;\n var _a = regex.exec(url).slice(1, 3), library = _a[0], version = _a[1];\n return { library: library, version: version };\n }", "function getVersion(a) {\n return a.url.substring(1, 3) || \"v1\";\n}", "...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
empty if no ast (equivalently, the formula is '').
isEmpty() { return !this.ast; }
[ "get formula() { return this.ast ? this.ast.toString(this.id) : ''; }", "function test_nondet_empty() {\n parse_and_eval(\"amb();\");\n\n assert_equal(null, final_result);\n}", "jsx_parseEmptyExpression() {\n \t\t let node = this.startNodeAt(this.lastTokEnd, this.lastTokEndLoc);\n \t\t retur...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Tries to connect with the database. If a connection not can be made, it waits for a set amount of time set in the config. This function cannot be called multiple times if one one the calls has not succeeded (because of the globals tate of the tries variable)
function connectionLoop() { const { host, username, password, database, maxAmountOfTries, timeout } = config.database; return new Promise((resolve, reject) => { try { console.log( `Testing connection with database (attempt: ${tries + 1}/${maxAmountOfTries})` ...
[ "function tryToConnectToDatabase() {\n tryConnectOptions.currentRetryCount += 1;\n winston.debug('Database connection try number: ' + tryConnectOptions.currentRetryCount);\n connect(function() {\n tryConnectOptions.resolve();\n }, function() {\n if (tryConnectOptions.currentRetryCount < tryConnectOptions....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Register a single REST endpoint with the RestAPI endpoint
function _registerRESTEndpoint(resource, endpoint, address) { if ( endpoint && typeof endpoint == 'object') { bus.publish('restapi.register', { "resource": resource, endpoint: endpoint.path, method: endpoint.method.toUpperCase(), expect...
[ "static registerEndpoint(module, endpoint, definition){\n this.modules || (this.modules = {});\n this.modules[module] || (this.modules[module] = { endpoints: {} });\n this.modules[module].endpoints[endpoint] = definition;\n\n // Create meteor method\n var methodDefinition = {};\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Flash image for a set amount of time, originally a fraction of a second, progressively longer as time proceeded, originally simple abstracts, becoming more elaborate
function flashImage(){ document.getElementById('flash').innerHTML="<img src='http://lorempixel.com/600/400/'>" // 5000 = 5 secs setTimeout(function() {document.getElementById('flash').innerHTML='';},3000); }
[ "function flashimage(){\n\t\tif (g3==0){\n\t\t\tsauronflash();\n\t\t\t$(\"#timeleft\").css(\"display\",\"none\");\n\t\t\t$(\"#timeleftsec\").css(\"display\",\"none\");\n\t\t\t// $(\"#questionarea\").css(\"display\",\"none\");\n\t\t\tsetTimeout(restore,flashduration);\n\t\t}\n\t\telse if (g3==1){\n\t\t\tbilboflash()...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
mock slot count response
async fetchSlotsResponse(/*page, dateString*/) { const slotCount = sequence.next().value; slotTotal += slotCount; return slotCount; }
[ "static async count(slot){\n const count = await this.findAll({\n attributes: [[sequelize.fn('COUNT', sequelize.col('slot')), 'slots']],\n where: {\n slot: {\n [Op.eq]: moment(slot)\n }\n }\n });\n\n return count[0].dataValues.slots;\n }", "count...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Renders the AWS CloudFormation properties of an `AWS::WAFv2::RuleGroup.Count` resource
function cfnRuleGroupCountPropertyToCloudFormation(properties) { if (!cdk.canInspect(properties)) { return properties; } CfnRuleGroup_CountPropertyValidator(properties).assertSuccess(); return { CustomRequestHandling: cfnRuleGroupCustomRequestHandlingPropertyToCloudFormation(properties.c...
[ "function getPropertyGroupCount()\n\t{\n\t\treturn propertyGroups.length;\n\t}", "function CfnRuleGroup_CountPropertyValidator(properties) {\n if (!cdk.canInspect(properties)) {\n return cdk.VALIDATION_SUCCESS;\n }\n const errors = new cdk.ValidationResults();\n if (typeof properties !== 'objec...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
flushAppendBuffer() content is buffered because it must be written all at once see append(content)
function flushAppendBuffer(){ $('#fp_wrapper').append(appendBuffer); appendBuffer = ""; }
[ "function append(content){\n\tappendBuffer += content;\t\n}", "_flush() {\n this.push(this.contents);\n this.emit('end')\n }", "function flushBuffer() {\n refresh(buffer);\n buffer = [];\n }", "_flush(done) {\n let buf;\n if (this.lastByte === 0x0a) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sync timeout how often to sync local reviews with server
get SYNC_TIMEOUT() { // once a minute return 1000 * 60; }
[ "syncReviews() {\n let self = this;\n if (navigator.onLine) {\n self._syncReviews();\n }\n window.setTimeout(self.syncReviews, self.SYNC_TIMEOUT);\n }", "function sync(){\n if ( pause )\n return;\n\n $http({\n method : 'GET',\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
curry5 :: ((a, b, c, d, e) > f) > a > b > c > d > e > f . . Curries the given quinary function. . . ```javascript . > const toUrl = S.curry5 ((protocol, creds, hostname, port, pathname) => . . protocol + '//' +
function curry5(f) { return function(v) { return function(w) { return function(x) { return function(y) { return function(z) { return f (v, w, x, y, z); }; }; }; }; }; }
[ "function curry4 (f) {\n function curried (a, b, c, d) { // eslint-disable-line complexity\n switch (arguments.length) {\n case 0: return curried\n case 1: return curry3(function (b, c, d) { return f(a, b, c, d); })\n case 2: return curry2(function (c, d) { return f(a, b, c, d); })\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
sync client assert ignore list
function __FIXME_SBean_assert_ignore_list() { this._pname_ = "assert_ignore_list"; //this.keywords: set[string] }
[ "async set_ignore_list(stub, list) {\n await this.config.set(stub + ':ignored', list);\n }", "async test_send_object_again(){\n let arrayList = new ArrayList();\n await this.socket1.root.setData(arrayList);\n Assert.equals(arrayList, await this.socket1.root.getData());\n }", "f...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
generateTrackingNumber() Purpose: Helper function generates a random tracking number Parameters: none Returns: string
function generateTrackingNumber() { const TN_LENGTH = 10; const TN_PREFIX = "IWD"; var tokens = ['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z','1','2','3','4','5','6','7','8','9','0']; var trackingNumber = new String(TN_PREFIX...
[ "function generateTrackingNumber() {\r\n return Math.floor(Math.random() * 1000000);\r\n}", "function generateTrackingNumber() {\n return Math.floor(Math.random() * 1000000);\n}", "function generateTrackingID () {\n return Math.floor(Math.random() * 999999999999)\n}", "function generateTrackingNumber() {...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
adds zero padding to single number
function addZeroPaddingSingle(number){ var result=number; if(number<10 && number>-1) result="0"+number; return result; }
[ "function addPadding(number) {\n var a = (\"00000000\" + number).slice(-8);\n return a;\n}", "function padWithZero(val) {\n return val > 9 ? val : \"0\" + val;\n }", "function zeroPad(num){\n return (num < 10 ? \"0\" + num.toString() : num.toString());\n }", "function zeroPad(num...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
var locations = [ ['Oficina de ventas : Urb. Los Cedros Mz E lote 3 Yanahuara', 16.393940, 71.549208,1] ]; var icon = ['public/img/markermenorca.png','public/img/markermap.png']; Initialize and add the map
function initMap() { var icon = [{ url: path+"public/web/images/marker-menorca.svg", // url scaledSize: new google.maps.Size(70, 70), // scaled size origin: new google.maps.Point(0,0), // origin anchor: new google.maps.Point(0, 50) // anchor }]; // console.log(locations[0][1]...
[ "function addMarker(map) {\r\n for (var i = 0, length = data.length; i < length; i++) {\r\n var busdata = data[i];\r\n var myLatLng = {lat: parseFloat(busdata.stop_lat), lng: parseFloat(busdata.stop_lon)};\r\n\r\n // Creating markers and putting it on the map\r\n\r\n // {#var image =...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function to prefind all the "short descriptions" for the pattern tooltips
function createShortDescriptions(){ Patterns.forEach((pattern) => { pattern.ShortDescription = $(pattern.Content).find("i").first().text(); }); }
[ "shortDescription() {\n const shortDesc = this.description.length > 200 ? this.description.substring(0 ,200) + '...' : this.description;\n return shortDesc;\n }", "displayShortDescription(description) {\r\n let shortDesc = ''\r\n let counter = 0\r\n if (description.length > 64) {\r\n fo...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
grab all the expenses and related items from the database. call on renderExpense().
fetchAndLoadExpenses() { this.expensesAdapter .getExpenses() .then(expenses => { expenses.forEach(expense => this.expenses.push(new Expense(expense))) }) .then(() => { this.renderExpense() }) }
[ "function getAllExpensesFromDatabase() {\n ExpensesService.getAllExpensesFromDatabase()\n .then(\n function success(response) {\n // if the call is successful, return the list of expenses\n vm.expenseEntries = response.data;\n },\n fun...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function: isPlusFloatTD4(valueOfStr, eLength). Description: Check out that if the parameter valueOfStr is one plus float number with effective length eLength and 4 decimals. Param: A string or a number. Return: True when it is or it can be cast to a plus float number and with effective length eLength and 4 decimals, ot...
function isPlusFloatTD4(valueOfStr, eLength){ var patrn1 = /^([+|]?[0-9])+(.[0-9]{0,4})?$/; try{ //alert("isPlusFloatTD4("+valueOfStr+","+eLength+").patrn="+patrn1.exec(valueOfStr)); if (patrn1.exec(valueOfStr)){ var tlen = valueOfStr.length; var dot = valueOfStr.indexOf('.'); var plus = valueOfSt...
[ "function isFloatTD4(valueOfStr, eLength){\r\n\tvar patrn1 = /^([+|-]?[0-9])+(.[0-9]{0,4})?$/;\r\n\ttry{\r\n\t\t//alert(\"isFloatTD4(\"+valueOfStr+\",\"+eLength+\").patrn=\"+patrn1.exec(valueOfStr));\r\n\t\tif (patrn1.exec(valueOfStr)){\t\t\r\n\t\t\tvar tlen = valueOfStr.length;\r\n\t\t\tvar dot = valueOfStr.indexO...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
builds and loads a checkout page via calls to the checkout.js file, and corresponding functions in cart.js files which generate and manage carts dynamically
function loadCheckoutPage(){ loadNavbar(); generateCheckoutPage(); }
[ "function processCheckoutPage(checkoutUrl)\n{\n\tif (DXR_CONFIG.justForFunMode)\n\t\treturn;\n\n\tvar page = require('webpage').create();\n\n\tpage.open(checkoutUrl, function(status) {\n\n\t\tsetTimeout(function() {\n\n\t\t\tvar success = page.evaluate(function(e, fn, ln, s1, s2, c, s, p, t) {\n\t\t\t\tconsole.log(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }