query
stringlengths
9
34k
document
stringlengths
8
5.39M
negatives
listlengths
19
20
metadata
dict
Return a JavaScript Date for the given UTC time, offsetting by the time zone specified by the forecast.
function getDateFromForecastTime(forecast, time) { let timeMilliseconds = time * 1000; // The forecast timezone offset has the opposite sign of the offset we get // back from JavaScript's getTimezoneOffset. let forecastOffsetHours = -forecast.offset; let forecastOffsetMilliseconds = forecastOffsetHours * MI...
[ "async utcToLocalTime(utcTime) {\n let dateIsoString;\n if (typeof utcTime === \"string\") {\n dateIsoString = utcTime;\n }\n else {\n dateIsoString = utcTime.toISOString();\n }\n const res = await spPost(TimeZone(this, `utctolocaltime('${dateIsoString...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
a b c d e f a b c d e stack: [a, b] stack: [a, b] returns a node at the half point
function findHalf(head, stack) { var runner1, runner2; runner1 = runner2 = head; while (runner2) { stack.push(runner1.value); runner1 = runner1.next; runner2 = runner2.next; runner2 = runner2.next; if (!runner2 || !runner2.next) break; } while (runner2 && runner2.next) { runner1 = ru...
[ "swap() {\n const { top, stack } = this;\n const tmp = stack[top - 2];\n\n stack[top] = stack[this.top];\n stack[this.top] = tmp;\n }", "function movePiece(startStack, endStack) {\n let blockToMove = stacks[startStack].pop();\n stacks[endStack].push(blockToMove);\n return stacks;...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
prints the entire network in console
printConsole() { for (let layer = 0; layer < this.nodes.length; layer++) { for (let node = 0; node < this.nodes[layer].length; node++) this.nodes[layer][node].printConsole(); } }
[ "print() {\n for (let layer = 0; layer < this.nodes.length; layer++) {\n for (let node = 0; node < this.nodes[layer].length; node++)\n this.nodes[layer][node].print();\n }\n }", "printNodes() {\n for (let layer = 0; layer < this.nodes.length; layer++) {\n for (let node = 0; node < this....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
issueName > String projName> String descr > String
function updateIssueDataModel (issueName, projName, descr) { return { name : issueName, projname : projName, descr : descr } }
[ "function createIssueLabel(labelName , projName){\n return {\n labelName : labelName,\n projname : projName\n }\n}", "function Project (ID, projectName, tasks) {\n\t\t/* solve problem of retriving data from db later */\n\t\tthis.ID = ID;\n\t\tthis.projectName = projectName;\n\t\tthis.tasks = t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Patches the 'scrollBy' method on the Element prototype
function patchElementScrollBy() { Element.prototype.scrollBy = function (optionsOrX, y) { handleScrollMethod(this, "scrollBy", optionsOrX, y); }; }
[ "__patchWheelOverScrolling() {\n this.$.selector.addEventListener('wheel', (e) => {\n const scrolledToTop = this.scrollTop === 0;\n const scrolledToBottom = this.scrollHeight - this.scrollTop - this.clientHeight <= 1;\n if (scrolledToTop && e.deltaY < 0) {\n e.preventDefault();\n } els...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Deduces numer of elements in a JavaScript container. Autodeduction for ES6 containers that define a count() method Autodeduction for ES6 containers that define a size member Autodeduction for Classic Arrays via the builtin length attribute Also handles objects, although note that this an O(N) operation
function count(container) { if (!isObject(container)) { throw new Error(ERR_NOT_OBJECT); } // Check if ES6 collection "count" function is available if (typeof container.count === 'function') { return container.count(); } // Check if ES6 collection "size" attribute is set if (Number.isFinite(contai...
[ "function len( obj )\n {\n if ( undefined === obj.length && \"number\" !== typeof obj.length )\n { return undefined; }\n \n return obj.length\n }", "function UBound(arr, dm) {\n if (!dm || dm==null || dm<1) dm=1;\n dm--;\n var rv=null;\n if (dm==0) {\n try { arr[0]==null; rv=Object.k...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Modify project button background based on click
function formatProjectButtonsBackground(clickedButton) { $('.project-item').each(function() { $(this).css("background","transparent"); }) if (clickedButton != null) { clickedButton.css("background", "linear-gradient( -45deg, #FFDA3B 0%, #DB3C6D 100%)"); } }
[ "function changeButtonBg(color){\r\n document.getElementById(\"btn\").style.background = color;\r\n}", "function goBlue() {\n $target.css({\n backgroundColor: 'blue'\n });\n }", "function mouseClickBtnRandom() {\n clickColor =\n \"rgb( \" +\n Math.floor(Math.random() * (0 + 255)) +\n \" \...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Set up the clues
function setup_clues () { game . board . forEach (function (row, x) { row . split ('') . forEach (function (char, y) { board [id (x, y)] . value = char; }) }) }
[ "function prepare(env) {\n\n var speech_properties = {\n lang: 'en-US',\n voice: voices.filter(function(voice) {\n return voice.name == 'Alex';\n })[0],\n rate: 1\n }\n\n // Grab selected cell\n var selected_cell = env.notebook.get_selected_cell();\n\n // Get the type of th...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Event handler for the 'snooze' event. Snoozes the given alarm by the given number of minutes using the alarm service.
function onSnoozeAlarm(event) { // reschedule alarm: var duration = Components.classes["@mozilla.org/calendar/duration;1"] .createInstance(Components.interfaces.calIDuration); duration.minutes = event.detail; duration.normalize(); getAlarmService().snoozeAlarm(event.targ...
[ "function snooze() {\r\n stopAlarm();\r\n alarmTimer = setTimeout(initAlarm, 300000); // 5 * 60 * 1000 = 5 Minutes\r\n}", "function snoozeAlarm (time) {\n console.log(`The alarm for ${time} has been changed to ${time + 1}`)\n}", "function openSnoozeWindow(event, aContainerItem) {\n const uri = \"chrome:...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Changes state.canvas to the select screen
function selectScreen(state) { //Stores dynamic components corresponding to each character so they can be switched around for different selected chars var selectBoxes = []; var charDisplays = []; var skillDisplays = []; var charNames = []; var selected = 0; //Adds and renders dynamic conten...
[ "function drawSelectionChanged() {\n drawType = drawSelector.value();\n setImage();\n}", "function setSelectMode() {\n mode = modes.SELECT\n GameScene.setRegionSelectPlaneVis(true)\n }", "function initSelection() {\n canvas.on({\n \"selection:created\": function __listenersSelectionCr...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get Alerts from MBTA and save them to storage
function getAlertsFromMBTA() { if (!Alert) return; // Delete alerts older than a threshold since we don't need them any more. var d = new Date(); d.setHours(d.getHours() - config.dbRetentionInHours); Alert.destroy({ where: { updateDate: { $lte: d } } }); // Get alerts ...
[ "storeNotifications() {\n try {\n fs.writeJSONSync(path.join(this.dataDir, 'notifications.json'), this.currentNotifications);\n } catch (e) {\n this.log.error(`${this.logPrefix} Could not write notifications.json: ${e.message}`);\n }\n }", "getAlerts() {\n return [...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets the current highcontrastmode for the page.
getHighContrastMode() { if (!this._platform.isBrowser) { return 0 /* NONE */; } // Create a test element with an arbitrary background-color that is neither black nor // white; high-contrast mode will coerce the color to either black or white. Also ensure that // appen...
[ "function getDarkMode() {\n chrome.storage.local.get(\"darkMode\", results => {\n let mode = results[\"darkMode\"];\n if (mode == null) {\n mode = \"light\";\n chrome.storage.local.set({ [\"darkMode\"]: mode });\n }\n if (mode === \"dark\") {\n darkModeButton ? (darkModeButton.innerText ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
If return null/undefined, indicate that should not use datasetModel.
function getDatasetModel(seriesModel) { var option = seriesModel.option; // Caution: consider the scenario: // A dataset is declared and a series is not expected to use the dataset, // and at the beginning `setOption({series: { noData })` (just prepare other // option but no data), then `setOption({series: ...
[ "function getDatasetModel(seriesModel) {\n var option = seriesModel.option;\n // Caution: consider the scenario:\n // A dataset is declared and a series is not expected to use the dataset,\n // and at the beginning `setOption({series: { noData })` (just prepare other\n // option b...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
take a validation config and put it into standardized format for clean merging
function standardizeValidationObj(validation = {}) { const output = {}; const customKeys = Object.keys(validation).filter( key => validatorKeys.indexOf(key) < 0 ); customKeys.forEach(key => { output[key] = validation[key]; }); validatorsArray.forEach(validator => { const { key, showKey, otherKe...
[ "formatConfig () {\n _.defaults(this.config, {debug: false})\n\n const hasSlackAppConfigs = this.config.clientId && this.config.clientSecret && (this.config.server)\n\n this.config.connectedTeams = new Set()\n\n this.config.isSlackApp = !this.config.slackToken\n\n if (!this.config.slackToken && !hasS...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Redirects form to a new window.
function redirectWindow(myForm) { var now = new Date(); var timeNow = now.getTime(); var name = "report_"+timeNow; window.open("about:blank", name, "toolbar=yes,menubar=yes,scrollbars=yes,resizable=yes,status=yes,location=yes"); myForm.target = name; return true; }
[ "function redirect(url, newWindow) {\n if (newWindow) {\n window.open(url);\n } else {\n window.location = url;\n }\n}", "function submitURLFieldForm() {\n var url = document.getElementById('addressfield').value;\n if (!url.match(/^[a-zA-Z]+:\\/\\//)) {\n url = 'http://' + url;...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Total guests don't count the number of infants
getTotalGuests() { return this.state.guests[ADULTS] + this.state.guests[CHILDREN]; }
[ "function guestCount() {\n let attendingGuests = 0;\n let unconfirmedGuests = 0;\n let totalGuests = 0;\n const filterCheckboxArea = document.querySelector('.filterArea');\n\n for (let i = 0; i < ul.children.length; i += 1) {\n const guestStatus = ul.children[i].className;\n if (guestSt...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Renders the lesson tabs
renderLessonTabs() { let lessons = this.state.lessons; return lessons.map( (lesson) => { return <LessonTabItem key={lesson.id} lesson={lesson} courseId={this.props.courseId} ...
[ "function showTab(tabName) {\n var template = document.querySelector(tabName);\n\n const params = new URLSearchParams(window.location.search);\n if (tabName === '#announcements') {\n template.content.querySelector('#club-name').value = params.get('name');\n template.content.querySelector('#schedule-club-na...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
get quantity selected if undefined set a default value
function showquantity(){ let getQuantitySelected = document.querySelector("#quantity-selection").value; console.log(getQuantitySelected) if(getQuantitySelected == null || getQuantitySelected == undefined){//set default value if user don't choose the quantity return getQuantitySelected = 1 ...
[ "get select_value() {\n return (this.select == undefined) ? this.select_config.default : this.select.selectedOption;\n }", "function getpsPrice(product) {\n\n let $prod = $(product);\n let qty = $prod.find(\"option:selected\").data(\"qty\");\n let pprice_to = Number($prod.find(\"option:selected\").da...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Create a new asset type.
function createAssetType(axios$$1, assetType) { return restAuthPost(axios$$1, 'assettypes/', assetType); }
[ "function createAsset(axios$$1, payload) {\n return restAuthPost(axios$$1, '/assets', payload);\n }", "function createAreaType(axios$$1, areaType) {\n return restAuthPost(axios$$1, 'areatypes/', areaType);\n }", "static add(fileAsset){\n\t\tlet kparams = {};\n\t\tkparams.fileAsset = fileAsset;\n\t\tretu...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Tracks Score using hasVisited attribute of localeArray
function checkScore() { if (locArray[currentLocation].hasVisited === false) { locArray[currentLocation].hasVisited = true; score = score + 5; } else if (locArray[currentLocation].hasVisited === true) { score = score + 0; } }
[ "function calculateScore() {\n for (var i = 0; i < quizLength; i++){\n if (userAnswers[i][1]) {\n quiz[\"questions\"][i][\"global_correct\"]+=1;\n score++;\n }\n quiz[\"questions\"][i][\"global_total\"]+=1;\n }\n}", "__score(){\n this.p1Score = 0;\n this.p2Score = 0;\n\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
In absolute mode, the operand is a littleendian 2byte address.
absolute() { this.incrementPc(); let lo = this.ram[this.cpu.pc]; this.incrementPc(); let hi = this.ram[this.cpu.pc]; return hi * 0x0100 + lo; }
[ "absoluteX() {\n this.incrementPc();\n let lo = this.ram[this.cpu.pc];\n this.incrementPc();\n let hi = this.ram[this.cpu.pc];\n\n let target = (hi * 0x0100 + lo + this.cpu.xr) & 0xffff;\n\n if ((target & 0xff00) != (hi * 0x100)) {\n this.penaltyCycles += 1;\n }\n\n re...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
find all objects with the preselected IDs preselected_ids: array of IDs
function find_preselections(preselected_ids, datasource) { var pre_selections = [] for (index in datasource) for (id_index in preselected_ids) { var objects = find_object_with_attr(datasource[index], { key: 'id', val: preselected_ids[id_index].id }); if (ob...
[ "get selectedDataItems() {\n return this.composer.queryItemsByPropertyValue('selected', true);\n }", "function selectAllJob() {\n const selected_ids = floristjob.map((x) => x.order_item_id)\n setSelJob(selected_ids)\n }", "function removeSelectVertices(uid_set) {\n uid_set.forEach((uid) ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This method use to remove error of cvv from credit, debit & emi.
function removeErrorCvv(self) { if (self.value.length === 3 || self.value.length === 4) { document.getElementById(self.parentNode.id).style.border = '1px solid #CCC'; document.getElementById('error_' + self.id).style.display = 'none'; } else if (self.value.length > 0 && self.value.length < 3) { ...
[ "function cvvErrorTest(){\n if(regexCvv.test(cvv.val()) === false){\n cvvError.show();\n return 0;\n }\n else{\n cvvError.hide();\n return 1;\n }\n}", "function removeError(self) {\n var str = document.getElementById(self.parentNode.id).style.border;\n if (self.value !== '' && str.search(\"2...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Use this to register only the HTML and MathML builders for a function (e.g. if the function's ParseNode is generated in Parser.js rather than via a standalone handler provided to `defineFunction`).
function defineFunctionBuilders(_ref2) { var type = _ref2.type, htmlBuilder = _ref2.htmlBuilder, mathmlBuilder = _ref2.mathmlBuilder; defineFunction({ type: type, names: [], props: { numArgs: 0 }, handler: function handler() { throw new Error('Should never be called.'); ...
[ "function AddFunctionNodes(node){\n if(her.length > 0){\n nodesFunctions.push(node);\n }\n }", "function addFunctionToPage(f, label) {\n let $script = document.createElement('script');\n $script[($script['innerText']) ? 'innerText' : 'textContent'] = '('+f+')()';\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
.end of consoleCommon_updateNextDeliveryOrderNo_postHandler Get next available customer no.
function consoleCommon_getNextCustomerNo() { var settingsObj_customerNoPrefix= Cached_getSettingsByKey(SettingsConstants.SETTINGS_RELATION_KEY_CUSTOMER_NO_PREFIX); var settingsObj_customerMaxNo = Cached_getSettingsByKey(SettingsConstants.SETTINGS_RELATION_KEY_CUSTOMER_NO_MAX); var settingsObj_customerNext...
[ "function consoleCommon_getNextBillingNo()\n{\n var settingsObj_billingPrefix = Cached_getSettingsByKey(SettingsConstants.SETTINGS_POS_KEY_BILLING_NO_PREFIX);\n var settingsObj_billingNextNo = Cached_getSettingsByKey(SettingsConstants.SETTINGS_POS_KEY_BILLING_NO_NEXT);\n var settingsObj_billingMaxNo ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
apply f to pairise elements of two equal length vectors
function zipWith(f, xs, ys) { return xs.map((x, idx) => f(x, ys[idx])); }
[ "function vectorOperation(v1, v2, op) {\n let minLength = Math.min(v1.length, v2.length);\n let newV = [];\n for (let i = 0; i < minLength; i++) {\n newV.push(op(v1[i] * 1.0, v2[i]));\n }\n return newV;\n}", "addVectors(aBar, bBar){\n if(aBar.length == bBar.length){\n for(let i = 0; i < ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Befehle werden sequenziell abgearbeitet ... Geo taggint object
function GeoTag(latitude, longitude, name, hashtag) { this.latitude = latitude; this.longitude = longitude; this.name = name; this.hashtag = hashtag; }
[ "function gui_add_tag(){\n for (var i = 0 ; i < numbertag_list.length ; i++){\n\ttag = bb1[i].add( workspace.bboxes[i], 'numbertag' ,numbertag_list).name(\"BoundingBoxTag\");\n\tgui_tag.push(tag)\n }\n}", "function geoJsonConverter(){\n var gCon = {};\n\n /*compares a GeoJSON geometry type and...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Fetches the raw validation errors from the Splade instances based on the current stack.
rawErrors() { return p.validationErrors(this.stack); }
[ "_getErrors() {\n this._client.lpopAsync(this._queueName + ERRORS_QUEUE_TAG).then((reply) => {\n if (reply === null) {\n this._log('All errors processed');\n this.stop();\n this._closeConnection();\n } else {\n this._log(reply)...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
fontGrid finds a minimal grid (in rem) for the fontSize values so that the lineHeight falls under a x pixels grid, 4px in the case of Material Design, without changing the relative line height
function fontGrid({ lineHeight, pixels, htmlFontSize }) { return pixels / (lineHeight * htmlFontSize); }
[ "function setUpTextDimensions() {\n // isFirefox(): checks for Firefox-ness of the browser.\n // Why? Because we have to adjust SVG font spacing for Firefox's\n // sake.\n // It would be better if SVG-font-sizing differences were detectable\n // directly, but so far I haven't figured out how to test ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
var out = new MuteStream(process.stdout) argument autopipes
function MuteStream (opts) { Stream.apply(this) opts = opts || {} this.writable = this.readable = true this.muted = false this.on('pipe', this._onpipe) this.replace = opts.replace // For readline-type situations // This much at the start of a line being redrawn after a ctrl char // is seen (such as b...
[ "function pipeStdIn() {\n\n process.stdin.resume();\n process.stdin.on('data', function ( chunk ) {\n\n var s = chunk.toString('utf8');\n\n // Find the relevant child process by its stdin prefix.\n var cp = childProcesses.filter(function ( cp ) {\n var prefix = new RegExp('^' + cp.stdinPrefix + '\\\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
cambia de lugar los valores de un array, swapArrayIndices(myArr, indexOne, indexTwo) > array myArr == array Array que se desea modifica indexOne == int Numero de indice, donde se movera el indexTwo indexTwo == int Pocision donde se movera el indexOne
swapArrayIndices(myArr, indexOne, indexTwo){ var tmpVal = myArr[indexOne]; myArr[indexOne] = myArr[indexTwo]; myArr[indexTwo] = tmpVal; return myArr; }
[ "function swapCoordinateValues(coordinateA, coordinateB){\n\t\tlet temp = arr[coordinateA.x][coordinateA.y];\n\t\tarr[coordinateA.x][coordinateA.y] = arr[coordinateB.x][coordinateB.y];\n\t\tarr[coordinateB.x][coordinateB.y] = temp;\n\t}", "function shiftVals(num, array, idx) {\n for (let i = 0; i <= idx; i++) {\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Delay each 30 seconds for subscribe new users.
async function subscribe () { for (let ex of tradeExchange) { let users = await User.findAllInExchange(ex.name); for (let user of users) { let userKey = `${user.exchange}:${user.address}:${user.apiKey}`; if (!(userKey in subscribedUsers)) { ex.subscribe(crypt.decrypt(user.apiKey), crypt.de...
[ "function delayChat() {\n if (self.enabled === true || self.isChatDelayed === true) {\n clearTimeout(self.lastDelayTimeout);\n\n self.disable();\n self.isChatDelayed = true;\n if (self....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Generic Gauge Function element_id to attach to in order to position gauge on the page.
function GenericGauge(element_id, options, label, initialValue) { this.element_id = element_id; this.options = options; // Each data row create a gauge instance this.dataTable = google.visualization.arrayToDataTable([ ['Label', 'Value'], [label, initialValue] ]); ...
[ "drawGauge( gaugeElement ) {\n const {\n size, hasPlaceholder, animate, percentage,\n animationAutoplay, animationDelay, valueRaw,\n valueType\n } = this.props;\n\n this.gaugeSvg = Snap( gaugeElement );\n\n /*\n * make gauge responsive - this is p...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
shuffleDeck Takes a deck of cards and randomizes the order of the cards. Parameters: deck The deck of cards Returns: The shuffled deck
function shuffleDeck(deck) { //Create an empty, temporary deck. shuffledDeck = []; /* The algorithm pulls random cards, one at a time, from the deck and places them into the new deck. The loop will run for as long as there are cards in the original deck. */ while (deck.length > 0) { //getRandomInteger ...
[ "function shuffle(deck) {\n\t// Shuffle\n\tfor (let i=0; i<1000; i++) {\n\t // Swap two randomly selected cards.\n\t let pos1 = Math.floor(Math.random()*deck.length);\n\t let pos2 = Math.floor(Math.random()*deck.length);\n\n\t // Swap the selected cards.\n\t [deck[pos1], deck[pos2]] = [deck[pos2], de...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Clears output for the given input id. like "hw11" .. output is added internally. todo: I don't think this is used
function clearOutputId(id) { var output = document.getElementById(id + "-output"); if (!output) { var err = new Error; err.message = "clearOutput() with bad id " + id; err.inhibitLine = true; // this gets the .message through, but the line number will be wrong throw(err); } output.innerHTML = "...
[ "function reset() {\n\t\tclearInterval(timerId);\n\t\ttimeId = null;\n\t\tindex = 0;\n\t\tid(\"output\").textContent = \"\";\n\t\tid(\"input-text\").value = \"\";\n\t\tid(\"input-text\").disabled = false;\n\t}", "function evaluateClear(id) {\n store(id);\n \n window.globalRunId = id; // hack: set state used b...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates a Privacy Policy view
function PrivacyPolicyView() { if (!(this instanceof PrivacyPolicyView)) { return new PrivacyPolicyView(); }; this.el = render.dom(template, { md: marked(md) }); }
[ "savePrivacyCompliancePolicy() {\n return this.saveJson('compliance', get(this, 'complianceInfo'))\n .then(this.actions.resetPrivacyCompliancePolicy.bind(this))\n .catch(this.exceptionOnSave);\n }", "showPasswordView() {\n const view = new Passphrase({model: this.collection.get('priva...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Resolve the names to a node (or missing node) and push a frame onto the stack.
pushSection(names) { const len = names.length; let node = MISSING_NODE; if (len > 0) { node = this.resolveName(names[0], this.frame()); } if (len > 1) { node = node.path(names.slice(1)); } this.stack.push(new Frame(node)); }
[ "lookupStack(name) {\n const len = this.stack.length - 1;\n for (let i = len; i >= 0; i--) {\n const frame = this.stack[i];\n const node = this.resolveName(name, frame);\n if (node.type !== types.MISSING) {\n return node;\n }\n\n if (frame.stopResolution) {\n break;\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
function to determen overstepping of keyframes using the current value, the keyframe value and the current step
function detekt_overstepping_of_animation_keyframe(value,delta,keyframe_max) { /*Trivial, overstepping is impossible - at least i thougt so. turns out, overstepping can occour, if two frames share the exakt same point.*/ if(delta==0) { if(this.time_in_current_frame >= this.animation.keyframes[this.current_fram...
[ "function resetAnimation(){\n animationSteps = [];\n step = 0;\n resetFlowCounter();\n resetTraceback();\n animationSteps.push({\n network: TOP,\n action: \"reveal\",\n pStep: 0\n });\n}", "function previousSlide(step) {\n pos = Math.max(pos - step, -(slideCount - 1));\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Takes in a Spotify playlist's id and returns an array of playlist track objects (or error)
async function getSpotifyPlaylistTracks(playlist_id) { const response = await fetch(`https://api.spotify.com/v1/playlists/${playlist_id}/tracks`, { headers: { 'Authorization': `Bearer ${access_token}` } }) if (response.status === 200) { const data = await response.json()...
[ "function getPlaylistSongs(playlist_id){\n let currentPlaylist = getPlaylistById(playlist_id);\n let url = currentPlaylist.link + \"/tracks\";\n\n ajaxCall(url, null, function(response){populatePlaylist(response, currentPlaylist);});\n}", "async function getTracks(id) {\n return redis.hgetallAsync(`play...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Recalculate any attributes if needed
_updateAttributes() { const attributeManager = this.getAttributeManager(); if (!attributeManager) { return; } const props = this.props; // Figure out data length const numInstances = this.getNumInstances(); const startIndices = this.getStartIndices(); attributeManager.update({ ...
[ "refreshAllBuffers() {\n\t\tfor (const attributeName in this.attributes)\n\t\t\tthis.refreshAttribData(attributeName);\n\t}", "readAttributes() {\n this._previousValueState.state = this.getAttribute('value-state')\n ? this.getAttribute('value-state')\n : 'None';\n\n // save the original attribute ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
throw error codes as per the error js file not used as of now.
error(errorCode) { throw new Error(errors[errorCode] || errorCode); }
[ "error(code, api){\n // Favorite API specific errors\n if (api === 'SYNO.FileStation.Favorite') {\n switch (code) {\n case 800: return 'A folder path of favorite folder is already added to user\\'s favorites.'; break;\n case 801:\n return 'A ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Tarea para generar los documentos de los ficheros Scss
function generar_docs() { return src("./scss/styles.scss") .pipe(sassdoc(doc_options)); }
[ "function writeCssFile() {\n const origin = fs.createReadStream(\"./style.txt\", { flags: \"r\" });\n const destination = fs.createWriteStream(outputpathForcss, {\n flags: \"w+\",\n });\n origin.pipe(destination);\n}", "function generar() {\n return src(\"./scss/styles.scss\")\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Filter scores by player name. Player name is typed into the field and the scores are filtered by this input.
function filterByPlayer() { const nameFilterValue = getById('filter-bar').value; if (nameFilterValue) { fetch(`${server}?action=filter&name=${nameFilterValue}`, { headers: { 'Accept': 'application/json' }, mode: "no-cors" }) .then(r...
[ "function filterScores() {\n if (focus) {\n toggleFocus(selectedItem);\n }\n if (selectedItem) {\n unselectItem();\n }\n if (highlightedNode) {\n unhighlightNode(highlightedNode);\n highlightedNode = false;\n }\n displayFil...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Example to below such method | textToEnter | locator | | CTA label | CTA label field | | /content | CTA URL field |
EnterValueInMultipleTextFields (fields) { try { const fieldsTemp = fields.hashes() fieldsTemp.array.forEach((element) => { browser.setValue(element.textToEnter, element.locator) }) } catch (err) { throw new Error(err) } }
[ "inputTextAndSelectFromResult(element, text){\n driver.findElement(element).sendKeys(text);\n //TODO find less fragile locator/way of seleting this element\n driver.findElement(By.className(\"hierarchy-picker-node\")).click();\n \n }", "getListOfElementsAndClick(element, text) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets or sets the width of the crosshairs lines. The 'enableCrosshairs' property should be 'true' Property type: number
get crosshairsLineWidth() { return this.nativeElement ? this.nativeElement.crosshairsLineWidth : undefined; }
[ "setCrosshairsLength(length) {\n if (this._crossHairs)\n this._crossHairs.setLength(length);\n }", "getCrosshairsLength() {\n if (this._crossHairs)\n return this._crossHairs.getLength();\n else\n return 0;\n }", "setCrosshairsThickness(thickness) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This function clears the "testResutls" array
clearResults() { testResults = []; }
[ "function clear() {\n\t\tgenerations = [];\n\t\tfittest = [];\n\t}", "function clearAllResults()\n{\n var tests=[];\n for(var name in unitTests)\n {\n clearResultSet(name);\n }\n updateAllTestsVisibility();\n}", "clearAll() {\n //geklikt resultaat\n if (this._clickedResult) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Language: dsconfig Description: dsconfig batch configuration language for LDAP directory servers
function dsconfig(hljs) { const QUOTED_PROPERTY = { className: 'string', begin: /"/, end: /"/ }; const APOS_PROPERTY = { className: 'string', begin: /'/, end: /'/ }; const UNQUOTED_PROPERTY = { className: 'string', begin: /[\w\-?]+:\w+/, end: /\W/, relevance: 0 }; c...
[ "function datasourceForConfig(args)\n{\n\tvar bename;\n\n\tmod_assertplus.object(args);\n\tmod_assertplus.object(args.dsconfig);\n\tmod_assertplus.object(args.log);\n\n\tbename = args.dsconfig.ds_backend;\n\n\tif (bename == 'manta')\n\t\treturn (mod_datasource_manta.createDatasource(args));\n\tif (bename == 'file')...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Check if the SDP offer/answer contains a=inactive field, which indicates it is a renegotiation triggered when a participant holds a call.
function isHoldRequest(sdp) { return /\ba=inactive\b/gmi.test(sdp); }
[ "isLocalOnHold() {\n if (this.state !== CallState.Connected) return false;\n if (this.unholdingRemote) return false;\n let callOnHold = true; // We consider a call to be on hold only if *all* the tracks are on hold\n // (is this the right thing to do?)\n\n for (const tranceiver of this.peerConn.getTr...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
if the mood is below this threshold, then increase the mood be this amount
function increaseMood(amount, threshold) { if(!threshold || WORLD.AGENT.state.mood < threshold) WORLD.AGENT.state.mood += amount; // clamp the value between 0 and 1 WORLD.AGENT.state.mood = Math.max(0, Math.min(1, WORLD.AGENT.state.mood)); }
[ "eat() {\n if (this.food >= 1) {\n this.food -= 1\n } else { \n this.isHealthy = false\n }\n }", "function reachNextLevel(experience, threshold, reward) {\n return experience + reward >= threshold;\n}", "hunt() {\n this.food += 2\n }", "skierI...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates a button first function to get called, loads the nbextension into Jupyter
function load_ipython_extension () { events.on('create.Cell',create_cell); Jupyter.toolbar.add_buttons_group([ { label : 'Input Excel', icon : 'fa-compress', callback : run_it } ]); ...
[ "function load_ipython_extension() {\n // Attach WYSIWYG buttons to existing cells when a notebook is loaded\n attach_buttons();\n\n // Attach WYSIWYG button when a new cell is created\n $([Jupyter.events]).on('create.Cell', function(event, target) {\n add_wysiwyg_button(targe...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
CSS gradient from colormap. Based on the data from COLORMAP. `direction` is the gradient direction (e.g. "to right"). Returns a CSS gradient definition string.
function colormap_gradient(direction) { var g = 'linear-gradient(' + direction; for (var i = 0; i < COLORMAP.length; i++) { var c = COLORMAP[i]; g += ',rgb(' + Math.round(255 * c[0]) + ',' + Math.round(255 * c[1]) + ',' + Math.round(255 * c[2]) + ')'; ...
[ "function GradientColor(type, direction, numStops, arrGradientStop)\n{\n\tthis.type = type;\n\tthis.direction = direction;\n\tthis.numStops = numStops;\n\tthis.arrGradientStop = arrGradientStop;\n}", "function _createColourGradient(colorstops) {\n var ctx = document.createElement('canvas').getContext('2d')...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Component: Bounds.Debug Outlines the boundaries and angle of an entity.
function BoundsDebug() { this.color = Color(); }
[ "function getBoundingBox() {\n if (!bounds) { return } // client does not want to restrict movement\n\n if (typeof bounds === 'boolean') {\n // for boolean type we use parent container bounds\n var sceneWidth = owner.clientWidth;\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Handler to update place details
function handleUpdatePlace() { $('main').on('submit','.edit-place-form', function(event) { event.preventDefault(); const placeId = $(this).data('id'); const tripId = $(this).data('trip'); const toUpdateData = { id: placeId, name: $('.place-name-entry').val(), date: $('.form-place-date').val(), desc...
[ "function handleEditPlace() {\n\t$('main').on('click','.edit-place-button', function(event) {\n\t\tconst placeId = $(this).data('id');\n\t\tconst tripId = $(this).data('trip');\n\t\tshowPlaceDetailsToEdit(tripId, placeId);\n\t})\n}", "function updatePlacesLocationInformation() {\n\tupdatePlacesLocationInformation...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Uses the associative array of error messages according to the chosen language to find the matching error message to an error code.
findErrorMessage(errorCode) { return this.errorMessageCollection[this.languageCode][errorCode]; }
[ "getMessages(language) {\n let languageKey = Object.keys(i18nMessages).find( (currentLanauge) => {\n return language === bcp47normalize(currentLanauge);\n });\n \n return i18nMessages[languageKey];\n }", "function getErrorMessage(errorCode) {\n var Error = {};\n Error[errorCode] = ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
this function will researve seats in a screen if possible, if not then reject with a message
function reserveSeats(name,seats,screen) { return new Promise(function(resolve,reject) { //console.log(seats) console.log(screen) var currentScreenStatus = screen[0].screenInfo; //get complete object console.log(currentScreenStatus) for(var row in seats) { //row is key , seats is dict for( var c i...
[ "checkForUnavailableSeats(seats) {\n const userId = authService.getAuthenticatedUser().id;\n\n seats.forEach((row, rowNumber) => {\n row.forEach((seat, number) => {\n const isSeatListed =\n seat.status === TEMPORARY_OCCUPIED &&\n seat.occupiedBy !== userId &&\n this.prop...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Crea el panel de pestanas y las pestanas al cargarse la pagina
function creaPestanas() { /**ADAPTADO PARA MOZILLA**/ if (atcl_navegador.esIE()) { all = document.all; } else if (atcl_navegador.esFF()) { all = document.forms[0]; } /**FIN ADAPTACION**/ var numElementos = all.length; var nombreClase, elemento; var parentTabPane; for ( var i = 0; i < numElementos; i++...
[ "function PanelPestanas( elemento) {\n\tvar hijos=null;\n\ttry {\n\tthis.element = elemento;\n\tthis.element.tabPane = this;\n\tthis.element.className = this.classNameTag + \" \" + this.element.className;\n\tthis.pages = [];\n\tthis.selectedIndex = null;\n\t// Crea el tab-row para anadirlo al panel\n\tthis.tabRow =...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This function generates a random number to serve as delay in a setTimeout() since real asynchrnous operations take variable amounts of time
function generateRandomDelay() { return Math.floor(Math.random() * 2000); }
[ "function getRandomNum() {\n let time = new Date();\n return time.getMilliseconds();\n}", "function getRandomNumber(){\n return new Promise (resolve => {setTimeout(function(){\n //Multiply Math.random() by 10\n resolve (Math.random()*10);\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This method draws the HTML5 logo
function drawHtml5Logo(ctx, x, y) { html5radius += html5direction; if((html5radius < 40) || (html5radius >= 60)) { html5direction *= -1; } ctx.save(); //ctx.scale(0.8,0.8); drawHalo(ctx, x + (html5logo.width/2), y + (html5logo.height/2), html5radius, "rgb(255,255,255)", 0.1); ctx.drawImage(html5l...
[ "function logoArt() {\n console.log(\n logo({\n name: \"Employee DB\",\n font: \"Speed\",\n lineChars: 10,\n padding: 2,\n margin: 3,\n borderColor: \"grey\",\n logoColor: \"bold-green\",\n textColor: \"green\",\n })\n .emptyLine()\n .right(\"version 1.0.0\")...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Create a dummy Fall Trauma
function createFallTraumaEntry(){ db.transaction( function(transaction) { transaction.executeSql( 'INSERT INTO trauma_fall (patient, assessed, assault, distance, distance_unit, surface, loss_of_c, loss_of_c_time, ' + ' bleeding, controlled, head, neck, chest, abd, ' + ' pelvis, ulxr, urxr, ll...
[ "plantSeed() {\n\t\tthis.stop();\n\t\tthis.loops = 0;\n\t\tthis.myTree = new FractalTree({x: ground.width/2-100, y: ground.height-20}, this.myDNA);\n\t\tthis.settingsClose();\n\t\tthis.play();\n\t}", "function make_patient_preset(runs){\n\t//save any changes to sim config\n\tsave_patient_changes()\n\t//clone conf...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function shows the post editor and fills in data if applicable
function showEditor(post){ $('#newpostBtn').hide(); $('#editpostBtn').hide(); $('#savepostBtn').show(); $('#deletepostBtn').hide(); $('#backBtn').show(); $('#editordiv').show(); $('#postdiv').hide(); $('#postlistdiv').hide(); //if we edit an existing post we fill in the form if(post!=null){...
[ "function displayEditPost(post){\r\n\t\t\t$(\"form#edit-form input#title\").val(post.title);\r\n\t\t\t$(\"form#edit-form textarea#content\").val(post.body);\r\n\t\t}", "fillEditForm() {\n let post = editor.currentPost,\n editTitle = document.getElementById('editTitle'),\n postTitle = h.getP...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
The Google Places API is loaded and the onScriptLoaded() function is called to alert the parent component that the Google Places API is loaded
componentDidMount() { const googleMapScript = document.createElement('script'); googleMapScript.src = `https://maps.googleapis.com/maps/api/js?key=${googlePlacesAPIKey}&libraries=places`; window.document.body.appendChild(googleMapScript); googleMapScript.addEventListener('load', () => { /*global ...
[ "function initialize() {\n\t\t\tconsole.log('Initializing Home Controller');\n\n $scope.state.doneInitializing = false;\n\t\t\t// Make sure the Google Places API is loaded before continueing.\n\t\t\tbaLibraryStore.load('googleplaces')\n\t\t\t\t.then(function() {\n\t\t\t\t\tconsole.log('Loaded Google Places');\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Write a function called getDurationInSeconds which takes in an array of songs and returns an array of each song's duration in seconds.
function getDurationsInSeconds(songs) { return songs.map(song => { return song.duration.split(":") .map((num, index) => index < 1 ? +num * 60 : +num) .reduce((acc, next) => acc + next); }) }
[ "function getDurations(songs) {\n return songs.map(song => song.duration);\n}", "function getTotalDurationInSeconds(songs) {\n return getDurationsInSeconds(songs).reduce((total, songDuration) => {\n return total + songDuration;\n }, 0)\n}", "function getDurations (arr){\n\treturn arr.map(functio...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
IMGUI_API void BeginGroup(); // lock horizontal starting position + capture group bounding box into one "item" (so you can use IsItemHovered() or layout primitives such as SameLine() on whole group, etc.)
function BeginGroup() { bind.BeginGroup(); }
[ "function groupLineToggle() {\n groupLines *= -1;\n\tdrawBoard();\n}", "setElementGroups() {\n //use groups as layers to keep points on top and selectable\n this.groupCircles = this.D.group().attr({\n id: \"Circles\"\n });\n this.groupLines = this.D.group().attr({\n id: \"Lines\"\n });...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Removes the browser action popup so that the onClicked listener can fire.
function removeDefaultPopup() { chrome.browserAction.setPopup({ popup: '' }); }
[ "function close_popup(popup) {\r\n popup.style.display = \"none\";\r\n}", "function revokeCustomAlertPopup() {\n\tRichfaces.hideModalPanel('alertPanel');\n}", "function hidePopup () {\r\n editor.popups.hide('customPlugin.popup');\r\n }", "function revokeCustomConfirmationPopup() {\n\thideModel('con...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
COPY PURE REACT RESOURCES
_copyPureReact() { var pureReactContext = this._getPureReactContext(); this.fs.copyTpl( this.templatePath(appConfig.config.path.pureReact.templatePath + '/' + pureReactContext.indexHTML), this.destinationPath(appConfig.config.path.pureReact.destinationPath + '/' + pureReactContex...
[ "function copy_src(){\n return gulp.src(['components/**/*.ts'])\n .pipe(gulp.dest('generated'));\n}", "function MySpecial() {\n return (\n <div className=\"MySpecial\">\n <h1 className=\"dashboard__header\">Điểm đặc biệt</h1>\n <UseImages CNAME=\"myspecial\" />\n </div>\n );\n}", "fu...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
OBS: HAS TO HAPPEN BEFORE THE FILTERING loops through all the cities and adds profit properties to every item object in every city. the profit calculations also takes into account different qualities since you can sell higher qualities to lower qualities buy orders in BM
function calculateProfits(cities) { printToConsole("Calculating profits...\n"); var item; // starts from the last city (6: Caerleon) so the profit properites for Caerleon are calculated before looping // through the other cities in descending order. does not loop through i=0 because BM is the first index (0) ...
[ "function filterDataByParameters(cities) {\n // cities[0] is the blackMarket first for loop then starts from 1\n for (var i = 1; i < cities.length; i++) { // Loop through every city\n for (var j = 0; j < cities[i].length; j++) { // Loop through every item\n var item = cities[i][j];\n\n // the reason ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Finds the initial locations of both team's flags Return Value: information about flag locations
function flagLocations (input) { var data = []; var xhr = Titanium.Network.createHTTPClient(); xhr.open('POST','http://ctf.playamericalive.com/form.php'); xhr.send({ action: 'flagLocations', gameID: input.gameID, }); xhr.onload = function(e) { var xml = this.responseXML; var results = xml.docum...
[ "getFlagScore() {\n const board = this.state.boardData;\n const mines = this.getMines(board);\n const flags = this.getFlags(board);\n var correct = 0, score = 0;\n\n mines.forEach(mine => {\n flags.forEach(flag => {\n if (mine[0] === flag[0] && mine[1] ==...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
3. Check each string in array for numbers and remove if they contain numbers
function removeNumericStrings(arr) { var arrLen = arr.length; var nonNumericArr = []; for (var i=0; i < arrLen; i++) { if (!checkNumeric(arr[i])) { nonNumericArr.push(arr[i]); } } return nonNumericArr; }
[ "function filterDigitLength(arr, num) {\n\tconst a = arr.filter(x => x.toString().length === num);\n\treturn a;\n}", "removeNumbers(string) {\n return string.replace(/[0-9](\\ )*/g, '');\n }", "function removeNumbers(str) {\n return str.replace(/\\d/g, '');\n}", "function filterNumbers(inputArray) { //st...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Find Beatbox in the swf_tags.
function getBeatBox() { var len = swf_tags.tags.length; var i = 0; var elm = null; for(i = 0; i < len; i++) { elm = swf_tags.tags[i]; if(elm.header.code == SWFTags.DOACTION) return elm; } return null; }
[ "function getBox(value) {\n\tfor(box in boxes) {\n\t\tif(boxes[box].value === value) {\n\t\t\treturn boxes[box];\n\t\t}\n\t}\n\t// If none were found.\n\treturn null;\n}", "async _createFindBar(aTab) {\n let findBar = document.createXULElement(\"findbar\");\n let browser = this.getBrowserForTab(aTab);\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Visit a parse tree produced by PlSqlParserschema_object_name.
visitSchema_object_name(ctx) { return this.visitChildren(ctx); }
[ "visitSchema_name(ctx) {\n\t return this.visitChildren(ctx);\n\t}", "visitSqlj_object_type(ctx) {\n\t return this.visitChildren(ctx);\n\t}", "visitAudit_schema_object_clause(ctx) {\n\t return this.visitChildren(ctx);\n\t}", "visitOracle_namespace(ctx) {\n\t return this.visitChildren(ctx);\n\t}", "visitS...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get an array of scripts currently on the page
function getScripts() { var result = []; var scripts = targetWindow.document.scripts; forEach(scripts, function(script) { if (script.src) { result.push({ type: script.type, src: script.src, async: script.async, defer: script.defer }); } }); return result; }
[ "function getInitialScripts() {\n\t\tvar scripts = [];\n\t\tdocument.querySelectorAll( 'script' ).forEach( function( script ) {\n\t\t\tif ( script.src && script.crossOrigin === 'anonymous' && !script.src.match( /\\/base\\/tests\\// ) ) {\n\t\t\t\tscripts.push( script.src );\n\t\t\t}\n\t\t} );\n\t\treturn scripts;\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This function is used to retrieve bookmarks from database
function getBookmarks() { var db = getDatabase(); var respath=""; db.transaction(function(tx) { var rs = tx.executeSql('SELECT * FROM bookmarks ORDER BY bookmarks.title;'); for (var i = 0; i < rs.rows.length; i++) { // For compatibility reasons with older versions if ...
[ "function fetchBookmarks(){\n\n if(localStorage.getItem('bookmarks')){\n bookmarks = JSON.parse(localStorage.getItem('bookmarks'));\n }else{\n // Create array and set to lacal storage\n bookmarks = [{\n name:'Mohammad Design',\n url:'test.com'\n }];\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Propose setting taxe A
static setTaxeA(){ //console.info("set Taxe A") KB.listenTyping([ {key: Const.KEYBOARD_INT_TYPING, callback: KB.startTyping}, // 0-9 + backspace {key: Const.KEYBOARD_RETURN, callback: Invest.doSetTaxeA}, // ↩ ], [tpl_4_base, tpl_4_a]); Party.refreshWithTemplates([tpl_4_base, tpl_4_a]); }
[ "static setTaxeB(){\n //console.info(\"set Taxe B\")\n KB.listenTyping([\n {key: Const.KEYBOARD_INT_TYPING, callback: KB.startTyping}, // 0-9 + backspace\n {key: Const.KEYBOARD_RETURN, callback: Invest.doSetTaxeB}, // ↩\n ], [tpl_4_base, tpl_4_b]);\n\n Party.refreshWithTemplates([tpl_4_base, t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
cuts tail of lasso and leaves only the loop
cutTail () { // while we have duplicated node targets, remove not targeted node from chain one by one while ( this.hasDuplicatedTargets() ) { this.nodes = this.nodes.filter( node => { return ~this.targets.indexOf( node.index ) }); this.refreshTargets(); } }
[ "function drawTail(){\n\tfor(var i = 0; i < tailPos.length; i++){\n\t\tctx.fillStyle = \"#00ff00\";\n\t\tctx.fillRect(tailPos[i][0], tailPos[i][1], blockSize, blockSize);\n\t}\n\tif(tailPos.length > score){\n\t\ttailPos.shift();\n\t}\n}", "function moveTail() {\n let snakeSize = snakePositions.length;\n $('...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Show/Hide Create New Photo Album
function shownewalbum(){ document.getElementById('hidenewalbum').style.visibility="hidden"; document.getElementById('hidenewalbum').style.display="none"; document.getElementById('shownewalbum').style.display="block"; document.getElementById('shownewalbum').style.visibility="visible"; ...
[ "albumModalFinished() {\n this.setState({showAlbumCreationModal: false});\n }", "function hideAndShowAlbums() {\r\n //console.log('hideAndShowAlbums: ' + albumSelected);\r\n for (var i = 0; i < albumSelectors.length; i++) {\r\n var selector = albumSelectors[i];\r\n if...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns the html string (for the drop down box) to select modules
function getModuleSelectStr() { var selected_index = CurProgObj.curModNum; var str = "<select class='stepsel' " + " onchange='changeModule(this.selectedIndex)'>"; for (var i = 0; i < CurProgObj.allModules.length; i++) { var val = CurProgObj.allModules[i].name; str += "<op...
[ "DropdownOptionsLANG() {\n let html = '';\n let sel = '';\n let fileListData = spx.getJSONFileList('./locales/');\n fileListData.files.forEach((element,i) => {\n sel = '';\n if (element.name == config.general.langfile)\n {\n sel = 'selected';\n }\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
close isValidDate showUserSpecificFields() This method runs once the new user enters their email and will hide/show the relavent fields Parameters: None Returns: None Exceptions: None
function showUserSpecificFields() { //get email field var email = document.getElementById("email").value.trim(); //determine user role var role = getRoleFromEmail(email); //get all student fields var studentFields = document.getElementsByClassName("studentRole"); //get all facstaff fields...
[ "function onSignUpClicked (event) {\n let isValid = true;\n let userType = 'student';\n\n $(getClassName(userType, 'signUpFirstNameError')).hide()\n $(getClassName(userType, 'signUpLastNameError')).hide()\n $(getClassName(userType, 'signUpCountryCodeError')).hide()\n $(getClassName(userType, 'Sign...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Calculate an estimated number of live births each year per state using the state's intercensal population estimate and birth rate. Live births = (population / 1000) birthRate Also, birthTotals is an array of each year's total births, to be used in calc of percentages. Pass JSON to calcPercentages()
function calcLiveBirths(newSet,callback){ var birthRates; var population; var liveBirths; var currentValue; var birthTotals = [0,0,0,0,0,0,0,0,0,0]; _.each(newSet,function(element,index){ //save references so it's easier to read birthRates = element.birthRate; population = element.population; liveBirths =...
[ "function calcPercentages(newSet,birthTotals,callback){\n\tvar percentage;\n\t_.each(newSet,function(element,index){\n\t\tfor(var i=0;i<birthTotals.length;i++){\n\t\t\tpercentage = element.liveBirths[i]/birthTotals[i];\n\t\t\telement.percentage.push(percentage);\n\t\t}\n\t});\n\tcallback(null,newSet);\n}", "funct...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
average function for students grades
function average() { var total = 0; for (var i = 0; i < this.grades.length; ++i) { total += this.grades[i]; }//end for return print(total / this.grades.length); }//end average function
[ "averageAssignmentGrade(grades) {\n // return grades.reduce(function(acc, grade) {\n var avg = grades.reduce(function(acc, grade) {\n return acc + grade.percentage;\n }, 0) / grades.length;\n return Number(avg.toFixed(2));\n // return avg;\n }", "function calculateAverage(grades) {\n // grad...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
show Revaluation list in Grid view for Revaluation Entry
function RevaluationList() { //alert('grid'); $http.post("/Accounts/FixedAsset/RevaluationList").success(function (data) { $scope.RevaluationList = data; }).error(function (error) { }); }
[ "function refreshFurnitureList(){\n\tvar listPanel = View.panels.get('treePanel');\n\tlistPanel.refresh(listPanel.restriction);\n}", "function displayEval(data, evalType) {\n\n //$('#evalDetailsDialog > ul').html('');\n $.each(data[0], function(key, value) {\n $('#detail-' + key).find('sp...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Load the draft data from Firebase
function loadData(callback) { firebase.database().ref('users/' + uid + '/drafts').on('value', snapshot => { if (snapshot.val()) { draftData = JSON.parse(snapshot.val()); //Find the draft ID from the url parameters (make sure it exists) let searchParams = new URLSearchPa...
[ "async read(draftLinks) {\n return this.apiClient.readDraft(draftLinks);\n }", "function loadLeaderBoard() {\n var leaderRef = firebase.database().ref().child(\"highscores\");\n leaderRef.child(\"p0\").child('name').on('value', snap => {\n $(\"#p0\").text(snap.val());\n lea...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
compares errors with standard deviation array to find joint angles above threshold returns string containing results
function generate_results(errors, sd){ var results_str = ""; var numErrors = 0; for (var i = 0; i < errors.length; i++){ // get angle of error in degrees var angle_err = parseInt(errors[i] * 180 / Math.PI, 10); // TEST FOR INCORRECT JOINT... // i > 2 ignores roll, pitch, yaw... // angle_err...
[ "function errorOf() {\n\tvar obs = arguments[0];\n\tvar sim = arguments[1];\n\tvar err = 0;\n\tfor(var i = 0; i < obs.length; i++) {\n\t\terr += Math.abs(obs[i] - sim[i]);\n\t}\n\treturn err;\n}", "static std_dev(arr) {\n let av = Ex.average(arr);\n return Math.sqrt(Ex.average(arr.map(e => Ex.sq(av - e))));...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
clone Returns a new GameBoard object, identical to this one
clone () { var newBoard = new GameBoard(this.size); var i,j; for (i=0; i<this.size; i++) { for (j=0; j<this.size; j++) { newBoard.set(this.get(i, j), i, j); } } return newBoard; }
[ "copy() {\n const copy = new Grid(this.size);\n copy.grid = copyBoard(this.grid);\n return copy;\n }", "function cloneBoard(){\n\t\ttestBoard = [\n\t\t\t\t[\"\",\"\",\"\"],\n\t\t\t\t[\"\",\"\",\"\"],\n\t\t\t\t[\"\",\"\",\"\"]\n\t\t\t];\n\t\tfor(cbi=0; cbi<3; cbi++){\n\t\t\tfor(cbj=0; cbj<3; cbj++){\n\t\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
processHandler needs to return true for the collision to happen.
function processHandler(monster,bullet){ return true; }
[ "_setupCollision () {\n this.PhysicsManager.getEventHandler().on(this.PhysicsManager.getEngine(), 'collisionStart', (e) => {\n\n for (let pair of e.pairs) {\n let bodyA = pair.bodyA\n let bodyB = pair.bodyB\n\n if (bodyB === this.body) {\n this.onCollisionWith(bodyA)\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Generate a Rover Report
function generateRoverReport(){ $('div#roverReport').empty(); $('div#roverReport').append("<h2>Rover Report:</h2>"); allRoversObjArray.forEach(function(rover) { var reportWrapper = document.createElement("div"); reportWrapper.className = 'reportWrapper alert alert-primary col-md-12 col-sm-4'; var roverNameHT...
[ "function printReport() {\n\n\tvar report = Banana.Report.newReport(param.reportName);\n\n\treport.addParagraph(param.title, \"heading1\");\n\treport.addParagraph(\" \");\n\treport.addParagraph(param.headerLeft + \" - \" + param.headerRight, \"heading3\");\n\treport.addParagraph(\"Periodo contabile: \" + Banana.Con...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
normalizes path/package info and places info on either the global cfg.pathMap or on a pluginspecific altCfg.pathMap. also populates a pathList on cfg or plugin configs.
function fixAndPushPaths (coll, isPkg) { var id, pluginId, data, parts, currCfg, info; for (var name in coll) { data = coll[name]; if (isType(data, 'String')) data = { path: coll[name] }; // grab the package id, if specified. default to // property name, if missing. data.name...
[ "prepare () {\n this.bloggify = path.join(this.root, this._paths.bloggify)\n iterateObject(this._paths, (value, pathName) => {\n if (pathName === \"bloggify\" || pathName === \"root\" || typeof this[pathName] === \"function\") { return; }\n this[pathName] = value.startsWith(\"/\"...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Synchronize a test case from TestRail to the local filesystem
synchronizeCase(testcase, relativePath) { return __awaiter(this, void 0, void 0, function* () { const basename = this.slugify(testcase.title); const exists = (this.testFiles[testcase.case_id] !== undefined); let featurePath = path.resolve(this.config.featuresDir + '/' + relat...
[ "function RunSingleTest()\r\n{\r\n\tfullReport = WshShell.CurrentDirectory + \"\\\\\" + fso.GetBaseName(testSetPath) + \".trp\";\r\n\r\n if(g_helper.FileExists(fullReport))\r\n {\r\n g_helper.DeleteFile(fullReport);\r\n }\r\n \r\n\t// Initialize Log functions\r\n\t_initializeLogging();\r\n\tg_helper.Init(ful...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
FUNCTION NAME : appendListToTable AUTHOR : marlo agapay DATE : January 6, 2014 MODIFIED BY : REVISION DATE : REVISION : DESCRIPTION : append dynamic list to table PARAMETERS : mPortArr
function appendListToTable(mPortArr,lineId,destinationDevice,sourceDevice){ setTimeout(function(){ if (globalDeviceType == 'Mobile'){ $(document).on('pagebeforeshow', '#manageConnectionDiv', function (e, ui) { $('#manageConnectionDiv div[role="dialog"]').css({"max-width":"60%"}); $('ul').css({"max-width"...
[ "function generatePortList()\r\n{\r\n\r\n\tlet output = \"\";\r\n\r\n //create row for local port\r\n for (let j = 0; j < newPortList.length; j++)\r\n\t{\r\n output += \"<tr>\"\r\n output += \"<td onmousedown=\\\"viewNewPortInfo(\"+j+\")\\\" class=\\\"full-width mdl-data-table__cell--non-numeri...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Check if a value is a void `Element` object.
isVoid(editor, value) { return Element.isElement(value) && editor.isVoid(value); }
[ "isVoid(editor, value) {\n return Element$1.isElement(value) && editor.isVoid(value);\n }", "isEmpty(editor, element) {\n var {\n children\n } = element;\n var [first] = children;\n return children.length === 0 || children.length === 1 && Text.isText(first) && first.text === '' ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Code for Pagination of File Upload report
function uploadPagination(id, totalRec) { $('.pagination-arrows').empty(); var index = id; var noOfRecords = totalRec; var noOfPages = Math.floor(noOfRecords / index); if (noOfRecords % index != 0) { noOfPages = noOfPages + 1; } if (noOfPages > 1) { // pagination arrows $(".pagination-arrows"...
[ "function infiniScroll(pageNumber) {\n \n $.ajax({\n url: \"rest/getMoreImages/\"+pageNumber+\"/\"+uploadCount,\n type:'GET',\n success: function(imageJSON){\n \n var imageResults = $.parseJSON(imageJSON);\n for(var i=0;i<6;i++) { \n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
generates basket div elements from basket_point array
function generateBaskets() { container = document.getElementById('container'); var square_dummy = document.getElementById("Square1"); var rect_dummy = square_dummy.getBoundingClientRect(); var i = 0; for (point in basket_points) { basket = document.createElement('div'); basket.setAttribute('id', 'Bas...
[ "function appendBasketPointsOfColumn(c){\n var temp_basket_array = [];\n var squaresInColumn = document.getElementById('Column'+ (c+1)).childNodes;\n var array_index = 0;\n for (m = 0 ; m < squaresInColumn.length; m ++){\n if ( !(m%2) ) {\n var rectsInColumn = squaresInColumn[m].getBoundingClientRect();...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Initialize the soundmanager library
function soundInit() { _soundInitialized = true; soundManager.setup({ url: '.', debugMode: false, onready: function() { _soundReady = true; } }); }
[ "function initApplication() \n{\n console.log(\"Loading sounds\\n\");\n\n var outval = {};\n var result;\n\n /*\n Create an oscillator DSP units for the tone.\n */\n result = gSystem.createDSPByType(FMOD.DSP_TYPE_OSCILLATOR, outval);\n CHECK_RESULT(result);\n gDSP = outval.val;\n\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
return the closest element (depending on direction)
function getClosestElement() { var $list = sections , wt = contTop , wh = contentBlockHeight , refY = wh , wtd = wt + refY - 1 ; if (direction == 'down') { $list.each(function() { var st = $(this).position().top; if ((st > wt) && (st <= wt...
[ "function getClosestFood(){\n if (foodList.length == 0){\n return 0;\n } else {\n var curClosest = -1;\n var curDistance = -1;\n for (var i = 0; i < foodList.length; i++){\n var curFood = foodList[i];\n var distance = Math.sqrt(Math.pow(curFood.xLoc - this.xLo...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Check if the key contains parenthesis and if so, split out the query function from the real key. Take the passed key and set this constraint key and conditionally this constraint query function.
splitFunctionFromKey (theKey) { if (theKey !== null && theKey.indexOf('(') !== -1) { // Must be an aggregate or queryFunction let functionKeyPair = theKey.split('('); // Split function and property let functionAlias = functionKeyPair[0]; let fieldName = functionKeyPair[1]; let queryFunction...
[ "function resolveKey(opKey, keys) {\n\tif (objUtils.isEmpty(keys)) {\n\t\t// when keys map is null or empty, use the param key in rsql string\n\t\treturn opKey;\n\t}\n\telse {\n\t\tif (opKey in keys) {\n\t\t\tvar key = keys[opKey];\n\t\t\tif (!objUtils.isEmpty(key)) {\n\t\t\t\treturn key;\n\t\t\t}\n\t\t}\n\t\telse ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
data array goes [(data value1(data value subset1)), (data value2(data value subset2) ...) ] options array goes["numerical value position", "bar colour", "label colour", "bar spacing (pass this as a number?)", "bar chart axisX name", "bar chart title", "bar chart title font", "bar chart title size" ]
function drawBarChart(data, options, element) { }
[ "function getBarDataset(label, data){\n return [{\n label: label,\n fillColor: \"rgba(151,187,205,0.2)\",\n strokeColor: \"rgba(151,187,205,1)\",\n highlightFill: \"rgba(151,187,205,0.1)\",\n highlightStroke: \"rgba(151,187,205,1)\",\n data: data\n }];\n}", "functio...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
return the DOM object for the corresponding square, "none" if it does not exist
function getSquare(x, y) { const full_id = "square_" + x + "_" + y; const square = document.getElementById(full_id); if (square) { return square; } return "none"; }
[ "function getSquareTypeHTML(x, y) {\n\t// Get the relevant div\n\tvar row = $( \".row\" )[x];\n\tvar square = $( row ).children( \".square\" )[y];\n\tvar classString = $( square ).attr(\"class\").split(' ')[1];\n\treturn classString;\n}", "function getDivFromPiece(gamePiece) {\n let gpDiv = document.getElement...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Load all the existent series
function loadSeries() { for(var i = 2, j = 0; i < data.length, j < series_names.length; i++, j++) { chart.addSeries({name: series_names[j], data : data[i]}); } }
[ "init() {\n const series = this.chartData.series;\n const seriesKeys = Object.keys(series);\n\n for (let ix = 0, ixLen = seriesKeys.length; ix < ixLen; ix++) {\n this.addSeries(seriesKeys[ix], series[seriesKeys[ix]]);\n }\n\n if (this.chartData.data.length) {\n this.createChartDataSet();\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
respond to scroll event: update class for both section and the corresponding link
function whenScroll() { for (let section of sections) { if (isInViewport(section)) { removeActiveClassFromSection(); //remove 'active_section' class from the previous active section section.classList.add('active_section'); //add 'active_section' class to the current active sectio...
[ "function onScroll(event){\n var scrollPos = $(document).scrollTop();\n $('a.activeOnScroll').each(function () {\n var currLink = $(this);\n var refElement_id = $(this).attr(\"href\");\n var refElement = $(refElement_id);\n if ( (refElement.offset().top <= scrollPos ) && ( refElement.offset().top + re...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
below is the function to print numbers in front of the nonempty lines of the file given function name: add sequence to non empty lines.
function addSequenceTnel(fileData) { //similar to above just avoid lines which does not have any data let lines = fileData.split("\n"); let count = 1; for(let i = 0; i < lines.length; i++) { if(lines[i] != "") { console.log(count + ". " + lines[i]); count++; } ...
[ "function emptyLines(number) {\n if (typeof number !== 'undefined') {\n for (i = 1; i <= number; i++) {\n console.log(' ');\n }\n }\n else {\n console.log(' ');\n }\n}", "visitAutogenerated_sequence_definition(ctx) {\n\t return this.visitChildren(ctx);\n\t}", "function func_call_before_declar...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
adjustCrit (luckySign, luckModifier) add bonus/penality to Crit based on Lucky Sign
function adjustCrit (luckySign, luckModifier) { var adjust = luckModifier * 1; if (luckySign.luckySign != undefined && luckySign.luckySign === "Warrior's arm"){ adjust = luckModifier * 2; } return adjust; }
[ "function adjustAC (luckySign, luckModifier) {\n var adjust = 0;\n if (luckySign.luckySign != undefined && luckySign.luckySign === \"Charmed house\"){\n adjust = luckModifier;\n }\n\treturn adjust;\n}", "function adjustFort (luckySign, luckModifier) {\n var adjust = 0;\n if (luckySign.luckySi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }