query
stringlengths
9
34k
document
stringlengths
8
5.39M
negatives
listlengths
19
20
metadata
dict
Add a `setBalance()` function
setBalance(value) { this.balance = value; }
[ "function workToGetBalance() {\n payBalance += 100;\n}", "function withdraw (account, amount) {\n account.balance -= amount;\n}", "function updateRunningBalance(amount){\n\t\n\t\tAccount.runningBalance = Account.endingBalance;\n\t}", "function transferMoney() {\n bankBalance += payBalance;\n payBa...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
if user clicks delete, then store it in the email object, but have to use $set so Vue 'sees' it and reacts to it if any changes happen
deleteEmail() { switch (this.view) { // move item to trash case "inbox": this.$set(this.selectedEmail, "deleted", true); this.selectedEmail = ""; break; // move item back from trash...
[ "onDeletingTrash() {\r\n this._update('Deleting trash emails...');\r\n }", "function updateAttendees(event) {\n\tvar attendee_name = $(this).attr(\"value\");\n\tvar attendee_email = \"\";\n\n\tvar contacts_list = JSON.parse(localStorage.getItem(\"contacts\"));\n\tfor(var count = 0; count < contacts_list...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Extract currency code from combined currency name string
function get_currency_code(str) { return str.match(/\((.*?)\)/)[1]; }
[ "function get_currency_name(str) {\n return str.replace(` (${get_currency_code(str)})`, '');\n}", "static getCurrencyName(code) {\n let currencyName = this.getPhrase(code, \"CurrencyCode\");\n if (currencyName != \"\" && currencyName.length > 0)\n return currencyName;\n else\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns humanreadable calldata. Example: simpleFunction(string[], string[]) strings = ["Hello", "World"] simpleFunction(strings, strings) Output: 0xbb4f12e3 simpleFunction 0x0 0000000000000000000000000000000000000000000000000000000000000040 ptr (alias for array2) 0x20 000000000000000000000000000000000000000000000000000...
_toHumanReadableCallData() { // Sanity check: must have a root block. if (this._root === undefined) { throw new Error('expected root'); } // Constants for constructing annotated string const offsetPadding = 10; const valuePadding = 74; const namePaddin...
[ "toString() {\n // Sanity check: root block must be set\n if (this._root === undefined) {\n throw new Error('expected root');\n }\n // Optimize, if flag set\n if (this._rules.shouldOptimize) {\n this._optimize();\n }\n // Set offsets\n co...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
An implementation of the BellmanFord algorithm. The algorithm finds the shortest path between a starting node and all other nodes in the graph. The algorithm also detects negative cycles. If a node is part of a negative cycle then the minimum cost for that node is set to Infinity
function bellmanFord(edges, V, start) { let dist = Array(V).fill(Infinity); dist[start] = 0; // Only in the worst case does it take V-1 iterations for the Bellman-Ford // algorithm to complete. Another stopping condition is when we're unable to // relax an edge, this means we have reached the optimal solutio...
[ "function sol(\n blocked = [\n [0, 1],\n [1, 0],\n ],\n source = [0, 0],\n target = [0, 2]\n) {\n // mark visited positions\n // once manhattan distance between source and current is greather than 200 return true (AT MOST 200 blocked positions!)\n // check source -> target AND target -> source\n const...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates the button that triggers the move interaction of the feature.
createMoveButton(index) { let scope = this; let modifyButtonElement = document.createElement('button'); modifyButtonElement.className = cssConstants.ICON + ' ' + cssConstants.EDITOR_FEATURE_MODIFY; modifyButtonElement.title = langConstants.EDITOR_FEATURE_MODIFY; modifyButtonElement.setAttribute('fea...
[ "button(x, y, content, opts){\n\n let button = new Button(x, y, content, opts);\n this.layer.buttons.push(button);\n return button;\n\n }", "createButton () {\n\n this.button = document.createElement('button')\n\n this.button.title = 'This model has multiple views ...'\n\n this.bu...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Attempt to credit a player for their consumed item, and remove it from the consumed items list in local storage on success.
function creditConsumedItem(item, token, receiptString, origin) { try { if (typeof onPurchase === "function" && consumedItems[item]) { if(token && receiptString && receiptString!=="noreceipt") { onPurchase(item === 'android.test.purchased' ? simulated_item : item, receiptString, token, origin)...
[ "function consumePurchasedItem(item, token, receiptString, origin) {\n try {\n if (purchasedItems[item]) {\n delete purchasedItems[item];\n consumedItems[item] = {\n token: token,\n receipt: receiptString,\n origin: origin\n };\n\n localStorage.setItem(\"billingConsumed\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
loop white tuts until 28 give chord name in every tuts
function pianoClickWhite(ctx){ //to give chord name for each tuts //make array and fill with white tuts chord name var keyName=["C","D","E","F","G","A","B","C'","D'","E'","F'","G'","A'","B'","C''","D''","E''","F''","G''","A''","B''","C'''","D'''","E'''","F'''","G'''","A'''","B'''"]; var keyNameNumber = 0; var...
[ "function pianoClickBlack(ctx){\r\n\t//to give chord name for each tuts\r\n\t//make array and fill with black tuts chord name\r\n\tvar keyName2=[\"C#\",\"D#\",\"F#\",\"G#\",\"A#\",\"C#'\",\"D#'\",\"F#'\",\"G#'\",\"A#'\",\"C#''\",\"D#''\",\"F#''\",\"G#''\",\"A#''\",\"C#'''\",\"D#'''\",\"F#'''\",\"G#'''\",\"A#'''\"];...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Add meal to menu calls redux action
addMenu() { const { meals, title, orderBefore, emailSwitch } = this.state; if (!title) { this.setState({ errorTitle: 'Title is required', errorOrderBefore: '' }); return; } if (!orderBefore) { this.setState({ errorOrderBefore: 'Order Expiring time is required', errorTitle: ''...
[ "onAddMealButtonPressed(event) {\n\t\tthis.addMeal();\n\t}", "function AddCustomMenuItems(menu) {\r\n menu.AddItem(strHelp, 0, OnMenuClicked);\r\n}", "addToMenu(menuEntry, menuItemSpec) {\n const menuItems = this.state.getItem('menuItems');\n const menuItemDef = menuItems[menuItemSpec.id]...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
stateSetOwner calls the server with a request to change the approver to the newly selected user
function stateSetOwner() { var FlowState = w2ui.propertyForm.record.FlowState; var si = getCurrentStateInfo(); var uid = 0; if (si == null) { console.log('Could not determine the current stateInfo object'); return; } if (typeof w2ui.stateChangeForm.record.OwnerName == "object" &...
[ "function stateSetApprover() {\n var FlowState = w2ui.propertyForm.record.FlowState;\n var si = getCurrentStateInfo();\n var uid = 0;\n\n if (si == null) {\n console.log('Could not determine the current stateInfo object');\n return;\n }\n if (typeof w2ui.stateChangeForm.record.Approv...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
======== onChangeConfigurePinHFXT ======== onChange callback function for the onChangeConfigurePinHFXT config
function onChangeConfigurePinHFXT (inst, ui) { let subState = !inst.enableHFXTClock; ui.bypassHFXT.hidden = subState; ui.hfxtFrequency.hidden = subState; }
[ "function onChangeConfigurePinLFXT (inst, ui)\n {\n let subState = !inst.enableLFXTClock;\n\n ui.bypassLFXT.hidden = subState;\n ui.lfxtDriveLevel.hidden = subState;\n }", "function pinClickHandler(e) {\n\tvar $pin = this;\n\tif($pin.id == 'pin-3') return;\n\tvar data = getPinData($pin);\n\n //consol...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Loop through all tbody rows and add a delete button column. Note that if the number of column headings changes in then the length check below needs to be updated.
function addRequiredRenewalFormDeleteButtons(){ if(('#requiredRenewalFormsTable thead tr th').length == 2){ $('#requiredRenewalFormsTable thead tr').append("<th>&nbsp;</th>"); } $('#requiredRenewalFormsTable tbody tr').each(function(index){ var id = this.children[0].innerText.trim(); var del = getRequiredRenew...
[ "function appendDeleteBtn(tr) {\n appendTd(tr, \"X\");\n let newTd = tr.lastElementChild;\n newTd.addEventListener(\"click\", deleteTrContainingTd);\n return newTd;\n}", "function deleteRow(button){\r\n button.parent().parent().remove();\r\n}", "deleteRow() {\n let table = this.getParent();\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Override method inherited from `InputMixin` to forward the input to combobox.
_inputElementChanged(input) { super._inputElementChanged(input); if (input) { this.$.comboBox._setInputElement(input); } }
[ "onSuggestChange(event, o) {\n switch(o.method) {\n // this is necessary for the input to show each letter as its typed\n case 'type':\n this.setState({\n value: o.newValue\n });\n break;\n // one of the suggests...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Remove all Delete and Reorder buttons (before adding them again)
function removeDeleteButtons() { YUI().use('node', function (Y) { var allButtons = Y.all('.lfr-ddm-repeatable-delete-button'); allButtons.remove(); }); }
[ "function removeButtons() {\n const div = document.getElementById('buttons');\n while (div.firstChild) {\n div.removeChild(div.firstChild);\n }\n}", "function clearAddOnButtons(addOnButtons) {\r\n}", "function clearButtons() {\n const div = document.querySelector('.question__div');\n while...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
constructor(x,y,paddleWidth,paddleHeight) Just uses the "Block" constructor which defines a simple rectangle and collisions
constructor(x,y,paddleWidth,paddleHeight) { super(x,y,paddleWidth,paddleHeight,color(255)); }
[ "function Paddle(x, y, width, height) {\n this.x = x;\n this.y = y;\n this.width = width;\n this.height = height;\n this.x_speed = 0;\n this.y_speed = 0;\n}", "constructor(x, y, paddle) {\n this.x = x;\n this.y = y;\n this.paddleW = 120;\n this.paddleH = 60;\n this.onPaddle = true;\n this....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Create RTCPeerConnection and get ready to start call We need to start the call to mod_verto only after we gathered our ICE candidates. The ICE gathering process is started in the createOffer() function.
function createPeerConnection() { var pc_config = { iceServers: [] }; var pc_constraints = { optional: [{ DtlsSrtpKeyAgreement: true }, { googIPv6: false }], mandatory: { OfferToReceiveAudio: true, OfferToReceiveVideo: false } }; var self = this; LOGGER.log("Creating RTCPeerConnection...
[ "function makeCall() {\n callButton.disabled = true;\n hangupButton.disabled = false;\n var servers = null;\n localConnection = new RTCPeerConnection(servers);\n localConnection.onicecandidate = localCandidate;\n \n remoteConnection = new RTCPeerConnection(servers);\n remoteConnection.onicec...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
I will call this function to get the list of currently toggled on pokemon objects
function getDefendingPokemon() { var defendingPokemon = []; var comboBoxes = $('.defender-combo-box'); var toggles = $('.defender-toggle'); for (var index = 0; index < comboBoxes.length; index++) { var comboBox = $(comboBoxes[index]); var toggle = $(toggles[index]); if (toggle.prop("checked")) { ...
[ "renderPokedex() {\n let pokemonList = [];\n if (this.state.pokemon.results) {\n this.state.pokemon.results.forEach(\n pokemon => pokemonList.push(\n <Pokemon\n url={pokemon.url}\n key={pokemon.name}\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Call Coccyx.history.start to start your application. When called starts responding to 'popstate' events which are raised when the user uses the browser's back and forward buttons to navigate. Pass true for trigger if you want the route function to be called. 0.5.0
function start(trigger, controllers){ v.controllers.registerControllers(controllers); //0.5.0 historyStarted = true; history.replaceState({verb: 'get'}, null, window.location.pathname); if(trigger){v.router.route('get', window.location.pathname);} }
[ "init() {\n if (typeof Path !== 'undefined') {\n Path.history.listen(true);\n Path.routes.rescue = function() {\n //window.location.replace(document.location.pathname);\n };\n }\n else throw new Error('Pathjs library is required for routing.');\n }", "constructor() {\n super...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Calls PUT /tale/:id/build with the given id
rebuildTale(taleId) { return $.ajax({ url: `${config.apiUrl}/tale/${taleId}/build`, method: 'PUT', headers: { 'Girder-Token': this.get('tokenHandler').getWholeTaleAuthToken() }, timeout: 3000, // ms success: function(respons...
[ "function build (dir, id) {\n // Executes from base directory. The script builds the repo. See details in script.\n const { code, stdout, stderr } = shell.exec('./build.sh ' + dir + id, { silent: true })\n console.log('Build ' + id + ' exit code: ', code)\n let success = !(stderr)\n let result = { id: id, buil...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
JQuery callback function to add projects in carousel and modals
function callbackProjects(data) { var items = 0; data.forEach(function(d){ //add pictures that will go to modals var pics = $("<div class='row'>"); d.pictures.forEach( function (p) { pics.append($("<img src='' class='col-12 col-sm-6 image-carousel'>") ...
[ "function projectDisplay() {\n// set variable outside of click function to hold previously clicked project\nvar lastClick;\n $('.project-tile').click(function(e){\n// set variables\n let $target = $(e.currentTarget);\n let $targetId = $target.attr('data-target');\n let $slick = $(`#${$targetId}-slick`);\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
a "NumberParser" is a "GenericParser" on a number column
function NumberParser(table, filter){ 'use strict'; generic.GenericParser.call(this, table, filter); }
[ "parse_number() {\n let vals = this.find_some(tk.NUMBER, tk.COLON);\n return Ex(pr.Number, vals);\n }", "readNumberLiteral() {\n const location = this.getLocation();\n let value = '';\n // Check for an integer format\n if (this.peekChar() === '0' && /[a-z]/.test(this.p...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This function is designed to be triggered by an event listener set on the job roles selection form. It evaluates the job roles selected by the user on the form, and then repaints the webpage with the info cards of the team members with those roles.
function rolesFormHandler(event) { event.preventDefault(); const checkboxList = document.getElementsByName("selectedroles"); let rolesIdArray = []; //Loop over the checkbox values to see which ones were checked by the user and store the checkbox values in an array checkboxList.forEach((ch...
[ "function displayRolesSelectMenu(container) {\n\n fetch('http://sandbox.bittsdevelopment.com/code1/fetchroles.php')\n .then((response) => {\n return response.json();\n })\n .then((rolesArray) => {\n\n let rolesMenu = `<form action=\"#\" method=\"GET\">\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
encode_digit(d,flag) returns the basic code point whose value (when used for representing integers) is d, which needs to be in the range 0 to base1. The lowercase form is used unless flag is nonzero, in which case the uppercase form is used. The behavior is undefined if flag is nonzero and digit d has no uppercase form...
function encode_digit(d, flag) { return d + 22 + 75 * (d < 26) - ((flag != 0) << 5); // 0..25 map to ASCII a..z or A..Z // 26..35 map to ASCII 0..9 }
[ "function decode_digit(cp) {\n return cp - 48 < 10 ? cp - 22 : cp - 65 < 26 ? cp - 65 : cp - 97 < 26 ? cp - 97 : base;\n }", "function prefixToBase(c)\n\t{\n\t\tif (c === CP_b || c === CP_B) {\n\t\t\t/* 0b/0B (binary) */\n\t\t\treturn (2);\n\t\t} else if (c === CP_o || c === CP_O) {\n\t\t\t/* 0o/0O (o...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Action to hide cart minimum price modal
function hideOrderMinimumPriceModal() { return { type: types.CART_TOTAL_IS_ABOVE_MIN_PRICE }; }
[ "function hide_add_product()\n{\n\t//hide the modal box \n\t$('.overlay').hide(); \n\t$('#product_picker').hide(); \n\tonBackKeyDown();\t\n\t//Redraw the screen \n\tredraw_order_list();\n}", "function getpsPrice(product) {\n\n let $prod = $(product);\n let qty = $prod.find(\"option:selected\").data(\"qty\")...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function that gets called to update the zombies. For each zombie, have it attempt to collide with other zombies (to prevent stacking), have it attempt to collide with the player (to deal damage), and call the zombie update function.
function updateZombies() { for (var i = 0; i < game.globals.zombies.length; i++) { if (game.globals.zombies[i].alive) { game.physics.arcade.overlap(game.globals.player, game.globals.zombies[i].zombie, zombieHitPlayer, null, this); //game.physics.arcade.collide(game.globals.zombies, game.globals.zombie...
[ "function SZ_resetZombie(whichOne, zombieBubble_generate){\n //reset this zombies hit counter\n zombieHits_counter[whichOne-1]=0\n //assign a user friendly name for our div\n var $zombiex = $(\"#zombie\"+whichOne);\n //we need to stop this zombies animations\n $zombiex.stop();\n //we want to position our zom...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Return the data for a service
function getServiceData (servicePath, cb) { self.serviceDiscovery.client.getClient().getData(servicePath, null, cb); }
[ "function getService(name, id) {\n var deferred = $q.defer();\n $http.get(BASE_URL + \"invoice/getService/name=\" + name + \"&id=\" + id)\n .then(\n function (response) {\n \tconsole.log(\"getService\" + response.data);\n deferred.resolve(response.data);...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Fixedpoint notation for number of MFIL which is divisible to 3 decimal places
function financialMfil(numMfil) { return Number.parseFloat(numMfil / 1e3).toFixed(3); }
[ "function formatDecimal3(val, n) {\n n = n || 2;\n var str = \"\" + Math.round ( parseFloat(val) * Math.pow(10, n) );\n while (str.length <= n) {\n str = \"0\" + str;\n }\n var pt = str.length - n;\n return str.slice(0,pt) + \".\" + str.slice(pt);\n}", "fun...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Clears Answers list of li elements/answers
function clearList() { if (answerList) { while (answerList.firstChild) { answerList.removeChild(answerList.firstChild); } info.removeChild(info.firstChild); } }
[ "function clearButtons() {\n const div = document.querySelector('.question__div');\n while (div.firstChild) {\n div.removeChild(div.firstChild);\n }\n }", "static resetChoices() {\n\t\tvar storyChoiceListEl = document.getElementsByTagName(\"jw-story-choice-list\")[0];\n\t\tstoryChoiceListEl.innerHT...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
update a contestant's steps displayed in DOM
updateHtmlSteps() { this.htmlStepDisplay.innerText = `${this.emoji} steps: ${this.stepsTaken.toFixed(0)}`; }
[ "function displaySteps(steps)\n{\n document.getElementById(\"mood-steps-main\").text = \" \" + formatSteps(steps) + \" \";\n}", "#updateStepIndicator() {\n if (!this.#stepIndicator.children.length) {\n this.#steps.forEach(({ name, status, label }, index) => {\n let item = document.createElement(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets a device by its id Method: GET Url: api/device/:id
async function getDeviceById(req, res, next) { const id = req.params.id; try { const foundDevice = await Device.findOne({ _id: id }).exec(); if (!foundDevice) { res.status(HttpStatus.NOT_FOUND).json({ message: "Product is not found" }); } return res.json(await formatDevice(fou...
[ "function getDevice(axios$$1, token, options) {\n var query = '';\n query += options.includeDeviceType ? '?includeDeviceType=true' : '?includeDeviceType=false';\n query += options.includeAssignment ? '&includeAssignment=true' : '';\n query += options.includeAsset ? '&includeAsset=true' : '';\n query ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
function for that takes in the hour and determines if it is past, present, next color
function checkColor(hour) { let now = moment().format('h A'); let momentTime = moment(now, 'h A'); let laterMomentTime = moment(hour, 'h A'); if (momentTime.isBefore(laterMomentTime)) { return "future"; } else if (momentTime.isAfter(laterMomentTime)) { return "past"; } else { ...
[ "function colorizor() {\n var timeOfDay = moment().hour();\n var timeSlots = [9, 10, 11, 12, 13, 14, 15, 16, 17];\n\n $.each(timeSlots, function (index, slot) {\n\n var hrNum = slot < 13 ? slot : slot - 12;\n\n if ((timeOfDay > slot)) {\n $('#hour-' + hrNum)...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Data of number of clicks for the chart
function chartClickData () { var data = []; for (var i = 0; i < allProducts.length ; i++) { data.push(allProducts[i].timesClicked); } return data; }
[ "function chartRenderedData () {\n var data = [];\n for (var i = 0; i < allProducts.length ; i++) {\n data.push(allProducts[i].timesrendered);\n }\n return data;\n\n}", "value_counts() {\n const sData = this.values;\n const dataDict = {};\n for (let i = 0; i < sData.length; i++) {\n const val...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
update dog to page
function updateDogOnPage(dog) { const trEl = document.querySelector(`#dog-row-${dog.id}`) }
[ "function updateDogOnServer(dog) {\n fetch(`${dogsURL}/${dog.id}`, {\n method: \"PATCH\",\n headers: { \"Content-Type\": \"application/json\" },\n body: JSON.stringify(dog)\n }).then(() => getDogs())\n}", "function updatePetInfoInHtml() {\n $('.name').text(pet_info['name']);\n $('.weight').te...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Simulated Annealing && optimizing
function SimulatedAnnealing() { // Init var alpha = 0.999; var temperature = 400.0; var epsilon = 0.001; var iteration = 0; // Grid Init var a, b; Grid = new Array(); for (a = -500; a < 500; a++) { Grid[a] = new Array(); for (b = -500; b < 500; b++) Grid[a][b] = 0; } // -- // Inital Pl...
[ "function vectorSwap(){\n\tchanges = 0;\n\tnoiseLevel = 0;\n\tvar eta = 1;\n\t\n\tvar lchanges = changes;\n\tvar a = fixedSpots[0][2];\n\tvar b = fixedSpots[1][2];\n\tvar c = fixedSpots[2][2];\n\tvar d = fixedSpots[3][2];\n\t\n\tfor (var i=0;i<gridSize2;i++){\n\t\tvar i1 = iToY(i,gridSize);\n\t\tvar j1 = iToX(i,gri...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Description: Triggered after a change, update the page elements associated with that field, primarily the maximum and minimum subtitle. Parameters: F: Field to be updated Notes: Author: Damon Murdoch Date: 22/11/2019
function updateField(f) { // Dereference active Pokemon let active = window.active; // Dereference active Pokemon base stats let bs = active.baseStats; // Integer contained in the webpage maximum EV input field for the field max_ev = parseInt(document.getElementById(f + '-max').value); // Integer contained...
[ "function updatePageRange(pageRange) {\r\n\tif (pageRange.length > 0) {\r\n\t\tvar rangeArray = pageRange.split(\"-\");\r\n\t\t$(\"#start\").val(rangeArray[0]);\r\n\t\t$(\"#end\").val(rangeArray[1]);\r\n\t}\r\n}", "function limitingPercentage(){\r\n if(customPercentage > 100){\r\n document.querySelector...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Rebuild the testsectiontest option fields
function /*void*/ updateTestSectionTestOptions(testSectionId, testId) { var optList = ""; if ($jq("#" + testSectionId).val() != 0 && $jq.isArray(testSectionTestMap[$jq("#" + testSectionId + " option:selected").val()])) { // Build list from array in the map var testsToShow = []; $jq(testSectionTestMap[$jq("#" + ...
[ "function createSelectedCashOptionSubsection(jsonType) {\n\t$(\"#optionsListContainer\").hide();\n\t$(\"#cashInfoTxt\").hide();\n\t$(\"#helpCash\").hide();\n\tjsonType = jsonType.trim();\n\tif (jsonTypeConstant.PRECASH == jsonType) {\n\t\t$(\"#cashPaymentOptionBox1\").show();\n\t\t$(\"#cashPaymentOptionBox1 #cashSe...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Given a map and a resource path, drill down in the map to find the most specific map node that matches the path. Return the map node, the matched path prefix, and the unmatched path suffix.
function reduce(map, path) { var mapNode, prefix, split, splits = getResourcePathSplits(path), subValue, suffix; while (splits.length) { split = splits.shift(); suffix = split[1]; prefix = suffix ? split[0] + '/' : split[0]; mapNode = map[prefix]; if (mapNode) { if (!suffix || typeof mapNode =...
[ "function applyMap(name, parentName, loader) {\n\n var curMatch, curMatchLength = 0;\n var curParent, curParentMatchLength = 0;\n var subPath;\n var nameParts;\n \n // first find most specific contextual match\n if (parentName) {\n for (var p in loader.map) {\n var curMap = loader.m...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns a String encoded or decoded depending on the mode informed ENCODE_MODE returns a encoded String DECODE_MODE returns a decoded String
function encodeDecode(text, mode) { if (text == null) return text; var textEncoded = ''; for (var count = 0; count < text.length; count++) { var index = ALPHABET.indexOf(text.charAt(count)); if ( index != -1) { textEncoded = textEncoded + ALPHABET.charAt((((index+(OFFSET*mode))+ALPHABET.length)...
[ "static getEncodeFunctionByName(functionName) {\n var _a;\n let fn = (_a = functionName === null || functionName === void 0 ? void 0 : functionName.toLowerCase()) === null || _a === void 0 ? void 0 : _a.trim();\n const result = (fn == \"fanspeed\") ? DatagramUtils.encodeFanSpeed :\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Return the Channel Key (the key for joining the channel)
function get_channel_key(){ return this.channel; }
[ "function key(network, channel) {\n return network + \"|||\" + channel;\n}", "function setKey(key){\n this.channel = key;\n }", "ComputeKeyIdentifier() {\n\n }", "function getClientKey() {\n\n }", "get keyName() {\n const prefix = this.guildIDs ? this.guildIDs.join(',') : 'global';\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Spriteset_MapTS The set of sprites on the map screen.
function Spriteset_MapTS() { this.initialize.apply(this, arguments); }
[ "function drawMap() {\n map = document.createElement(\"div\");\n var tiles = createTiles(gameData);\n for (var tile of tiles) {\n map.appendChild(tile);\n }\n document.body.appendChild(map);\n }", "loadTilesetImages() {\n\n // Load all the required tileset images\n for(let tilesetId in ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Takes attribute key token an returns location.
getAttributeKeyLocation(token) { return token.location; }
[ "getAttribLocation(name) {\n\t\treturn this.attributes[name] ? this.attributes[name].location : -1;\n\t}", "function _getCurrentAttributeToken(editor) {\n var cursor = editor.getCursorPos(),\n ctx = TokenUtils.getInitialContext(editor._codeMirror, cursor);\n while (ctx.token.type !== \"at...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function: addCourseNavButton creates an onClick event on the element with the id within button. When that element is clicked, a popup window will open with the url contained within the 'url' parameter and the page nane contained within the 'name' parameter. Parameters: button id of the element to add the clickability t...
function addCourseNavButton(button, url, name, prefix) { //console.log(prefix); if (prefix == 'SCOspecific') { prefix = SCOResources[name]; } if (name == 'Certificate') { if (typeof noCertificate == 'undefined') { //url = url+"?course="+SCOData.courseTitle; ada$(button).onclick = function() { openCer...
[ "function addTakenCourse(id) {\n if (checkCourseExist(id)) {\n alert(\"This course is already in the course bin!\");\n return null;\n }\n if (!checkPrereq(id)) {\n alert(\"check the prerequisite constraints!\");\n return null;\n }\n if (!checkCoreq(id)) {\n alert(\"...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
function that displays form for creating a topic
function showAddTopic(){ // show form and set the form fields to null createForm.style.display = "block"; document.getElementById("create-topic").value = ""; document.getElementById("create-description").value = ""; formType = "addTopic"; }
[ "function addTopic(){\n\tvar name = document.getElementById(\"form-subject\").value;\n\tdocument.getElementById(\"form-subject\").value = \"\";\n\tif(name.length>1){\n\t\tvar newFile = choosenSubject.add(name);\n\t\tif(newFile!==false){\n\t\t\t// Save an empty flashcard set object into this new topic\n\t\t\tif(stor...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
aBCheck("chainbreak"); aBCheck("painsarc"); 1. find first instance of string.indexOf("a") set that to a var firstA, 2. var array2 = string.slice([firstA], string[firstA] +3) forms new array that has values from first a to a +3 3 if array2[2] === "b" || "a", return true else false Solution 2/22
function aBCheck(string){ var firstA = string.indexOf("a"); console.log(firstA); // console.log(string[firstA]); // string[firstA] returns what is at index position 1, 'a' console.log(firstA + 3) if (string[firstA + 3] == "a" || string[firstA + 3] == "b"){ return true; ...
[ "function sc(apple) {\n return apple.reduce((acc, letterArr, i) => {\n let letterIndex = letterArr.indexOf('B')\n letterIndex === -1 ? false : acc = [i, letterIndex]\n return acc\n }, -1)\n\n}", "function checkPattern(aLength, bLength, pattern, string, startsWith){\r\n var aString = st...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Given a request validate that all of the fields for it are valid and make sense. This includes verifying the following notions: Each type requested is present in types Only allow a name for a field to be specified once If an array is specified, validate that the requested field exists and comes before it. If fields is ...
function ctCheckReq(def, types, fields) { var ii, jj; var req, keys, key; var found = {}; if (!(def instanceof Array)) throw (new Error('definition is not an array')); if (def.length === 0) throw (new Error('definition must have at least one element')); for (ii = 0; ii < def.length; ii++) { req = def[ii]...
[ "function isRequestValid(req){\n return !(req.body === undefined\n || Object.keys(req.body).length < 4\n || !supportedTypes.includes(req.body.type)\n || !activityFields.every(field => req.body.hasOwnProperty(field)));\n}", "hasRequiredFields(required, params){\n return required.ever...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Constructs a new RideRequest. Minimal set of ride details
function RideRequest() { _classCallCheck(this, RideRequest); this.ride_id = undefined; this.status = undefined; this.origin = undefined; this.destination = undefined; this.passenger = undefined; }
[ "function addRide(req, res){\n\n\tvar body = '';\n\treq.on('data', function (data) {\n\t\tbody += data;\n\t\tif (body.length > 1e6) {\n\t\t req.connection.destroy();\n\t\t}\n\t});\n\treq.on('end', function () {\n\t\t//parse and get all the information for the ride\n\t\tvar post = qs.parse(body);\n\t\tvar accom = p...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get ontology from server
function getOntology () { var q = /* Ontology version */ "'@' == 'cfg:OntoVsn' || " + /* Classes */ "'rdf:type' === 'owl:Ontology' || " + "'rdf:type' === 'rdfs:Datatype' || " + "'rdf:type' === 'rdfs:Class' || " + "'rdf:type' === 'owl:Class' || " + ...
[ "async fetchArticleOpenGraph(props, wiki) {\n const url = await this.wikiUrl(wiki);\n const body = await got(`https://services.fandom.com/opengraph`, {\n searchParams: {\n uri: `${url}/wiki/${props.title}`,\n },\n cookieJar: this.jar\n }).json();\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets/sets the conventions object to which this class is bound.
static conventions(conventions) { if (arguments.length) { this._conventions = conventions; return this; } if (!this._conventions) { conventions = this.classes().conventions; this._conventions = new conventions(); } return this._conventions; }
[ "bind(context) {\n\t\tif (!globalParams.modelProperty) {\n\t\t\tthrow new Error('Data key has not been set!');\n\t\t}\n\t\treturn Reflex.set(this, globalParams.modelProperty, context);\n\t}", "schema(schema) {\n if (arguments.length) {\n this._schema = schema;\n return this;\n }\n if (!this._sc...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Grab all cities from TELEPORTCITIES in cities.database.js. The for/if statement only allows a fraction of cities to be placed on the map using the equation. Essentially, the more zoomed in the map is, the more cities that will display.
function showTeleportCities() { clearMarkers(); Object.keys(TELEPORTCITIES).forEach(function(cityName, index) { let zoomMax = MAP.maxZoom - MAP.minZoom; let zoomCurr = MAP.getZoom() - MAP.minZoom; if (index % zoomMax < (zoomCurr)) { displayTeleportCity(cityName); } }); }
[ "function coolCities(cities) {\n let coolTowns = cities.filter(function (element) {\n return element.temperature < 70.0 })\n return coolTowns}", "function showInitialCities() {\n Object.keys(INITIALCITIES).forEach(function(cityName) {\n displayTeleportCity(cityName);\n });\n }", "function c...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
esta funccion es el main del programa lo primero que hace es calcular si el jugador ha ganado (explicacion de la funccion de ganado mas abajo) luego coje las posiciones de la parte del puzzle clickada y la poscicon del espacio en blanco si alguna de las funcciones de comprovacion de movimiento nombradas arribas es poss...
function calcular_si_mueve(element, partes) { switch (puzzleElegido){ case "south_park": comprovarGanado(partes, array_south_park); break; case "peter": comprovarGanado(partes, array_peter_partido); break; case "homer": comprovarGanado(partes, array_homer_partido); break; case "stan ": comprovarGanado(partes, e...
[ "function pintar(simulacion){\r\n\r\n\t\tlimpiar();\r\n\t\tpintarAgua(simulacion);\r\n\t\tpintarAlcantarillado(simulacion);\r\n\r\n\t\t\r\n\r\n\t\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n}", "function xocPilotaJugador () {\n\n // TODO: Inicia les següents variables,\n // segons la descripció del seu val...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Given an object representing a todo, this will create a list item to display it.
function createTodoListItem(todo) { var checkbox = document.createElement('input'); checkbox.className = 'toggle'; checkbox.type = 'checkbox'; checkbox.addEventListener('change', checkboxChanged.bind(this, todo)); var label = document.createElement('label'); label.appendChild( document.createTe...
[ "function displaytodo(todo) {\r\n console.log(\"Display\")\r\n if (todo.state == 0) {\r\n // create an item on the pending list\r\n var list = $(\"#todo\");\r\n list.append(`<li id=\"${todo.id}\" class=\"list-group-item\">${todo.text} <button class=\"btn btn-outline-primary float-right\" onclick=...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Determine whether the given properties match those of a `AdditionalAuthenticationProviderProperty`
function CfnGraphQLApi_AdditionalAuthenticationProviderPropertyValidator(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 hasProperties(json, properties) {\n return properties.every(property => {\n return json.hasOwnProperty(property);\n });\n}", "function CfnRoute_HttpQueryParameterMatchPropertyValidator(properties) {\n if (!cdk.canInspect(properties)) {\n return cdk.VALIDATION_SUCCESS;\n }\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns true if the contract address is part of the given bloom. note: false positives are possible.
function isContractAddressInBloom(bloom, contractAddress) { if (!isBloom(bloom)) { throw new Error('Invalid bloom given'); } if (!isAddress(contractAddress)) { throw new Error(`Invalid contract address given: "${contractAddress}"`); } return isInBloom(bloom, contractAddress); ...
[ "walletIsValid(address) {\n return DigiByte.Address.isValid(address);\n }", "function isAddress(string) {\n try {\n bitcoin.Address.fromBase58Check(string)\n } catch (e) {\n return false\n }\n\n return true\n}", "contains (data, size = data.length) {\n for (let i = 0; i < this.nHashes...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
///////////////////////////////////////////////////Update Stick/////////////////////////////////////////////////// add stick functions for adapter
function updateStick(stickId, stickTitle, stickImage, stickInfo){ var invocationData = { adapter : 'StickerStore', procedure : 'updateStick', parameters : [stickId, stickTitle, stickImage, stickInfo] }; WL.Client.invokeProcedure(invocationData,{ onSuccess : updateStickSuccess, onFailure : upda...
[ "_cycle(s1, s2, s3, s4) {\n const temp = this.stickers[s1];\n this.stickers[s1] = this.stickers[s4];\n this.stickers[s4] = this.stickers[s3];\n this.stickers[s3] = this.stickers[s2];\n this.stickers[s2] = temp;\n }", "function makeSynthFunc(sk, geneDefs) {\n //consider how much o...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns previous sibling node that is not a blank text node
function _getPreviousSiblingThatIsNotBlank(node) { var previousSibling = node.previousSibling; while (previousSibling && _isBlankTextNode(previousSibling)) { previousSibling = previousSibling.previousSibling; } return previousSibling; }
[ "function prevParentTextNode(e) {\n\t\tconst elem = e.first()[0],\n\t\t\tparent = e.parent();\n\t\t/*\n\t\t\tQuit early if there's no parent.\n\t\t*/\n\t\tif (!parent.length) {\n\t\t\treturn null;\n\t\t}\n\t\t/*\n\t\t\tGet the parent's text nodes, and obtain only the last one which is\n\t\t\tearlier (or later, depe...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Convenience function for reading a string containing CSV. This simply calls rowStore.buildFromCsv() and sends the result to columnStore.buildFromStore().
function buildFromCsv(csvText, metaData) { if (metaData === void 0) { metaData = {}; } return ozone.columnStore.buildFromStore(ozone.rowStore.buildFromCsv(csvText), metaData); }
[ "function buildFromCsv(csv) {\n var dataArray = csv.split(/(\\r\\n|\\n|\\r)/);\n var reader = new rowStore.CsvReader();\n var fieldInfo = (function () {\n reader.onItem(dataArray[0]);\n var result = {};\n for (var index in reader.columnNa...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
this is the configuration for the Materialize "toast" messages that will show on user click events:
function showToast(message, duration){ Materialize.toast(message, duration, 'rounded'); }
[ "function showToastMessage() {\n const toast = localStorage.getItem('showToast');\n if (localStorage.length <= 0) return;\n if (data.shouldShowToast === false) return;\n\n switch (toast) {\n case 'profile-info':\n new Toast('Updated profile info');\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
button to exit from the slider when the modal appear
function exitSlider () { mainWrapper.style.display = 'none'; }
[ "function CloseSilder(){\n modelBG.style.display = \"none\";\n modelSlider.style.display = \"none\";\n }", "handleClick (event) {\n minusSlides(1);\n }", "hideVolumeWidget(e) {\n\n StateManager.ResetModal();\n\n }", "function closecancelpanel(){\n $.modal.close();\n }", ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
given a specific route and pickup spot on the route, gets the time the next shuttle will come based on the stored time arrays, the day, and the current time
function timeTilNextShuttle(route, stop) { var t = getCurrTime(); var day = t / 10000; var time = t % 10000; if (route == RouteA) { if (day < 1 || day > 5) return -1; else return timeDiff(routeAMF, time); } else if (route == RouteB) { if (day < 1 || day > 5) ...
[ "function getNextSubwayTime() {\n\t// Get the schedule information\n\t// TODO: Only update schedule info once a day\n\tgetSubwaySchedule(SUBWAY_ID).then(function (data) {\n\t\t// Get just the information for arrivals\n\t\tvar arrivals = data.data.result.arrivals;\n\n\t\t// Get current time\n\t\tvar now = moment();\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Player inherits from Paddle
function Player(){ Paddle.call(this); this.x = 20; }
[ "function Paddle(x, y, width, height) {\n this.x = x;\n this.y = y;\n this.width = width;\n this.height = height;\n this.x_speed = 0;\n this.y_speed = 0;\n}", "function Computer() {\n this.paddle = new Paddle(10, 170, 10, 50);\n}", "function Bot(){\n Paddle.call(this);\n \n this.x = game.widt...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
list of JSVal to array, list must have been completely forced first
function h$fromHsListJSVal(xs) { var arr = []; while(((xs).f === h$ghczmprimZCGHCziTypesziZC_con_e)) { arr.push(((((xs).d1)).d1)); xs = ((xs).d2); } return arr; }
[ "function sc_string2list(s) {\n return sc_jsstring2list(s.val);\n}", "function getInputEleVals(eles) {\n var valArr = [];\n for(var i = 0; i< eles.length; i++) {\n valArr.push(eles[i].value);\n }\n return valArr;\n}", "asArray() {\n return Array.from(this);\n }", "castToArray(value) ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creation of the save filters toggle content (apppears on click).
function create_save_filters_toggle_content() { //Create a link part to enter the name of the filter (inserted into a span to resize it) var span0 = document.createElement("span"); span0.className = "col-md-9 created-inputs-span"; span0.id = "save_input"; span0.style.display = "none"; var input = document.creat...
[ "function create_filter() {\n\t//If a filter name was entered\n\tif($(\"#filter_name\").val() !== '') {\n\t\t\n\t\t//Get the user name\n\t\tvar user = \"test_user\";\t\n\t\tvar filter_name = $(\"#filter_name\").val();\n\t\t\t\n\t\t//XML generation\n\t\tvar xml = '<xml version=\"1.0\"><user>' + user + '</user>' +\n\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Public function `emptyArray`. Returns true if `data` is an empty array, false otherwise.
function emptyArray (data) { return array(data) && data.length === 0; }
[ "function isZeroArray(arr) {\r\n\t\tif (!arr[0] && !arr[1] && !arr[2] && !arr[3]) return true;\r\n\t}", "isEmpty() {\n return queue.length === 0;\n }", "isEmpty() {\n return (this.queue.length == 0);\n }", "function isEmpty(value) {\n if (typeof value === 'undefined') {\n ret...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Update company storage and set new client
function UpdateCompanyStorageNewClient(Company){ localStorage.setItem('Company', JSON.stringify(Company)); var Clients = Company.clients; $('#Client').empty(); $.each(Clients, function (i, item) { $('#Client').append($('<option>', { value: item.cli...
[ "function updateCompany(company) {\n\n // update the target URL\n var targetUrl = CompanyUrl;\n\n // Update the stored data\n $.ajax({\n url: targetUrl,\n type: 'PUT',\n dataType: 'json',\n data: company,\n success: function (data, t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Extend the lock for this job.
async extendLock(token, duration) { return scripts_1.Scripts.extendLock(this.queue, this.id, token, duration); }
[ "lock() {\n if (this.isLocked) {\n throw new Error(\"The stream '\" + this + \"' has already been used.\");\n }\n this.isLocked = true;\n if (this.previous) {\n this.previous.lock();\n }\n }", "lock() {\n const iab = this.iab;\n const state...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
grant_token computed: true, optional: false, required: false
get grantToken() { return this.getStringAttribute('grant_token'); }
[ "get grantId() {\n return this.getStringAttribute('grant_id');\n }", "static get_token({ organizationId, tokenId }) {\n return new Promise(\n async (resolve) => {\n try {\n resolve(Service.successResponse(''));\n } catch (e) {\n resolve(Service.rejectResponse(\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
post.distinguished = "moderator" checks for mod posts post.self_text checks for text posts and not image posts post.url checks that it has a link
function isValidPost(post) { return post && post.url && !post.distinguished && !post.self_text && !post.stickied && !post.pinned; }
[ "function checkPost(post, options, searchRequest) {\n // The url for accessing a particular post.\n let postAuth = localStorage.getItem(\"api\") + \"/post/?id=\" + post;\n fetch(postAuth, options)\n .then(response => response.json())\n .then(data => {\n let ul = document.getElement...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Transform one to zero and transform zero to one
function transformZeroOne(str) { let result = ""; let i; for (i = 0; i < str.length; i++) { if (str.charAt(i) == '0') { result = result + "1"; } else if (str.charAt(i) == '1') { result = result + "0"; } else { console.log("Error in ...
[ "switchAfterZero(val) {\n /*\n Override by component\n */\n return val\n }", "ones_vector() {\n\t \n\t return Matrix_ones_vector( this )\n\t}", "isZero() {\n\t return this.getNorm() === 0;\n\t}", "function makeZero() {\n\t\tvar m = arguments[0];\n\t\tv...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets a new Vector2 by adding the current Vector2 coordinates to the given Vector3 x, y coordinates
addVector3(otherVector) { return new Vector2(this.x + otherVector.x, this.y + otherVector.y); }
[ "add(otherVector) {\n return new Vector3(this.x + otherVector.x, this.y + otherVector.y, this.z + otherVector.z);\n }", "add(otherVector) {\n return new Vector4(this.x + otherVector.x, this.y + otherVector.y, this.z + otherVector.z, this.w + otherVector.w);\n }", "static vAdd(a,b) { ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Load the dex page for a pokemon. Inputs: $ reference to jQuery id dex ID number to load Outputs: (anonymous) A promise that will be resolved when the page is loaded
static getPokemonDexPage($, id) { return $.get('https://pokefarm.com/dex/' + id); }
[ "static getMainDexPage($) {\n return $.get('https://pokefarm.com/dex');\n }", "static loadDexPages($, dexNumbers, progressBar, progressSpan) {\n const requests = [];\n progressBar.value = 0;\n progressSpan.textContent = 'Loading Pokedex info. Please wait until th...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Selects the parent checkbox of element
function checkParent(element) { $(element).closest(".checkbox-tree-ul").parent().children(".checkbox").find(":checkbox").prop("checked", true); $(element).closest(".checkbox-tree-ul").parent().children(".checkbox").find(":radio").prop("checked", true); }
[ "function toggleParentCheckbox(layer) {\n var parentId = layer.getParentNode().getId();\n // If layer is not root (root id == 80), toggle parent layers.\n if (parentId != 80) {\n document.getElementById('cb_' + parentId).checked = true;\n var parentLayer = ge.getLayerRoot().getLayerById(parentId);\n tog...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
commit the current notepad hash, name, description, last edit timestamp, and sync status to the IndexedDB catalog object store
function idbCatalogUpdate() { if (!idbSupport) return; var os = 'catalog'; var item = { npidLocal: notepadIdLocal, npname: catalog[notepadIdLocal]["npname"], nphash: catalog[notepadIdLocal]["nphash"], npdesc: catalog[notepadIdLocal]["npdesc"], lastEdit: catalog[notepadIdLocal]["lastEdit"], lastOpen: cata...
[ "function editNotesRecord(recordId,editedTDchange,c) {\n\tconsole.log('In function editNotesRecord. recordId = '+ recordId);\nlet noteId = Number(recordId);\n//let editedDate = dateSelect.value;\nconsole.log('noteId = ' + noteId + '. editedTDchange = ' + editedTDchange);\n//noteId = 3. editedDate = 1\nlet transacti...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Constructor that take the number of the element and gets its information form another file
constructor(num) { var elt = elts['elements']; this.number = num; this.letter = elt[num - 1]['symbol']; this.name = elt[num - 1]['name'].split(' ')[0]; this.mass = Math.round(elt[num - 1]['atomic_mass'] * 1000) / 1000; this.type = elt[num - 1]['category'].replace(/\s+/g, ...
[ "function BAElement() { }", "constructor(element) {\n this.element = element;\n this.next = null;\n }", "function AttributeInfo(bytesArray, index) {\n this.bytes = bytesArray;\n var startByteIndex = index;\n var nameIndex = getTwoBytes(bytesArray, index);\n var attributeLength = get...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Saves data to Solid using the persistmethod, and then closes the card
@action async save() { await this.rdfaCommunicator.persist(); this.owner.lookup(SAVE_RESET_KEY).handleClose(this.args.info, null); }
[ "closeWithSaving() {\n this.send('save', true);\n }", "function savetosaveCard () {\n step++\n if (step < saveCard.length) { \n saveCard.length = step;\n console.log(`reset Savecard ${step} < ${saveCard.length}`)\n }\n saveCard.push(canvasReal.toDataURL());\n console.log(`thi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Expands boundingBox:[xMin, yMin, xMax, yMax] to match aspect ratio of given width and height
function scaleToAspectRatio(boundingBox, width, height) { const [xMin, yMin, xMax, yMax] = boundingBox; const currentWidth = xMax - xMin; const currentHeight = yMax - yMin; let newWidth = currentWidth; let newHeight = currentHeight; if (currentWidth / currentHeight < width / height) { // expand boundi...
[ "function fit(bounds, width, height)\n{\n var topLeft = bounds[0];\n var bottomRight = bounds[1];\n\n var w = bottomRight[0] - topLeft[0];\n var h = bottomRight[1] - topLeft[1];\n\n var hscale = width / w;\n var vscale = height / h;\n\n // pick the smallest scaling factor\n var scale = (hscale < vscale) ? h...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Given a list node type, returns an input rule that turns a bullet (dash, plush, or asterisk) at the start of a textblock into a bullet list.
function bulletListRule(nodeType) { return wrappingInputRule(/^\s*([-+*])\s$/, nodeType) }
[ "function listRule(type) {\n return MarkupIt.Rule(type)\n .regExp(reList.block, (state, match) => {\n const rawList = match[0];\n const bull = match[2];\n const ordered = bull.length > 1;\n\n if (ordered && type === MarkupIt.BLOCKS.UL_LIST) return;\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get the average damage of this weapon.
getAverageDamage() { const avgAttacks = (this.minAttacks + this.maxAttacks) / 2; const avgDmg = (this.minDamage + this.maxDamage) / 2 * avgAttacks; const critDmg = this.crit / 100 * avgDmg * 2; return avgDmg + critDmg; }
[ "function average(){\n\t\t\tvar sum = 0;\n\t\t\tlist.forEach(function(item){\n\t\t\t\tsum += item.age;\n\t\t\t});\n\n\t\t\treturn sum / list.length;\n\t\t}", "function averageFunction(fruit) {\n\t\treturn fruit.totalSpent / fruit.totalPurchased\n\t}", "get softwareDamage () {\n return this._softwareDamage\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
serve brotli file if exists, otherwise try gzip
function tryServeWithBrotli(shouldTryGzip) { fs.stat(brotliFile, (err, stat) => { if (!err && stat.isFile()) { file = brotliFile; serve(stat); } else if (shouldTryGzip) { tryServeWithGzip(); } else { statFile(); } }); }
[ "function gzipResponseHandler(request, response) {\n var urlPath = request.url.split('?')[0];\n var file = compressedFiles[ urlPath.replace('/base', '') ];\n\n if (!file) {\n log.error('Gzipped file not found: ' + request.url);\n throw new Error('Gzipped file not found: ' + request.url);\n }\n\n if (acce...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Determine whether the given properties match those of a `RDSSourceConfigProperty`
function CfnAnomalyDetector_RDSSourceConfigPropertyValidator(properties) { if (!cdk.canInspect(properties)) { return cdk.VALIDATION_SUCCESS; } const errors = new cdk.ValidationResults(); if (typeof properties !== 'object') { errors.collect(new cdk.ValidationResult('Expected an object, bu...
[ "function CfnAnomalyDetector_RedshiftSourceConfigPropertyValidator(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('Expect...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creation of LNode object is extracted to a separate function so we always create LNode object with the same shape (same properties assigned in the same order).
function createLNodeObject(type, currentView, parent, native, state, queries) { return { type: type, native: native, view: currentView, parent: parent, child: null, next: null, nodeInjector: parent ? parent.nodeInjector : null, data: state, que...
[ "function createNode(type, attributes, props) {\r\n var node = document.createElement(type);\r\n if (attributes) {\r\n for (var attr in attributes) {\r\n if (! attributes.hasOwnProperty(attr)) continue;\r\n node.setAttribute(attr, attributes[attr]);\r\n }\r\n }\r\n if (props) {\r...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Calls on checkrequirements() to set values to the requirements booleans Based on the requirements pushes desired chars into pool choices Generates the password by randomly chosing a char from a pool choices. This is reapeated according to the chosen length of the password Variables are cleared for future use.
function generatePassword() { // Check user options. False if user cancels prompt let check = checkRequirements(); if (check) { // Add to pool of char choices if (options.hasLowerCase) { choices += lowerCaseChars; } if (options.hasUpperCase) { choices += uppe...
[ "function generatePassword() {\n var useableCharactersArray = [];\n getUserPreferences();\n var lowerArray = []; \n var upperArray = [];\n var numberArray = [];\n var specialCharsArray = [];\n if (userPreferences.useLowerCase) {\n lowerArray = Array.from(lowercaseAlphabet);\n for (var i = 0; i < lowerc...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns the export of this Output
get exportName() { return this._exportName; }
[ "get exported() {\n return this.exportNames.size > 0;\n }", "export() {\n let { output, outputFrozen } = this.appState.data.seizureData;\n\n // Generate CSV\n let csv = 'is-seizure,is-seizure-user-corrected\\n';\n\n for( let i = 0; i < output.length; i++ ) {\n csv += `${Number(outputFro...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
REGION TREE NEW END // START NEW REGION TREE WITH CHECKBOX
function fnGetRegionTreeByRegionWithCheckBox(regionCode, treeId, filterId) { if (regionCode == "") { regionCode = currentRegionCode_g; } $('span').removeClass('childIcon'); if (regionCode == currentRegionCode_g) { $('#dvPreviousNode').hide(); } else { $('#dvPreviousNode')...
[ "buildTree() {\n if (!this.drawnAnnotations.length && !this.annosToBeDrawnAsInsets.size) {\n // Remove all exlisting clusters\n this.areaClusterer.cleanUp(new KeySet());\n return;\n }\n\n // if (this.newAnno) this.tree.load(this.drawnAnnotations);\n\n this.createInsets();\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
returns data for the last 10 years
listYearly() { const tenYearBefore = dateService.getYearsBefore(10); return this.trafficRepository.getYearlyData(tenYearBefore) .then(data => { data = this.mapRepositoryData(data); const range = numberService.getSequentialRange(tenYearBefore.getFullYear(), 10); const valuesToAdd = ...
[ "function filterYear(data) {\n let filteredData = data.filter(function(d, i) {\n return data[i].year === \"1980\";\n });\n data = filteredData;\n return data;\n }", "_yearsQuery() {\n const operation = operationKeys.GET_YEARS;\n\n return queryString.stringify({\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
displayPaddle(paddle) Draws the specified paddle on screen based on its properties
function displayPaddle(paddle) { rect(paddle.x, paddle.y, paddle.w, paddle.h); }
[ "function displayPaddle(paddle) {\n // Draw the paddles\n push();\n fill(paddle.paddleColourR,paddle.paddleColourG,paddle.paddleColourB);\n rect(paddle.x, paddle.y, paddle.w, paddle.h);\n pop();\n}", "function drawPaddle() {\r\n ctx.beginPath();\r\n ctx.rect(paddleX, canvas.height-paddleHeight,...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
accepts values like "100%" or "20% 80%" or "20 50" and parses it into an absolute start and end position on the line/stroke based on its length. Returns an an array with the start and end values, like [0, 243]
function parse(value, length, defaultStart) { var i = value.indexOf(" "), s, e; if (i === -1) { s = defaultStart !== undefined ? defaultStart + "" : value; e = value; } else { s = value.substr(0, i); e = value.substr(i+1); } s = (s.indexOf("%") !== -1) ? (parseFloat(s) / 100) * length : parseFl...
[ "function toOffsetValues( spaceValues, lineHeight, lineHeightUnits )\n{\n\tif (\n\t\t( spaceValues[0] === 0 )\n\t\t&& ( spaceValues[1] === 0 )\n\t\t&& ( lineHeight === 1 )\n\t)\n\t{\n\t\treturn ['', ''];\n\t}\n\t\n\tif ( !lineHeightUnits )\n\t{\n\t\tvar heightCorrection = (lineHeight - 1) / 2;\n\t\t\n\t\treturn [\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function that sets the controls to the FlyControls, from In which the keyboardbuttons: w a s d (to go foward,back,left right in the scene) up,down,left,right (to rotate up,down,left,right in the scene) r,f (to move up/down in the scene) (have removed the functionality for the camera to follow the mouse movement)
function createControls(){ controls = new THREE.FlyControls(camera); controls.movementSpeed = 1.0; controls.domElement = container; controls.rollSpeed = Math.PI / 240; controls.autoForward = false; controls.dragToLook = false; }
[ "function controls(){\nthis.mouse = new point(0,0);\n\nthis.x = false;\nthis.z = false;\n\nthis.w = false;\nthis.a = false;\nthis.s = false;\nthis.d = false;\n\nthis.up = false;\nthis.left = false;\nthis.bot = false;\nthis.right = false;\n\nthis.j = false;\n}", "preStep() {\n if (this.controls) {\n if (th...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets a new Vector2 set from the given index element of the given array
static FromArray(array, offset = 0) { return new Vector2(array[offset], array[offset + 1]); }
[ "static FromArray(array, offset = 0) {\n return new Vector3(array[offset], array[offset + 1], array[offset + 2]);\n }", "function rebuilding(arr, index1, index2) {\n var newArr = arr.map(function (value) { return value });\n var arg = Array.prototype.slice.call(arguments, 1);\n for (var i=0...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
challenge 4: filter breeds that start with a letter (a d)
function breedFilter() { let filterDropdown = document.getElementById('breed-dropdown') filterDropdown.addEventListener('change', function (e) { let firstLetter = filterDropdown.value let breedList = document.querySelectorAll('.dog-breed') breedList.forEach((breed) => { breed.style.visibility = 'v...
[ "function filterByFirstName(arr, letter) {\n}", "checkLetter(pressedLetter)\n {\n let clickedLetter = pressedLetter.textContent;\n const letterArray = this.phrase.split(\"\");\n const wordLength = letterArray.length;\n const newArray = letterArray.filter( letter => letter !== clickedLetter );\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Parse a given elements CSS property into an int
function intCss(elem, prop) { return parseInt(vendorCss(elem, prop), 10); }
[ "function intCss(elem, prop) {\r\n return parseInt(vendorCss(elem, prop), 10);\r\n}", "function toCSSPixels(number) {\r\n if (Object.isString(number) && number.endsWith('px'))\r\n return number;\r\n return number + 'px'; \r\n }", "function _getstylevalue(el) {\n if(typeof prop == \"string...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Update the page URL to include the slide number after a
function updateUrlFragment() { window.history.replaceState(null, '', '#' + (currentSlideNumber + 1)) }
[ "updatePage(increment) {\n // get rid of the first character of the hash (#)\n const queryString = window.location.hash.slice(1);\n // turn search params into string of key/value pairs (URLSearchParams returns URL input as string)\n const searchParams = new URLSearchParams(queryStrin...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Parse string to extract albumID and imageID (format albumID/imageID)
function parseIDs( IDs ) { var r={ albumID: '0', imageID: '0' }; var t=IDs.split('/'); if( t.length > 0 ) { r.albumID=t[0]; if( t.length > 1 ) { r.imageID=t[1]; } } return r; }
[ "function parseDockerImageInfo(strDockerImage) {\n // image string might contain docker registry url\n const urlMatch = strDockerImage.match(/\\//g);\n if (!urlMatch || (urlMatch.length > 1)) {\n exit(`Invalid image name: '${strDockerImage}'. Expected format: 'ppiper/jenkins-master:tag'`, RETURN_COD...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
given an array of bitcoin addresses and an amount, return a list of transaction references which have a total value greater then or equal to the given amount and which use older transactions first while trying to use the given addresses before other address. Do you get what I mean; probably not. Just read the code :) w...
function bitAddArr2transRefArr(baa, amount, tha, onlyFromAddrs){ var save, res, tot, i, t, ta save = [] res = [] tot = 0.0 // first sort the unspent transactions with the oldest first // but skip unconfirmed transactions; where block=0 for(i in Unspent){ t = Unspent[i] // ta = t.address i...
[ "function solveBalances(balances) {\n var remains = balances.entrySeq()\n .filter(v => v[1] > 0 || v[1] < 0)\n .groupBy(v => v[1] > 0)\n var positives = remains.get(true).sort((a, b) => a[1] - b[1]).toArray()\n var negatives = remains.get(false).sort((a, b) => b[1] - a[1]).toArray()\n var transactions = [...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Combines the binding value and a factory for an animation player. Used to bind a player to an element template binding (currently only `[style]`, `[style.prop]`, `[class]` and `[class.name]` bindings supported). The provided `factoryFn` function will be run once all the associated bindings have been evaluated on the el...
function bindPlayerFactory(factoryFn, value) { return new BoundPlayerFactory(factoryFn, value); }
[ "function keyhandlerBindingFactory(keyCode) {\n return {\n init: function(element, valueAccessor, allBindingsAccessor, data, bindingContext) {\n var wrappedHandler, newValueAccessor;\n\n // wrap the handler with a check for the enter key\n wrappedHandler = function(data, event...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
We generate the css for keyframes in javascript in order to 1. Minimize page load time (with many phrases these take up many lines) 2. Scale appropriately as phrases are added/removed. 3. Make everything well factored. This could be done in sass (loops) but would then require an additional build step. (And we'd have to...
function generateKeyframeCSS(num_keyframes) { var generated_keyframes_style = document.createElement("style"); generated_keyframes_style.type = "text/css"; document.getElementsByTagName("head")[0].appendChild(generated_keyframes_style); function enumerateSlideUpKeyframes() { var style = ""; ...
[ "function textWiggle() {\n var timelineWiggle = new TimelineMax({repeat:-1, yoyo:true}); \n for(var j=0; j < 10; j++) {\n timelineWiggle.staggerTo(chars, 0.1, {\n cycle: {\n x: function() { return Math.random()*4 - 2;...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Compute the tour point order from a previously saved order in the web map application data
function computeTourPointOrderFromConfig() { var order = WebApplicationData.getTourPointOrder(); return computePointsOrderFromIds(order); }
[ "function computeInitialTourPointOrder()\r\n\t\t\t{\r\n\t\t\t\tvar pointsOrder = [];\r\n\t\r\n\t\t\t\t$.each(_tourPoints, function(i, tourPoint) {\r\n\t\t\t\t\tpointsOrder.push({\r\n\t\t\t\t\t\tid: tourPoint.attributes.getID(),\r\n\t\t\t\t\t\tindex: i,\r\n\t\t\t\t\t\torder: i,\r\n\t\t\t\t\t\tvisible: true\r\n\t\t\t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Convert patterns to regexps.
function convertPatternsToRe(patterns, options) { return patterns.map(function (pattern) { return makeRe(pattern, options); }); }
[ "regexAll (text, array) {\n for (const i in array) {\n let regex = array[i][0]\n const flags = (typeof regex === 'string') ? 'g' : undefined\n regex = new RegExp (regex, flags)\n text = text.replace (regex, array[i][1])\n }\n return text\n }", "f...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
mutate the input array so that each element ends up in their new index Discuss the runtime of the algorithm and how you can be sure there won't be ///any infinite loops. Runtime O(n)
function mutate(input, specArr) { var visited = []; specArr.forEach(function(newIdx, i) { var tmp; visited.push(newIdx); if (visited.indexOf(i) > 0) { tmp = input[i]; input[i] = input[newIdx]; input[newIdx] = tmp; } }); }
[ "function evenIndexesMult(arr) {\n\n\tfor (var i = 0; i < arr.length; i++) {\n\t\tif(i % 2 ===0 ){\n\t\t\tarr[i] = arr[i] * 2;\n\t\t}\n\t}\n\n\treturn arr;\n\n\n}", "function shiftVals(num, array, idx) {\n for (let i = 0; i <= idx; i++) {\n if (i === idx) {\n array[i] = num;\n } else {\n array[i]...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
The `getLineInfo` function is mostly useful when the `locations` option is off (for performance reasons) and you want to find the line/column position for a given character offset. `input` should be the code string that the offset refers into.
function getLineInfo(input, offset) { for (var line = 1, cur = 0;;) { lineBreakG.lastIndex = cur; var match = lineBreakG.exec(input); if (match && match.index < offset) { ++line; cur = match.index + match[0].length; } else { return new Position(line, offset - cur); ...
[ "function lineColPositionFromOffset(offset, lineBreaks) {\n let line = remix_lib_1.util.findLowerBound(offset, lineBreaks);\n\n if (lineBreaks[line] !== offset) {\n line += 1;\n }\n\n const beginColumn = line === 0 ? 0 : lineBreaks[line - 1] + 1;\n return {\n line: line + 1,\n character: offset - begi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Trims only newlines (no spaces) at the beginning and end of the string
function _trimNewlines(str) { return str.replace(/^[\r\n]+|[\r\n]+$/g, ''); }
[ "static removeEmptyNewlines(string) {\n return string.replace(/^[\\n\\r\\s]*/gm, '')\n }", "function removeBreaks(text) {\r\n\treturn text.replace(/(\\n|\\r)/gm, \"\");\r\n}", "function extUtils_stripWhiteSpace(inStr)\n {\n var spaceChars = \" \\n\\r\\t\";\n var startPos = 0;\n while (startPos < i...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }