query
stringlengths
9
34k
document
stringlengths
8
5.39M
negatives
listlengths
19
20
metadata
dict
============================================================ ============================================================ Functions / Normalize the data according to an index point.
function indexify(idx, data) { return data.map(function(line, i) { if (!line.values) { return line; } var v = lines.y()(line.values[idx], idx); //TODO: implement check below, and disable series if series loses 100% or more cause divide by 0 issue if (v < -.95 && !noErrorCheck...
[ "function normalize(idx){\n if( idx < 0 ){\n return normalize(idx + hist.length)\n }else if( idx > hist.length ){\n return normalize(idx - hist.length); \n }else{\n return idx;\n }\n }", "function performSustIndexNormalization(fieldToNormalizeWith)...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Converti un xpath nel formato delimitato da underscore per salvarlo su fuseki
function _xpath_to_fragment(xpath) { xpath = xpath.replace(/^\//, ""); xpath = xpath.replace(/\//gi, "_"); xpath = xpath.replace(/\[/gi, "").replace(/\]/gi, ""); return xpath; }
[ "ntkeyToDOMId(key)\n {\n return key.replace(/ /g, \"__\");\n }", "function removeUnderscoreForPrimitiveChildPath(input) {\n return input\n .split('.')\n .map(p => p.replace(/^_/, ''))\n .join('.');\n}", "function fixMyID(id) {\r\n return id.replace(/\\W/g,'_');\r\n}", "...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
post content on user's facebook pages
static postContentOnUserPages(user, payload) { //post on facebook page user.integrations.Facebook.pages .filter(page => page.isEnabled) .forEach(async page => { try { payload.access_token = page.access_token; await FacebookLogic.postContentOnFacebookPage(page.id, payload) } catch (err) { ...
[ "function postToPage(body) {\n var ACCESS_TOKEN;\n //call API for all pages user manages\n FB.api('/me/accounts', 'get', function(response) {\n //iterate through data returned, matching the page id to find access token\n for(var i = 0;i<response.data.length; i++){\n if(response.data[i].id === Router.c...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns the whole set from the posts table
all() { return db.select().from('posts'); }
[ "function findAllPosts() {\n\t\tvar deferred = q.defer();\n\t\tPostModel.find(function(err, res){\n\t\t\tdeferred.resolve(res);\n\t\t});\n\t\treturn deferred.promise;\n\t}", "function getPosts() {\n return db.query(\"SELECT * FROM posts\").then(result => result.rows);\n}", "function getAllPosts() {\n let sele...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This function will check a location's block (a location is "valid" if it is on the grid, is not an "obstacle", and has not yet been visited by our algorithm) Returns "Valid", "Invalid", "Blocked", or "Goal"
function locationStatus(location, grid, ignoreTowerSpawns, ignoreTowers) { var dft = location.distY; var dfl = location.distX; // If the location is outside of the grid if (location.distX < 0 || location.distX >= grid.length || location.distY < 0 || location.distY >= grid[0].length) { return 'Invalid...
[ "function locationStatus(location, grid) {\n var dft = location.distanceFromTop;\n var dfl = location.distanceFromLeft;\n\n if ( dfl < 0 ||\n dfl >= grid[0].length ||\n dft < 0 ||\n dft >= grid.length) {\n\n // location is not on the grid--return false\n return 'Invalid';\n } else if...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
get the next best move on the board
determineNextMove() { let min = 9 let moves = [] for (let cell of this.cells) { if (cell.possibilities.length < min && cell.possibilities.length > 1) { min = cell.possibilities.length } } for (let cell of this.cells) { if (cell.possibilities.length === min) { moves.push(cell) } } retur...
[ "function nextBestMove() {\n var best_move = -1;\n var best_move_score = 0;\n\n // Grab the set of potential moves\n var potential_moves = getPotentialMoves(current_board);\n\n potential_moves.forEach((move) => {\n // Make each move on a copy of the board\n var board = Object.assign([], current_board);\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
save game method called on save button clicked, checks few validations and saves game in database
function saveGame(){ var selectedValue = $('#difficultylevelselectmenu').find(':selected').val(); var allImagesSet = 'true'; // check difficulty level drop down if(selectedValue === 'SELECT'){ $('<div>').simpledialog2({ mode: 'button', headerText: 'Error !!!', headerClose: ...
[ "saveGame() {\n this.removeGameListeners();\n this.stateService.save(this.gameState);\n GamePlay.showMessage('Игра сохранена');\n this.addGameListeners();\n }", "function saveGame() {\n let game_state = board_to_array()\n\n if (parseInt($('table').data('game_id')) > -1) {\n // game has been save...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
function for invoice calculation with 10% discount
function studentInvoice(starterPrice, maindishPrice, dessertPrice, beveragePrice){ var discount = 0.1 var sum = Math.round((starterPrice+maindishPrice+dessertPrice)*(1-discount))+beveragePrice; return "Your Invoice with 10% Discount: "+sum+" Euro"; }
[ "function calculateInvoice(starterPrice, maindishPrice, dessertPrice, beveragePrice) {\n\n return Math.round((starterPrice + maindishPrice + dessertPrice + beveragePrice) * 100) / 100 // auf 2 Nachkommastellen geundet wegen ungenauigkeit von 0,00000000000002\n\n}", "function find_DiscountAmount(item1,item2,...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get summary of tenant subscriptions
getTenantsSubscriptionsSummary() { return this.request.get('/tenant-subscriptions-summary'); }
[ "getTenantsSubscriptions(qParams) {\n return this.request.get('/tenant-subscriptions', qParams);\n }", "async listSubscriptions() {\n const path = '/v1/subscriptions';\n return request.get(this.token, path, this.logger);\n }", "function getSubscriptions() {\n var result;\n var subscriptio...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Normallydistributed variate with given average and standard deviation
function normal(avg, stdev){ return avg + (stdev * Math.sqrt(-2 * Math.log(Math.random())) * Math.cos(2 * Math.PI * Math.random())); }
[ "function randomNormalDistribution(mean, stdev) {\n return (((Math.random()*2-1)+(Math.random()*2-1)+(Math.random()*2-1))*stdev+mean);\n}", "function normal(mean, variance) {\n var u = 0, v = 0;\n while(u === 0) u = Math.random(); //Converting [0,1) to (0,1)\n while(v === 0) v = Math.random();\n var std_norm...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Validate Edit Department Form in Departments Page
function validateEditDeptForm() { var dept_name = document.forms["EditDepartment"]["deptName"]; var dept_head = document.forms["EditDepartment"]["deptHead"]; document.getElementById("invalid-dept-head").style.display = "none"; document.getElementById("invalid-dept").style.display = "none"; dept_nam...
[ "function departmentUpdateMode(departmentId) {\n\t$.get(\"?action=edit&departmentId=\" + departmentId, function(resp) {\n\t\tvar departmentName = resp.departmentName;\n\t\tvar departmentDescription = resp.departmentDescription\n\t\tif(departmentName != null && departmentDescription != null) {\n\t\t\t$('#department_...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Inserts a new item at top level of hierarchy inside the layout at position left
insertLayoutLeft(item) { this._insert(0, item, 'layout-left', 'insertLayoutLeft'); }
[ "childBefore(pos) { return this.enter(-1, pos); }", "insertBefore() {\n this.insertElementAdjacentToChild('before');\n }", "function insert(parent, elm, ref) {\n if (isDef(parent)) {\n if (isDef(ref)) {\n if (nodeOps.parentNode(ref) === parent) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
extract selected number of top muslim population countries from dataset
function selectTopCountries(europeAll, number){ percentageWithIndex = [] indices = [] topCountries = [] // combine index and percentage values for (var i = 0; i < europeAll.length; i++){ percentageWithIndex.push([europeAll[i].values[2].population_percentage,i]) } // sort on percentage percentageWi...
[ "function topCountries(data) {\n var sortedNames = sortCountries(data);\n //console.log(\"names: \", sortedNames);\n var topData = [];\n var sumOthers = 0;\n var isTop = 0;\n var namesLabel;\n if (inOut == \"In\") {\n namesLabel = \"source\";\n } else {\n namesLabel = \"target\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Ajout des logos SVG.
function createSVG(where, className) { var svg = "<svg class=\"" + className + "\" width=\"64\" height=\"64\" viewBox=\"0 0 64 64\"><path class=\"ldp-icon-color\" d=\"M3.352,48.296l28.56-28.328l28.58,28.347c0.397,0.394,0.917,0.59,1.436,0.59c0.52,0,1.04-0.196,1.436-0.59 c0.793-0.787,0.793-2.062,0-2.849l-29.98-29.7...
[ "function armar(lente_grafico){ \n $(\"#GlassesSVG\").remove();\n $(\"#display_anteojos\").append('<svg version=\"1.1\" id=\"GlassesSVG\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" x=\"0px\" y=\"0px\" viewBox=\"0 0 768 384\" style=\"enable-background:new 0 0 768 384;\" x...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Select tab based on passed 'what'
function selectTab(what) { switch(what) { default: case 'top': case 'Most Fucked': $e = $('.tabs #top_thats_tab a'); $('.tabs #top_thats_tab a').click(); break; case 'mine': case 'My Fuck Thats': $('.tabs #my_thats_tab a').click(); break; case 'month': case 'Thi...
[ "selectTab(tabItem) {\n // TODO!!\n }", "function setTab( tab ) {\n\n // hide all tabs and then show selected tab\n\n $(\"div[name^=searchTab]\").hide();\n $(\"div[name^=searchTab]\").eq( tab ).show();\n}", "function selectTab(o)\r\n{\r\n var oArray = o.id.split(\":\");\r\n var tabName = oArr...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Resets the interface GUI.
resetGUI() { if (!this.sceneInited) return; this.interface.gui.remove(this.currentViewGUI); this.interface.gui.remove(this.ambientViewGUI); Object.keys(this.lightsGUI).forEach(k => { this.interface.gui.remove(this.lightsGUI[k]); }); this.lightsGUI = {}; }
[ "_resetUI() {\n\t\tthis._hide([\n\t\t\t'#replace',\n\t\t\t'#fillin_1_',\n\t\t\t'#chain',\n\t\t\t'#octhigh',\n\t\t\t'#rubber',\n\t\t\t'#octdown',\n\t\t\t'#octup'\n\t\t]);\n\t\tthis._toggle('#hold', c.CLASS_FADED, true);\n\t}", "resetInterface() {\n this.removeReplayButton()\n this.removeRestartButton...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
expect a headers frame
function headers(f) { if (f.id === defs.BasicProperties) { message.properties = f.fields; totalSize = remaining = f.size; // for zero-length messages, content frames aren't required. if (totalSize === 0) { message.content = new Buffer(0); continuation(message); ...
[ "function headers(f) {\n if (f.id === defs.BasicProperties) {\n message.properties = f.fields;\n totalSize = remaining = f.size;\n\n // for zero-length messages, content frames aren't required.\n if (totalSize === 0) {\n message.content = Buffer.alloc(0);\n continuation(message)...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
A bit slower than stringifyStrictObject(), but use slightly less memory
function stringifyStrictObjectMemory( v , runtime ) { var k , comma = false ; runtime.str += '{' ; for ( k in v ) { if ( v[ k ] !== undefined && v.hasOwnProperty( k ) ) //if ( v[ k ] !== undefined ) // Faster, but include properties of the prototype { if ( comma ) { runtime.str += ',' ; } stringifyS...
[ "function stringify(val) {\n return JSON.stringify(val, function (_, value) {\n if ((0, object_util_1.isBrokenObject)(value)) {\n return {\n __isBrokenObject__: true,\n __reason__: (0, object_util_1.getBrokenObjectReason)(value)\n };\n }\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
groups the crafts for fileFormating
function GroupCrafts_FunctionTypeLevel(hortiItems){ let jsonByFucntion = flatCraftList(hortiItems); jsonByFucntion = _.groupBy(jsonByFucntion, function(craft) { return craft.function ? craft.function : "Others"; }); Object.keys(jsonByFucntion).forEach(craftType => { jsonByFucntion[craf...
[ "_mapPartFormatting() {\n this.score.layoutManager = this.score.staves[0].partInfo.layoutManager;\n let replacedText = false;\n this.score.staves.forEach((staff) => {\n staff.updateMeasureFormatsForPart();\n if (staff.partInfo.preserveTextGroups && !replacedText) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Puts data to the 'variableslist' group.
function putVariable(head, body) { putData($("#variables-list"), head, body); }
[ "addClinicalVariables() {\n if (this.selectedValues.length > 0) {\n this.selectedValues.forEach((d) => {\n this.props.rootStore.dataStore.variableStores.sample\n .addVariableToBeDisplayed(new OriginalVariable(d.object.id, d.object.variable,\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Add Entire suit to the deck
addSuit(suit){ suit.forEach(card => { this.add(card); }); }
[ "function addDeck()\r\n{\r\n\tfor (var s=0; s<SUITE.length; s++)\r\n\t\tfor (var c=0; c<CARDS_IN_SUITE; c++)\r\n\t\t\tCards.push(s+':'+(c+1));\r\n\t\tshuffleCards();\r\n}", "function addToDeck(deck, newCard) {\n\tdeck.cards.unshift(newCard);\n\n\treturn deck;\n}", "add(card){\n\t\tthis.theDeck.push(card);\n\t}"...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Clone an article redirect the user to an edit page for now, popup editing may be an option in future...
function clone_article(articleid) { var uri = new URI(edit_url + articleid); uri.setData('clone', '1'); location.href = uri.toString(); }
[ "function pmxSendArtClone()\r\n{\r\n\tFormFunc('clone_article', document.getElementById('pWind.id').value);\r\n\tpmxRemovePopup();\r\n}", "function copyPage() {\n var $wp = $('.write-pages li'); // the list of book pages\n var $page = $($wp.get(editIndex)); // the current page\n v...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
The beginning of the synthesizer pipeline. Generate a time series, at 44100 Hz, that indicates the frequency of the sound at each moment. The starting frequency is params.base_freq, but other parameters can make the frequency slide or oscillate. Parameters: repeat_speed, base_freq, freq_limit, freq_ramp, freq_dramp; al...
function computePeriodSamples(params) { // Determine buffer size and allocate the array. var env_length = env_lengths(params, 44100); var len = (env_length[0] + env_length[1] + env_length[2]); var buffer = new Float64Array(len); // Determine whether params.repeat_speed comes into play. // t_lim...
[ "function changeFrequency() {\n if (speed != 0) {\n if (speed < 0 && currentFreq > firstFreq)\n currentFreq = currentFreq / Math.pow(2, 1 / (semitonesPerOctave * semitoneSubdivisions));\n else if (speed > 0 && currentFreq < lastFreq)\n currentFreq = currentFreq * Math.pow(2, 1 / (semitonesPerOctave...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Change all colors inside the container over an animation timer(milliseconds). eg. changeAllColors(".captionimage", "backgroundcolor", 255, 214, 0, 0.9, 0, 0, 0, 0.5, 1000, false); The last arguement is whether or not the border of the container will also be affected.
function changeAllColors(container, style, startR, startG, startB, startA, endR, endG, endB, endA, timer, changeBorder) { var tick = 10; //milliseconds var curR = startR; var curG = startG; var curB = startB; var curA = startA; var animation = setInterval(function() { if (curR < endR) { curR += ...
[ "function changeAllColors() {\n self.changeColorOne();\n self.changeColorTwo();\n self.changeColorThree();\n self.changeColorFour();\n self.changeColorFive();\n self.changeColorSix();\n }", "function changeCaptionColor() {\n colIterations++;\n $(\"#img-caption\").css(\"color\",CAP...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Converts a grp.jQuery instance to a django.jQuery instance.
function django$($sel) { if (typeof window.grp === "undefined") { return (0,_jquery_shim_js__WEBPACK_IMPORTED_MODULE_0__["default"])($sel); } if (window.grp.jQuery.fn.init === _jquery_shim_js__WEBPACK_IMPORTED_MODULE_0__["default"].fn.init) { return (0,_jquery_shim_js__WEBPACK_IMPORTED_MODULE_0__["defaul...
[ "function django$($sel) {\n if (typeof window.grp === \"undefined\") {\n return $($sel);\n }\n if (window.grp.jQuery.fn.init === $.fn.init) {\n return $($sel);\n }\n const $djangoSel = $($sel);\n if ($sel.prevObject) {\n $djangoSel.prevObject = django$($sel.prevObject);\n }\n return $djangoSel;\n}"...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates the filter panel's HTML structure in default mode.
createDefaultHTMLStructure() { const that = this, context = that.context, firstList = document.createElement('smart-drop-down-list'), operatorList = document.createElement('smart-drop-down-list'), secondList = document.createElement('smart-drop-down-list'), ...
[ "DisplayFilterPanel() {\n }", "createDefaultHTMLStructure() {\n const that = this,\n context = that.context,\n firstList = document.createElement('jqx-drop-down-list'),\n operatorList = document.createElement('jqx-drop-down-list'),\n secondList = document.crea...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
PROPS AND STATE Set props and state below. You should set state for vehicles (empty array), value (empty string), pilot (empty) string. Enter your code below:
constructor(props){ super(props) this.state = { vehicles:[], value:'', pilot:'' }; this.handleNameChange = this.handleNameChange.bind(this) this.handleSubmit = this.handleSubmit.bind(this) }
[ "constructor() {\n super();\n this.state = {\n vehicles: [],\n value: \"\",\n pilot: \"\"\n }\n }", "constructor(props){\n super(props)\n\n this.state = {\n vehicles: [],\n value: '',\n pilot: '',\n }\n }", "constructor(props) {\r\n super()\r\n this.state = {\r\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
OPERATIONS Operations are used to wrap changes in such a way that each change won't have to update the cursor and display (which would be awkward, slow, and errorprone), but instead updates are batched and then all combined and executed at once.
function startOperation(cm) { if (cm.curOp) ++cm.curOp.depth; else cm.curOp = { // Nested operations delay update until the outermost one // finishes. depth: 1, // An array of ranges of lines that have to be updated. See // updateDisplay. changes: [], delayedCallbacks: ...
[ "applyOps(patches, ops, changeCols, docState) {\n for (let col of docState.opsCols) col.decoder.reset()\n const {skipCount, visibleCount} = seekToOp(ops, docState.opsCols, docState.actorIds)\n if (docState.lastIndex[ops.objId] && visibleCount < docState.lastIndex[ops.objId]) {\n throw new RangeError('...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Funktion "hitSkier" > klickt man auf den Skifahrer beginnt dieser wieder von seiner Startposition zu fahren!
function hitSkier(_event) { let mousePosition = new L11_Skipiste.Vector(_event.clientX - L11_Skipiste.crc2.canvas.offsetLeft, _event.clientY - L11_Skipiste.crc2.canvas.offsetTop); //position meiner maus for (let oneSkier of skifahrer) { if (oneSkier.position.x - oneSkier.hitRadius < mousePos...
[ "function hitSkier(_event) {\n var mousePosition = new L11_Skipiste.Vector(_event.clientX - L11_Skipiste.crc2.canvas.offsetLeft, _event.clientY - L11_Skipiste.crc2.canvas.offsetTop); //position meiner maus\n for (var _i = 0, skifahrer_1 = skifahrer; _i < skifahrer_1.length; _i++) {\n var on...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Does the storage have enough data remaining.
hasRemaining(remaining) { return this._readIndex + remaining <= this._storage.byteLength; }
[ "hasRemaining(remaining) {\r\n return this._readIndex + remaining <= this._storage.byteLength;\r\n }", "isFull() {\n return this.length() === this.capacity;\n }", "isFull() {\n return this.length >= this.limit;\n }", "hasCapacity () {\n return this.percentCommitted() < 100\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Associate the callback method to each of the children. If no callback specified by the user, set a default.
function setCallBacks(){ var children = parentDIV.childNodes; for(var i = 0; i < children.length; i++){ children[i].onclick = params.callBack || function(){alert("Default callback");}; } }
[ "forEach(callback) {\n callback(this);\n for (const child of this.children) {\n child.forEach(callback);\n }\n }", "forEachChild(callback) {\n for (let [name, node] of this.children) {\n callback(name, node);\n }\n if (this.profile != null) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Run initial game functionality on page load. Add event listeners on the game mode buttons, add event listeners to the squares and run the reset game functionality to bring the page to its initial state.
function init() { setupModeButtons(); setupSquares(); resetGame(); }
[ "function initGame() {\n\n setEventHandlers();\n\n }", "function init() {\n id(\"start-btn\").addEventListener(\"click\", startGame);\n id(\"back-btn\").addEventListener(\"click\", returnToMain);\n id(\"refresh-btn\").addEventListener(\"click\", refreshBoard);\n }", "function i...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get caller file name
function callerfile ( lvl ) { var error = new Error, stack = error.stack.split(/\s+at\s+/).slice(lvl), name; try { name = stack[ 0 ].split('(')[ 1 ].split(':')[ 0 ]; } catch ( err ) { name = null; } return name; }
[ "function get__filename() {\n return get_caller_file_path_2.get_caller_file_path();\n}", "function callerPath () {\n return callsites()[2].getFileName()\n}", "function callerFile() {\n Error.prepareStackTrace = function(err, stack) {\n return stack;\n };\n let err = new Error...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sort object by value
function sortByValue(object) { sortByValue = object.sort(function (a, b) { return a.value - b.value; }) return sortByValue }
[ "function _sortObjectByValues(obj) {\n const keys = Object.keys(obj);\n return keys.sort((keyA, keyB) => {\n if(obj[keyA]>obj[keyB]){\n return -1;\n } else if(obj[keyB]>obj[keyA]) {\n return 1;\n }\n return 0;\n })\n}", "function sortByValue(data) {\n var result = Object.keys(data).sor...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Monta a tabela com todos os dados recuperados
function montaTabela(ano, mes) { const tabela = document.getElementById('tabela'); for (const [i, redator] of redatores.entries()) { let celulasND = ''; let qtdNoticias = 0; let qtdDestaques = 0; let links = `<tr id='info${i}' style='display:none !important'><td colspan='100'><table ...
[ "crearTablero() {\n // Número de parejas necesario de cada tipo para rellenar el tablero\n let nParejas = ((this.n * this.m) / 2) / this.tipos.length;\n\n for (let j = 0; j < this.tipos.length; j++) {\n for (let i = 0; i < nParejas; i++) {\n this.crearPareja(this.tipos...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Save all of the dirty settings files
async saveAll() { // Make sure we are able to save await this.canSave(); // Make a copy of the dirty settings since items will be removed by saving const copy = [...this.dirtySettings]; if (copy.length > 0) console.log("saved:", copy.map(sf => sf["path"])); ...
[ "function saveSettings() {\n\t\tsaveGeneralSettings();\n\t\tsaveEditorSettings();\n\t\tsaveViewerSettings();\n\t}", "function saveSettings() {\r\n\t\tsaveGeneralSettings();\r\n\t\tsaveEditorSettings();\r\n\t\tsaveViewerSettings();\r\n\t}", "function save() {\n\t\t$$invalidate(1, excluded_files = allExcludedFile...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Registers an activity event handler for the _members added_ event, emitted for any incoming conversation update activity that includes members added to the conversation.
onMembersAdded(handler) { return this.on('MembersAdded', handler); }
[ "onMemberAdded(member) {\n this.members.push(member);\n }", "addMemberListeners(info) {\n const dropdownMembers = this.memberDropdown.querySelectorAll('.member')\n for (const dropdownMember of dropdownMembers) {\n dropdownMember.addEventListener('click', this.handleMemberClick)\n }\n\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
940 941 Prep haltSubmission function // 942
function haltSubmission() { // 943 event.preventDefault(); // 944 event.stopPropagation(); ...
[ "function haltSubmission() { // 79\n event.preventDefault(); // 80\n event.stopPropagation(); ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates a new chapter for the given narration, with the given properties. Properties have to include at least "text" (JSON in ProseMirror format) and "participants" (an array of ids for the characters in the chapter).
createChapter(narrationId, chapterProps) { if (!chapterProps.text) { throw new Error("Cannot create a new chapter without text"); } if (!chapterProps.participants) { throw new Error("Cannot create a new chapter without participants"); } return this.getNa...
[ "function Verse(chapter, number, text, newParagraph) {\n this.parent = chapter;\n this.number = number;\n this.text = text;\n this.newParagraph = newParagraph;\n}", "function createChapter(req, res) {\n\t\tvar chapName = req.body.chapName;\n\t\tvar natName = req.body.natName;\n\t\tvar ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Updating the next and previous buttons after every page change.
function updatePager() { if (isNext) { nextButton.removeClass('disable'); } else { nextButton.addClass('disable'); } if (isPrevious) { prevButton.removeClass('disable'); } else { prevButton.addCla...
[ "function _updatePageButtons() {\n var nextButton = document.querySelector('.next-page');\n var prevButton = document.querySelector('.prev-page');\n\n prevButton.disabled = (leftPageNo == -1);\n nextButton.disabled = (rightPageNo >= maxPageNo);\n}", "function nextAndPrev() {\n pageChangeButtons.forEach((item...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Create and return octets for a 48bit node id: 47 bits random, 1 bit (multicast) set to 1
function _randomNodeId() { crypto.getRandomValues(_rnds); return [ _rnds[0] & 0xff | 0x01, // Set multicast bit, per 4.1.6 and 4.5 _rnds[0] >>> 8 & 0xff, _rnds[0] >>> 16 & 0xff, _rnds[0] >>> 24 & 0xff, _rnds[1] & 0xff, _rnds[1] >>> 8 & 0xff ]; }
[ "generateId(node){\n return 1 << this.nodes.size;\n }", "function generateConnectionId(){\n var S4 = function (){\n return Math.floor(\n Math.random() * 0x10000 /* 65536 */\n ).toString(16);\n };\n\n return (S4() + S4());\n}", "function getUUID() {\n let randomNumbers ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
when remote adds a stream, hand it on to the local video element
function onRemoteStreamAdded(event) { console.log("Added remote stream"); remotevid.src = window.URL.createObjectURL(event.stream); }
[ "function onRemoteStreamAdded(event) {\r\n console.log(\"Added remote stream\");\r\n attachVideo(this.id, event.stream);\r\n //remoteVideo.src = window.webkitURL.createObjectURL(event.stream);\r\n }", "function onRemoteStreamAdded(event) {\n console.log(\"Added remote stream\");\n remo...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
the prelink function will be called at parent scopes first and be going down to the child scopes we will put a container for the control inside the grid and append the control inside of it
function preLink(scope, element, attrs){ setViewTurnFlag(scope); controlContainer = applyViewGrid(scope, element); controlElement = appendControlElement(scope, element); checkControlOrientation(scope); }
[ "function SetParentGridLinks() {\n var parentGrid;\n if ($get('ctl00_cphPageContents_GVUC_grdVwContents')) {\n parentGrid = $get('ctl00_cphPageContents_GVUC_grdVwContents');\n }\n else if ($get('ctl00_cphPageContents_PCGVUC_grdVwContents')) {\n parentGrid = $get('ctl00_cphPageContents_PCGV...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
GET request with a JWT token and CSRF token
function get(url) { return Request .get(url) .timeout(TIMEOUT) .set('Accept', 'application/json') .set('Authorization', 'Bearer ' + jwt()) .set('X-CSRF-Token', csrfToken()); }
[ "function getCsrfToken() {\n var params_2 = {\n action: \"query\",\n meta: \"tokens\",\n format: \"json\"\n };\n request.get({ url: url, qs: params_2 }, function(error, res, body) {\n if (error) {\n return;\n }\n var data = JSON.parse(body);\n mer...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
convert a cents value to decimal
function cents_to_decimal(input) { return Math.pow(2, parseFloat(input) / 1200.0); }
[ "function cents_to_decimal(input) {\n const inputfloat = parseFloat(input);\n if (Number.isNaN(inputfloat)) return NaN;\n return Decimal.pow(2, Decimal(input).div(1200)).toNumber();\n}", "function covertCents(amount){\n return parseInt(amount*100);\n }", "function makesCents(amount) {\n return Math....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Given an array of arcs in absolute (but already quantized!) coordinates, converts to fixedpoint delta encoding. This is a destructive operation that modifies the given arcs!
function delta(arcs) { var i = -1, n = arcs.length; while (++i < n) { var arc = arcs[i], j = 0, k = 1, m = arc.length, point = arc[0], x0 = point[0], y0 = point[1], x1, y1; while (++j < m) { point = arc[j], x1 = point[0], y1 = poi...
[ "function delta(arcs) {\n\t var i = -1,\n\t n = arcs.length;\n\n\t while (++i < n) {\n\t var arc = arcs[i],\n\t j = 0,\n\t k = 1,\n\t m = arc.length,\n\t point = arc[0],\n\t x0 = point[0],\n\t y0 = point[1],\n\t x1,\n\t y1;\n\n\t while (++j < m) {...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function to add an edge from src index to tgt index
function addEdgeOnto(src,tgt){ if(src>=0 && src<node_dataOnto.length){ if(tgt>=0 && tgt<node_dataOnto.length){ if(-1==indexOfLinkOnto(src,tgt)){ link_dataOnto.push({source: node_dataOnto[src],target: node_dataOnto[tgt]}); refreshGraphOnto(node_dataOnto,link_dataOnto); } } } }
[ "function addEdgeToAdjacencyMatrix(source, target) {\n if (adj[source]) {\n var points_to = adj[source];\n if ($.inArray(target, points_to) < 0) {\n points_to.push(target);\n }\n adj[source] = points_to;\n } else {\n var points_to = [];\n points_to.push(tar...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Definition of the BezierSpline class
function BezierSpline() { this.firstPoint = null; this.lastPoint = null; this.size = 0; /* Adds a new point to the bezier spline. */ this.addPoint = function(point) { if (this.size < MAX_NUMBER_OF_POINTS) { if (point != null) { if (this.lastPoint != null) { point.previous = this.lastPoint; ...
[ "function KeySpline (bezier) {\n var mX1 = bezier[0];\n var mY1 = bezier[1];\n var mX2 = bezier[2];\n var mY2 = bezier[3];\n\n this.get = function(aX) {\n if (mX1 == mY1 && mX2 == mY2) return aX; // linear\n return CalcBezier(GetTForX(aX), mY1, mY2);\n }\n\n function A(aA1, aA2) {...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Return profile manager instance
getProfileManager() { return this._profileManager }
[ "GetProfile() {\n return this.m_profile;\n }", "get profile() {\n\t\treturn this.__profile;\n\t}", "function Profile() {\n _classCallCheck(this, Profile);\n\n Profile.initialize(this);\n }", "get profile () {\n\t\treturn this._profile;\n\t}", "getCurrentProfile() {\n return this.prof...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
instruments a directory. see src/js/commands/instrument.js for details. creates a temporary output directory if none specified.
function instrumentDir(options) { if (!options.outputDir) { options.outputDir = temp.mkdirSync(); } if (options.instHandler) { setupConfig(options.instHandler); } var deferred = Q.defer(); instDir.instrument(options, function (err) { clearConfig(); if (err) { ...
[ "createOutputDirectory(){\n let dirname = this.output.replace(/!?[\\w-]+\\..*/, \"\");\n if (!Fs.existsSync(dirname)) {\n console.log('creating dir ' + dirname);\n Fs.mkdirSync(dirname, {recursive: true});\n }\n }", "function processDirectory(input, output) {\n par...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Scale data from integers [0,255] to floats [0.0,1.0]
function scaleData(data) { return new Float32Array(data).map((i) => i / 255.0); }
[ "function from255(value) {\n return value/255.0;\n}", "function correct_to(data,scale){\r\n\t\tvar return_data=[];\r\n\t\tvar null_data=data.slice();\r\n\t\tvar int_null_data=to_integer(null_data);\r\n\t\tfor(var a=0;a<int_null_data.length;a++){\r\n\t\t\treturn_data.push(int_null_data[a]*100/scale);\r\n\t\t}\r\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Converts fraction to pixel
fracToPixel(frac){ return frac*c.width }
[ "function toPixel(decimal) {\n return {\n r: decimal >>> 24 & 0xFF,\n g: decimal >>> 16 & 0xFF,\n b: decimal >>> 8 & 0xFF,\n a: decimal & 0xFF,\n decimal: decimal\n }\n }", "function getFraction(r) {\n if ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Override defaults with other values. Useful to initialize a page. usage: modifyHash("foo=1&bar=2","foo=3") > "foo=3&bar=2"
defaultHashTo(defaultHash, newHash) { return this.buildHash(Object.assign(this.parseHash(defaultHash), this.parseHash(newHash))); }
[ "function setHash(str){\n window.location.hash = str;\n lastHash = blaze.base.getHash();\n }", "function setHashValue(key, theVal) {\n var hashValues = getHashValues();\n hashValues[key] = theVal;\n window.location.hash = makeHash(hashValues);\n\n }", "function _updateHa...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
set real url to manifest
function setRealUrlToManifest(options, manifest) { const { urlPrefix, cdnPrefix } = options; if (!urlPrefix) { return manifest; } if (manifest.app_worker && manifest.app_worker.url) { manifest.app_worker.url = cdnPrefix + manifest.app_worker.url; } if (manifest.pages && manifest.pages.length > 0) ...
[ "set url(val) {\n this._setAttributes(val,'url')\n }", "function mapManifestUrlToId(manifest) {\n var sourceManifest = \"unknown\";\n if (manifest) {\n sourceManifest = manifest.split(\"//\")[1];\n if (sourceManifest.match(/.ism\\/manifest/i)) ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Calculates the time column width/height based on the value defined viewPreset "tickWidth/tickHeight". It also checks for the forceFit view option and the snap, both of which impose constraints on the time column width configuration.
calculateTickSize(proposedSize) { const me = this, { forceFit, timeAxis } = me, timelineUnit = timeAxis.unit; let size = 0, ratio = 1; //Number.MAX_VALUE; if (me.snap) { const resolution = timeAxis.resolution; ratio = DateHelper.getUnitToBaseUnitRatio(timelineUnit, resolution...
[ "calculateTickSize(proposedSize) {\n const me = this,\n {\n forceFit,\n timeAxis,\n suppressFit\n } = me,\n timelineUnit = timeAxis.unit;\n let size = 0,\n ratio = 1; //Number.MAX_VALUE;\n\n if (me.snap) {\n const resolution = timeAxis.resolution;\n rati...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
partition this interval into two intervals if insertLeft is true puts the key in the left interval else puts it in the right interval
partition(time, key, insertLeft) { this.key = insertLeft ? key : SETINEL_NAME; let rightKey = insertLeft ? SETINEL_NAME : key; let prevRight = this.right; this.right = new Node(rightKey, time); this.right.left = this; this.right.right = prevRight; prevRight.left =...
[ "function swap(d1, d2) {\n var i1 = d1.action == \"insert\";\n var i2 = d2.action == \"insert\";\n \n if (i1 && i2) {\n if (cmp(d2.start, d1.end) >= 0) {\n shift(d2, d1, -1);\n } else if (cmp(d2.start, d1.start) <= 0) {\n shift(d1, d2, +1);\n } else {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Toggles the favourite state
setFavourite() { this.favourite = !this.favourite; }
[ "TOGGLE_FAVORITE (state) {\n state.activeNote.favorite = !state.activeNote.favorite;\n }", "function toggleFavoriteButton(){\n // if toggle is true set it to false\n if(toggled){\n toggled = false;\n // if toggle is false set it to true\n }else{\n toggled = true;\n }\n}", ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
get prevouse ride page
function getPrevouseRides(){ if(vm.currentPage > 1) vm.currentPage -=1; else vm.currentPage = 1; if(vm.currentPage < 4) vm.showCurrentPage = false; vm.getAllRides(); }
[ "function getuRideFare() {\n}", "function ktGetDocPage (req, res) {\n try {\n var hid = req.url.slice(2);\n\n getTldrRows({view: \"getTldrByHid\", key: hid}, function (err, data) {\n if (err) {\n res.sendStatus(404);\n }\n else {\n re...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Adds this query to the supplied batch
inBatch(batch) { if (this.batch !== null) { throw Error("This query is already part of a batch."); } this._batch = batch; return this; }
[ "inBatch(batch) {\r\n if (this.batch !== null) {\r\n throw Error(\"This query is already part of a batch.\");\r\n }\r\n if (objectDefinedNotNull(batch)) {\r\n this._batch = batch;\r\n this._batchDependency = batch.addDependency();\r\n }\r\n return ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Hide the tooltip in an animation.
hideTooltip() { Animated.timing(this.animation, { toValue: 0, duration: 140, }).start(); }
[ "hide() {\n switch (this._animType) {\n case 'fade': {\n this._tooltip.animate({ opacity: 0 }, this._animSpeed, this._destroyTooltip);\n break;\n }\n case 'none':\n default: {\n this._destroyTooltip();\n break;\n }\n }\n }", "hideTooltip() {\n thi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Timer to verify client is still connected
function timerConnected(client, server) { setInterval(function() { checkLastStanza(client, server); }, 100); }
[ "checkConnectionIsAlive() {\n // Do not allow duplicate timer\n if (this.aliveTimer !== null) {\n return;\n }\n\n // Ask customers once every 30sec by requesting ping.\n // In response, the customer must send pong.\n // Otherwise, the connection will be closed on the next test.\n this.aliv...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Removes `style` element with STYLE_NAME name attribute from given element. Function assumes that the structure of the input `element` is correct (`element.elements[name = resources].elements[name = style, attributes.name = STYLE_NAME]`).
function removeStyleElement(element) { var _a, _b, _c, _d; const resources = (_a = element.elements) === null || _a === void 0 ? void 0 : _a.find(el => el.name === 'resources'); const idxToBeRemoved = (_c = (_b = resources === null || resources === void 0 ? void 0 : resources.elements) === null || _b === vo...
[ "function removeFromElement(style, element){\n\t\tvar def = style.styleDefinition, \n\t\t\tattributes = Object.merge({}, def.attributes, getOverrides(style)[element.name()]), \n\t\t\tstyles = def.styles,\n\t\t\tremoveEmpty = utils.isEmpty(attributes) && utils.isEmpty(styles);\n\t\t\n\t\t// Remove definition attribu...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Generate a summary string for some stats.
function getStatsSummary(stats: BenchmarkStats): string { const parts = []; if (stats.improved > 0) { parts.push(colors.green.bold(`${stats.improved} improved`)); } if (stats.regressed > 0) { parts.push(colors.red.bold(`${stats.regressed} regressed`)); } parts.push(`${stats.to...
[ "function stats(){\n Object.keys(getUnique).forEach(function(key){\n statistics += key + \": \" + getUnique[key] + '<br />';\n });\n statistics += \"</span>\";\n }", "summary() {\n console.log(`${this.firstName} ${this.lastName} is a ${this.age} year old ${this.gender} from ${this.city}...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Renders the AWS CloudFormation properties of an `AWS::RUM::AppMonitor` resource
function cfnAppMonitorPropsToCloudFormation(properties) { if (!cdk.canInspect(properties)) { return properties; } CfnAppMonitorPropsValidator(properties).assertSuccess(); return { Domain: cdk.stringToCloudFormation(properties.domain), Name: cdk.stringToCloudFormation(properties.n...
[ "function cfnAppMonitorAppMonitorConfigurationPropertyToCloudFormation(properties) {\n if (!cdk.canInspect(properties)) {\n return properties;\n }\n CfnAppMonitor_AppMonitorConfigurationPropertyValidator(properties).assertSuccess();\n return {\n AllowCookies: cdk.booleanToCloudFormation(pr...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns amounts of given items from corresponding text fields in a reservation form. Amounts are required as a string that can be passed as an onchange event's "with" parameter
function getItemAmountsFromTextfields(item_ids) { amounts = ""; for (i = 0; i < item_ids.length; i++) { amount = $('conversation_reserved_items_' + item_ids[i]).value; amounts += "amounts[]=" + amount; if (i < (item_ids.length - 1)) { amounts += "&"; } } return amounts; }
[ "function fetchItemAmounts()\n{\n\t// find the rows that match the user's input on \"item\",\"container\",\"location\"\n\tvar rows = findInventoryRows1();\n\t// return array with integer amounts\n\treturn $(rows).map(function() { return parseInt($(this).find(\"[name='amount']\").val()); });\n}", "function invoice...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Set the currentSongId to the id of the song previous of the current song
function previousSong() { const currentSongIndex = songs.findIndex((s) => s.id === currentSong.id) if (currentSongIndex !== 0) { setCurrentSongId(songs[currentSongIndex - 1].id) } else { setCurrentSongId(songs[songs.length - 1].id) } }
[ "function previousSong() {\n\n currentSong--;\n\n if(currentSong < 0) {\n currentSong = songList.length - 1;\n }\n\n loadSong(songList[currentSong]);\n\n playSong();\n}", "function previous () {\n\tcurrentsong--;\n\tcurrentsong = (currentsong < 0) ? songs.length - 1:currentsong;\n\tloadSong(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Populates a structured dataset given an array of result docs. Should be followed by a call to appendDatasetToDownload() to incrementally build up a Blob for downloading.
fillDataset (docs) { if (!docs) return const numFields = this.reactiveState.fieldNames.length const obj = this.plainState.dataset = this.plainState.dataset || {} docs.forEach(doc => { // Lookup field index in memory const index = this.plainState.datastreamIdsToFieldIndex[doc._id] if ...
[ "function loadDataset(result) {\n var deferred = Q.defer();\n var collection = result[0];\n var dataset = result[1];\n\n collection.insert(_.values(dataset), { continueOnError: true }, function(err) {\n if (err) return deferred.reject(err);\n else deferred.resolve(collection);\n });\n\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
draw the average yield crops production
function crops_average_yield(){ a_FAO_i='crops_average_yield'; initializing_change(); change(); }
[ "function getTotalYield({crops}, environmentFactors) {\n return crops.reduce((previousValue, crop) => {\n return previousValue + getYieldForCrop(crop, environmentFactors)\n }, 0)\n}", "drawGraduations()\n {\n let yPixelPer5Mil = this.pixelsPerMil * 5;\n \n this.ctxPlot.beginPa...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Add all messages produced from an invocation of the TSDoc parser, assuming they refer to code in the specified source file.
addTsdocMessages(parserContext, sourceFile, astDeclaration) { for (const message of parserContext.log.messages) { const lineAndCharacter = sourceFile.getLineAndCharacterOfPosition(message.textRange.pos); const options = { category: "TSDoc" /* TSDoc */, mes...
[ "extractFromSource() {\n\n // TODO: Handle \\' \\\" in messages\n const r = /\\Wt\\(('|\")(.*?)\\1/g;\n\n let messages = {};\n\n this.config.sourcePath.forEach(function (source) {\n let files = glob.sync(source + \"/**/*.js\", { debug: false });\n \n files.forEach(function (file) {\n\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Handles shift up key.
handleShiftUpKey() { this.extendToPreviousLine(); this.checkForCursorVisibility(); }
[ "onKeyup(event) {\n if (!event.shiftKey) {\n this.shiftPressed = false;\n }\n }", "function key_up(event) {\n // If shift still pressed\n if (event.shiftKey) return;\n\n shift_key_pressed = false;\n}", "function shiftUp() {\n shift = false;\n }", "moveUp() {\n this.sh...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Basic Action Handler Handle user input from a commadelimmted string of HEX codes
function onRun(context) { try { hexInput = context.document.askForUserInput_initialValue( "Please enter a sequence of HEX values", EXAMPLE_HEX_STRING ); } catch (e) { SharedApplication.displayDialog_withTitle("There was an error processing your hex string", "Hex I...
[ "function in_hex() {\n let backend = entrada_selecionada();\n let s = NaN;\n do {\n s = parseInt(prompt(\"Insira uma word de quatro nibbles como 00A0 ou F0DA.\",\n \"0000\"), 16);\n } while (isNaN(s));\n backend.inserir(s);\n update_entrada();\n}", "async function checkHex(input, h...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Remove a row from the sync table
function removeSyncRow(row) { var DB = new SQLite('_alloy_'); DB.table(exports.config.syncTableName) .where(row) .delete() .run(); }
[ "removeRow(row){\n //avoid model churn by checking if this actually has the row in it\n let rowIdx = this.get('model.rows').indexOf(row);\n if(rowIdx >= 0){\n this.set('model.rows', this.get('model.rows').without(row));\n }\n }", "function remove() {\n if (specTable.rows.length > 1) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Tool tip for regions in grid
function formRegionsGridToolTip(rawObject) { return 'title="Name ' + rawObject.name + ' , Type ' + rawObject.type + ' , ' + jQuery.i18n.prop('pulse-entrycount-custom') + ' ' + rawObject.entryCount + ' , Scope ' + rawObject.scope + ' , Disk Store Name ' + rawObject.diskStoreName + ' , Disk Sync...
[ "function on_tooltip_custom_paint(gr) {}", "function formClientsGridToolTip(rawObject) {\n return 'title=\"Name ' + rawObject.name + ' , Host ' + rawObject.host\n + ' , Queue Size ' + rawObject.queueSize + ' , CPU Usage '\n + rawObject.cpuUsage + ' , Threads ' + rawObject.threads + '\"';\n}", "get to...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
List workspaces, and get reports of the first workspace
function listWorkspaces(data, workspaceCollectionName, accessKey) { $.each(data, function (n, value) { $('#workspaceList').append($('<option>', { value: value.workspaceId }).text(value.displayName)); }); if (data.length > 0) { getReports(data[0].workspaceId, workspaceCollectionName, accessKe...
[ "function listWorkspaces () {\n getWorkspaces()\n .then(workspaces => {\n (unDisplay(workspaces))\n // storedWorkspaces.push(workspaces)\n })\n}", "async getAllWorkspaces(){\n const workspaceRepository = locator.get('iworkspaceRepository');\n var workspaces = await workspaceRepository.getAllWorkspac...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Create a sprite file.
function createSprite() { return src(iconSRC) .pipe(svgSprite(config)) .pipe(dest(iconURL)); }
[ "function createSprite() {\n\t\tsprite.style.width = options.width + \"px\";\n\t\tsprite.style.height = options.height + \"px\";\n\t\tsprite.style.backgroundImage = 'url(\"'+spritesheet.src+'\")';\n\t\tsprite.style.backgroundPosition = \"0 0\";\n\t\tsprite.style.overflow = \"hidden\";\n\n\t\tspritesheet.parentNode....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
If teams want to reset points midgame
resetPoints(teamnr){ if (teamnr==1) { document.getElementById("team1score").innerHTML = "0" team1points = 0 } else if (teamnr==2) { document.getElementById("team2score").innerHTML = "0" team2points = 0 } }
[ "resetGame(){\n this.player1.points = 0;\n this.player2.points = 0;\n this.winningPlayer = \"\";\n }", "function resetTeamScoreValues() {\n\n team1Score = 0;\n team2Score = 0;\n\n updateTeamScoreDisplayElements(1);\n updateTeamScoreDisplayElements(2);\n}", "function resetGame...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Handles the click event for features
featureClickEventHandler(event) { this.featureEventResponse(event); }
[ "featureClickEventCallback(event) {\r\n\r\n }", "function featureServiceClicked(evt){\n providerList.selectProviders(evt.features);\n }", "clickFeature(feature) {\n let ids = this.state.selectedFeatureIds;\n if (ids.includes(feature.id)) {\n //remove the feature if it is alre...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
recursive function to construct a balanced binary search tree given the array of values in sorted order
balancedBST(arr, start, end, root, inverted) { if (start >= end) return; // base case let leftMid, rightMid; // indices of left and right children in arr const mid = Math.floor((start + end) / 2); // left child is the middle element of first half of the sorted array leftMid = en...
[ "function createBalancedBST(arr, start = 0, end = arr.length) {\n // true base case\n if (start === end) {\n return null;\n }\n\n // used to split the array into two parts\n const middleIndex = Math.floor((start + end) / 2);\n const middleValue = arr[middleIndex];\n\n // const left = arr.slice(0, middleIn...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
_win: takes input array of 4 cell coordinates [ [y, x], [y, x], [y, x], [y, x] ] returns true if all are legal coordinates for a cell & all cells match currPlayer
function _win(cells) { // TODO: Check four cells to see if they're all legal & all color of current // player // if given cell coordinates are all same value (1 or 2 from BOARD) return true for ( let cell of cells) { // console.log(`cell 0 is ${cell[0]}\ncell 1 is ${cell[1]}`) // BOARD[cell...
[ "function checkForWin() {\n\tfunction _win(cells) {\n\t\t// Check cells to see if they're all color of current player\n\t\t// - cells: list of # (y, x) cells\n\t\t// - returns true if all are legal coordinates & all match currPlayer\n\n\t\treturn cells.every(\n\t\t\t([ y, x ]) => y >= 0 && y < settings.gridHeight...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Builds a square array of a given side length from a given string
function buildArray(string, elementLength) { var array = []; for (var i = 0; i < string.length; i += elementLength) { array.push(string.slice(i, i + elementLength)); } return array; }
[ "function makeGrid(string){\n\n console.log('string = ', string);\n\n // split string into an array of characters\n let strToArr = string.split('');\n console.log('strToArr = ', strToArr)\n\n let xy = gridDimensions(string);\n\n let xWidth = xy[0]; // 3\n let yWidth = xy[1]; // 5\n\n console.log('xWidth =' ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates a count of the number of text characters and carridge returns at before and before the given n, offset.
function charCount(n,offset,nodes){ //debug("counting chars function"); //debug(n); //debug(offset); var node; var off; if(n.nodeName=="PRE"){ //debug("PRE"); node=n.childNodes[offset]; off=0; }else{ node=n; off=offset; } //debug(node); //debug(offset); var count=0; var currNodeNum=0; var len=nod...
[ "function spanCharCount(n,offset,nodes){\n\t/*debug(\"doing spanCharCount\");\n\tdebug(\"node\");\n\tdebug(n);\n\tdebug(\"off\");\n\tdebug(offset);\n\t*/\n\t\n\t\n\tvar node;\n\tvar off;\n\t\n\tif(n.nodeName==\"PRE\"){\n\t\t//debug(\"nodes[0].parentNode\");\n\t\t//debug(nodes[0].parentNode);\n\t\t//debug(n.childNod...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Event handler to control movement of the rabbit via arrow keys
function keyPressListener (event) { if (event.key === "ArrowUp") { rabbit.y -= 80 } else if (event.key === "ArrowDown") { rabbit.y += 80 } else if (event.key === "ArrowLeft") { rabbit.x -= 10 } else if (event.key === "ArrowRight") { rabbit.x += 10 } if (rabbit.x >= (rabbit.xUpper + 4...
[ "function keyDownHandler(e){\r\n switch (e.key) {\r\n case \"ArrowUp\": rocket1.moveUp(10); break;\r\n case \"ArrowDown\": rocket1.moveDown(10); break;\r\n case \"ArrowRight\": rocket1.moveRight(10); break;\r\n case \"ArrowLeft\": rocket1.moveLeft(1...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Extracts even indexed complex values in the given array.
function complexWithEvenIndex(complex) { var len = Math.ceil(complex.length / 4); var real = new Float32Array(len); var imag = new Float32Array(len); for (var i = 0; i < complex.length; i += 4) { real[Math.floor(i / 4)] = complex[i]; imag[Math.floor(i / 4)] = complex[i + 1]; } re...
[ "function complexWithEvenIndex(complex) {\n const len = Math.ceil(complex.length / 4);\n const real = new Float32Array(len);\n const imag = new Float32Array(len);\n\n for (let i = 0; i < complex.length; i += 4) {\n real[Math.floor(i / 4)] = complex[i];\n imag[Math.floor(i / 4)] = complex[i + 1];\n }\n\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
We create a negative bloc of chat (a question with its negative response)
function createNegativeResponse(p2Negative) { let div = document.createElement('div'); div.className = "full-negative-bloc"; div.appendChild(p2Negative); return div; }
[ "function reject_answer() {\r\n\r\n send({\r\n type: \"busy\"\r\n });\r\n\r\n clear_incoming_modal_popup();\r\n chat_window_flag = false;\r\n incoming_popup_set = false;\r\n}", "function negative(){\n clarifai.negative(phishNegatives[0], 'beard', cb).then(\n promiseResolved,\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Escape all HTML encoded ampersand characters with '&' from dbPromotionName
function escapeChars(dbPromotionName) { if (dbPromotionName.indexOf("&amp;") >= 0) { dbPromotionName= dbPromotionName.replace(/\&amp;/g,'&'); } return dbPromotionName; }
[ "function escapeAmpersands(str) {\n return str.replace(/&/g, \"&amp;\");\n}", "function GridControl_escHTMLChars(theStr) \n{\n theStr = theStr.replace(/&/g,\"&amp;\"); // always do this one first\n theStr = theStr.replace(/</g,\"&lt;\");\n theStr = theStr.replace(/>/g,\"&gt;\");\n theStr = theStr.replace(/...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
void SetDefaultPluginAccount (string, string)
SetDefaultPluginAccount(string, string) { }
[ "SetDefaultAccount(string, string) {\n\n }", "setDefaultAccount(id)\n {\n if (typeof(id) == \"object\")\n id = id.id\n\n this.meta[\"settings.default-account\"] = id\n }", "setAsDefault(): Promise<void> {\n return Util.callAsync(this.setAsDefault, async () => {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Provider component that wraps your app and makes auth object .. ... available to any child component that calls useAuth().
function ProvideAuth({ children }) { const auth = useProvideAuth(); return __jsx(authContext.Provider, { value: auth }, children); } // Hook for child components to get the auth object ...
[ "function WrappedApp() {\n const [user] = useObservable(getUser$, anonymousUser);\n\n return (\n <UserContextProvider value={user}>\n <App />\n </UserContextProvider>\n );\n}", "function AuthProvider({children}) {\n // now set two state for currentuser and loading State and intially there will b...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Change customer id to myDigi account from Leka account and call transfer
function changeCustomerNumberandTransfer(lekaSource, mdDestination) { mdDestination.id = lekaSource.id; DP.execute({type:"apiCustomer", method:"changeCustomerNumber", params: mdDestination}).then(function(response) { if (response.message === 'Successful') { Notification.success({title: tr...
[ "async function onBtnRequestTransfer() {\n outputWrite('onBtnRequestTransfer() call');\n const to = els.receiverPrincipalId?.value;\n const amount = Number(els.amount?.value.replaceAll('_', ''));\n const requestTransferArg = {\n to,\n amount,\n };\n\n if (!to) {\n outputWrite(`onBtnRequestTransfer() ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Submit workouts / Live Workout
function submitWorkout(e) { if (e.target.classList.contains("live-start")) { // Form variables const name = ui.workoutName.value, activity = ui.workoutActivity.value; // Validation if (name === "" || activity === "") { // Alert ui.showAlert("Please fill in required fields", "alert a...
[ "async postWorkout() {\r\n\r\n const workout = this.state.workout;\r\n\r\n let newWorkout = await createWorkout(workout);\r\n this.context.addWorkout(newWorkout);\r\n }", "function submitForm(evt){\n evt.preventDefault();\n savedWorkouts.forEach(elem => {\n // loop over savedWorkouts, find th...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Draw the curve stored in event to canvas ID
function drawCurve( ctx, event ) { ctx.strokeStyle = event.color; // draw curve as quadratic spline var coords = event.coords; var cx, cy; if (coords.length > 4) { ctx.beginPath(); ctx.moveTo(coords[0], coords[1]); cx = 0.5 * (coor...
[ "function drawLine(mouseEvent, sigCanvas, context) {\r\n var position = getPosition(mouseEvent, sigCanvas);\r\n cord.push(position.X);\r\n cord.push(position.Y);\r\n //alert(position.X);\r\n //alert(position.Y);\r\n context.lineTo(position.X, position.Y);\r\n context.stroke();\r...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Component to create every select in CreateFormation depending on the player type. Props needed: formControl, playerNum, playerType, setPlayerValue, playersList, selectedPlayersList
function PlayersSelect(props) { // TODO: Optimise this piece of code. It lacks of the validation of no repetition of position. const checkSelectedPlayers = (player_id) => { // Selected Players List const spl = props.selectedPlayersList /* For every player selected, we check ...
[ "function populatePlayerOptions(form_id){\n for(var t = 0; t<24; t++){\n for (var i = 0; i<Object.keys(Players).length; i++){\n var o = document.createElement('option');\n var pair = intToPair(i);\n o.text = Players[pair].Name;\n o.value = i;\n document.getElementById(form_id+t).appendChild(o);\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
wraps arguments to JSON string format
function wrapToString(/* ...args */) { return JSON.stringify([].slice.call(arguments)); }
[ "function formatArgument(arg) {\n if (typeof arg === \"function\") {\n return arg.toString();\n }\n else {\n return JSON.stringify(arg);\n }\n }", "function toJsonString(arg) {\n if (isString(arg)) {\n return arg;\n }\n try {\n return JSON.stringify(arg);\n } catch (err) {\n va...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get the given number of queued jobs uuids. start Integer Position of the first job to retrieve stop Integer Position of the last job to retrieve, _included_ callback f(err, jobs) See for the details about start/stop.
function nextJobs(start, stop, callback) { var slice; return client.sort('wf_queued_jobs', 'by', 'job:*->created_at', 'asc', 'get', 'job:*->uuid', function (err, res) { if (err) { log.error({err: err}); return c...
[ "getJobs(types, start = 0, end = -1, asc = false) {\n return this.queue.getJobs(types, start, end, asc);\n }", "async getRepeatableJobs(start = 0, end = -1, asc = false) {\n const repeat = await this.queue.repeat;\n return repeat.getRepeatableJobs(start, end, asc);\n }", "getListOfJob...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
addNodeConnection adds the targetIDpeer pair to nodeList and nodeToPeer, while also ensuring the connectionLimit is not exceeded
addNodeConnection(targetID, peer){ if(this.nodeList.length <= this.options.connectionLimit){ this.nodeToPeer[targetID]=peer; this.nodeList.unshift(targetID); } else{ var removedID = this.nodeList[this.nodeList.length - 1]; this.removeNodeConnection(removedID) this.nodeToPeer[ta...
[ "_addConnection(peerId, connection) {\n $c4ee9f36c11cf69efa75d5c6d35$export$default.log(`add connection ${connection.type}:${connection.connectionId} to peerId:${peerId}`);\n\n if (!this._connections.has(peerId)) {\n this._connections.set(peerId, []);\n }\n\n this._connections.get(peerId).push(conn...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Start reminder for due dates
function startReminder(Discord, client, message) { console.log("Starting due date reminder.") const command = client.commands.get('dueReminder'); if (command) { command.execute(client, message, "", Discord); console.log("Due date reminder is scheduled.") } }
[ "function trigger_diary_entry_reminder() {\n if (!store.get('reminders')) return;\n create_diary_entry_window();\n setTimeout(trigger_diary_entry_reminder, 24 * 60 * 60 * 1000); //Run again in 24 hours.\n}", "function _dDateStartDateOnSetTime() {\n vm.$scope.$broadcast('due-start-date-changed'...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
public default class SourceMap constructor
function SourceMap(){ this.lines = []; }
[ "__init() {\n\t\tthis.sourcemap_list = [];\n\t}", "function SourceMapper() {\n}", "function SourceMapGenerator$4(aArgs){if(!aArgs){aArgs={};}this._file=util$9.getArg(aArgs,'file',null);this._sourceRoot=util$9.getArg(aArgs,'sourceRoot',null);this._skipValidation=util$9.getArg(aArgs,'skipValidation',false);this._...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Filter the cross filter such that only favorite data for the given custom list row id persists. Assumes crossfilter has been cleared. Adds the filters to filteredDimensions array. Has many side effects on crossftiler environment. This needs to be used in conjunction with accumulate group
function filterFavoritesOnlyForCustomListRowId(crossfilter, customListRowId) { var userInputHeader = crossfilter.dimension(function(d) { return d.pcuihId; }); userInputHeader.filter(function(p) { return p == 1 || p == -1; }); var arg1 = crossfilter.dimension(function(d) { return d.arg1; }); ar...
[ "function filterViewsOnlyForCustomListRowId(crossfilter, customListRowId) {\n\t\tvar userInputHeader = cf.dimension(function(d) {\n\t\t\treturn d.pcuihId;\n\t\t});\n\n\t\tuserInputHeader.filter(function(p) {\n\t\t\treturn p == 13 || p == -1;\n\t\t});\n\n\t\tvar arg1dimension = cf.dimension(function(d) {\n\t\t\tretu...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
listen for keypress events on the iFrame
function setKeypressHandler(windowOrFrame, keyHandler) { var doc = windowOrFrame.document; if (doc) { if (doc.attachEvent) { doc.attachEvent( 'onkeypress', function () { keyHandler(win...
[ "function iframeListenForKeyPress(iframe, uuid) {\n return once(function () {\n var message = { uuid: uuid, event: 'listenForKeyPress', keyCode: '27' };\n send(message, \"https://\" + getPlaybackURL(), iframe);\n });\n}", "function HandleKeyPressIFrame(evnt) {\r\n\t\tvar intKeyCode;\r\n\t\tvar...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
function that gets called when save machine gets clicked saves the machine as an image as well as json object
function saveImage() { var link = document.createElement('a'); link.href = canvas.toDataURL(); link.download = "machine.png"; link.click(); //call function to save the machine as a json exportToJsonFile(json) }
[ "function saveimg(){\n let monsterDrawing = get(canvasX1, canvasY1, 550,550);\n monName = nameIn.value();\n save(monsterDrawing, monName+\".jpg\");\n console.log('Image Saved')\n //img = createImg(monName+\".jpg\");\n\n}", "function save_image(id) {alert(\"Print command received: \"+id);Control.OFC.save(id)}...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
constrain opacity within bounds
boundedOpacity(opacity) { const o = opacity + this.opacity; if (o < 0) { return 0; } else if (o > 1) { return 1; } else { return o; } }
[ "function opacityBonus() {\n opacity = (parseInt(opacity, 16)-6).toString(16);\n if (parseInt(opacity, 16)<0) { stopOpacity(); loadCar(); }\n else refreshScreen();\n}", "get opacity() { return this.alpha * 255; }", "updateOpacity(opacity) {\n this._model.preset.opacity = opacity / 100;\n }", "get...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }