query
stringlengths
9
34k
document
stringlengths
8
5.39M
negatives
listlengths
19
20
metadata
dict
Returns an array of fallback languages to try first when selecting which language version to show. We return English as a fallback if we don't have a better answer, since it's the most widely spoken secondary language.
getFallbacks(langKey) { let fallbacks = ['en']; switch (langKey) { case 'pt': fallbacks.unshift('pt-PT'); break; case 'pt-PT': fallbacks.unshift('pt'); break; // no default } return fallbacks; }
[ "getFallbacks(langKey) {\n let fallbacks = ['en', 'und'];\n switch (langKey) {\n case 'pt':\n fallbacks.unshift('pt-PT');\n break;\n case 'pt-PT':\n fallbacks.unshift('pt');\n break;\n // no default\n }\n return fallbacks;\n }", "function getFallbackLng(lang...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Read up to and including a _contiguous_ substring, or read until the end of the template.
readUntil(substr) { const nextIndex = this.content.substring(this.index).indexOf(substr) + substr.length; return this.toNext(nextIndex); }
[ "readUpto(substr) {\n const nextIdx = this.content.substr(this.idx).indexOf(substr);\n return this.toNext(nextIdx);\n }", "readUntil(substr) {\n const nextIdx = this.content.substr(this.idx).indexOf(substr) + substr.length;\n return this.toNext(nextIdx);\n }", "readUpTo(substr)...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
TODO: add constructor with state: data[], isLoading, isListEmpty
constructor(props) { super(props); // set empty array to state this.state = { search: '', data: [], isLoading: true, isListEmpty: false }; }
[ "loadingData() {}", "InitList() {\r\n this._data = [];\r\n }", "_handleLoadSearchDataAll() {\n // if (! this.isValidData()) {\n // return;\n // }\n\n this._loading(true);\n\n const inputData = {\n SearchType: this.state.dataSearch.SearchType,\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Load emojis in dropup
function loadEmojis() { let emojis = ""; for (let i = 128512; i <= 128591; i++) { emojis += `<div class="emoji">&#${i};</div>`; } $("#emojisDropup").html(emojis); }
[ "function loadEmojis(){\n // #10 #add emojis form emojis.js\n var emojis = require('emojis-list');\n $('#emojis').empty();\n for (x in emojis){\n $('#emojis').append(emojis[x] + ' ');\n }\n}", "function loadEmojis() {\n var emojis = require('emojis-list');\n $('#emojis').empty();\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sets the analysis parameter of the energy when the user changes the drop down menu
function energySelect(analysis_params) { var myList=document.getElementById("myEnergy"); analysis_params.energy = myList.options[myEnergy.selectedIndex].value; return analysis_params }
[ "function select_Ensemble_Changed(theOptionValue)\n{\n // Change the ClimateVariable select box based on what was selected on the Ensemble drowdown\n var ensemble_Selection_Value = theOptionValue;\n UI_Builder_Add_ClimateVariable_Options_ForEnsemble(ensemble_Selection_Value);\n //alert(theOptionValue);\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
GAME METHODS ///////////////////////////// adds food every 80ish frames, interval decreasing as time progresses
function addFood() { let r = floor(random(15)); if (time % (80 - interval) === 0) { if (r < 10) { food.push(new Food(junkFood[floor(random(junkFood.length))], 1, false, false)); } else if (r < 14) { food.push(new Food(vegetables[floor(random(vegetables.length))], -5, true...
[ "function updateGame() {\n music.play();\n if ((cat.foodsMissed >= 10)|| (cat.flowerCaught)) {\n cat.gameOver = true;\n }\n\n for (let j = 0; j < foods.length; j++) {\n foods[j].fall(foods[j]);\n }\n timer = window.setTimeout(updateGame, 30);\n }", ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Display a "build output" table for a particular build. This displays a list of "active" (i.e. "in production") build outputs (stock items) for a given build. Any required tests are displayed here for each output Additionally, if any tracked items are present in the build, the allocated items are displayed
function loadBuildOutputTable(build_info, options={}) { var table = options.table || '#build-output-table'; var params = options.params || {}; // test templates for the part being assembled let test_templates = null; // tracked line items for this build let has_tracked_lines = false; //...
[ "function makeBuildOutputActions(build_info) {\n\n return [\n {\n label: 'complete',\n title: '{% trans \"Complete outputs\" %}',\n icon: 'fa-check-circle icon-green',\n permission: 'build.add',\n callback: function(data) {\n completeBu...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Adds a CSRF token in a header if a 'csrf' option is provided
function includeCSRFToken ({ method, csrf=true, headers }) { if (!csrf || !CSRF_METHODS.includes(method)) return const token = getTokenFromDocument(csrf) if (!token) return return { headers: { ...headers, 'X-CSRF-Token': token } } }
[ "function addCsrfHeader(ajaxRequest){\n\tvar header = $(\"meta[name='_csrf_header']\").attr(\"content\");\n\tvar token = $(\"meta[name='_csrf']\").attr(\"content\");\n\tajaxRequest.setRequestHeader(header, token);\n}", "function attachCSRF(req, csrftoken) {\n if (shouldSendCSRF(req.method)) {\n req.headers['X...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
convert json to array by key
function JsonToArray(list,key){ var array = []; if(!list){ return array; } $.each(list,function(i,v){ if(v[key] != undefined){ array.push(v[key]); } }); return array; }
[ "function convertToArrayWithKey(json) {\n //loop through an attach the key as a value property\n for(var k in json) {\n if(json.hasOwnProperty(k)){\n json[k].key = k;\n }\n }\n\n //convert objects to an array and return the result\n json = Object.keys(json).map(function(k) { return...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Set center of map to current location, or given location if given.
function setCenter(map, center) { if (center) { map.instance.setCenter(new google.maps.LatLng(center.latitude, center.longitude)); } else { navigator.geolocation.getCurrentPosition(function (position) { var center = position; map.instance.setCenter(new google.maps.Lat...
[ "function setCenter() {\n\t\t// Google.v3 uses EPSG:900913 as projection, so we have to\n\t\t// transform our coordinates\n\t\tmap.setCenter( getTransform(longitude, latitude), zoomLevel);\t\t\n\t\treturn;\n\t}", "function centreMap(latLng){\n map.setCenter(latLng);\n}", "function centerOnLocation() {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
DNA Pairing: using for loop and Object
function pairDna(str){ let dnaArr = [...str]; let dnaObj = { "A": "T", "T": "A", "C": "G", "G": "C" } let finalArr = []; for(let i = 0; i < dnaArr.length; i++){ finalArr.push([dnaArr[i], dnaObj[dnaArr[i]]]); } return finalArr; }
[ "function pairDNA(str) {\r\n var pairs = {\r\n A: \"T\",\r\n T: \"A\",\r\n C: \"G\",\r\n G: \"C\"\r\n };\r\n return str.split(\"\").map(x => [x, pairs[x]]);\r\n}", "function pairElement(str) {\n // array that will hold base pair arrays\n var dnaPairs = [];\n /* basePa...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Compares 2 visibles. Returns true if they are equal with an allowable imprecision
function compareVisibles(vis1, vis2) { return vis2 != null ? (Math.abs(vis1.centerX - vis2.centerX) < allowedVisibileImprecision && Math.abs(vis1.centerY - vis2.centerY) < allowedVisibileImprecision && Math.abs(vis1.scale - vis2.scale) < allowedVisibileImprecision) ...
[ "function compareVisibles(vis1, vis2) {\n return vis2 != null ? (Math.abs(vis1.centerX - vis2.centerX) < CZ.Settings.allowedVisibileImprecision && Math.abs(vis1.centerY - vis2.centerY) < CZ.Settings.allowedVisibileImprecision && Math.abs(vis1.scale - vis2.scale) < CZ.Settings.allowedVisibileImprecision) ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
open socket connection of single/multiple cubes
function openCubeConnection(){ if(settings.is_multiple_collectors){ var no_of_cubes = settings.cube.length; for( i=0;i<no_of_cubes;i++){ cube_url = settings.cube[i].protocol+"://"+settings.cube[i].domain+":"+settings.cube[i].port; settings.cube[i].client = cube.emitter(cube_url); } }else{ cube_url = se...
[ "function openCubeConnection() {\n if (settings.is_multiple_collectors) {\n revlogger.log('info', \"Open socket connection for multiple cubes\");\n var no_of_cubes = settings.cube.length;\n for (i = 0; i < no_of_cubes; i++) {\n cube_url = settings.cube[i].protocol + \"://\" + settings.cube[i].domain ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Action that sets the posts status to `open` and saves the post.
reopenPost() { let post = this.get('post'); post.set('status', 'open'); return post.save(); }
[ "closePost() {\n let post = this.get('post');\n post.set('status', 'closed');\n return post.save();\n }", "function status_post_saved(data) {\n\t// refresh activity stream\n\trefresh_profile_widget('activity_feed_profile');\n\t// refresh activity post\n\trefresh_profile_widget('status_posts_prof...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
PRIVATE Writes the background image iside the network element's main span.
function writeImageNE() { var elem = document.getElementById(this.id).appendChild(document.createElement("span")); elem.style.position = "absolute"; elem.style.left = 0; elem.style.width = this.width; elem.style.backgroundImage = "url(" + this.image + ")"; var pos = NAME_CENTER; if (this.nameLocation == N...
[ "function writeMinimapBackground() {\n\t\tif (this.bgImage != null) {\n\t\t\tvar image = new Image();\n\t\t\timage.src = this.bgImage;\n\t\t\tvar img = document.createElement(\"img\");\n\t\t\timg.setAttribute(\"border\", \"0\");\n\t\t\timg.setAttribute(\"src\", image.src);\n\t\t\tvar imgsp = document.getElementById...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get form element "nearest" another element. If the given element is a form element, then it is returned. Otherwise the first descendant of it that is a form element is returned.
function getNearestForm(element) { if (element.tagName.toLowerCase() === "form") { return element; } else { return element.getElementsByTagName("form").item(0); } }
[ "function getAncestorForm(element) {\n if (!element) {\n return null;\n }\n return isForm(element) ? element : getAncestorForm(element.parentElement);\n }", "function closest ( element, selector ) {\n\n var parent = null;\n\n while ( element !== null ) {\n\n parent = ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Converts transaction to JSON string. If transaction contains custom LONG instances and this instances doesn't have toString method, you can provide converter as second param
function stringifyTx(tx, fromLongConverter) { const { type, version } = tx; const schema = schemas_1.getTransactionSchema(type, version); const txWithStrings = index_1.convertLongFields(tx, schema, undefined, fromLongConverter); return stringifyWithSchema(txWithStrings, schema); }
[ "function parseTx(str, toLongConverter) {\n const tx = parse(str);\n return toLongConverter ? index_1.convertTxLongFields(tx, toLongConverter) : tx;\n}", "function generateTransactionJSON(){\n var tobject = createTransactionObjectJson();\n setData('send_transaction_object_json',JSON.stringify(tobje...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Output the data to ensure everything was processed and passed along correctly
function finalStep(data) { console.log("Processed output: \n" + data); }
[ "function outputData(dataArray) {\n // functionen logger i consolen en string og klistre den sammen med vores array\n console.log('Dette er funktionen der udskriver det hentede data: ' + dataArray);\n}", "function writeData() {\n\tvar output = \"\";\n\toutput += '<p>Count: '+count+'</p>';\n\t$data.html(outp...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Create just an element for a partial
function createPartial(template) { console.log("CREATING PARTIAL"); console.log(Navigation.transition); // Create it this way because some templates give error // when you just do angular.element(template) (unknown reason) var d = document....
[ "function getPartialField(opts, scope, idx) {\n var newField = '<partial-field pf-type=\"'+opts.type+'\" pf-default-value=\"'+opts.defaultValue+'\" pf-max-length=\"'+opts.maxLength+'\" pf-glue=\"'+opts.glue+'\" pf-glue-original=\"'+opts.glueOriginal+'\"/>';\n var elem = $compile(newField)(scop...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
A function that convert email into html.
function mailHTML(email, isIn){ const time = document.createElement("div") time.innerHTML = "<div>" + email._id + "</div>" const emailContainer = document.createElement("div") emailContainer.classList.add("mail") const lnk = document.createElement('a') lnk.setAttribute("href", "userprofile.html") lnk.inn...
[ "function generateHTMLEmail(email, message){\n\treturn `\n\t\t<!DOCTYPE html>\n\t\t<html>\n\t\t <head>\n\t\t <meta charset='UTF-8' />\n\t\t <title>title</title>\n\t\t </head>\n\t\t <body>\n\t\t \t<table border='0' cellpadding='0' cellspacing='0' height='100%' width='100%' id='bodyTable'>\n\t\t <tr>\n\t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
FUNCTION: matchRadioInput DESCRIPTION: Pass to dwscripts.findInArray to find a radio input element that is part of a radio group represented by an existing radio input element in a list of form elements. ARGUMENTS: listElm DOM node ptr. searchValue DON node ptr. The radio node. RETURNS: boolean true if object is a radi...
function FormFieldsMenu_matchRadioInput(listElm, searchValue) { var retVal = false; if( listElm && listElm.tagName == "INPUT" && listElm.type.toUpperCase() == "RADIO" && listElm.name == searchValue.name ) { retVal = true; } return retVal; }
[ "function TagMenu_pickValue(theValue) {\r\n var retVal = false;\r\n\r\n var index = -1;\r\n var theList = this.listControl.getValue(\"all\");\r\n for (var i=0; index == -1 && i < theList.length; i++) {\r\n if (theList[i].isRadio) {\r\n for (var j=0; j < theList[i].length; j++) {\r\n if (theList[i...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Populate the guestTableData state object with Guest objects pulled from the JSON.
_populateGuestsArray() { const guestData = this.state.guestRawData.data; for(let i = 0; i < guestData.length; i++) { const guest = guestData[i]; this.state.guestTableData.push( new Guest(guest.id, guest.first_name, guest.last_name, guest.email, guest.city, ...
[ "function getGuests(eventName) {\n $.get(\"/api/guests/\"+ eventName, function (data) {\n var rowsToAdd = [];\n for (var i = 0; i < data.length; i++) {\n rowsToAdd.push(createGuestRow(data[i]));\n }\n renderGuestList(rowsToAdd);\n // nameInput.val(\"\");\n });\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Call this instead of accessing $scope.tutorials directly. This allows us, if we want, to change settings for each page.
function loadTutorial(index) { return $scope.tutorials[index]; }
[ "function setupTutorial() {\n TUTORIAL = setupTutorialObject()\n var tutorial = TUTORIAL\n\n _(tutorial.setup)\n .forEach(function(tutorialStep) {\n // attach the popover to the specified html element\n if (\"popover_attach\" in tutorialStep ||\n \"popover\" in tutorialStep) {\n $(tu...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sort the subarray arr[lo .. hi]
static _sort(arr, lo, hi) { if (hi <= lo) { return; } let lt = lo; let gt = hi; const v = arr[lo]; let i = lo + 1; while (i <= gt) { const cmp = compare(arr[i], v); if (cmp < 0) { swap(arr, lt++, i++); } else if (cmp > 0) { swap(arr, i, gt--); }...
[ "function subSort(arr) {\n // didnt get this one. try again\n}", "static sectionSort(arr) {\n for (let i = 0; i < arr.length - 1; i++) {\n let last = i;\n for (let j = i + 1; j < arr.length; j++) {\n if (arr[j] < arr[last]) {\n last = j;\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Resolve a tuple id reference.
function getTupleId() { return tupleid; }
[ "function getTupleId(){return tupleid;}", "function parameters_getTupleId() {\n return tupleid;\n}", "function getTupleId() {\n return vega_dataflow__WEBPACK_IMPORTED_MODULE_1__.tupleid;\n}", "function getTupleId() {\n return vegaDataflow.tupleid;\n }", "function getTupleId() {\n return _vegaDataflow...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Middleware to validate that ID that you pass in is actually numeric
function checkNumeric(req, res, next) { //RegEx explanation: // ^: From the start of the line // [0-9]: there must be a character that is a digit 0-9 // +: repeated one or more times // $: until the end of the line if(req.params.id.match(/^[0-9]+$/)) { next(); return; } res.json(...
[ "function checkNumeric(req, res, next)\r\n{\r\n //RegEx explanation:\r\n // ^: From the start of the line\r\n // [0-9]: there must be a character that is a digit 0-9\r\n // +: repeated one or more times\r\n // $: until the end of the line\r\n if(req.params.id.match(/^[0-9]+$/))\r\n {\r\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Removes the preview polygons created with the function returned by showPolygon.
function removePreview () { svg.selectAll("polygon.preview").remove(); }
[ "function removePolygon() {\n\t\t var widget_data = $this.data(WIDGET_NS);\n\t\t // Check that we have a reference to the polygon.\n\t\t if(widget_data.polygon !== null ) {\n\t\t\t// Disable editing (even though it is probably already disabled) to enable removal to work.\n\t\t\twidget_data.polygon.setMap(n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
fetch all getAllActivityLogTable table
function getAllActivityLogTable() { vm.allActivityLogsPagination.length = 0; vm.tableParams = new NgTableParams({ // initial value for page page: 1, // initial page count: 10, // number of records in page, filter:...
[ "async function getAllActivities() {\n try {\n const { rows } = await client.query(`\n SELECT * FROM activities;\n `);\n return rows;\n } catch (error) {\n throw error;\n }\n}", "getAllActivity(db) {\n return db\n .select('*')\n .from('activity')\n .orderBy('date_cr...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
XXX only load the footnotes once the user has clicked on one
function Load_Footnotes(footnoteId) { // define F_ID in case script doesn't load properly window.F_ID = {}; var head = document.getElementsByTagName('head')[0]; var script = document.createElement('script'); script.type = 'text/javascript'; // ie 7/8 event handler (not sure if it's needed for 8 or not) script....
[ "function ShowFootnote(footnoteId) {\n\t// XXX: only load the footnote once the user has clicked on one\n\tif (window.F_ID == null) {\n\t\tLoad_Footnotes(footnoteId);\n\t\treturn\n\t}\n\n\t// Decide on the content\n\tvar content;\n\tif (F_ID[footnoteId] == null) {\n\t\tcontent = 'No footnote...';\n\t} else {\n\t\tc...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function for guess History
function getGuessHistory(guess) { guesses.push(guess); console.log(guesses); }
[ "function saveGuessHistory(guess){\n guesses.push(guess);\n}", "function saveGuessHistory ( guess ) {\n // *CODE GOES BELOW HERE *\n guesses.push ( guess );\n}", "function saveGuessHistory(guess) {\n guesses.push(guess);\n}", "function saveGuessHistory(guess) {\n guesses.push(guess);\n}", "func...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Remove all active clsses from content Elements
function cleanAllContentsActiveClasses(){ articles.forEach( (content) => content.classList.remove('active')); }
[ "function clearActive() {\n\t\t\t// cycle through all elements with class=\"tab-item\" and remove \"active\".\n\t\t\tfor (i = 0; i < tabContent.length; i++) {\n\t\t\t\ttabContent[i].classList.remove('active');\n\t\t\t}\n\t\t}", "function clearActivedItems() {\n btn.forEach((e) => {\n e.classList...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
function to handle loading more followers and load next page of followers
function handleMoreFollowers() { setNextPage(page + 1) }
[ "function loadFollowers() {\n UserService.getFollowers(vm.user.username, vm.loaded)\n .then(res => {\n vm.arr.push(...res);\n vm.loaded = vm.arr.length;\n });\n }", "function load_following_posts() {\n document.querySelector('#form-view').style.display ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
returns an object with all data for plotting results:
function myPlottingData(){ this['ResQTL'] = "", this['ResRel'] = "", this['ResRelbetweenC'] = "", this['ResgMean'] = "", this['Summary'] = "", this['RespMean'] = "", this['ResAccBVE'] = "", this['confidence'] = false, this['legend'] = true }
[ "getPlotData() {\n const values = [];\n\n for (let i = 0; i < this.dataList.length; i += 1) {\n const obj = this.dataList[i];\n const v = {\n date: obj.date,\n value: obj.value,\n };\n values.append(v);\n }\n return values;\n }", "function getAllData() {\n retu...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Event factory function used to communicate from the page script to the background script and viceversa
function xhrEventListenerFactory() { return function (e) { // send message to extension the background script runtime.sendMessage({ type: e.type, detail: e.detail }); }; }
[ "registerEvents() {\n // listen to global events (received from other Browser window or background script)\n browser.runtime.onMessage.addListener((request, sender) => {\n //console.debug('runtime.onMessage listener fired: request=%O, sender=%O', request, sender);\n switch (request.action) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Getter method for errortext
get errortext() { return this._errortext; }
[ "get errortext(){return this._errortext}", "set errortext(value) {\n Helper.UpdateInputAttribute(this, \"errortext\", value);\n }", "set errortext(value){Helper$2.UpdateInputAttribute(this,\"errortext\",value)}", "static getErrorText() {\n return cy.get(\"[data-cy=error-text]\");\n }", "function get...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns XPath node of the first form on page, or null if no form.
function getFormNode(doc) { var tag; tag = find(".//form", XPFirst, doc); if (tag == null) return null; return tag; }
[ "function get_first_form() {\n\tvar forms = window.document.forms;\n\tvar ix;\n\tfor (ix = 0; ix < forms.length; ix++) {\n\t\tvar e = forms[ix];\n\t\tif (e.id != \"logOffForm\") {\n\t\t\treturn e;\n\t\t}\n\t}\n\treturn null;\n}", "function documentForm() {\n return document.forms[0];\n}", "function getFormEl...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
function runAgain allows the user to make another transaction.
function runAgain(){ inquire.prompt([ { name: 'again', message: 'Would you like to make another purchase?', type: 'confirm' } ]).then(function(res){ if (res.again){ customer(); } else { console.log('We hope to see you at...
[ "function reRun() {\n inquirer.prompt([\n {\n type: \"list\",\n message: \"Another transaction or exit?\",\n choices: [\"Transaction\", \"Exit\"],\n name: \"again\"\n }\n ]).then(function(resp) {\n var answer = resp.again;\n if (answer === \"Transaction\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Each event listener is different but adds 1, 5, or 10 to the red, green, and blue values.
function increaseColor(event){ red = red + 1; colorChange(); }
[ "function addBlue(event) {\n let blueInc = event.target.getAttribute(\"data-inc\");\n blue = blue + Number(blueInc);\n\n //updates div to show current color with new value after button press\n colorDiv.innerHTML = \"rgb(\"+red+\",\"+green+\",\"+blue+\")\";\n}", "function colorSliders(){\n red.addEv...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
brainCloud client source code Copyright 2016 bitHeads, inc.
function BrainCloudClient() { var bcc = this; bcc.name = "BrainCloudClient"; bcc.appVersion = "1.0"; // If this is not the singleton, initialize it if(window.brainCloudClient !== bcc) { BCAbTest.apply(bcc); BCAsyncMatch.apply(bcc); BCAuthentication.apply(bcc); BCCha...
[ "get bucket() { return \"nextstrain-inrb\"; }", "function ChannelBank() {}", "function runBamazon() {}", "async function run() {\n await cloud.login('crownstoneEmail', 'crownstonePassword')\n\n let allKeys = await cloud.keys();\n\n // you can call keys on a sphere object too. Select the sphere by its ID\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Generates summary text of the target of the edit
genDataSummaryText() { let target = this.state.searchTarget; let summary = genSummary(target) return summary === "Entire Corpus" ? "No Data Selected" : summary }
[ "summaryMessage() {\n return 'You clicked ' + this.numberOfClicks + ' times. The input is ' + this.textInput + '. You chose radio ' + this.radioGroup + '. ' +\n 'You are using the ' + (this.lightTheme ? 'light' : 'dark') + ' theme.';\n }", "function displaytarget() {\n\t\t\t$(\"#targe...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
blog/index.js auto generates /blog/. This function generates "/blog/posts/[n]" for each blog (defined in gatsbyconfig.siteMetadata)
function generateBlogPostsIndex(graphql, createPage){ //Query the siteMetadata for the blogs, For each blog - let prArray = [] //the promise array BC.forEach((blog) =>{ // query all the markdown in it's children folder with - // render!=false, publish=true, type=post //RegEx cant end without '/', it...
[ "function addBlogs(posts) {\n posts.forEach(post => {\n $blogPost.append(\n `<article id=\"${post.id}\" class=\"blog-post z-depth-4 grid-element-wrap-col s6 m5 l10\">\n <h3>${post.post_title}</h3>\n <h5>Post by: ${post.author_name}</h5>\n <p class=\"overflow-ellipsis\">${post.body}</...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
id :: Category c => TypeRep c > c . . Function wrapper for [`fantasyland/id`][]. . . `fantasyland/id` implementations are provided for the following . builtin types: Function. . . ```javascript . > id(Function)('foo') . 'foo' . ```
function id(typeRep) { return Category.methods.id(typeRep)(); }
[ "function id(typeRep) {\n return Category.methods.id (typeRep) ();\n }", "static id() {\n\t\t// Category c => () -> c (a->a)\n\t\treturn AJS.of(AJS.identity)\n\t}", "function idFunction() {\n var s = typeVariable('_');\n return functionType(s, s);\n }", "function id(a) { return a }", "f...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates a new pet in the store. Duplicates are allowed newPet NewPet Pet to add to the store returns Pet
static addPet({ newPet }) { return new Promise( async (resolve) => { try { resolve(Service.successResponse('')); } catch (e) { resolve(Service.rejectResponse( e.message || 'Invalid input', e.status || 405, )); } }, ); }
[ "addPet(parent, { data }, { models }, info) {\n return models.Pet.create(data);\n }", "function newPet (ownername, pettype, petname, pethabitat, petactivity, db = connection) {\n return db('pets')\n .insert({\n owner: ownername,\n petType: pettype,\n petName: petname,\n h...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Redraw layout sidenav (Safari bugfix)
_redrawLayoutSidenav() { const layoutSidenav = this.getLayoutSidenav() if (layoutSidenav && layoutSidenav.querySelector('.sidenav')) { const inner = layoutSidenav.querySelector('.sidenav-inner') const scrollTop = inner.scrollTop const pageScrollTop = document.documentElement.scrollTop ...
[ "function sidenavOpen () {\n sidenavBar.style.transform = 'translateX(0%)'\n sidenavStatus = true\n}", "function updateSideBar() {\n\tselectionChanged(true);\n}", "function changeSideNav() {\r\n // If current scroll position is below topnav offset\r\n if ($(window).scrollTop() > topNavOffset...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
USAGE console.log(diagonalReverse([[1,2,3,4], [5,6,7,8], [9,10,11,12], [13,14,15,16]])); Write a function game() numberguessing game, that takes 2 int parameters defining the range. Using some kind of random function to generate random int from the range. While user input isn't equal that number, print "Try again!". If...
function game(param1, param2) { if (param1 - Math.floor(param1) !== 0 || param2 - Math.floor(param2) !== 0) return; var random = Math.floor(Math.random() * (param2 - param1 + 1) + param1); var userAnswer = +prompt("Enter number"); while (random !== userAnswer) { console.log('Try again!')...
[ "function sample_board(){\n\nvar a = Math.floor(Math.random()*4);\n\nif(a==0){\n // valid board\n board = [\n [5, 3, 0, 0, 7, 0, 0, 0, 0],\n [6, 0, 0, 1, 9, 5, 0, 0, 0],\n [0, 9, 8, 0, 0, 0, 0, 6, 0],\n [8, 0, 0, 0, 6, 0, 0, 0, 3],\n [4, 0, 0, 8, 0, 3, 0, 0, 1],\n [7, 0, 0, 0, 2, 0, 0, 0, 6],\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
todoController.$inject = ['$http', '$stateParams']
function todoController(){ var todoCtrl = this todoCtrl.list = ["something"] }
[ "function dashBoardController($scope,$stateParams,$state,$http,filterService,workingSetWebAPIService) {\n}", "function TodoController(todoService, ) { //$router\n\n let vm = this;\n vm.myName = 'Irina';\n vm.arrTasks = todoService.arrTasks;\n\n vm.add = function(task) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Find the toplevel node that contains the node before this one.
function topLevelNodeBefore(node, top) { while (!node.previousSibling && node.parentNode != top) node = node.parentNode; return topLevelNodeAt(node.previousSibling, top); }
[ "function topLevelNodeBefore(node, top) {\n while (!node.previousSibling && node.parentNode != top) {\n node = node.parentNode;\n }\n return topLevelNodeAt(node.previousSibling, top);\n }", "get nodeBefore() {\n let index = this.index(this.depth);\n let dOff = this.pos - this.path[this.path.length...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
pass .small_box element, get it's row/col within it's container box, and the rol/col of its container box
function box_position($box) { var row_col = function(position) { var row, col; if ((position >= 1) && (position <= 3)) { box_row = 1; box_col = position; } else if ((position >= 4)&&(position <= 6)) { box_row = 2; box_col = position - 3; } else if ((position >= 7)&&(position <= 9)) { b...
[ "function get_row_col($small_box) {\n\t\tvar position = box_position($small_box);\n\t\tvar box_row = position.small_row,\n\t\t\tbox_col = position.small_col,\n\t\t\tcontainer_row = position.container_row,\n\t\t\tcontainer_col = position.container_col,\n\t\t\trow_vals = {1:[1, 2, 3],2:[4, 5, 6],3:[7, 8, 9]},\n\t\t\t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
get the delay between a forecast and completion date, with a positive delay meaning "behind schedule" and a negative delay indicating ahead of schedule.
function getDelay(forecast, complete) { return moment(complete, 'YYYY-MM-DD') .diff(forecast, 'days'); }
[ "function calcDelay (entity, target) {\n \tvar delay = target - entity.time();\n \treturn (delay < 0) ? 0 : delay;\n }", "function reviewDelay(r) {\n\treturn Math.floor(moment.duration(moment().diff(moment(r.Delivery))).asDays());\n}", "function getDelay() {\n return _config2.default.delay;\n }", ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Given a total count, divide it into a number of whole item partitions, each as equal as possible Return an array: [0] = the item index of the start item in the set. (offset) [1] = the number of items in partition specified by the index. (count)
function partition(totalCount, partitionCount, partitionIndex) { var pop = 0; var part = ~~ (totalCount / partitionCount); pop = part; var rem = totalCount % partitionCount; if (partitionIndex < rem) pop++; var base = (part * partitionIndex) + Math.min(rem, partitionIndex); return [base...
[ "function Divide(array, count) {\n var divides = [];\n for (var i = 0; i < array.length; i += count) {\n divides.push(array.slice(i, i + count));\n }\n return divides;\n }", "function split(collection, count, isParallel = false) {\n count = _.pa...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets if the provided structure is a StaticableNodeStructure.
static isStaticable(structure) { switch (structure.kind) { case StructureKind_1.StructureKind.GetAccessor: case StructureKind_1.StructureKind.Method: case StructureKind_1.StructureKind.MethodOverload: case StructureKind_1.StructureKind.Property: ...
[ "static isStaticableNode(node) {\r\n switch (node.getKind()) {\r\n case typescript_1.SyntaxKind.GetAccessor:\r\n case typescript_1.SyntaxKind.MethodDeclaration:\r\n case typescript_1.SyntaxKind.PropertyDeclaration:\r\n case typescript_1.SyntaxKind.SetAccessor:\r\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Parses the 2bit file header.
function parseHeader(dataView: DataView): TwoBitHeader { var bytes = new ReadableView(dataView); var magic = bytes.readUint32(); if (magic != TWO_BIT_MAGIC) { throw 'Invalid magic'; } var version = bytes.readUint32(); if (version != 0) { throw 'Unknown version of 2bit'; } var sequenceCount = byt...
[ "function parse(buffer) {\n var headerSize = 1024, headerView = new DataView(buffer, 0, headerSize), warnings = [];\n var endian = false;\n var mode = headerView.getInt32(3 * 4, false);\n if (mode !== 2) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
15.2.4.7 PromiseOfStartLoadPartwayThrough absorbed into calling functions 15.2.4.7.1
function asyncStartLoadPartwayThrough(stepState) { return function(resolve, reject) { var loader = stepState.loader; var name = stepState.moduleName; var step = stepState.step; if (loader.modules[name]) throw new TypeError('"' + name + '" already exists in the module table'); ...
[ "function asyncStartLoadPartwayThrough(stepState) {\n\t return function(resolve, reject) {\n\t var loader = stepState.loader;\n\t var name = stepState.moduleName;\n\t var step = stepState.step;\n\n\t if (loader.modules[name])\n\t throw new TypeError('\"' + name + '\" already exists in ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
If `n` is null, this function throws `null`.
function throwOnNull(n) { if(n === null) { throw null; } return n; }
[ "function nth(list, n) { //can you explain this function?\n if (!list) {\n\t//console.log('list doesnt exist');\n return undefined;\n } else if (n == 0) {\n\t//console.log('value found', list.value);\n return list.value;\n } else {\n\t//console.log('calling nth again with list: ', list.rest);\n\t//console....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
handles the click event on the comment icon view wrapper
function commentClickHandler(){ /** * Capture analytics event for button click for reporting purposes */ Ti.Analytics.featureEvent('app.briefcase.commentbtn.clicked'); /** * update the state variable for the button */ commentStatus = !commentStatus; /** * set the icon variable to the proper reference...
[ "function handleOnShowCommentsClicked(commenticonContext)\n{\n var commentsModal = $('#commentsOnAdvice');\n var showOldCommentsButton = $(commentsModal).find('button.oldComments');\n var showNewCommentsButton = $(commentsModal).find('button.newComments');\n //on clicking show old comments at modal\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
A function that asserts cookie jar values are correct after the specified times Part 1. Performs authenticate(), sets cookie into jar and retrieves it for assertions Elapses time (relative to start of test) to the number of seconds specified by the first arg Part 2. Performs authenticate(), sets cookie into jar and ret...
function renewalTest(useMaxAge, firstElapsedSeconds, secondElapsedSeconds) { const options = { username: 'username', password: 'password', serviceUrl: 'http://cloudant.example:80', jar: new CookieJar(), }; // Promisify the cookie jar methods for easier chaining in the test const ...
[ "function makeAuth(){\n //set current time\n var currTime = new Date().getTime();\n //if we have authenicated, let's see if are cookies have expired\n if(authDetails!=undefined){\n //find the delta between the time when the cookies will expire and now\n var delta = dtExpire - currTime;\n //console.log(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Prints ObjectTypeIndexer, prints id, key, and value, handles static.
function ObjectTypeIndexer(node, print) { if (node["static"]) this.push("static "); this.push("["); print.plain(node.id); this.push(":"); this.space(); print.plain(node.key); this.push("]"); this.push(":"); this.space(); print.plain(node.value); }
[ "function ObjectTypeIndexer(node, print) {\n if (node[\"static\"]) this.push(\"static \");\n this.push(\"[\");\n print.plain(node.id);\n this.push(\":\");\n this.space();\n print.plain(node.key);\n this.push(\"]\");\n this.push(\":\");\n this.space();\n print.plain(node.value);\n}", "printIndex() {\n\t\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get XML FIle and parse the data onto web
function getXML(file){ reader.onload = function (file) { var xmlDoc = $.parseXML( file.target.result), $xml = $( xmlDoc ); $xml.find( "result" ).each(function () { $title = $(this).find( "title" ).text(); $url = $(this).find( "url" ).text(); $description = $(this).find( "description" ).t...
[ "function load_xml(path_to_xml) {\r\n // Create a connection to the file.\r\n var Connect = new XMLHttpRequest();\r\n // Define which file to open and\r\n // send the request.\r\n Connect.open(\"GET\", path_to_xml, false);\r\n Connect.setRequestHeader(\"Content-Type\", \"te...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Read characters from this Tokenizer until the end of the stream or until the provided condition is false when provided the current character.
function readWhile(tokenizer, condition) { var result = ""; while (hasCurrentCharacter(tokenizer)) { var currentCharacter = getCurrentCharacter(tokenizer); if (!condition(currentCharacter)) { break; } else { result += curren...
[ "function readWhile(tokenizer, condition) {\n var result = \"\";\n while (hasCurrentCharacter(tokenizer)) {\n var currentCharacter = getCurrentCharacter(tokenizer);\n if (!condition(currentCharacter)) {\n break;\n }\n else {\n result += currentCharacter;\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
If the new props requires a new falcor call this will pick it up and refresh the falcor state
componentWillReceiveProps(nextProps) { const newPathSets = this.constructor.getFalcorPathSets(nextProps.params) const oldPathSets = this.constructor.getFalcorPathSets(this.props.params) if (!_.isEqual(oldPathSets, newPathSets)) { this.safeSetState({ready: false}); if (pathSetsInCache(this.props....
[ "componentDidUpdate(previousProps) {\n this.props.list && !previousProps.list && setEditFormData(this.props.list)\n }", "componentDidUpdate(prevProps, prevState) {\n\t\tif(prevProps.rules !== this.props.rules) {\n\t\t\tthis.findFrequencyDistribution();\n\t\t}\n\t}", "updateProps(props = {}) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
cycleQuote: continuously cycles through the divs on the page which have the quote class.
function cycleQuote() { var currentQuote = $(quoteDivs).eq(quoteIndex); $(currentQuote).fadeIn(1200); currentQuote.delay(4000); $(currentQuote).fadeOut(1200, cycleQuote); currentQuote.delay(1200); quoteIndex = ++quoteIndex % quoteDivs.length; }
[ "function cycleQuotes() {\n var i = vm.quotes.indexOf(vm.currentQuote);\n if(!vm.currentQuote || i >= 0){\n vm.currentQuote = i === vm.quotes.length-1? vm.quotes[0]: vm.quotes[i+1];\n changeQuoteHeader();\n $timeout(cycleQuotes, 5000);\n }\n }", "function loadquote() {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Init delete entity endpoint DELETE '/:id'
initDeleteEndpoint() { this.router.delete('/:id', (req, res) => this.getDAO().remove(req.params.id, { user: req.user }).then(result => { if (result === 0) { return this.sendErr(res, 404, 'Not found'); } return res.status(200).send({...
[ "function createDeleteMethod() {\n this.delete(\n '/:id',\n (req, res, next) => {\n let id = req.params.id;\n this.model.destroy({\n where: { id: id }\n }).then(result => {\n res.json(result);\n }).catch(e => {\n next(e);\n });\n }\n )\n}", "delete (options...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Write a function to push either a simple value or an array of values onto a specified array. For the purpose of the exercise, we will call the target array simply array and the stuff to push onto it (either a simple value or array) simply toPush. If toPush is a simple value, it should be pushed onto array as an element...
function pushOntoArray(array, toPush) { // FILL THIS IN if (typeof toPush === 'string' || typeof toPush === 'number' || typeof toPush === 'boolean') { array.push(toPush); } else if (Array.isArray(toPush)) { array.concat(toPush); } return arr...
[ "function pushOntoArray(array, toPush) {\n // FILL THIS IN\n if ( typeof toPush == \"array\" ) {\n for (var i = 0; i < toPush.length; i++){\n array.push(toPush[i]);\n }\n }\n else {\n array.push(toPush);\n }\n }", "functio...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
When time is up alert player and run the stop function
function timeUp(){ if (timer===0){ alert("Sorry...Time's up!"); stop(); } }
[ "function quit() {\n onTimesUp();\n isPaused = true;\n document.getElementById( \"pause\" ).style.display = \"none\";\n document.getElementById( \"play\" ).style.display = \"inline-block\";\n console.log(timerIsRunning);\n }", "stopSpectate(player) {}", "function stopUpdatePlaytime() {\n clea...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Search member in database field 'searchableIndex' returns 5 entries
search() { return this.offset.pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_5__["filter"])(val => !!val), Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_5__["switchMap"])(offset => { return this.afs.collection('users', ref => ref.orderBy(`searchableIndex.${offset}`).limit(5)).valueChanges(); ...
[ "function luceneIndexSearch() {\n stompClient.send(\"/app/lucene/search\", {});\n}", "search() {\n return this.offset.pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__[\"filter\"])(val => !!val), Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__[\"switchMap\"])(offset => {\n return thi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
first name + last name
function getFullName(firstName, lastName){ return firstName+" "+ lastName }
[ "function fullName(firstname,lastname){\n\n return firstname +\" \"+ lastname\n}", "function fullName(first, last){\n return first + ' ' + last;\n}", "function getFullName(firstName, lastName) {\n return firstName + ' ' + lastName;\n}", "function getFullName(firstName, lastName) {\n return firstNa...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
For each comments relationship with a link (each post, not each comment), findHasMany is called with that link.
findHasMany(store, snapshot, link/*, relationship */) { if (link === '/posts/2/comments') { return resolve({ data: [ { id: 21, type: 'comment', attributes: { message: `${COMMENT_MESSAGES['21']} loaded via findHasMany`, }, ...
[ "linkToComments(link, options = {}) {\n const res = this.getFlattenedComments(subredditToCorpus(link.subreddit), link.article, options)\n return res\n }", "findHasMany(store, record, relationship) {\n var related = JSON.parse(relationship);\n\n var query = {\n where: {\n '$relatedTo': {\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Alterna a div de "Carregando" Texto = Texto a ser exibido (Opcional)
function ativaCarregando(Texto) { fixH(); if ($('div.Direita div.Carregando')) { if (Texto) { $('div.Direita div.Carregando span b').html(Texto); } if ($('div.Direita div.Carregando').css('display') == 'none') { $('div.Direita div.Carregando').css('display','table'); } else { $('div.Direita div.Carre...
[ "function siguienteTexto(){\n\t\n\tmostrar(divTextos);\n\tmostrar(divBoton);\n ocultar(divContingencia);\n ocultar(divJuicio);\n ocultar(divCuestionariosEdad);\n\t\n htmlContenido=arrayInstruc[stateTexto];\n\thtmlBotones=arrayBoton[stateTexto];\n\t\n\tpintarHTML(\"divTextos\",htmlContenido);\n pintar...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
move inside of vault // VaultKeeps view >> set active vault
goToVaultKeeps({ commit, dispatch }, vaultid) { api.get('/vaultkeeps/' + vaultid) .then(res => { commit("setActiveVaultKeeps", res.data) }) router.push({ name: 'vaultkeeps', params: { vaultid: vaultid } }) }
[ "activateHold() {\n this._isHoldWaypoint = true;\n }", "setVM (vm) {\n OnTheAir.vm = vm\n return OnTheAir\n }", "function hold() {\r\n if (canHold()) {\r\n renderClearTetrimino(currTetrimino);\r\n swapWithHold();\r\n renderHoldPreview();\r\n renderTetrimino(currTe...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Generate unique id for trip card
function createTripId() { const tripId = 'trip-' + tripIdCounter; tripIdCounter += 1; return tripId; }
[ "generateId() {\n return cuid();\n }", "function makeId() {\n return \"_\" + (\"\" + Math.random()).slice(2, 10);\n }", "function makeID() {\n function trash() {\n return Math.floor((1 + Math.random()) * 0x10000);\n }\n return `${trash()}${Date.now()}${trash()}`;\n}", "function _creat...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns false if the song is not in the queue, or the index if it is
function songIndexInQueue(id) { var ret = false; for (var i = 0; i < queue.length; i++) { if (queue[i].id == id) { ret = i; break; } } return ret; }
[ "function empty_song_queue() {\n\tif (song_ids.length <= 0) {\n\t\treturn true;\n\t}\n\treturn false;\n}", "function getSongOnQueue(idx){\n var song = null;\n if(idx !== null && _private.state.current_queue.getSongs()[idx]){\n song = _private.state.current_queue.getSongs()[idx];\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Hide DIV with this ID = tip_id
function HideToolTip(tip_id){ try{ if(document.getElementById){ var tooltip = document.getElementById(tip_id); tooltip.style.display = 'none'; tooltip.style.visibility = 'hidden'; } }catch(e){ } }
[ "function hidetip(tip) {\r\n\tdocument.getElementById(tip+\"-arrow-left\").style.visibility = \"hidden\";\r\n\tdocument.getElementById(tip+\"-tooltip\").style.visibility = \"hidden\";\r\n\t\r\n}", "function hideTip() {\r\n $(this).parent().children().last().hide();\r\n }", "function showHideTips() {\r\n va...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get hex from preferences file
function getHex(colourID, decoded) { var colorIndex = prefString.search(colourID); var colourHexEncoded = ""; var colourHexDecoded = ""; for (var i = colorIndex + colourID.length; prefString[i] != "\n"; i++) { colourHexEncoded += prefString[i]; } for (var i...
[ "function getHexFile(python) {\n var hexlified_python = hexlify(python);\n var insertion_point = ':::::::::::::::::::::::::::::::::::::::::::';\n return firmware.replace(insertion_point, hexlified_python);\n}", "async function hexRead(filePath) {\n return cmd(`xxd -p ${filePath}`).then(res => {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
insert a row in user_skills
function createLink(user, skill){ db.get('SELECT id FROM users WHERE username = ?', [user], function(err, uid){ db.get('SELECT id FROM skills WHERE skill_name = ?', [skill], function(err, sid){ db.run('INSERT INTO user_skills (user_id, skill_id) VALUES (?, ?)', [uid.id, sid.id]); console.log (uid.id + "...
[ "function insertskill(me){\n var queryString = 'INSERT INTO pickup_skills (id_user) VALUES (' + me.id + ')';\n connection.query(queryString, function(err, rows, fields) {\n if (err) throw err;\n });\n }", "function addSkill(name){\n db.transaction(tx => {\n tx.ex...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
redirects the user to the selected plan's 'view plan' page
function goToPlan(plan) { window.location.href = `/viewPlan/${plan.planId}`; }
[ "_goToPlanSelectionPage() {\n return browserHistory.push(routePaths.PLAN_SELECTION);\n }", "function doReportsCostForPremises() {\n window.location.href = \"reports-premise-cost.htm?premicesSelected=\" + $(\"#premisesSelectedForCostReport\").val();\n}", "function directUserFromViewInfo() {\n if (nex...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns a default label for the specified body
function getLabel(body){ switch(bodyType(body)){ case 'kinematics1D-mass': return Globals.massBodyCounter; case 'kinematics1D-pulley': return Globals.pulleyBodyCounter; case 'kinematics1D-surface': return Globals.surfaceBodyCounter; case 'kinematics1D-ramp': return Globals.rampBodyCounter; ...
[ "defaultLabel() {\n return null;\n }", "function label(type) {\n return labels[map(type)] || 'Unknown';\n }", "function GetLabelAuto(heading){\n var label = new ContentItem();\n label.snippet = \"\";\n label.heading = heading;\n label.flags = gddContentItemFlagStatic;\n //label.SetRect(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Confirm that the current video is under the music category
function check_if_music() { $("#meta-contents #more .more-button").click(); setTimeout(function(){ if($(".ytd-metadata-row-container-renderer #content a:contains('Music')") .text().includes("Music")) { this_is_music = true; init(); this_is_music = false; } $("#meta-contents #le...
[ "function isMusic() {\n if (videoTags.split('music').length!=1) {\n return true;\n };\n if (videoTitle.split('music').length!=1) {\n return true;\n };\n if (videoDesc.split('music').length!=1) {\n return true;\n };\n return false;\n}", "function player_active_music() {\n\treturn document.body.cont...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
We have to monkeypatch the teardown function so Vue will run runCleanup() when it tears down the watcher on unmounted.
function patchWatcherTeardown(watcher, runCleanup) { var _teardown = watcher.teardown; watcher.teardown = function () { var args = []; for (var _i = 0; _i < arguments.length; _i++) { args[_i] = arguments[_i]; } _teardown.apply(watcher, args); runCleanu...
[ "function patchWatcherTeardown(watcher, runCleanup) {\n var _teardown = watcher.teardown;\n watcher.teardown = function () {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n _teardown.apply(watcher, args);\n runC...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Unshallow the git repository (retriving every commits and tags).
async function unshallow() { await execa('git', ['fetch', '--unshallow', '--tags'], {reject: false}); }
[ "static async fetch() {\n try {\n await this.git(['fetch', '--unshallow']);\n } catch (error) {\n core.warning(`Fetch --unshallow caught: ${error}`);\n await this.git(['fetch']);\n }\n }", "function wipeGit() {\n return fsp.remove(path.join(__dirname, '.git'))\n .then(() => {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
returns an outlet point saturated to a given efficiency of an inlet point
maximumSaturation(pt, saturationEfficiency = 1.00) { var saturationPt = new psych.PointBuilder() .withElevation(pt) .withRelativeHumidity(100) .withEnthalpy(pt) .build(); var maxW = (saturationEfficiency * (saturationPt.properties.W - pt.properties.W)) + pt.properties.W; return new psych.P...
[ "efficiency(pt1, pt2) {\n\t\t\tvar intermediatePt = new psych.PointBuilder()\n\t\t\t\t.withElevation(pt2.properties.elevation)\n\t\t\t\t.withHumidityRatio(pt1.properties.W)\n\t\t\t\t.withEnthalpy(pt2.properties.h)\n\t\t\t\t.build();\n\t\t\tvar saturationPt = new psych.PointBuilder()\n\t\t\t\t.withElevation(pt2.prop...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
gets a value indicating whether or not this invoice has an order
function hasOrder() { return this.orders.length > 0; }
[ "async OrderExists(ctx, id) {\n const OrderJSON = await ctx.stub.getState(id);\n return OrderJSON && OrderJSON.length > 0;\n }", "function orderHasVoucher () {\n var len, i;\n for (i = 0, len = order.items.length; i < len; i += 1) {\n i...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Funcion para filtrar los productos segun su etiqueta
function filtrarProductosXEtiqueta() { let textoIngresado = $("#txtFiltroProductos").val(); textoIngresado = textoIngresado.toLowerCase(); let arrayFiltrados = { data: Array(), error: "" }; for (let i = 0; i < productos.length; i++) { let unProd = productos[i]; let unaEtiqueta = unProd.e...
[ "function filtrarUso(event){\n let filtro = event.currentTarget.innerText.toLowerCase();\n let productoFiltrado = productos.filter(elem => elem.uso == filtro)\n construirHTML (\"productos\", productoFiltrado, \"desSeleccionarFavorito\")\n }", "function filtrarProd(){\nlet filtrado = productos.filter(prod => {...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates a new SearchButton. Binds a `click` event on the element. Adds a search icon on the element.
function SearchButton(element, options, bindings) { var _this = _super.call(this, element, SearchButton.ID, bindings) || this; _this.element = element; _this.options = options; Dom_1.$$(element).setAttribute('aria-label', Strings_1.l('Search')); _this.bind.on(element, 'click', fu...
[ "function createSearchButton() {\r\n let searchButton = $('<span tabindex=\"0\" style=\"-moz-user-select: none; '\r\n + 'left: 105px;\" role=\"button\" id=\"lhn-add-subscription\"'\r\n + ' class=\"jfk-button-primary jfk-button\">Search'\r\n + '</s...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
1.2 function added to handle WMS requestFailedWMS(error) callback function only called when the request has failed. Otherwise it calls requestSucceededWMS().
function requestFailedWMS(error) { console.log("Error: ", error.message); // If service is secured, then log in and re-run the esriRequest. Token should be cached in session. if(error.code === 499){ var serviceRequestError = esriRequest({ url: serviceParamsWMS, handleAs: "xml" }); ...
[ "function getWmsInfo(callback) {\n var url = document.getElementById(mapId).getElementsByClassName('bkgwebmap-customlayerwmsinput')[0].value;\n if (url === '') {\n callback(undefined);\n return;\n }\n var title = '';\n var wmsInfo ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Move the snake by adding a new head at the beginning of the growth array and removing the end of the growth array. Also, checks for collision.
moveSnake(){ let head = this.growth[0]; let newHead; /* sets the current direction to next direction and updates the direction of the snake to the latest pressed direction by the player. */ this.currDirection = this.nextDirection; if(this.currDirection === 'right'){ newHead = new Roles(...
[ "function growSnake() {\n // Add food to head of snake\n var headCoord = snake.body[0];\n x = headCoord.x;\n y = headCoord.y;\n\n // if travelling up, add head to the top\n if (up) {\n snake.body.unshift(new Coordinate(x, y - side));\n } else if (down) {\n snake.body.unshift(new Coordinate(x, y + side)...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
=================================================================== from parser/ParseException.java ===================================================================
function ParseException() { }
[ "parseError(message) {\n let location = this.tokens[this.tokenIndex].location;\n let err = new Error(\"Line \" + location.line + \", column \" + location.column + \": \" + message);\n err.name = \"ParseError\";\n throw err;\n }", "function TrParseException(\n message\n )\n{\n this._message = messa...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Iteration 6: Time Format Turn duration of the movies from hours to minutes
function turnHoursToMinutes(movies) { return movies.map(movie => {const duration = movie.duration.split(" "); //console.log(movie.duration); let mins = 0; for (let time of duration) { if (time.includes("h")) { mins += parseFloat(time) * 60; } else { mi...
[ "function turnHoursToMinutes (movie){\n for (var i=0; i<movie.length;i++){\n var horas=parseInt(movie[i].duration.split(\" \")[0].toString().replace('h',''));\n var minutos=parseInt(movie[i].duration.split(\" \")[1].toString().replace('min',''));\n var tiempo=(horas*60)+minutos\n movie[i].dur...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
A class that can be used to associate any item with a path. Items and paths are kept in flat arrays for easy iteration and a memo is used to provide constant time lookup.
function PathStore () { this.items = []; this.paths = []; this.memo = {}; }
[ "function Zipper(item, path, meta) {\n this.item = item;\n this.path = path;\n this.meta = meta;\n}", "function System () {\n this.items = [];\n this.paths = [];\n this.memo = {};\n}", "__handleItemPath(path,value){let itemsPath=path.slice(6),dot=itemsPath.indexOf(\".\"),itemsIdx=0>dot?itemsPa...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Create a mark of this type. `attrs` may be `null` or an object containing only some of the mark's attributes. The others, if they have defaults, will be added.
create(attrs = null) { if (!attrs && this.instance) return this.instance; return new Mark$1(this, computeAttrs(this.attrs, attrs)); }
[ "mark(type, attrs) {\n if (typeof type == \"string\")\n type = this.marks[type];\n return type.create(attrs);\n }", "setNodeMarkup(pos, type, attrs = null, marks) {\n setNodeMarkup(this, pos, type, attrs, marks);\n return this;\n }", "mark(marks) {\n return marks == this.marks ? this : new...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Parse an expression given the argument signature and body code.
function expression(args, code, ctx) { // wrap code in return statement if expression does not terminate if (code[code.length-1] !== ';') { code = 'return(' + code + ');'; } var fn = Function.apply(null, args.concat(code)); return ctx && ctx.functions ? fn.bind(ctx.functions) : fn; }
[ "function parseExpression(program) {\n program = skipSpace(program);\n let match, expr;\n if ((match = /^\"([^\"]*)\"/.exec(program))) {\n expr = { type: 'value', value: match[1] };\n } else if ((match = /^\\d+\\b/.exec(program))) {\n expr = { type: 'value', value: Number(match[0]) };\n } else if ((match...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
\ Function : generate_wysiwyg() Description : replace textarea with wysiwyg editor Usage : generate_wysiwyg("textarea_id"); Arguments : textarea_id ID of textarea to replace \
function generate_wysiwyg(textareaID) { // Hide the textarea document.getElementById(textareaID).style.display = 'none'; // Pass the textareaID to the "n" variable. var n = textareaID; // WYSIWYG Width and Height wysiwygWidth = document.getElementById(textareaID).style.width; ...
[ "function createWysiwygControls() {\n\t\tvar textareas = document.getElementsByTagName(\"textarea\");\n\t\tfor (var i = 0; i < textareas.length; i++) {\n\t\t\tif (textareas[i].className.indexOf(\"wysiwyg\") > -1) {\n\t\t\t\tvar wysiwyg = document.createElement(\"div\");\n\t\t\t\tvar wrap = document.createElement(\"...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
The rotation of the base servo in radian
get baseRotation() { return this._baseRotation; }
[ "get baseRotationDegree() { return this._baseRotation * 180.0 / Math.PI; }", "get rotation() {}", "get rotationRate() {}", "get rotation() {\n // Get the radian angle\n let radianAngle = this.object3d.rotation.z;\n\n // Convert into degrees and return it\n return Math.round((radianAngle / Math.PI)...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Constructs a new RelatedDealDataDEALID. The ID of the deal which is associated with the item
constructor() { RelatedDealDataDEALID.initialize(this); }
[ "function creatIdObject() {\n var caseIDs = [];\n var itemIDs = [];\n results.createdCases.forEach(function(iCase) {\n caseIDs.push(iCase.id);\n itemIDs.push(iCase.item.id);\n });\n return {caseIDs: caseIDs, itemIDs: itemIDs};\n }", "createId () {\n\t\tthis.attributes.id ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
PROBLEM `absVal`: (normal) Write a function called `absVal` that return the absolute value of a given integer. Don't use Math.abs(...) If the input is invalid throw an 'Invalid Input' exception.
function absVal(integer) { // your code goes here }
[ "function absVal(integer) {\n\tif (typeof integer !== 'number' || integer.length<1 || \n\t\ttypeof integer == 'undefined'|| integer%1 !== 0) {\n\t\tthrow 'Invalid Input';\n\t} else if (integer < 0) {\n\t\tinteger = - integer; \n\t}\n\treturn integer;\n}", "function absVal(integer) {\n\tif(typeof(integer) !== 'num...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function to center node when clicked/dropped so node doesn't get lost when collapsing/moving with large amount of children.
function centerNode(source) { scale = zoomListener.scale(); x = - source.y0; y = - source.x0; x = x * scale + viewerWidth / 2; y = y * scale + viewerHeight / 2; d3.select('g').transition() ...
[ "function centerNode(source) {\n lastExpandedNode = source;\n var scale = zoomListener.scale();\n //WATCH OUT EVERYTHING WAS BADLY DONE OBJECTS\n //HAVE INVERTED X AND Y\n var x = -source.y0;\n var y = -source.x0;\n\n var nodeHeightOffset = 32;\n\n //to center...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
If an environments key exists within a config object, use that data instead.
function overrideWithEnvironment (object, environment) { if (object.environments && object.environments[environment]) { const newObject = Object.assign( {}, object, object.environments[environment] ) delete newObject.environments return newObject } return object }
[ "function _updateConfigFromEnv() {\n const envVarNames = [];\n\n for (const envVarName in process.env) {\n if (\n Object.prototype.hasOwnProperty.call(process.env, envVarName) &&\n envVarName.indexOf('ENKETO_') === 0\n ) {\n envVarNames.push(envVarName);\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get X translation of target.
get targetTranslateX() { return +this.getAttribute('target-translate-x') || 0; }
[ "set targetTranslateX(value) {\n const newValue = (Math.round(+value) || 0).toString();\n this.setAttribute('target-translate-x', newValue);\n }", "getTransformToElement(target) {\n const ref = Vector.toNode(target);\n return Dom.getTransformToElement(this.node, ref);\n }", "...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
If entries by current type already loaded earlier. Just check state property.
isLoadPerformed() { const entriesType = this.getEntriesType(); const { isLoadPerformed = false } = this.props.state.entries[entriesType]; return isLoadPerformed; }
[ "loadAdd(state, { type, data: allLatest, ctx }) {\n const { getters } = ctx;\n const keyField = getters.keyFieldForType(type);\n\n allLatest.forEach((entry) => {\n const existing = state.types[type].map.get(entry[keyField]);\n\n load(state, {\n data: entry, ctx, existing\n });\n })...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Dropdowns This will make the necessary changes for the dropdowns to work. This way if the JavaScript doesn't run all the content will still be displayed. The role=button and aria attributes are for accessibility. ID's are attached to the dropdowns and content divs so ariacontrols and arialabeledby can be implemented pr...
function initDropDowns() { "use strict"; try { var pointer = "<span class='drop-pointer' aria-hidden='true'>&#x276f;</span>", dropDowns = document.querySelectorAll(".drop-down"), dropContentDivs = document.querySelectorAll(".drop-content"), i; ...
[ "function getDropdowns() {\n dropdowns = document.querySelectorAll(Selectors.dropdown);\n } // Function to activate all dropdowns", "function dropdowns () {\n // Set the initial method name (in case it was set by the querystring module)\n setSelectedMethod(form.method.button.val());\n\n // Update each drop...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns `true` if the payload has been visited by our "preprocessing," in `standardizeJsonRpcRequestPayload(...)`.
function isPayloadPreprocessed(payload) { return !!payload[payloadPreprocessedSymbol]; }
[ "function isJsonRpcRequestPayload(value) {\n if (isNil(value))\n return false;\n return (!isUndefined(value.jsonrpc) && !isUndefined(value.id) && !isUndefined(value.method) && !isUndefined(value.params));\n}", "hasPayload()\n\t{\n\t\tconst pl = this.getPayload();\n\t\treturn pl !== undefined && pl !=...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }