query
stringlengths
9
34k
document
stringlengths
8
5.39M
negatives
listlengths
19
20
metadata
dict
The functions triggered when we get location events, both good and bad. On error, we show various "Hey, bad location!" warnings around the app On success, we update the GPS readout, maybe recenter the map, position the
function handleLocationFound(event) { // detect whether we're within the expected area and/or have poor accuracy // showing/hiding messages indicating that they may not like what they see var within = MAX_BOUNDS.contains(event.latlng); var poor = event.accuracy > 100; $('.location_fail').hide(); ...
[ "function getLocation() {\n function success(position) {\n lat = position.coords.latitude;\n lng = position.coords.longitude;\n // center the map arround user location\n map.setCenter({lat: lat, lng: lng})\n map.setZoom(13)\n\n if (!mainPosition) {\n // put a ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
throws a runtime error if component access is not valid, and disallows duplicate components because duplicate components can not be in a left expression. (for example `v.xyx = vec3(1., 2., 3.)` is illegal, but `v1.xyz = v2.xyx` is legal.) also checks for type errors such as `v1.xy = vec3(1., 2., 3.)`; the right hand si...
function checkChangeComponents(comps, setter, vec) { // setter has different length than components if (comps.length !== getcompexpr_1.typeStringToLength(setter.typeString())) { throw new Error("components length must be equal to the target float/vec"); } // duplicate components if (duplicat...
[ "_checkValidAssignmentTarget(node) {\n if (node.type === \"Identifier\" || node.type === \"MemberExpression\") {\n return node;\n }\n throw new SyntaxError(\"Invalid left-hand side in assignment expression\");\n }", "isValidSpread(expression) {\n const expressionType =\n expression.construc...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Ensure the root properties `states`, `transitions`, `sounds`, and `vendor` are present. If `vendor` is missing, the nested properties are also autogenerated. Other, unknown properties are preserved.
function ensureExpectedPropertiesPresent (newState) { const present = { ...newState, states: newState.states || {}, transitions: newState.transitions || {}, sounds: newState.sounds || {}, vendor: newState.vendor || {} } if (!present.vendor.fernspieleditor) { ...
[ "function fillInMissingProperties(event) {\n for (var attr in attributes) {\n if (event[attributes[attr]] === undefined) {\n event[attributes[attr]] = null;\n }\n }\n}", "function normalizeDocument(jsonDocument) {\n var state = makeArray(jsonDocument.data).reduce(addRecordToState, ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Request an specific GIF from server
function requestGifByID( gifID ){ if(!gifID){return;} requestGifFromServer( RandME.commands.byID , gifID ); //Call server }
[ "function requestGifFromServer( cmd , param ){\n debug.log( \"[getGifImage]:\", \"Requesting GIF for:\", param );\n\n loader.show(); //Show loading\n\n api( cmd, param, function( response ){\n renderGifResponse( response.data ); //Display final GIF\n debug.log(\"[requestGifFromServer]\", \"RESPONSE:\", res...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Write a concat function that takes two generators, and produces a generator that combines the sequences:
function concat(generator1, generator2){ return function (){ var gen1 = generator1(); if (gen1 !== undefined){ return gen1; } else{ var gen2 = generator2(); return gen2; } }; }
[ "function concat(source) {\n return accumulatable(function accumulateConcat(next, initial) {\n function nextAppend(a, b) {\n if(b === end) return accumulate(a, next, initial);\n\n return a === null ? b : append(a, b);\n }\n\n accumulate(source, nextAppend, null);\n });\n}", "combineResults(pr...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Window load types (loading, dom, full)
appLoad(type, callback) { const _self = this; switch (type) { case 'loading': if (_self.doc.readyState === 'loading') { callback(); } break; case 'dom': _self.doc.onreadystatechange = function (...
[ "function DN_System_Load(){\r\nthis.wib = screen.width;\r\nthis.heb = screen.height;\r\nthis.documes = (document.getElementById || document.createElement || document.getElementsByTagName) ? true : false;\r\nthis.objects = window.addEventListener || window.attachEvent ? window : document.addEventListener ? document ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns an HTML string to display the title and the buttons to navigate in the script history
function backgroundScriptAddonTemplate2() { return ` <div class="history"> <button id="historyBackButton">&lt;- back</button> </div> ` }
[ "function showHistory() {\n\n\t}", "function getHistory() {\n const historyCmd = `appcenter codepush deployment history -a DigiServe/adroit-${os} ${environment} --output=\"json\"`;\n\n console.log(chalk.cyan(historyCmd));\n\n exec(historyCmd, (error, stdout, stderr) => {\n try {\n if (error) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This javascript method is called when the delete button is triggered on top of the post div. It will call an jQuery UI Dialog to confirm the deletion with the user and upon user's confirmation, it will delete the post. The database record is deleted by an ajax call to the webservices host/authors/username/posts/post_id
function deletePost(username, dbId) { var dialogBox = $("<div id='deleteMessage' class='dialog'><p>Are you sure you want to delete this post?</p></div>"); $("#post-"+dbId).append(dialogBox); $("#deleteMessage").dialog({ autoOpen: true, modal: true, dialogClass: "no-close", width:...
[ "confirmDelete() {\n const deletePost = async (event) => {\n await api.post.delete(this.id);\n modal.close();\n this.remove();\n };\n\n const modal = create(\"qp-popup\", {\n heading: \"You're about to delete this post\",\n headingElement: \"h3\",\n appearance: \"danger\",\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
finding the maximum ID among the employees stored in the array
function maxID(){ var res = 0; for(var i = 0; i < employees.length; i++){ if(employees[i].id > res){ res = employees[i].id; } } return res; }
[ "function findMaximumValue(array) {\n\n}", "function greatesDatetId() {\r\n let greatestIdNumber = 0;\r\n // Search for the greatest id number\r\n for (i = 0; i < travelDates.length; i++) {\r\n if (travelDates[i].id > greatestIdNumber) greatestIdNumber = travelDates[i].id;\r\n }\r\n return g...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
UTILITY METHODS Create a grouping of the items with the given keying function. The keying function receives a single argument the item and must return the key to be used for that item. The result of this method is an array of objects containing: key: the common key value of the items in this group items: array of items...
function createGrouping(items, keyFn) { const groups = []; let idx = 0; for (const item of items) { const itemKey = keyFn(item, idx); idx++; const predicate = (g) => (0, deep_eql_1.default)(g.key, itemKey); const construct = () => ({ key: itemKey, items: [] }); (0, fi...
[ "function group(items) {\n const by = (key) => {\n // create grouping with resolved keying function\n const keyFn = typeof key === 'function' ? key : (item) => item[key];\n const groups = createGrouping(items, keyFn);\n // return collectors\n return Object.freeze({\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
move some flow into another category
function moveFlow(targetCategory, flowInfoArray, fn, errorFn, callbackpanelid){ var url = REQUEST_URL + "?method=moveFlowIntoCategory"; ds.post(url, { categoryInfo: targetCategory, operateFlowInfoArray: flowInfoArray }, function(data){ if(data.error_code == -100){ if(errorFn){ errorFn.call(null,...
[ "switchCategory($event, transaction) {\n\t\tthis.switchTo($event, \"categories.category\", transaction.category.id, transaction);\n\t}", "move(destination) {\n if (!roadGraph[this.place].includes(destination)) {\n return this;\n } else {\n let parcels = this.parcels.map(p => {\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Helper function handles all the code around preparing the databaseversion file, and watching the Menus folder to update the version when said folder is modified
function _prepDatabaseVersion() { //set a new version of the database. A random number will //do fine here 9,999,999 times out of 10,000,000 version = Math.random()*10000000 version -= version % 1 //watch the menus folder. If it changes, //reload the menus, and update the ...
[ "onDatabaseVersionChange(_) {\n Log.debug('IndexedDb: versionchange event');\n }", "function processVersionUpgrade(oldVersion)\n{\n console.log('processVersionUpgrade:', oldVersion);\n\n // Make backup of synced data before proceeding\n makeEmergencyBackup(function()\n {\n var upgradeNotes = []; ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns selected item at key
getSelectedItem(key) { return this._selectedItems[key]; }
[ "function get(key) {\n console.log('Searching for: ' + key);\n storeObject.table.forEach(function(item) {\n if (item['key'] === key) {\n console.log(item['value']);\n } \n });\n }", "function setSelectedFromKey(selectField, keyField) {\r\n\t var found = false;\r\n\t options = selectFiel...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Create a new `EConstructor`, with the formatted `format` as a first argument.
function create(EConstructor) { FormattedError.displayName = EConstructor.displayName || EConstructor.name return FormattedError function FormattedError(format) { if (format) { format = formatter.apply(null, arguments) } return new EConstructor(format) } }
[ "function MessageFormat(pattren) {\n this.pattern;\n //\"(C) Currency: . . . . . . . . {0:C}\\n\" +\n //\"(D) Decimal:. . . . . . . . . {0:D}\\n\" +\n //\"(E) Scientific: . . . . . . . {1:E}\\n\" +\n //\"(F) Fixed point:. . . . . . . {1:F}\\n\" +\n //\"(G) General:. . . . ....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Visit a parse tree produced by PlSqlParseralter_table_properties.
visitAlter_table_properties(ctx) { return this.visitChildren(ctx); }
[ "visitAlter_table_properties_1(ctx) {\n\t return this.visitChildren(ctx);\n\t}", "visitAlter_table(ctx) {\n\t return this.visitChildren(ctx);\n\t}", "visitAlter_tablespace(ctx) {\n\t return this.visitChildren(ctx);\n\t}", "visitModify_col_properties(ctx) {\n\t return this.visitChildren(ctx);\n\t}", "fun...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Place markers on each of the subway stations using a custom marker with an icon from Also add a listener for click events on the marker and call the appropriate function to handle it
function placeMarkers() { //custom image for the marker var image = { url: 'place_marker.png', // This marker is 24 pixels wide by 24 pixels high. scaledSize: new google.maps.Size(24, 24), // The origin for this image is (0, 0). origin: new google.maps.Point(0, 0) };...
[ "function showStations() {\n\n Object.keys(Hubway.stations).forEach(function(id) {\n \n var row = Hubway.stations[id];\n \n var description = '['+ id + '] ' + row.name + ', ' + row['docks'] + ' bikes'; \n var marker = addMarker(row.latitude, row.longitude, description, \"def...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Show meal on click
function showMeal(e) { const meal = e.target.parentElement; console.log(meal); if(meal.classList.contains('meal')) { const mealID = meal.getAttribute('data-mealid'); getMealByID(mealID); } else { return false; } }
[ "onAddMealButtonPressed(event) {\n\t\tthis.addMeal();\n\t}", "function Meal(data) {\n Base.call(this, data);\n this.type = 'meal';\n}", "setShowGoalInfo(state, data) {\n state.showGoalInfo = data\n }", "function openPopUpLoan() {\n let popUp = prompt(\"How much would you like to loan?\"...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
repeal an object from this object. here we iterate over subobject and repeal only from the ones we collide with. read base shape repel() doc for more info.
repel(obj, force, iterations, factor_self, factor_other) { // do repel from independant shapes inside this composite shape var ret = SSCD.Vector.ZERO.clone(); for (var i = 0; i < this.__shapes.length; ++i) { var shape = this.__shapes[i].shape; if (shape.test_collide_with(...
[ "isCollide(potato) {\n\n\n // Helper Function to see if objects overlap\n const overLap = (objectOne, objectTwo) => {\n\n // Check X-axis if they dont overlap\n if (objectOne.left > objectTwo.right || objectOne.right < objectTwo.left) {\n return false;\n }\n // Check y-axis if they ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
When using multiple axes, adjust the number of ticks to match the highest number of ticks in that group
function adjustTickAmount() { if (maxTicks && !isDatetimeAxis && !categories && !isLinked && options.alignTicks !== false) { // only apply to linear scale var oldTickAmount = tickAmount, calculatedTickAmount = tickPositions.length; // set the axis-level tickAmount to use below tickAmount = maxTick...
[ "function tickCount() {\n\t\t\tif (svgWidth <= 500) { \n\t\t\t\tbottomAxis.ticks(5);\n\t\t\t\tleftAxis.ticks(5);\n\t\t\t\t}\n\t\t\telse {\n\t\t\t\tbottomAxis.ticks(10);\n\t\t\t\tleftAxis.ticks(10);\n\t\t\t}\n\t\t}", "function setTickInterval(event) \n {\n var xMin = event.xAxis[0].min;\n var xMax...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get index object currently associated with an html id
function getIndObjOfHtmlId(htmlId) { for (var i = 0; i < AllHtmlGridIds.length; i++) { if (AllHtmlGridIds[i] == htmlId) return CurStepObj.allIndObjs[i]; } alert("Internal Bug: HtmlID for Index not fuond for id:" + htmlId); }
[ "function getJouerParIndex(index) {\n let JoueurID = `#Joueur_${index}`;\n return $(JoueurID).val();\n}", "posById(id){\n let slot = this._index[id];\n return slot ? slot[1] : -1\n }", "function getAppIndexById(id) {\n if (!id || typeof id != \"string\") return null;\n \n for (va...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
superSize(123456) //654321 superSize(105) // 510 superSize(12) // 21 If the argument passed through is single digit or is already the maximum possible integer, your function should simply return it.
function superSize(num){ let newNum = num + "" let rev= newNum.split("").sort().reverse().join(""); return parseInt(rev) }
[ "function getLength(string){\n\n\n}", "function get_item_size() {\n var sz = 220;\n return sz;\n}", "function cs_file_size(number){\r\n\t\r\n\tif(number <= 1024){\r\n\t\t\r\n\t\treturn number + 'bytes';\r\n\t\t\r\n\t}else if(number > 1024 && number <= 1048576){\r\n\t\t\r\n\t\treturn (number/1024).toFixed(1) +...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get a specific country and its currency from inside the region.
function getCountryFromRegion(region, country) { for (var c in region) { var countryCurrency = region[c]; if (contains(countryCurrency, country)) { return countryCurrency; } } return null; }
[ "function getCountryFromRegionsMap(country) {\n for (var r in regionsMap) {\n var region = regionsMap[r];\n\n var countryCurrency = getCountryFromRegion(region, country);\n\n if (countryCurrency) {\n return countryCurrency;\n }\n }\n\n return null;\n}", "function ge...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Pops MVS and stores the result as the current modelViewMatrix
function gPop() { modelViewMatrix = MVS.pop() ; }
[ "function gPush() {\r\n MVS.push(modelViewMatrix) ;\r\n}", "function pushMVMatrix() {\n \tvar mvMatrixCopy = mat4.create();\n \tmat4.set(mvMatrix, mvMatrixCopy);\n \tmvMatrixStack.push(mvMatrixCopy);\n }", "function setMV() {\r\n gl.uniformMatrix4fv(modelViewMatrixLoc, false, flatten(modelView...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Object for a Game API system
function GameAPI(gameId, gameName, sessionId, canvas, canvasContainer, assetBaseURL, version, launcher){ console.log(assetBaseURL); this.gameName = gameName; this.assetBaseURL = assetBaseURL; this.version = version; this.canvas = canvas; this.launcher = launcher; v...
[ "function antRPSGame() {\n this.Player1 = new antPlayer('Player1');\n this.Player2 = new antPlayer('Player2');\n this.isReal = false;\n this.bRequiresUpdate = false;\n this.iGameState = 0;\n this.chat = 0;\n this.loser = 0;\n this.winner = 0;\n this.gotime = 0;\n this.bGameOver=false;\n\n} //end antRPSGa...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns a set of row and col slices, or null if we don't care
function slice () { if (settings.vshrink || settings.hshrink) { var slices = {}; if (settings.vshrink) { slices['rows'] = getRows(); } if (settings.hshrink) { slices['cols'] = getCols(); } return slices; } else { return null; ...
[ "getElements() {\n const result = new Set();\n for (const item of this.leftSide.concat(this.rightSide))\n item.getElements(result);\n return Array.from(result);\n }", "function getCrossSlice(startSlice,endSlice)\n{\n var sliceString;\n\n //trying to move z slices from the ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
generates array with no bars needed, with range needed
function generate_RandArray(max, min, no_bars=4){ let lab_array = []; for (let i = 0; i<no_bars; i++){ let rand_val = (Math.random()*(max-min))+min; lab_array.push(rand_val); } return lab_array; }
[ "function createRange(number, value) {\n newArray = [];\n // return string * number;\n\n for (i = 0; i < number; i++) {\n\n newArray.push(value);\n }\n\n return newArray;\n\n}", "function getBars(){\n for(var i = 0; i < dataset.length; i++){\n let height = getHeight(highNumberFor...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Calculates and returns the root mean square of the array.
#rms(array) { const squares = array.map((value) => value * value); const sum = squares.reduce((accumulator, value) => accumulator + value); const mean = sum / array.length; return Math.sqrt(mean); }
[ "function avgValue(array)\n{\n\tvar sum = 0;\n\tfor(var i = 0; i <= array.length - 1; i++)\n\t{\n\t\tsum += array[i];\n\t}\n\tvar arrayLength = array.length;\n\treturn sum/arrayLength;\n}", "function absAvg(arr){\n // arr is a typed array! \n var abs_avg = arr.reduce((a,b) => (a+Math.abs(b))) / arr.length;\n r...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Marks the transaction as failed and makes sure everything in the transaction object is set accordingly. Typically this would be invoked when transaction runner decides to force a transaction to behave as failed.
failTransaction(transaction, reason) { transaction.fail = true; this.ensureTransactionErrors(transaction); if (reason) { transaction.errors.push({ severity: 'error', message: reason }); } if (!transaction.test) { transaction.test = this.createTest(transaction); } transaction.te...
[ "abortTransaction() {\n\t\tthis.isTransacting = false;\n\t\tthis.restoreToPreviousState();\n\t}", "commitTransaction() {\n\t\tthis.isTransacting = false;\n\t\tthis.save();\n\t}", "rejectTransaction() {\n stateTransition(this, this.state.onRejectTransaction);\n }", "async closeWithFailure() {\n aw...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sort series representing histogram by label value.
function sortSeriesByLabel(s1, s2) { var label1, label2; try { // fail if not integer. might happen with bad queries label1 = parseHistogramLabel(s1.label); label2 = parseHistogramLabel(s2.label); } catch (err) { console.log(err.message || err); return 0; } ...
[ "function sortLabels() {\n /** @type {Object[]} */\n var labels = labelsAsJSON.labels;\n\n labels.sort((a, b) => {\n // ascending order by start time\n return a.start - b.start;\n });\n}", "getSortedTags() {\n return this.data.map(series => series.tags)\n .reduce((a, b) => a.concat(b))\n .f...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Split a BCP 47 language tag into locale and extension.
function splitLanguageTag(tag) { var extRe = /(-[0-9A-Za-z](-[0-9A-Za-z]{2,8})+)+$/; var match = %regexp_internal_match(extRe, tag); if (match) { return { locale: tag.slice(0, match.index), extension: match[0] }; } return { locale: tag, extension: '' }; }
[ "static getLanguageName() {\n let twoLetterLangName = global.language.value.toLowerCase().split('-')[0];\n switch (twoLetterLangName) {\n case \"en\":\n return \"english\";\n case \"de\":\n return \"german\";\n case \"es\":\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
gathers all the .propName from each entry in objArray into a single return array
function extractPropFromObjArray(objArray, propName) { propArray = [] for (var i = 0; i < objArray.length; i++) { propArray.push(objArray[i][propName]) } return propArray }
[ "function extractPropArrayFromObjArray(objArray, arrayPropName) {\n propArray = []\n for (var i = 0; i < objArray.length; i++) {\n Array.prototype.push.apply(propArray, objArray[i][arrayPropName])\n }\n return propArray\n}", "function select(array, propName) {\r\n var output = [];\r\n if ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
function to validate appointment form
function ValidateAppointment() { AptDate = document.getElementById("IdDate").value; today = new Date().toISOString().slice(0, 10); // reject past date if (AptDate < today) { document.getElementById("error").innerHTML = "Cannot create past appointments!"; document.getElementById("IdDate").focus(); ...
[ "function validateGetCalendarForm() {\r\n //TODO: Check valid years, etc.\r\n}", "function validateForm() {\n\tif ( noShortCircuitAnd(\n\t\tvalidateItemName(), \n\t\tvalidatePounds(), \n\t\tvalidateOunces(), \n\t\tvalidateQuantity(), \n\t\tvalidateSampleDate()) ) {\n\t\t\n\t\treturn true; //Go ahead and submit...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Computa la stringa del capitolo
function computeStringCapitolo(capitolo) { var res = ''; if(!capitolo || !capitolo.uid) { return res; } res = capitolo.annoCapitolo + '/' + capitolo.numeroCapitolo + '/' + capitolo.numeroArticolo; if(isGestioneUEB) { res += '/' + capitolo.numeroUEB; ...
[ "function initCap (msg) {\n if (msg.length > 0) {\n return msg.toLowerCase().replace(/(?:^|\\s)[a-z]/g, function (m) {\n return m.toUpperCase();\n });\n }\n}", "capitalizar(cadena) {\n if(typeof cadena === \"number\") // Si es número.\n cadena = String(cadena);//Parsear a string.\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
getBoards(); output: [ [ 'name: Digital Marketing Projects', 'id: 348' ], [ 'name: IT Reoccurring ', 'id: 349' ], [ 'name: Dev Tickets', 'id: 25' ] ]
async function getBoards() { let boardsPromise = cw.ServiceDeskAPI.Boards.getBoards(); const [boards] = await Promise.all([boardsPromise]); console.log(Object.keys(boards).map(key => { return [`name: ${boards[key].name}`, `id: ${boards[key].id}`]; })); }
[ "function extractBoardToArray()\n{\n // Clear board array\n initBoardArray();\n\n // Board tiles have these properties : div class=\"board_pusher\" id=\"pusher_x_y\" (0..N-1)\n var tileNodes = document.querySelectorAll('[id*=pusher_]');\n if (tileNodes != null)\n {\n\n for(var i = 0; i < ti...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
`import` adds a stream of quads to the store
import(stream) { stream.on('data', quad => { this.addQuad(quad); }); return stream; }
[ "async import(data) {\n const { database: { name, version }, remove = {}, insert = {} } = data\n\n if (name !== this.database.name) {\n throw new Error(\n `Cannot import data for database ${name} into potentially \\\n incompatible database ${this.database.name}...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Parse xxd output into 8bit bytes. TODO: Shouldn't need this function: just use the bytes directly from `cat` without xxd... How to do this with Node? Example output from xxd: 00000000: 00c0 78a5 0129 f809 0385 01a9 d0a0 0085 ..x..).......... 00000030: 0158 60 .X` Output from function: [ 0,192,120,165,1,41,248,...]
function parseXxdOutput(xxdString) { return xxdString.split("\n").reduce((ac, el) => { if (el.trim() === "") return ac; const notAsciiDisplay = el.split(" ")[0]; const noSpace = notAsciiDisplay.replace(/\s*/g, ""); let byteString = noSpace.slice("00000000:".length); const bytes = []; while (b...
[ "function hex_str_to_byte_array(in_str) {\n var i\n var out = []\n var str = in_str.replace(/\\s|0x/g, \"\")\n for (i = 0; i < str.length; i += 2) {\n if (i + 1 > str.length) {\n out.push(get_dec_from_hexchar(str.charAt(i)) * 16)\n } else {\n out.push(\n get_dec_from_hex...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Merges locals with globals for pug rendering
function merge(locals, res) { var _locals = { siteTitle: Config.get("html-template.title"), siteDescription: Config.get("html-template.description"), siteAuthor: "Calvin 'calzoneman' 'cyzon' Montgomery", csrfToken: typeof res.req.csrfToken === 'function' ? res.req.csrfToken() : '', ...
[ "function merge(locals, res) {\n var _locals = {\n siteTitle: Config.get(\"html-template.title\"),\n siteDescription: Config.get(\"html-template.description\"),\n siteAuthor: \"\",\n cacheBuster: guid(),\n csrfToken: typeof res.req.csrfToken === 'function' ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Para ataques do monstro useMonsterskill: Utiliza uma magia do monstro.
function useMonsterskill(skillName, caster, target) { let message; message = monsterSkills[skillName].skill.bind(caster)(caster, target); monsterSkills[skillName].animation(caster, target); setTimeout(() => { writeBattle(message); fixAllBars(combat); }, 3000); }
[ "function neonObstacleShootBullet(){\n if(bullet1Group.isTouching(neonObstacleGroup)&&ammoMode===\"unlimited\"){\n \n neonObstacleGroup.destroyEach();\n bullet1Group[0].destroy();\n neonObstacleDieSound.play();\n neonObstacleDieSound.setVolume(1.2);\n }\n}", "function countryObstacleShootBullet()...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
getProject returns the current project name. It throws an exception if none is registered.
function getProject() { return settings.getProject(); }
[ "function getProjectKey(projectOrKey){if(typeof projectOrKey==='string'){return projectOrKey;}else if(!projectOrKey){throw new Error(AJS.I18n.getText('bitbucket.web.error.no.project'));}return projectOrKey.getKey?projectOrKey.getKey():projectOrKey.key;}", "function getConfigForProject(projectId) {\n var allPro...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
retrieve the top column in a group of columns
getTopColumn(){ if(this.parent.isGroup){ return this.parent.getTopColumn(); }else{ return this; } }
[ "function top_column(col_idx) {\n table = document.getElementById(\"output_table\");\n data = get_table_data(table); // get the data from the table\n if (data.length == 1) return;\n sorted = data.sort((a, b) => {\n return b[col_idx]- a[col_id...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Refreshes a query by combining matches from all active views and removing matches from deleted views. Returns true if a query got dirty during change detection, false otherwise.
function queryRefresh(queryList) { var queryListImpl = queryList; if (queryList.dirty) { queryList.reset(queryListImpl._valuesTree); queryList.notifyOnChanges(); return true; } return false; }
[ "_checkIfDirty(){\n if (this._isDirty === true){\n this._isDirty = false;\n this._refresh();\n }\n }", "diff(query) {\n if (this.useInitialQuery(query)) {\n return {\n result: this._INITIAL_QUERY.result,\n complete: true\n };\n }\n return sup...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
`_readPrefixIRI` reads the IRI of a prefix declaration
_readPrefixIRI(token) { if (token.type !== 'IRI') return this._error(`Expected IRI to follow prefix "${this._prefix}:"`, token); const prefixNode = this._readEntity(token); this._prefixes[this._prefix] = prefixNode.value; this._prefixCallback(this._prefix, prefixNode); return this._readDeclara...
[ "_readPrefixIRI(token) {\n if (token.type !== 'IRI') return this._error(`Expected IRI to follow prefix \"${this._prefix}:\"`, token);\n\n const prefixNode = this._readEntity(token);\n\n this._prefixes[this._prefix] = prefixNode.value;\n\n this._prefixCallback(this._prefix, prefixNode);\n\n return thi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
readonly attribute calIDateTime recurrenceStartDate;
get recurrenceStartDate() { if ((this.recurrenceInfo) && (!this._newRecurrenceInfo)) { if (this._recurrenceStartDate) { return this._recurrenceStartDate; } } //dump("get recurrenceStartDate: title:"+this.title+", value:"+this._calEvent.recurrenceStartDate); return this._calEvent.recurrenceStartDate; ...
[ "get recurrenceId()\n\t{\n\t\t//dump(\"get recurrenceId: title:\"+this.title+\", value:\"+this._calEvent.recurrenceId);\n\t\treturn this._calEvent.recurrenceId;\n\t}", "get recurrenceInfo()\n\t{\n\n\t\tif (this._newRecurrenceInfo !== undefined) {\n\t\t\treturn this._newRecurrenceInfo;\n\t\t}\n\n\t\tif (this._recu...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
========= MDEC_ExamperiodCheckboxChange ================ PR20220827
function MDEC_ExamperiodCheckboxChange(el_input) { console.log( "===== MDEC_ExamperiodCheckboxChange ========= "); console.log( "el_input", el_input); if (el_input.checked) { mod_MEX_dict.examperiod = get_attr_from_el_int(el_input, "data-field") }; const form_elemen...
[ "function OnInclusionOfConnectorsForSteelBeamBoltedAPillarWithConfinement_Change( e )\r\n{\r\n try\r\n {\r\n var newMeasuresOfEmergencyValue = Alloy.Globals.replaceCharAt( current_structural_elements_id * 13 + 3 , Alloy.Globals.ShedModeDamages[\"MEASURES_OF_EMERGENCY\"] , $.widgetAppCheckBoxShedModeFor...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This funciton selects a random letter from my Psychic array
function getPsychicLetter () { var random = Math.floor(Math.random() *(psychicGuess.length-1)); //Pics random index value from psychicGuess array console.log("Computer's Choice: " + psychicGuess[random]); return psychicGuess[random]; }
[ "function randomlySelectSingleCharacter(array){\n\n var i = Math.floor(Math.random() * array.length);\n \n var randomCharacter = String.fromCharCode(array[i]);\n\n return randomCharacter;\n}", "function chooseword() {\n chosenword = possiblewords[Math.floor(Math.random() * possiblewords.length)].toUpperCase(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Tries to register a measure. If no slot are available return false
function registerMeasure(fromNet , toNet ){ var regID = uniqueRegID(fromNet , toNet); if (!__registered_measures__[regID]){ __registered_measures__[regID]={ fromNet: fromNet, toNet:toNet, numRetries : 0 }; return true; }else{ if (__register...
[ "_addSlot() {\n if (this[_value]) {\n this[_fillElement].appendChild(this[_slotElement]);\n } else {\n this[_trackElement].appendChild(this[_slotElement]);\n }\n }", "function DeviceSlot() {}", "static measure(name, executedFunction) { \n\t\tvar usedTicks = Game.cpu.getUsed();\n\t\texecute...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Update the browser action icon and title
function updateBrowserAction() { var buttonTitle = "Disable Accenture SignOn"; var buttonIcon = "images/icon-48.png"; if( getIsACNUserAgentEnabled() == "false" ) { buttonTitle = "Enable Accenture SignOn"; buttonIcon = "images/gray-icon-48.png"; } chrome.browserAction.setTitle({ ...
[ "function updateIcon(info) {\n chrome.tabs.get(info.tabId, function(tab) {\n // if url gets starred elsewhere, should reflect star status without the need to update(refresh)\n if(typeof urls[tab.url] != \"undefined\" && urls[tab.url]) {\n starredTabs[tab.id.toString()] = true;\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function: getApiTypeByServiceType Maps service type to webServer Server type
function getApiTypeByServiceType (servType) { switch (servType) { case global.SERVICE_ENDPT_TYPE_COMPUTE: return global.label.COMPUTE_SERVER; case global.SERVICE_ENDPT_TYPE_IMAGE: return global.label.IMAGE_SERVER; case global.SERVICE_ENDPT_TYPE_NETWORK: return global.label.NETWOR...
[ "registerService(serviceType) {\n const serviceFactory = new TypeServiceFactory_1.TypeServiceFactory(serviceType);\n this.registerFactory(serviceFactory);\n }", "function getOStackModuleApiVersion (apiType)\n{\n var version = httpsOp.getHttpsOptionsByAPIType(apiType, 'apiVersion');\n if (nu...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Enter a parse tree produced by ObjectiveCPreprocessorParserdirectiveText.
enterDirectiveText(ctx) { }
[ "enterOrdinaryCompilation(ctx) {\n\t}", "function parse_StatementList(){\n\t\n\n\t\n\n\tvar tempDesc = tokenstreamCOPY[parseCounter][0]; //check desc of token\n\tvar tempType = tokenstreamCOPY[parseCounter][1]; //check type of token\n\n\tif (tempDesc == ' print' || tempType == 'identifier' || tempType == 'type' |...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
when button mix is not blocked this function starts
function mixBtnClicked(){ if(($(".container-glass-items").find(".item").length > 2) && ($(".container-glass-items").find(".base").length === 1)){ mixBtn.addClass("mix-press"); //change display of button mix blockBtns = true; //block mix button var ingredients = []; //array for collect data from in...
[ "function _btnWeight() {\n //Working\n console.log(\"doing something\");\n }", "processStartButton() {\n\t\tclearTimeout(this.timer);\n\t\tthis.timer = null;\n\t\tthis.game.switchScreens('play');\n\t}", "function buzzTrggered(event){\n if (self.buzzerState == buzzerState....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Computes the number of units the interval is cleanly comprised of. If the given unit does not cleanly divide the interval a whole number of times, `false` is returned. Accepts start/end, a range object, or an original duration object.
function computeIntervalAs(unit, start, end) { var val; if (end != null) { // given start, end val = end.diff(start, unit, true); } else if (moment.isDuration(start)) { // given duration val = start.as(unit); } else { // given { start, end } range object val = start.end.diff(start.start, unit, true); } ...
[ "function isRangeWhole(range, unit) {\n return range.isSame(expandDateToRange(range.start, unit));\n}", "function duration_within_display_range(range_start, range_end, event_start, event_end) {\n if (event_start < range_start) {\n return duration_seconds_to_minutes(event_end - range_start);\n } else i...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Just cleaning the result chain to have a better use
_cleanResults(results) { const resultsErrored = results.filter(a => a.result === false) return { result: resultsErrored.length === 0, errors: resultsErrored, results, } }
[ "function cleanResultDiv() {\n\t//remove all divs from results div parent\n\twhile ( resultsDiv.firstChild ) resultsDiv.removeChild( resultsDiv.firstChild );\n}", "function cleanup(a) {\n return _.filter(a, function (a) {\n var field = a[0];\n return attr[field];\n });\n }", "function...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
route: GET /:id Retrieves home object with given id
async getHomeById(req, res) { let data = await this.db.home.select.byId(req.params.id).catch(this.throwError); this.sendResponse(res, this.HttpStatus.OK, true, data, "Success retrieving home"); }
[ "function getHomePlanet(planetData, id) {\n fetch(planetData)\n .then(r => r.json())\n .then(parsedPlanet => {\n document.getElementById(`droid-${id}-homeworld`).innerHTML = parsedPlanet.name;\n });\n}", "function showOne(req, res) {\n var walkId = req.params.walkId;\n db.Walks.findById(walkI...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Checks whether enrich function can be applied on the given control or prototype.
function checkLabelEnablementPreconditions(oControl) { if (!oControl) { throw new Error("sap.ui.core.LabelEnablement cannot enrich null"); } var oMetadata = oControl.getMetadata(); if (!oMetadata.isInstanceOf("sap.ui.core.Label")) { throw new Error("sap.ui.core.LabelEnablement only supports Controls with ...
[ "function isLabelableControl(oControl) {\n\t\tif (!oControl) {\n\t\t\treturn true;\n\t\t}\n\n\t\tvar sName = oControl.getMetadata().getName();\n\t\treturn NON_LABELABLE_CONTROLS.indexOf(sName) < 0;\n\t}", "function canApplyServerBehavior(sbObj)\r\n{\r\n var success = true;\r\n if (success)\r\n {\r\n success...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Generates a summary link for the section specified by id, this link describes how many messages of each type can be found in a particular section. The link links, the 'header' of that section.
function generateSummaryLink(sectionId) { //determine section title and section type var sectionTitle = jQuery("[data-header_for='" + sectionId + "']").find("> :header .uif-headerText-span, " + "> label .uif-headerText-span").text(); if (sectionTitle == null || sectionTitle == "") { //fi...
[ "function generateSummaries(id, messageMap, sections, order, newList) {\n var data = getValidationData(jQuery(\"#\" + id), true);\n //if no nested sections just output the fieldLinks\n if (sections.length == 0 || data.isTableCollection == \"true\") {\n for (var key in messageMap) {\n var ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Calculate all populations and save them into population_array vector
function calculate_all_populations(week){ let i = 0; equation_objs.forEach((item, index) => item.set_population( calculate_population(week, index) ) ); }
[ "initializePopulation() {\n for (let i = 0; i < this.solutionsCount; i++) {\n // solution\n this.population.push(this.getRandomSolution())\n\n // fitness value\n this.fitness_values.push(NaN);\n }\n }", "evaluatePopulationFitness() {\n\t\tfor (let i = 0...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
An Environment is a sandbox of schemas thats behavior is different from other environments.
function Environment() { this._id = randomUUID(); this._schemas = {}; this._options = {}; this.createSchema({}, true, "urn:jsv:empty-schema#"); }
[ "function environment() { \n let clientId = process.env.PAYPAL_CLIENT_ID;\n let clientSecret = process.env.PAYPAL_CLIENT_SECRET;\n\n return new checkoutNodeJssdk.core.SandboxEnvironment(\n clientId, clientSecret\n );\n}", "get environment() {\n if (this._enviornment)\n return...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Callback function for SIP sessions (INVITE, REGISTER, MESSAGE...)
function onSipEventSession(e /* SIPml.Session.Event */) { tsk_utils_log_info('==session event = ' + e.type); switch (e.type) { case 'connecting': case 'connected': { txtCallStatus.style.display='block'; var bConnected = (e.type == 'con...
[ "function receiveCallback(data) {\n receiveWhois(session,data);\n }", "function startSession(callback) {\n $.post('/session', participantInfo, function(data) {\n participantInfo.id = data.participantId;\n callback();\n }, 'json');\n}", "function onSessionUserID(user_id) {\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get the north layout options
function getNorthLayoutOptions() { return { // header spacing_open: 0, // cosmetic spacing togglerLength_open: 0, // HIDE the toggler button togglerLength_closed: -1, // "100%" OR -1 = full width of pane resizable: false, slid...
[ "function getEastLayoutOptions() {\n return { // menu selection\n size: 175,\n minSize: 150,\n maxSize: 300,\n spacing_open: 5, // cosmetic spacing\n spacing_closed: 0, // wider space when closed\n togglerLength_clo...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Update the sidebar with a list of trails based on filename given. IDEA: ADD SCROLL WHEEL.
function update_sidebar(filename) { // Empty IDs $( "#open_trails" ).empty(); $( "#closed_trails" ).empty(); // Add open trails. for(var open in filename.waterville_open) { $("#open_trails").append("<div>" + filename.waterville_open[open] + "</div>"); } // Add closed trails. for(var closed in file...
[ "function rerenderSidebar() {\n $.LoadingOverlay('show');\n\n setTimeout(function() {\n\n IBRSDK.renderAndCreateSidebar(\n Dashboard.ibrObject,\n document.getElementById('mainCanvas'),\n document.getElementById('layerList'),\n Dashboard.floorsToSave);\n if (docume...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Handles the Submit/New Question toggle button.
function submitNewToggle() { if (DEBUG) console.log("RAM: submitNewToggle"); var buttonLabel = maindocument.getElementById('submit_new_toggle').innerHTML; var result_element = maindocument.getElementById('quiz_result') if (buttonLabel == 'Submit') { Blockly.Quizme.evaluateUserAnswer(); } else { showQu...
[ "function handleAnswer() { \n $(SUBMIT_BUTTON_CLASS).click(function(event) {\n event.preventDefault();\n var userSelection = $('input[name=\"answerButton\"]:checked').val();\n evalAnswer(userSelection);\n layoutForFeedback();\n incrementQuestion();\n });\n}", "function handleQuestion() {\n $('...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Navigates backwards, prioritized in the following order: 1) Previous fragment 2) Previous vertical slide 3) Previous horizontal slide
function navigatePrev() { // Prioritize revealing fragments if( previousFragment() === false ) { if( availableRoutes().up ) { navigateUp(); } else { // Fetch the previous horizontal slide, if there is one var previousSlide; if( config.rtl ) { previousSlide = toArray( dom.wrapper.quer...
[ "slideBack() {\n this.slideBy(-this.getSingleStep());\n }", "goToPreviousSlide() {\n this._goToSlide(this.previousSlideIndex, false, false);\n }", "function back(x) {\n if (count == 1) {\n document.getElementById(\"slide-controls\").innerHTML = storyControlsPrevDisabled;\n return;\n }\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Parses the arguments of an instruction
function parseFuncInstrArguments(signature) { var args = []; var namedArgs = {}; var signaturePtr = 0; while (token.type === _tokenizer.tokens.name || isKeyword(token, _tokenizer.keywords.offset)) { var key = token.value; eatToken(); eatTokenOfType(_tokenizer.tokens.equa...
[ "_parse(args) {\n const parsed = args.map(arg => {\n if (arg.includes('=')) {\n const [flag, value] = arg.split('=');\n const command = this._commandParser.getCommand(flag);\n return new Argument(command, value);\n } else {\n c...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Fill one product card with the details of the product and remove the invisible class
function fillProductCard(cardId, product){ var prod_img = document.createElement("img"); prod_img.id = cardId + "_img"; prod_img.classList.add("card-img-top"); prod_img.src = product.productData.img[0]; var card_body = document.createElement("div"); card_body.id = cardId + "_card_body"; ...
[ "function createProductCard(product, index) {\n\n // Main dummy container. All elemets are insied this div\n var mainDiv = $('<div/>');\n\n // Created for slick library compatibility in responsive mode\n var slickDiv = $( \"<div/>\").appendTo(mainDiv);\n // Created for slick libra...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
set the initial slider values
function initialSliderValues() { // set initial values for config updateSliderValue('cannyConfigThreshold1Slider', 'cannyConfigThreshold1Textbox'); updateSliderValue('cannyConfigThreshold2Slider', 'cannyConfigThreshold2Textbox'); updateSliderValue('houghConfigRhoSlider', 'houghConfigRhoTextbox'); updateSlide...
[ "function updateSliderValues() {\n\t$('.slider_min').text(CLUB.lowValue);\n\t$('.slider_max').text(CLUB.highValue);\n}", "function resetSlider() {\n currentSlideIndex = 0\n }", "function initializeSliders() {\n rowSlider.value = num_rows;\n colSlider.value = num_cols;\n rowOutput.innerText = num_ro...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
getDroplet returns information about the droplet with the given id
getDroplet(id) { return this._request('GET', 'droplets/' + id); }
[ "createDroplet(dropletData) {\n return this._request('POST', 'droplets', { data: JSON.stringify(dropletData) });\n }", "async function getLodgingDetailsById(id) {\n /*\n * Execute three sequential queries to get all of the info about the\n * specified Lodging, including its photos.\n */\n co...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns POTENTIAL_MATCHES short strings, using the input characters a lot.
function regexShortStringsWith(frequentChars) { var matches = []; for (var i = 0; i < POTENTIAL_MATCHES; ++i) { var s = ""; while (rnd(3)) { s += rnd(4) ? Random.index(frequentChars) : String.fromCharCode(regexCharCode()); } matches.push(s); } return matches; }
[ "function solve(s) {\n\tlet result = \"\";\n\tlet regex = /[aeiou]/;\n\tlet consonants = s\n\t\t.split(\"\")\n\t\t.filter(char => {\n\t\t\treturn !regex.test(char);\n\t\t})\n\t\t.sort((a, b) => {\n\t\t\treturn a.charCodeAt(0) - b.charCodeAt(0);\n\t\t});\n\tlet vowels = s\n\t\t.split(\"\")\n\t\t.filter(char => {\n\t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
____________________________________________________________________________________// This function returns the number of elements identical to x starting at i position in array coordX ____________________________________________________________________________________
function FSS_GetNumberOfIdenticalXValueFrom(i, x) { var j, k, n; // j = i+1; k = 1; n = this.coordX.length; while((j < n) && (this.coordX[j] == x)) { k += 1; j += 1; } return k; }
[ "function getCount(objects) {\n let i = 0;\n for ( let j = 0; j < objects.length; j++ ) {\n if ( objects[j].x === objects[j].y ) {\n i++;\n }\n }\n return i;\n}", "function solution(X, A) {\n var numberOfX = A.filter(function(value) {\n return value === X\n }).length\n\n var count = ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
//////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////// / Impressions time series ////////////////////////////////////////////////////////////////////////////...
function ImpressionsTimeSeries() { var self = this; this.loading = false; this.loadData = function() { self.loading = true; Restangular .one('campaign_reports', ctrl.campaignId) .customGET('impressions_time_series') .then(function(re...
[ "function CumulativeImpressionsTimeSeries() {\n var self = this;\n this.loading = false;\n\n this.loadData = function() {\n self.loading = true;\n Restangular\n .one('campaign_reports', ctrl.campaignId)\n .customGET('cumulative_impressions_time_series...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Renders difficulty status depending on player's selected difficulty
function renderDifficulty(diff) { // string for qualitative level given numerical level of difficulty var level; // set level according to numerical difficulty switch (diff) { case 1: level = "n Easy "; break; case 4: level = " Medium "; b...
[ "function updateDifficultyText() {\r\n if (difficulty === 0) {\r\n $($difficulty).text('Easy');\r\n updateScorecardColor('Easy');\r\n $diffButton.removeClass('challening');\r\n $diffButton.removeClass('impossible');\r\n $diffButton.addClass('easy');\r\n $titleBar.removeClass('challe...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This function displays a message when there are no products
function displayEmpty() { productContainer.empty(); var messageH2 = $("<h2>"); messageH2.attr('id', 'no-product'); messageH2.html("No products have been added that match your search yet. Check back regularly to see new products! <br> Try a different <a href='/index'>search.</a>"); ...
[ "function displayEmpty() {\n checkoutContainer.empty();\n var messageH2 = $(\"<h2>\");\n messageH2.css({ \"text-align\": \"center\", \"margin-top\": \"50px\" });\n messageH2.html(\"No purchases yet , navigate <a href='/view_products'>here</a> if you wish to purchase a product.\");\n checkou...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Draw the actions on the form, if any.
buildActionBox() { if ((this.actions) && (this.actions.length > 0)) { this.actionbox = document.createElement('div'); this.actionbox.classList.add('actions'); for (let action of this.actions) { if ((action.cansubmit) && (action.submits)) { ...
[ "drawExtraUI() {\n // draw the button for canceling ability if an ability is being used if it has not been used partly\n if (this.situation === \"ability\") {\n if (currentAbility.currentStep === 1) {\n push();\n rectMode(CENTER);\n noStroke();\n // if moused over, it is highl...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get dropdown list and set collapse property to true. Call to collapseUtils() with predefined type and speed
setCollapseUtils() { const list = this.getDropdownList(); if (list.length > 0) { list.forEach(x => { x.collapse = true; }); const manyDropdowns = list.length > 1; this.shadowRoot.addEventListener('set-collapse', component => { collapseUtils({ component, list, ...
[ "function collapseLists() {\n\t\t$('.subpageList').find('li:has(ul)')\n\t\t\t.addClass('collapsed')\n\t\t\t.children('ul').hide();\n\t}", "function tree_collapse() {\n let $allPanels = $('.nested').hide();\n let $elements = $('.treeview-animated-element');\n\n $('.closed').click(function () {...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sends a message to all teams to announce that the game is almost over and sets the current location of all games to the end location of this bot.
async enterEndPhase() { let message = "Het spel is bijna gedaan. Kom nu naar de tuin!"; for (const [key, game] of Object.entries(this.games)) { game.currentLocation = this.endLocation; } console.log("Starting end phase of game."); let teamsArray = this.getTeamsAsArray...
[ "async endAllGames() {\n this.ended = true;\n for (const [key, game] of Object.entries(this.games)) {\n game.ended = true;\n game.currentLocation = this.endLocation;\n }\n let message = \"Het spel is gedaan.\";\n this.sendMessageToAllTeams(message);\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Visit a parse tree produced by PlSqlParsertype_body.
visitType_body(ctx) { return this.visitChildren(ctx); }
[ "visitType_body_elements(ctx) {\n\t return this.visitChildren(ctx);\n\t}", "visitProcedure_body(ctx) {\n\t return this.visitChildren(ctx);\n\t}", "visitReplace_type_clause(ctx) {\n\t return this.visitChildren(ctx);\n\t}", "visitCreate_procedure_body(ctx) {\n\t return this.visitChildren(ctx);\n\t}", "vis...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates an edit view to edit the element in an overlay with the edit context template This allows to make invisible properties editable
function Edit (view, clb) { view.on('edit', function () { var editNode = document.createElement('div'); editNode.setAttribute('x-context', 'edit'); ContentElement( { el: editNode, id: view.getId(), storage: vie...
[ "toggleEdit() {\n this.toggleProperty('isEditing');\n }", "handleEdit(event) {\n console.log('inside handleEdit');\n this.displayMode = 'Edit';\n }", "createEditButton(index) {\n let scope = this;\n let editButtonElement = document.createElement('button');\n editButtonElement.c...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
openEvent(): function for dispatching openinterface event
function openEvent() { var event = new Event('open-interface'); document.dispatchEvent(event); }
[ "_onOpen(ev) {\n ev.getData().set(this._tree.getOpenProperty(), true);\n }", "function onOpen(event){\n\t\tvar oQuickViewContent = event.getSource().getContent()[0];\n\t\t// Data is loaded and content is rendered at this point of time, \n\t\t// so call the setKeyboardNavigation function directly\n\t\t//se...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
create links to display/reset the log
function addLinks(pvpLogDiv) { //------- first row of links var linksdiv = document.createElement("div"); linksdiv.id = "pvp_fight_log_links_mod"; linksdiv.style.width = "100%"; linksdiv.style.margin = "7px 0px 0px 5px"; thediv = document.createElement("div"); //NOT NEEDED thediv.style.cssFloat =...
[ "function setupLinks() {\n $('#channels a').click(function(event){\n var elem = $(event.currentTarget);\n var baseUrl = window.location.href.split('#')[0];\n var newUrl = baseUrl + elem.attr('href');\n location.replace(newUrl);\n location.reload();\n });\n }", "function build_sym_l...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Combine height, metallic, roughness and ambient occlus into one map
function combineMaps(gl) { // Combine height, metallic, roughness and ambient occlussion let height = { map: this._shaderParameters.height.map, channel: this._heightChannel }; let metallic = { map: this._shaderParameters.metallic.map, chann...
[ "getWorlMapWithColors() {\n\t\t\treturn Object.keys(this.getWorldMapData).reduce((acc, key) => {\n\t\t\t\tacc[key] = this.getWorldMapData[key];\n\t\t\t\tacc[key].color = this.getColor(acc[key].value);\n\t\t\t\treturn acc;\n\t\t\t}, {});\n\t\t}", "function populateMountains() {\n\tmountains = [];\n\tfor (i = 0; i ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Update heap item i
function heapUpdate(i, w) { var a = heap[i] if(weights[a] === w) { return i } weights[a] = -Infinity heapUp(i) heapPop() weights[a] = w heapCount += 1 return heapUp(heapCount-1) }
[ "function heapUpdate(i, w) {\n var a = heap[i]\n if(weights[a] === w) {\n return i\n }\n weights[a] = -Infinity\n heapUp(i)\n heapPop()\n weights[a] = w\n heapCount += 1\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get a post, req.params: post id (pid)
function getPost(req, res) { const pid = parseInt(req.params.pid, 10); shared.verifyPID(req, res, () => { res.json(db.posts.feed[pid]); }); }
[ "function getSpecificProjectPosts(project_id, callback){\n var sql = \"SELECT * FROM public.posts WHERE project_id = '\"+ project_id +\"'\";\n pool.query(sql,function(err, result){\n console.log(\"querying DB\");\n if(err){\n console.log(\"An err with the db ocurred\");\n c...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
It doesn't make sense to render buttons when the results should be shown. Thus the result bars consist of pure divs. This allows for more flexible designs.
renderResults() { return ( <div className={cx(styles.resultBackgroundBar, this.props.highlight && styles.resultHighlight)}> <span className={styles.resultNumber}> {this.props.answerText}: {this.props.answerCount} </span> <div classN...
[ "barMethod() {\n const wide = Math.abs(this.props.qual.score / 10.0).toString() + \"vw\";\n const color = this.props.qual.color;\n let style1 = {\n width: wide,\n backgroundColor: color,\n paddingTop: \"0.3vw\",\n paddingBottom: \"0.3vw\"\n };\n\n let style3 = {\n marginLeft:...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
From a RingBuffer, build an object that can enqueue a parameter change in the queue.
constructor(ringbuf) { if (ringbuf.type() != "Uint8Array") { throw "This class requires a ring buffer of Uint8Array"; } // const SIZE_ELEMENT = 5; this.ringbuf = ringbuf }
[ "function buffer () {\n return {\n id: nextId(),\n type: 'buffer',\n inputs: Object.seal([pin()]),\n outputs: Object.seal([pin()])\n }\n}", "function PQueueInit() {\n\treturn new buckets.PriorityQueue();\n}", "function Ring () {\n this.first = null;\n}", "static create(arr) {\n const q...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Prepend the stub date to any unpinned content
function prependStubDate(){ $(this).find('.stub-date').prependTo(this); }
[ "function appendStubDate(){\n\t\tvar $this = $(this);\n\t\t$this.find('.stub-pub-info').append($this.find('.stub-date'));\n\t}", "function _removeDayNoteHeaders() {\r\n var $dayNumberOfHeaderNotes = $(\".day-number-of-header-note\");\r\n $dayNumberOfHeaderNotes.each(function( i ) {\r\n var dayNumber = ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
LINEUP STATE HELPERS findMinRaiseAmount
findMinRaiseAmount(lineup, dealer, lastRoundMaxBet, state) { if (!lineup || dealer === undefined) { throw new Error('invalid params.'); } const lastRoundMaxBetInt = parseInt(lastRoundMaxBet, 10); // TODO: pass correct state const max = this.getMaxBet(lineup, state); if (max.amount === last...
[ "minAmount() {\n if (this.props.marketPairData.minimum) {\n return this.props.marketPairData.minimum;\n } else return 0;\n }", "low() {\n let mark = Object.values(marks[0]).map(element => {\n return parseInt(element);\n });\n return Math.min(...mark);\n }", "getOrderMinAmount() {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
CreditCardTrackData() Constructor for CreditCardTrackData objects. Takes one argument which should be a string of track data as returned by a card reader (see for information about the format of track data). A CreditCardTrackData object can be used to parse a string of card data into strings for: format_code number exp...
function CreditCardTrackData(track_data) { this.fields = ['format_code', 'number', 'expiration', 'last_name', 'first_name', 'service_code'] this.track_data = track_data this.parse() this.CENTURY = "20" }
[ "constructor(_data, _blockhash, _prevhash){\n this.timestamp = Date.now()\n this.data = _data\n this.prevHash = _prevhash\n this.nonce = nonce ++\n this.blockHash = _blockhash\n }", "parseTrack() {\n\t\tlet done = false;\n\t\tif (this.fetchString(4) !== 'MTrk') {\n\t\t\tconso...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns the number of images that have been loaded
getNumberOfImagesLoaded(){ return this.loadedImages.length; }
[ "function imageLoaded() {\n imagesLoaded++\n if (imagesLoaded == totalImages) {\n allImagesLoaded()\n }\n }", "function loadspriteCount() {\n\treturn $(i18n.loadspriteElement).get().length;\n}", "function imageLoaded() {\n noOfImageLoaded++;\n if (noOfImageLoaded == 10) {\n onLoadF...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Pretty print a percent value
function format_percent(percent) { return Number(percent * 100).toFixed(2) + ' %'; }
[ "function format_percent(val) {\n return (val * 100).toFixed(places) + \"%\";\n}", "getPercentage(bookmark) {\n var cco = bookmark.currentChapterOrder;\n var tc = this.props.book.totalChapter;\n var st = bookmark.scrollTop;\n var sh = bookmark.scrollHeight;\n var pt = cco * 100 / tc + 100 * ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Created by Hendrik Strobelt (hendrik.strobelt.com) on 1/28/15. Modified by Alex Bigelow (alex.bigelowsite.com) on 9/25/15. / ====================================================== We follow the vis template of init wrangle update ====================================================== AgeVis object for HW4
function AgeVis(_parentElement, _data, _metaData) { /** * A word about "this": * * The meaning of "this" can change from function call to function call; the way * we have implemented the class, "this" refers to the AgeVis class * in each of the AgeVis.prototype.xxxxxxxx = functions. * ...
[ "function ageUp(){\n person.age++;\n showPerson();\n}", "function calcAge(el) {\n return 2016 - el;\n}", "function getCharacteristicRanges() {\n character.MiddleAge = Math.round((character.MaxAge - character.AdultAge) / 4) + character.AdultAge;\n character.OldAge = Math.round((character.MaxAge - ch...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Filter modules by name
function filter(...modules) { return modules.map(name => DEPENDENCIES[name]) }
[ "function skipModule (name) {\n var i, len;\n if (!skipModules) {\n return;\n }\n for (i = 0, len = skipModules.length; i < len; ++i) {\n // Accept a path prefix as well.\n if (name.indexOf(skipModules[i]) === 0) {\n return true;\n }\n }\n }", "function src(...modules) {...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns index of the cell at a given location. TODO(vasiliy): Do we need this?
GetCellIndexAt(x, y) { let x_idx = parseInt(x / this.cell_size); let y_idx = parseInt(y / this.cell_size); if (x_idx >= 0 && x_idx < this.num_cells_in_row && y_idx >= 0 && y_idx < this.num_cells_in_row) { return y_idx * this.num_cells_in_row + x_idx; } else { return null; } }
[ "getColumnIndex(): number {\n const { row, cell } = this;\n const cells = row.nodes;\n\n return cells.findIndex(x => x === cell);\n }", "function getBlockIndex() {\n log.debug(\"CALL: getBlockIndex()\");\n for (var index = 0; index < path.length; index++) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
INTERNAL: Get an index of an `value` in a sorted `array` by grouping search by `shift`. NOTE: This uses binary search algorithm for fast removals.
function _arrayIndexOfSorted(array, value, shift) { ngDevMode && assertEqual(Array.isArray(array), true, 'Expecting an array'); let start = 0; let end = array.length >> shift; while (end !== start) { const middle = start + ((end - start) >> 1); // find the middle. const current = array[m...
[ "function binarySearchWithShift (nums, value, shift) {\n let start = 0;\n let end = nums.length - 1;\n\n while (start <= end) {\n let medium = Math.floor((start + end) / 2);\n let mediumWithShift = (medium + shift) % nums.length;\n\n if (nums[mediumWithShift] === value) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Reset marker icon based on place type
function resetIcon(marker) { let type places.map((place) => { if (place.title === marker.title) { type = place.type } })[0] marker.setIcon(`${type}.png`) }
[ "function resetMarkers() {\n markers.forEach((marker) => {\n marker.setIcon('likes.png')\n marker.setAnimation(null)\n })\n }", "function setIcon(){\n\tif(type == goalIcon){\n\t\tmarker.setIcon(goal);\n\t\tfinalDestinationMarker = true;\n\t}\n\telse if(type == positiveIcon)\n\t\tmarker.setIcon(po...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
exports Constructs a pipeline that can be used by an ES6 Loader to load CommonJS modules. This pipeline may be extended and customized, as needed, to load other types of modules.
function Pipeline () { return { normalize: normalize, resolve: resolve, fetch: fetch, translate: translate, link: link }; }
[ "function Pipeline(props) {\n return __assign({ Type: 'AWS::CodePipeline::Pipeline' }, props);\n }", "function Pipeline(props) {\n return __assign({ Type: 'AWS::DataPipeline::Pipeline' }, props);\n }", "function register(loader) {\n if (typeof indexOf == 'undefined')\n in...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get the most reliable keysym value we can get from a key event if char/charCode is available, prefer those, otherwise fall back to key/keyCode/which
function getKeysym(evt){ var codepoint; if (evt.char && evt.char.length === 1) { codepoint = evt.char.charCodeAt(); } else if (evt.charCode) { codepoint = evt.charCode; } else if (evt.keyCode && evt.type === 'keypress') { // IE10 stores...
[ "function determineKeyPress(keycode) {\n switch (keycode) {\n case 49: return 1;\n case 50: return 2;\n case 51: return 3;\n case 52: return 4;\n case 53: return 5;\n case 54: return 6;\n case 55: return 7;\n case 56: return 8;\n case 57: return 9;\n }\n return 0;\n}", "function test...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
CREATE PANEL LAYERS ends MOVE ELEMENTS TO BACK LAYER Called from moveBackgroundElements. Arg is a group of either shapes or strings. In each case, the contents are transferred to the new backLayer.
function moveElementsToBackLayer(fromGrp) { var target = fromGrp.parent; var piCount = fromGrp.pageItems.length; for (var piNo = piCount - 1; piNo >= 0; piNo--) { var pItem = fromGrp.pageItems[piNo]; // NOTE: strings end up stacked backwards -- re-order if (pItem.name.search('string') >= 0) { ...
[ "function processBackgroundElements(mainGroup, backLayer) {\r\n // Args are the top-level main group (child of the SVG's forced 'Layer 1');\r\n // and the target background layer\r\n var bgMoved = true;\r\n try {\r\n // Get the SVG's background group, which is a child of the main group\r\n var backGroup =...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Converts the list of city tracts to a GeoJson
function tractList2GeoJson(tractList) { var geoJson = { "type": "FeatureCollection", "properties": { "maxPopDensity": 0, "maxEmpDensity": 0 }, "features": [] } for(var i = 0; i < tractList.length; i++){ v...
[ "getGeoJson(mode) {\n const stops = this.getGeoJsonStops(mode).features;\n const edges = this.getGeoJsonEdges().features;\n \n // Append the edge features to the stop features\n const geoJson = stops.concat(edges);\n \n return {\n 'type': 'FeatureCollection',\n 'features': geoJson\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
ensure all active items are fetched
function ENSURE_ACTIVE_ITEMS(_ref4) { var dispatch = _ref4.dispatch, getters = _ref4.getters; return dispatch('FETCH_ITEMS', { ids: getters.activeIds }); }
[ "fetchItems(store) {\n let query = encodeURI(this.state.query)\n let id = store['id']\n let request = `api/search?q=${query}&id=${id}`\n console.log(request)\n fetch(request)\n .then(function(response){\n return response.json()\n })\n .then((items) => {\n let activeStores = this.st...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function to map incoming location to database location
function mapLocToDBLoc(mapLoc) { console.log('In mapLocToDBLoc() function.'); var locStrings = mapLoc.replace(/\s+/g, "").replace("(",""). replace(")","").split(","); var DBLoc = []; DBLoc[0] = parseFloat(locStrings[0]); DBLoc[1] = parseFloat(locStrings[1]); return DBLoc; }
[ "function parseLocationInfo(location) {\n for (const key in LOCATIONS) {\n const abbr = location.substring(0, key.length)\n if (key.toLowerCase() == abbr.toLowerCase()) {\n const room = location.substring(key.length).trim()\n const { name, num } = LOCATIONS[key]\n return `(${num}) ${location} ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Processes the Object passed in Sass's `options.functions`. This is the main method, which will be called with the instance's `convert()` method.
_wrapObject(obj, options) { if (kindOf(obj) !== 'object') { throw new Error('JSFunctionsToSass - pass an object in the following format:\n{\n \'sass-fn-name($arg1: 0, $arg2: 6)\': function(arg1, arg2) {\n ...\n }\n}'); // prettier-ignore } const newObj = {}; options = Object.assign({}, this._options, ...
[ "compileSass () {\n const onCompiled = function (err, result) {\n if (err) {\n return system.logger.error(`AssetManager: Failed to compile SASS from ${this.mainFile}, reason: ${err.message}`, err);\n }\n // No errors during the compilation, write this result on...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }