query
stringlengths
9
34k
document
stringlengths
8
5.39M
negatives
listlengths
19
20
metadata
dict
Return the Q value to be used with the lowpass and highpass biquad filters, given Q in dB for the original filter formula. If the browser uses the new formula, conversion is made to simulate the original frequency response with the new formula.
function make_biquad_q(q_db) { if (!browser_biquad_filter_uses_audio_cookbook_formula) return q_db; var q_lin = dBToLinear(q_db); var q_new = 1 / Math.sqrt((4 - Math.sqrt(16 - 16 / (q_lin * q_lin))) / 2); q_new = linearToDb(q_new); return q_new; }
[ "function changeFilterQ(Q) {\n vcf1.Q.value = Q;\n\tvcf2.Q.value = Q;\n filterQ.innerHTML = (Q*1).toFixed(1);\n}", "function eq() {\n var filter = audioContext.createBiquadFilter();\n filter.type = INIT_EQ_TYPE;\n filter.frequency.value = INIT_EQ_FREQ;\n filter.Q.value = INIT_EQ_Q;\n filter.gain.value ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Delete albums from family shared albums
async deleteSharedAlbum(familyid, albumid){ data = { URI:`${FAMILIES}/albums/${familyid}/${albumid}`, method: 'DELETE', headers: { 'Content-Type': 'application/x-www-form-urlencoded' } } return await this.sendRequest(data) }
[ "deleteAlbum(artistName, albumName){\n let artistWithAlbum = this.getArtistByName(artistName);\n let albumToDelete = this.getAlbumInArtist(artistWithAlbum, albumName);\n let tracksFromAlbumToDelete = albumToDelete.tracks;\n tracksFromAlbumToDelete.forEach((t)=> this.deleteTrackFromPlaylists(t));\n al...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Trade above payload for an access token (i.e. get token)
function tradeCodeForAccessToken() { return axios.post(`https://${process.env.REACT_APP_AUTH0_DOMAIN}/oauth/token`, payload).catch(error => { console.log('--- error getting access token ---', error); }) }
[ "getAccessToken() {}", "function getToken() {\n return _additionalAccessToken? _additionalAccessToken : _authAccessToken;\n }", "function _getAuthToken() \n{\n misty.SendExternalRequest(\"POST\", misty.Get(\"AccessTokenTrigger\"), null, null, null, false, false, null, \"application/json\", \"_UpdateA...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
plugin / plugin name space uu.plugin enum plugins
function uuplugin() { // @return Array: ["plugin-name", ...] return uukeys(uuplugin); }
[ "get plugins() {\n return arrayToObject(this.pluginsArray, 'name');\n }", "getRegisteredPlugins() {\n return this.pluginTypes;\n }", "get plugins() {\n return Array.from(this.#plugins.values());\n }", "static registerActions() {\n webAPI.registerAction(\"get-plugin-prefix\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
get a field out of any firestation for any fyresafer
function getField(station, fyresafer, fieldname) { for (var key in station) { if (station.hasOwnProperty(key)) { console.log(key); if(key === fyresafer) { var fyresafers = station[key]; console.log(fyresafers); for (var key in fyresafers) { if (fyresafers.has...
[ "function getField(id) {\n for (i = 0; i < data.length; i++) {\n if (data[i].children[0].text == id) {\n return data[i].children[2];\n }\n }\n}", "function extractFieldValueFtn(obj, field) {\n $log.info('from object : ' + JSON.stringify(obj));\n if(typeof obj.getField ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
PERSIAN_TO_JD Determine Julian day from Persian date
function persian_to_jd(year, month, day){ var epbase, epyear; epbase = year - ((year >= 0) ? 474 : 473); epyear = 474 + mod(epbase, 2820); return day + ((month <= 7) ? ((month - 1) * 31) : (((month - 1) * 30) + 6)) + Math.floor(((epyear * 682) - 110) / 2816) + (epyear - 1)...
[ "function p2j(year, month, day) {\n var epbase, epyear;\n epbase = year - (year >= 0 ? 474 : 473);\n epyear = 474 + mod(epbase, 2820);\n return day + (month <= 7 ? (month - 1) * 31 : (month - 1) * 30 + 6) + $floor((epyear * 682 - 110) / 2816) + (epyear - 1) * 365 + $floor(epbase / 2820) * 1029983 + (PE - 1);\n}...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Delete the "templates" folder This happens every time a build starts
function clean(done) { rimraf('templates', done); }
[ "function cleanup() {\n return del([\n '.git',\n 'wp19',\n 'wp-cli.template.yml',\n 'wp-config.template.php'\n ]);\n}", "async cleanUp()\n {\n for (const f of this.tempJavascriptBootloaderFiles) {\n const compiledFilename = f.replace('.svelte', '.js');\n //await unlin...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Evaluate each single input Element
function evaluateElements(inputList) { // Evaluate input List from DOM let inputRequired = 0 for(let input in inputList) { // the element have 'input-required' class? let currentElement = inputList[input] if (currentElement.hasClass('input-required')) { inputRequired += 1; // the input ...
[ "Evaluate() {}", "function aesop_handle_elements(elements){\n for (var i = 0; i < elements.length; i++) {\n aesop_handler(elements[i]);\n }\n }", "_computeValue() {\n\t\tthis._localEvaluate();\n\t\tconsole.log(\"computing \" + [this._children]);\n\t\tfor(let element of this._children...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Render the list of projects
function renderProjects() { projects.forEach((project) => { const projectElement = document.createElement('li'); projectElement.dataset.projectId = project.id; projectElement.classList.add('list-name'); projectElement.innerText = project.name; if (project.id === selectedProjectId) { projectE...
[ "renderProjects() {\n //Retrieving the list header\n const listEl = document.getElementById(`${this.type}-projects-list`);\n //Clear the list since we're going to add everything again\n listEl.innerHTML = \"\";\n //Iterate through every project and render it as a list item\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Construct a markdown cell model from optional cell content.
function MarkdownCellModel(options) { var _this = _super.call(this, options) || this; // Use the Github-flavored markdown mode. _this.mimeType = 'text/x-ipythongfm'; return _this; }
[ "createMarkdownCell(options) {\n if (this.modelDB) {\n if (!options.id) {\n options.id = coreutils_2.UUID.uuid4();\n }\n options.modelDB = this.modelDB.view(options.id);\n }\n return new cells_1.MarkdownCellModel(option...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Here we heuristically define, if range is a column
get isColumn() { return this.startColumn === this.endColumn && this.startRow === 0 && this.endRow === null }
[ "isWithinRange(range){\n let {startRow, startCol, stopRow, stopCol} = range;\n return this.startRow >= startRow && this.stopRow <= stopRow && this.startCol >= startCol && this.stopCol <= stopCol;\n }", "function isSingleColumnRange(range) {\n var rangeColumn = range.getNumColumns();\n return rangeColumn ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets if the provided structure is a PropertySignatureStructure.
static isPropertySignature(structure) { return structure.kind === StructureKind_1.StructureKind.PropertySignature; }
[ "static isProperty(structure) {\r\n return structure.kind === StructureKind_1.StructureKind.Property;\r\n }", "static isPropertyNamed(structure) {\r\n switch (structure.kind) {\r\n case StructureKind_1.StructureKind.GetAccessor:\r\n case StructureKind_1.StructureKind.Method:...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Add row to product table
function add_product_table_row(name, index, id, model, descript, qty){ var table = ""; table += "<tr id='isl_row_"+ id + "'>"; table += "<td>" + index + "</td>"; table += "<td>" + model + "</td>"; table += "<td>" + descript + "</td>"; table += "<td>" + qty + "</td>"; ...
[ "function addIntoTable(product) {\n window.products[product.id] = product;\n addRowIntoTable(product);\n }", "function addRowToTable(){\n createTableElementsFromInputs();\n postTableElementsFromInputs();\n }", "function AddRow(index)\n{\n\t\tvar tableRow = \"<tr id=\\\"id_row_\" + (index...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Read a git object directly by its SHA1 object id
async function readObject ({ dir, gitdir = path__WEBPACK_IMPORTED_MODULE_0___default.a.join(dir, '.git'), fs: _fs, oid, format = 'parsed' }) { const fs = new FileSystem(_fs); // GitObjectManager does not know how to parse content, so we tweak that parameter before passing it. const _format = format === ...
[ "async function readObject$1 ({\n core = 'default',\n dir,\n gitdir = join(dir, '.git'),\n fs: _fs = cores.get(core).get('fs'),\n oid,\n format = 'parsed',\n filepath = undefined,\n encoding = undefined\n}) {\n try {\n const fs = new FileSystem(_fs);\n if (filepath !== undefined) {\n // Ensure t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
login : function () console.log('user logged in!')
login() { console.log('user logged in!') }
[ "function login(){\n\n }", "function login() {\n var email = $(constants.locators.login.email).val();\n var password = $(constants.locators.login.password).val();\n\n loginApi.login(email, password);\n }", "static login(){\r\n console.log(\"I am in User part\");\r\n }", ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Recolor region polygons (perhaps due to new weather data, or a different coloring function.
function recolor_regions() { scope.regions_geojson.setStyle(get_region_style); }
[ "function refreshPolygonShading() {\r\n\r\n var activePolygons = (activeGeography == \"census\") ? censusPolys : communityPolys;\r\n var activeDataset = (activeGeography == \"census\") ? censusData : communityData;\r\n\r\n if (relativeShadingEnabled) {\r\n\r\n // Blank polygons that ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Find the oldest person
function findOldestPerson(people) { var oldest = people[0]; for (var i = 1; i < people.length; i++) { if (people[i].age > oldest.age) { oldest = people[i]; } } return oldest; }
[ "function oldestPerson(arr) {\n let age = 0;\n let name = \"\";\n arr.forEach((element) => {\n if (element.age > age) {\n age = element.age;\n name = element.name;\n }\n });\n return name;\n}", "function oldestLivingFather (people){\n \n // create an array of f...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
models/Instance instance [string] problems string description TODO: Send along running instances and volumes
function reportInstance(username, instance, problems, description) { var subject = "Atmosphere Instance Report from " + username; var body = "Something is terribly wrong.\n\n"; body += description; return sendEmail(username, subject, body); }
[ "function formatInstanceType(name, mode, qi) {\n\t\tvar type = qi ? qi.price.type : {};\n\t\tname = type ? type.name : name;\n\t\tif (mode !== 'display' || (typeof type.id === 'undefined')) {\n\t\t\t// Use only the name\n\t\t\treturn name;\n\t\t}\n\t\t// Instance type details are available\n\t\tvar details = type.d...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Remove the added language, and readd it to the select
function removeLanguage(value){ //Find the container with the language in var p = document.getElementById("p"+value); //Removing the parent element also removes children (select etc.) p.parentElement.removeChild(p); //Re-add the language to the select, now at the end var select = document.getEle...
[ "remove_language(){\n this.post(this.root + '/actions/delete_path_lang', {\n id_option: this.source.id,\n language: this.source.language,\n id_project: this.id_project\n }, (d) => {\n if ( d.success ){\n this.source.language = null\n appui.succ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sets new value of the specified pagination element.
setPaginationElement(state, { paginationName, elementName, value }) { state[paginationName][elementName] = value; }
[ "function setPaginatedProperty(default_value, property, value){\t\n\tsetViewLevelProperty('paginatedProperties', default_value, property, value); \n}", "function setPage(value) {\n currentPage = value;\n}", "function fillInPagedListValues(page, element, url, limits) {\n\n // update the pager div(s) (don't...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
task 9 A function which concats all firstnested arrays in one array (use reduce):
function concatFirstNestedArrays(arr) { const array = arr.reduce(function (acc, value) { return acc.concat(value); }, []); return array; }
[ "function concatFirstNestedArrays(arr) {\n return arr.reduce(function(prevRes, current) {\n return [...prevRes, ...current];\n // або\n //const c =[...prevRes];\n //c.push(...current); \n //return c;\n });\n}", "function concatFirstNestedArrays(arr) \n{ \n return arr.reduce((a, b) => a.concat(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
poke port 5050 to see if 'npm run hotloader' was possibly called
function checkHotLoader() { return new Promise((resolve, reject) => { var server = net.createServer(); server.once("error", (err) => { resolve(err.code === "EADDRINUSE"); }); server.once("listening", () => server.close()); server.once("close", () => resolve(false)); server.listen(5050)...
[ "HotServer(web_port, api_port) {\n const api_proxy = api_port ? { '/graphql': `http://localhost:${api_port}` }\n : undefined;\n const server = new WebpackDevServer(this.compiler, {\n contentBase: './src',\n proxy: api_proxy,\n hot: true,\n publicPath: this.config.output.publicPath,\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Force all emulators to recreate their screens. This method is used when styling (fontsize, fontfamily) or screen size is updated.
async recreateScreens() { for (let i = 0; i < this._tabs.length; i++) { await this._tabs[i].emulator.recreateScreen() } }
[ "function resetScreen() {\n window.onresize = function(e) {\n rows = Math.floor(window.innerHeight / xlen)\n cols = Math.floor(window.innerWidth / ylen)\n field.setResolution(rows, cols)\n canvas.width = window.innerWidth\n canvas.height = window.innerHeight\n }\n window.onresize(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Changing project Displaying "Are you sure?" dialog
function changeProject(e) { e.preventDefault(); var buttonClicked = $(this); var buttonClickedCopy = buttonClicked.clone(); var yesButton = buttonClicked.clone(); var noButton = buttonClicked.clone(); yesButton.html('Yes'); noButton.html('Cancel'); noButton.attr('href', '#'); noButton.click(function(e...
[ "function showProjectResetDialogue() {\n showDialog({\n title: 'Project Reset',\n text: 'Project has been successfuly reset'.split('\\n').join('<br>'),\n negative: {\n title: 'Continue'\n }\n })\n}", "function onProjectCancel() {\n\n\t// Create the project\n\tif (newPr...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Set up function to update chosen circles using tooltip
function updateToolTip(chosenXAxis, chosenYAxis, chosenCircles) { // Set up x axis if (chosenXAxis === "poverty") { let xlabel = "Poverty: "; } else if (chosenXAxis === "income") { let xlabel = "Median Income: " } else { let xlabel = "Age: " } // Set up y axis if ...
[ "function updateToolTip(selXValue,selYValue, circlesGroup) {\n console.log(\"update tool tip\", selXValue);\n\n // Update X & Y lables depending on their corresponding selXValue & selXValue values\n var xlabel = setLabel(selXValue);\n var ylabel = setLabel(selYValue);\n\n var toolTip = d3.tip()\n .attr(\"cl...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Temporary function that will update the max directive index value in both the classes and styles contexts present on the provided `tNode`. This code is only used because the `select(n)` code functionality is not yet 100% functional. The `select(n)` instruction cannot yet evaluate host bindings function code in sync wit...
function updateLastDirectiveIndex(tNode, directiveIndex) { updateContextDirectiveIndex(getClassesContext(tNode), directiveIndex); updateContextDirectiveIndex(getStylesContext(tNode), directiveIndex); }
[ "function updateLastDirectiveIndex$1(tNode, directiveIndex) {\n updateLastDirectiveIndex(getClassesContext(tNode), directiveIndex);\n updateLastDirectiveIndex(getStylesContext(tNode), directiveIndex);\n}", "function updateLastDirectiveIndex(context, lastDirectiveIndex) {\n if (lastDirectiveIndex === TEMP...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Check whether an altitude code uses a simple format or Gillham coding.
static IsSimpleFormat(ac) { return !!(ac & AC_LOW_ALTITUDE_FLAG); }
[ "function isValidGBGGCode(code) {\r\n // make string upper case for easier comparison\r\n code = code.toUpperCase();\r\n \r\n // GBGG codes are either 7 or 11 characters\r\n if ((code.length != 7) && (code.length != 11)) {\r\n return false;\r\n }\r\n \r\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Seleciona Todos os jogadores
selecionaJogadores(){ let jogadores = document.querySelectorAll('#lista tr'); var time = []; jogadores.forEach( e => { var element = { nome : e.childNodes[1].innerHTML, nivel : parseInt(e.children[1].querySelector('input').value), ...
[ "buscarTodosOsContatos(){\n\t\t\n\t\treturn this.db.get('contatos').value();\t\n\t\t\n\t}", "function deleteButtonPressed(todo) {\n var motivoAsociado = db.get(\"motivo.\"+todo._id);\n db.remove(todo);\n db.remove(motivoAsociado);\n\n }", "function listarTodosMaestro(){\r\n\t\r\n\t\tlistarTodosM...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
iteration 5 function biggest product of 1 column
function biggestProduct1Column(mat ,col){ let result = []; for(let i =0;i<mat.length;i++){ for (let j=0;j<mat.length;j++){ result.push(mat[j][col]); } } return bigProd1Row(result); }
[ "function largestProduct() {\n var series = \"73167176531330624919225119674426574742355349194934969835203127745063262395783180169848018694788518438586156078911294949545950173795833195285320880551112540698747158523863050715693290963295227443043557668966489504452445231617318564030987111217223831136222989342338030813...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Retrieve the latest 10 visit records from the database.
function getVisits() { const query = datastore .createQuery('visit') .order('timestamp', {descending: true}) .limit(10); return datastore.runQuery(query); }
[ "function getLatest() {\n Paste.find({}).sort('-createdAt').limit(10).exec(function(err, result) {\n if (err) throw err;\n latest_pastes = result;\n //console.log('Scraped succesfully')\n //res.send(result);\n\t})\n}", "function mostRecentOrders(){\n db.any(`SELECT order_number, order_date\n FROM...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Handles drawing of an error message when user can not access the registration form
function drawRegistrationError() { var container = document.getElementById('welcome'); container.innerHTML = "<span class='error'>Registration form couldn't load!</span>" + container.innerHTML; }
[ "function onRegistrationFailed() {\n $('error-message').textContent =\n loadTimeData.getString('addingErrorMessage');\n setRegisterPage('register-page-error');\n recordUmaEvent(DEVICES_PAGE_EVENTS.REGISTER_FAILURE);\n }", "function onSignupFailure() {\n $(\"#signupError\").show();\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
FUNCTIONS TO NOTIFY USER OF INPUT REQUIREMENTS OR MISTAKES. Display prompt string s in status bar.
function prompt (s) { window.status = s }
[ "function prompt(s) {\r\n window.status = s\r\n}", "function promptEntry (s)\r\n{ window.status = pEntryPrompt + s\r\n}", "function promptEntry(s) {\r\n window.status = pEntryPrompt + s\r\n}", "function prompt(str) {}", "function prompt(str)\n{\n}", "function alertNotify(title,url){\n\twindow.prompt(t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
The showScore() function hides the questions and buttons then displays the user's total questions answered correctly, incorrectly, and unanswered.
function showScore() { $("#questions div").hide(); $("#questions button").hide(); $("#total-correct").append("Total Correct: " + correct); $("#total-incorrect").append("Total Incorrect: " + incorrect); $("#total-unanswered").append("Total Unanswered: " + unanswered); }
[ "function showScore () {\n\t$(\".questions\").hide();\n\t$(\".result\").show();\n\tshowScore();\n}", "function displayScore(){\n\t$(\"#radioAnswers\").hide();\n\t$(\"#submit\").hide();\n\t$(\"#questions\").text(\"You scored \" + score + \" out of \" + allQuestions.length + \" questions correctly.\"); \n}", "fun...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Make a new prompt box
function newPromptBox() { column = 0; promptText = ''; promptBox = $('<div class="jquery-console-prompt-box"></div>'); var label = $('<span class="jquery-console-prompt-label"></span>'); promptBox.append(label.text(promptLabel).show()); prompt = $(...
[ "function newPromptBox() {\ncolumn = 0;\npromptText = '';\nringn = 0; // Reset the position of the history ring\nenableInput();\npromptBox = $('<div class=\"jquery-console-prompt-box\"></div>');\nvar label = $('<span class=\"jquery-console-prompt-label\"></span>');\nvar labelText = extern.continuedPrompt? continued...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sample setup: uses the resource management client to create a sample resource group Then creates a key vault in this group and calls the authentication sample with the URI of the new vault.
function runSample(demoCallback) { var resourceClient; var kvManagementClient; const credentials = new DefaultAzureCredential(); resourceClient = new ResourceManagementClient(credentials, subscriptionId); kvManagementClient = new KeyVaultManagementClient(credentials, subscriptionId); /...
[ "async function createANewVaultOrUpdateAnExistingVault() {\n const subscriptionId =\n process.env[\"KEYVAULT_SUBSCRIPTION_ID\"] || \"00000000-0000-0000-0000-000000000000\";\n const resourceGroupName = process.env[\"KEYVAULT_RESOURCE_GROUP\"] || \"sample-resource-group\";\n const vaultName = \"sample-vault\";\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Event: foreignchange Fired when a foreign node is updated.
function fireForeignChange(path, oldValue) { return getNode(path). then(function(node) { events.emit('foreign-change', { path: path, oldValue: oldValue, newValue: node.data, timestamp: node.timestamp }); }); }
[ "fkChanged(fk) {\n const fKeys = Object.keys(this.fk);\n console.log(`FK changed: ${fk.config.name}`);\n for (let i = 0; i < fKeys.length; i++) {\n if (this.fk[fKeys[i]] === fk) {\n if (fk.loadState === 'reloaded') {\n // convert back to ID via old foreign key list\n fk.toID(f...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Change quiz start to true.
function startQuiz() { store.quizStarted = true; }
[ "function startQuiz() {\n console.log('quiz has begun');\n store.quizStarted = true;\n }", "function startQuiz() {\n console.log('quiz has begun');\n store.quizStarted = true;\n}", "function startQuiz() {\n fetchTriviaDbQuestions();\n addOptionEventListeners();\n }", "function startQ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Enable or disable buttons EXIT button
function enableExitButton() { exit.prop("disabled", false); }
[ "clickExit() {\n this.dialogueBox.visible = false;\n this.dialogueBook.visible = false;\n this.xButton.visible = false;\n this.bookObject.visible = false;\n }", "showExitConfirmation() {\n return true\n }", "function abort() {\r\n document.getElementById(\"launchButton\").disabled = fa...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Registers this addon to the list of routers in the DynamicRouter
_registerRouter(dynamicRouter) { if (this.instance.router) { dynamicRouter.addonRouters.push({ addon: this, router: this.instance.router }); } }
[ "register () {\n this._routers.forEach((router) => {\n if (router.match(this._type)) {\n this._matchedRouter = router;\n this._matchedRouter.register();\n\n return this._matchedRouter;\n }\n });\n }", "registerRouter() {\n this.application.container.singleton('Adonis/C...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This class bundles different functions to get some information about the property. All functions are called with parameters propertyName & propertyValue. This way you can make your own PropertyDetection class and create your own dialect.
function PropertyDetection() {}
[ "function PropertyExpression() {\n}", "_defineProperty (propertyName, propertyValue) {\n if (!SUPPORTED_PROPERTIES.includes(propertyName)) {\n return;\n }\n Object.defineProperty(this, propertyName, {\n get: () => this['_' + propertyName],\n set: expr => {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
in method getId I'm storing user selected employeeID
function getId(employee) { var id = employee.id; localStorage.setItem('employeeId', id); }
[ "getID () {\n return this.employeeID\n }", "function getEmployeeId(name) {\n return currentEmployees.find(el => el.employee === name).id;\n}", "getId() {\n return this.user ? this.user[this.config.identifierKey] : null;\n }", "function getEmployeeId(button) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns whether or not the popover is currently being shown
get isOpen() { return this._popover.isShown; }
[ "function isPopover() {\n var toPopover = false;\n if (!p.params.convertToPopover && !p.params.onlyInPopover) return toPopover;\n if (!p.inline && p.params.input) {\n if (p.params.onlyInPopover) toPopover = true;\n else {\n if (app.device.ios) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Default 'store' behavior, encaps into Handlebars SafeString
function getHandlebarsStore(name) { var temp = a.storage.temporary.get(name); if(a.isNone(temp)) { temp = a.storage.persistent.get(name); } return new Handlebars.SafeString(temp); }
[ "function safeStringHelper(text) {\n\treturn new Handlebars.SafeString(text);\n}", "function editStorageTemplate(data) {\n //takes template and populate it with passed array\n var rawTemplate = document.getElementById(\"editStorageTemplate\").innerHTML;\n var compiledTemplate = Handlebars.compile(rawTem...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Manage Enrollment Counts /copy enrollments from the primary plan properties (eg, eePlanCount, etc) to the count property in the viewspecific rates array, in each "rateType" object
function copyUpdatedCounts(plan) { this.$log.debug('THE PLAN CALLED WITHIN COPYUPDATED COUNTS'); this.$log.debug(plan); if (angular.isArray(plan.rates)) { angular.forEach(plan.rates, (rateObj) => { const planKey = rateObj.name.replace((/rate/i), 'PlanCount'); const count = parseInt(rateObj.count, ...
[ "function zeroEnrollments(plan) {\n const ratesArr = plan.rates || null;\n if (ratesArr) {\n angular.forEach(ratesArr, (ratesObj) => {\n if (angular.isDefined(ratesObj.count)) {\n ratesObj.count = 0;\n } \n });\n }\n for (const prop in plan) {\n if ((/plancount/i).test(prop)) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
======== onModeChange ======== On change function for mode config Sets visibility of modespecific configs and updates beaconmode order configs
function onModeChange(inst, ui) { // Update group configs based on mode selected networkScript.setBeaconSuperFrameOrders(inst, ui); oadScript.setDefaultOadBlockReqRate(inst); oadScript.setDefaultOadBlockReqPollDelay(inst); // Set visibility of network group dependents networkScript.setNetworkCo...
[ "function modeChanged(mode) {\n\n switch(mode) {\n case \"masking\":\n equalizerMenu.style.visibility = \"visible\";\n musicMenu.style.visibility = \"hidden\";\n pagingMenu.style.visibility = \"hidden\";\n showEqualizerSwitchDialog(\"masking\");\n break;\n\n case \"mu...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
localized created time for the current item
function localizedCreatedTimestamp() { if (vm.learningItem) { return moment(vm.learningItem.Created).format("M/D/YYYY h:mm A"); } else { return ''; } }
[ "function localizedModifiedTimestap() {\n if (vm.learningItem) {\n return moment(vm.learningItem.Created).format(\"M/D/YYYY h:mm A\");\n } else {\n return '';\n }\n }", "get createTime() {\n return this.getStringAttribute('create_time');\n }", "get creationTime() {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Push an open card on the array openCards[]
function addOpenCard(card) { openCards.push(card); }
[ "function addToOpenCards(card) {\n openCards.push(card);\n}", "function addToOpenCards(card){\n \topenCards.push(card);\n }", "function addOpenCard(opnedCard){\n\t// add the opened card into the openedCards array\n openCards.push(opnedCard);\n}", "function addToOpen(card) {\n openedCards.push(card)...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get Blocks by Address
function getBlocksByAddress(walletAddress) { let blocks = []; return new Promise((resolve, reject) => db.createReadStream().on('data', function (data) { var block = JSON.parse(data.value); if (block != null) { if (block.body.address == walletAddress) { blocks.push(b...
[ "getBlocksByAddress(address) {\n const blocks = [];\n var recursion = function (key, context) {\n return context.getBlockByHeight(key)\n .then((block) => {\n if (block.body.address === address) {\n blocks.push(block);\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns an escaped regexp from the string
function escapedRegExp(str) { var sanitize = str.toString().replace(/([.?*+^$[\]\\(){}|-])/g, '\\$1'); return new RegExp(sanitize); }
[ "function re(str) {\n return new RegExp(escapeStringRegexp(str), 'g');\n}", "function escapeRegExp(str) {\n\t return toString(str).replace(/\\W/g,'\\\\$&');\n\t }", "function quoteRegExp(str){\r\n\treturn str.replace(/([\\.\\\\\\/\\(\\)\\[\\]\\$\\*\\+\\-\\{\\}\\@\\^\\&\\?\\<\\>])/g, '\\\\$1') }", ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function : print_element_contents Purpose : Print the contents of the specified element Inputs : field_id id of the field to be printed title_string title string for header Output : A dynamically created window containing the content of the specified element Returns : (nothing) Example : Notes : (none)
function print_element_contents(field_id,title_string) { var element_contents = document.getElementById(field_id).innerHTML; var printwindow = window.open('', '', 'height=500, width=500'); var today = new Date(); var hours = today.getHours(); var mins = today.getMinutes(); var secs = today.getSeconds(); var yea...
[ "function printPage(id,title)\r\n{\r\n\tdocument.getElementById('report_title').value = title;\r\n\tdocument.getElementById('print_preview').value = document.getElementById(id).innerHTML;\r\n\tdocument.getElementById('form_preview').submit();\r\n}", "function printOut(elementId, elementValue) {\n var id = elem...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Center the "Working" div on the page
function centerProgressDiv() { var div = $('#working'); div.css("position","absolute") .css("top", (($(window).height() - div.outerHeight()) / 2) + $(window).scrollTop() - 100 + "px") .css("left", (($(window).width() - div.outerWidth()) / 2) + $(window).scrollLeft() + "px"); }
[ "function centerDiv() {\n var windowWidth = $(window).width();\n var windowHeight = $(window).height();\n\n var divWidth = $(\"#n-animation\").width();\n var divHeight = $(\"#n-animation\").height();\n\n $(\"#n-animation\")\n .css(\"top\", windowHeight / 2 - divHeight /...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Build the jscodeshift find query from nodes
function findQuery(node) { let str = ''; switch(node.type) { case 'CallExpression': str = callExpressionQuery(node); break; case 'MemberExpression': str = memberExpressionQuery(node); break; default: console.log('findQuery => ', node.type); break; } ret...
[ "function findQuery(node) {\n let str = '';\n switch (node.type) {\n case 'CallExpression':\n str = callExpressionQuery(node);\n break;\n case 'MemberExpression':\n str = memberExpressionQuery(node);\n break;\n case 'Literal':\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Initialize the connection to the client window
function initializeClient(clientWindow) { activeClientWindow = clientWindow // Send an initialization message to the client, // the signature property is included so that the // client doesn't get confused by other similiar // looking messages (checking origin would fix this) // Using '*' as the targetOrig...
[ "initClient() {\n //Handle bellhop events coming from the application\n this.client.on('loading', this.onLoading.bind(this));\n this.client.on('loaded', this.onLoadDone.bind(this));\n this.client.on('loadDone', this.onLoadDone.bind(this));\n this.client.on('endGame', this.onEndGame.bind(this));\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
CodeSplittingPhase heavy lifting by validating all modules included in the context
function CodeSplittingPhase(productionContext) { // loop over all modules to extract the modules that can be splitted const splitEntries = []; for (const possibleSplitEntry of productionContext.modules) { if (!possibleSplitEntry.isEntry && possibleSplitEntry.pkg.type === package_1.PackageType.USER_P...
[ "function checkModuleLoad() {\n if (moduleQueueList.length < 1 && inclusionQueue.module.length < 1 && !state.module) {\n dispatchModuleLoadEvent();\n }\n }", "shouldCompileModules() {\n return this._shouldCompileModules(this._getAddonOptions());\n }", "validate() {\n this.logger.time(Logg...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Check if the autoBid was enabled for one of the opened browser windows This will be used to reload BE popup after extension update.
static async checkAutoBidEnabledForWindow(window) { const result = await browser.storage.sync.get('SETTINGS'); if (Object.keys(result).length === 1 && result.hasOwnProperty('SETTINGS')) { const settingsInfo = result.SETTINGS; if (settingsInfo.hasOwnProperty('autoBid')) { const autoBid = sett...
[ "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" ] ] } }
R. Main local function to find subPolygon label coordinates
function labelPosition(subPolygon) { // R1. Create "segments" array createSegmentsArray(subPolygon); // R2. Create "filtered" array as a subset of the "segments" array var filtered = []; for (var k = 0; k < segments.length; k++) { var diff1 = Math.abs(90 - Math.abs(segments[k][7])); ...
[ "function drawLabel(x, y) {\n var subPolygonLabel = doc.layers['sub-polygon labels'].textFrames.add(); \n subPolygonLabel.contents = subPolygonNumber; \n subPolygonLabel.textRange.characterAttributes.fillColor = hexToRGB(textColor);\n subPolygonLabel.textRange.characterAttributes.size = textSize;\n v...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// Run transfer loop
async function single_transfer_loop() { if( MTA.verbose_get() >= MTA.RV_VERBOSE.debug ) log.write( cc.debug(MTA.longSeparator) + "\n" ); if( ! check_time_framing() ) { if( MTA.verbose_get() >= MTA.RV_VERBOSE.debug ) log.write( cc.warn("Skipped due to time framing") + "\n" ); ...
[ "async function Transfer(){\r\n\tlet i = 0;\r\n\tfor(i; i < nbWallets; i++){\r\n\t\tif(walletsData[i].balance && 5000-walletsData[i].free_net_usage > 500){\r\n\t\t\tlet tronWeb = new TronWeb({fullHost: fullHost, privateKey: myPks[i]});\r\n\t\t\tconst transaction = await tronWeb.transactionBuilder.sendTrx(sendTo, wa...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
throw if f is not a function
function _ensureFunction(f) { if (!f || typeof f !== 'function') throw new Error('the argument needs to be a function!'); }
[ "function isFn(f) {\r\n\treturn typeof f === \"function\";\r\n}", "function callIfFunc(f) {\n if (typeof (f) === 'function') {\n f();\n }\n }", "function checkFunction(f) {\n if (typeof adapter[f] !== 'function') {\n throw new Error('Object i...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
drawLights function: draws both light sources//
function drawLights(gl, a_position) { //enable hidden surface removal gl.enable(gl.DEPTH_TEST); //DIRECTIONAL LIGHT var source1 = [0,0,0,500,500,500]; var Lcolor1 = [1,0,0,1,0,0]; //red if (!light1){Lcolor1 = grayColors(Lcolor1);} //set positions of the vertices var ...
[ "static drawLights() {\n Draw.ctx.putImageData(Draw.behindLight1, Draw.dim.ratios[\"lights1\"][0] * Draw.dim.width, Draw.dim.ratios[\"lights1\"][1] * Draw.dim.height, 0, 0, Draw.behindLight1.width * Draw.dim.shrink, Draw.behindLight1.height * Draw.dim.shrink);\n Draw.ctx.putImageData(Draw.behindLight2...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Custom Adyen cartridge end Gets the gift certificate code from the httpParameterMap and redeems it. For an ajax call, renders an empty JSON object. Otherwise, renders a JSON object with information about the gift certificate code and the success and status of the redemption.
function redeemGiftCertificateJson() { var giftCertCode, giftCertStatus; giftCertCode = request.httpParameterMap.giftCertCode.stringValue; giftCertStatus = redeemGiftCertificate(giftCertCode); let responseUtils = require('~/cartridge/scripts/util/Response'); if (request.httpParameterMap.format.stringValue !==...
[ "function requestCertificate() {\r\n\tsetLoading(1)\r\n\t$.ajax({\r\n\t\turl : '../RequestCertificateServlet',\r\n\t\ttype : 'POST',\r\n\t\tdataType : 'json',\r\n\t\ttimeout : 8000,\r\n\t\tsuccess : function(data) {\r\n\t\t\tif (data.validSession && data.createdRequest) {\r\n\t\t\t\tsuccessful(1, \"SCS_CERT_REQUEST...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Starts a new battle, determins turn order based on agility stat and logs stats/enemy description before beginning battle.
startNewBattle() { if (this.player.agility > this.currentEnemy.agility) { this.isPlayerTurn = true; } else { this.isPlayerTurn = false; } console.log('Your stats are as follows:'); console.table(this.player.getStats()); console.log(this.currentEne...
[ "function battlePhaseStart(oldgame = false){\n if (!oldgame){\n //spawn the enemy mob, the mob's display is set within the constructor\n enemy = mobFactory.newMob(roundNum);\n // At the beginning of every battle, player is given startingshield\n player.shield = pla...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Read an entry from the P2WDB, given an entry hash.
async getEntry (hash) { try { // Input validation. if (!hash || typeof hash !== 'string') { throw new Error('getEntry() input hash must be a string.') } const serviceId = this.checkServiceId() const result = await this.axios.post(LOCAL_REST_API, { sendTo: serviceId, ...
[ "function holoWorldEntryRead (hash, callback) {\n\n // the url to post to\n var url = '/fn/HoloWorld/holoWorldEntryRead'\n \n // create the new request object & configure it to POST json data to url \n var xhr = new XMLHttpRequest()\n xhr.open('POST', url, true)\n xhr.setRequestHeader('Content-type', 'applic...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
US24Unique families by spousesNo more than one family with the same spouses by name and the same marriage date should appear in a GEDCOM file
function US24(fileName) { var data = parseGedcom(fileName); //var individualData = data.individualData; var familyData = data.familyData; var noError = true; let spousesNameMarriageDateList = []; for ( let famDataElement = 0; famDataElement < familyData.length; famDataElement++ ) { spouse...
[ "function US23(fileName) {\n var data = parseGedcom(fileName);\n var individualData = data.individualData;\n // var familyData = data.familyData;\n var noError = true;\n\n let nameBirthDayList = [];\n\n for (\n let indiDataElement = 0;\n indiDataElement < individualData.length;\n indiDataElement++\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Warning setting noMarge to true will overwrite state object!
setState(newState, noMerge = false) { const oldStateMemo = {...state}; if (noMerge) { // Notify all listeners of the state that is about to be overwritten. Object.keys(state).forEach((key) => stateEventEmitter.emit(`${storeName}-${storeEvents.STATEUPDATED}-${key}`, state)); state = {...
[ "empty(jug, state) {\n let new_state = this.copy_state(state);\n new_state[jug].level = 0;\n return new_state;\n }", "propagateState(aOld, aSticky) {\n return null;\n }", "fullState() {\n return Object.assign({}, this.state, this.internals)\n }", "adjustState(state, ...args) {\n retur...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This filter is used to select all controls that match a certain familyy
function familyFilter() { return func; //////////////// function func(items, filters) { var filtered = []; angular.forEach(items, function(item) { if(filters.indexOf(item.config.family) > -1 || filters.length === 0) { filtered.push(item); } }); return filtered...
[ "function filterFeaturesAtCTCDialog() {\n\t\tvar filter = trim(dijit.byId(\"ctcFeatureFilter\").attr(\"value\"));\n\t\tfor ( featureId in featureModelData ) {\n\t\t\tif ( !featureModelData[featureId][6].deleted && !isFeatureGroup(featureId) ) {\n\t\t\t\tvar featureObj = dojo.byId('ctc_feature_' + featureId);\n\t\t\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Generate a folder tree from a nested text list.
function folderTree(text_list, customRender) { // HTML rendering functions var Render = { icon : function(node) { return node.children ? '<i class="icon-folder-close"></i>' : '<i class="icon-file-alt"></i>'; } ,...
[ "make_folder(fnam) {\r\n let flds = fnam.split(\".\");\r\n let td = this.folder_tree_data;\r\n for (let f = 0; f < flds.length - 2; f++) {\r\n let fld = flds[f];\r\n let i = td.findIndex((e) => { return (e.txt == fld) })\r\n if (i == -1) {\r\n let tn = {\r\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets the role definition bindings for this role assignment
get bindings() { return SharePointQueryableCollection(this, "roledefinitionbindings"); }
[ "get bindings() {\r\n return new RoleDefinitionBindings(this);\r\n }", "get roleDefinitions() {\r\n return new RoleDefinitions(this);\r\n }", "function RoleDefinitionBindings(baseUrl, path) {\n if (path === void 0) { path = \"roledefinitionbindings\"; }\n return _super.call(thi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Removes the specified name from the kill file.
function removeFromKillFile(sname) { var curKF = GM_getValue(KILLFILE, "").split(KF_DELIMITER); var newKF = new Array(); for(var i=0; i<curKF.length; i++) { if(curKF[i] != sname) { newKF.push(curKF[i]); } } GM_setValue(KILLFILE, newKF.join(KF_DELIMITER)); }
[ "_removeFile(name) {\n let index = this.indexOf(name)\n\n if (index !== -1) {\n this._files.splice(index, 1)\n\n if (this.options.load) {\n this._list.splice(index, 1)\n }\n }\n }", "function caml_sys_remove(name){\n var root = resolve_fs_de...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Return a free port. / TODO: change to port.usable.
function getFreePort() { return ports.find((port) => port.usableCache); }
[ "function getFreePort(port, callback){\r\n if(portsUsed.indexOf(port)==-1)\r\n callback(port);\r\n else\r\n setImmediate(function() { getFreePort(port+2, callback); });\r\n}", "function findFreePort() {\n return __awaiter(this, void 0, void 0, function* () {\n return new Promise((resolve, rejec...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Adds a new column. Values must be specified and length of array equal to number of rows
upsertColumn(columnName, arrayOfValues) { if (arrayOfValues.length != this.data.intervalls.length){ throw new Error("New Column length is not equal to table column length: Length = " + this.data.intervalls.length); } for( var i = 0; i < this.data.intervalls.length; ++i ) { this.data.intervalls...
[ "function addToColumn(x, c) {\n\ttheCol = Columns[c];\n\tif (theCol === null) { // unused? make a new column\n\t\tColumns[c] = [x]; \n\t} else if (typeof(theCol) == 'number') {\n\t\tthrowError(ERR_NOAR_COL);\n\t\treturn true; // can't add a number to a column containing a constant\n\t} else { \n\t\tColumns[c].pus...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This function will get all the required input value from HTML for force calculation
function getForceCalculationValue() { force = document.querySelector("#force").value; mass = document.querySelector("#mass").value; acceleration = document.querySelector("#acceleration").value; }
[ "function getInput() {\n return document.querySelector('input#amount').value;\n }", "function onCalculateForce() {\n\n // This function will get all the value when calculate button was clicked\n getForceCalculationValue();\n\n // First check if input value contains 2 input\n // If the input is empty...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
this function will get all team past matches
async function getPastMatches(team_id){ let array_of_matches = []; const matches = await DButils.execQuery(`SELECT * FROM dbo.matches WHERE Played = 1 AND (HomeTeam_Id = '${team_id}' OR AwayTeam_Id ='${team_id}')`); for(const match of matches){ let jason_match = await match_utils.createMatch(match); ar...
[ "async function getNextMatches(team_id){\n let array_of_matches = [];\n const matches = await DButils.execQuery(`SELECT * FROM dbo.matches \n WHERE Played = 0 AND (HomeTeam_Id = '${team_id}' OR AwayTeam_Id ='${team_id}')`);\n for(const match of matches){\n let jason_match = await match_utils.createMatchPrev(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Read a word and look it up in the keywords array. If found, it's a keyword of that type; otherwise it's a PHP T_STRING.
function readWord() { source.nextWhileMatches(isWordChar); var word = source.get(); var known = keywords.hasOwnProperty(word) && keywords.propertyIsEnumerable(word) && keywords[word]; // since we called get(), tokenize::take won't get() anything. Thus, we must set token.content return know...
[ "function readWord(){\n source.nextWhile(isWordChar);\n var word = source.get();\n var known = keywords.hasOwnProperty(word) && keywords.propertyIsEnumerable(word) && keywords[word];\n return known ? result(known.type, known.style, word) : result(\"variable\", \"variable\", word);\n }", "fu...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Draw the user interface. Player health and ammo reserves, enemy health, current round, player inventory.
drawUI() { var ctx = this.canvas.getContext('2d'); ctx.font = "15px Courier"; // Colors to indicate the player's health situation if (this.player.hp >= 70) ctx.fillStyle = "#0f0"; else if (this.player.hp < 70) ctx.fillStyle = "#ff0"; if (this.player.hp < 40) ctx.fillStyle = "#f00"; if (this.player.h...
[ "function drawUI(){\n c.font = \"bold 25px Lucida Console, Monaco, monospace\";\n c.fillStyle = \"rgb(255, 184, 0)\";\n c.fillText(pad(hero.score, 6),canvas.width - 150,canvas.height-30);\n //draws the scoremeter\n\n c.beginPath();\n c.font = \"bold 25px Lucida Console, Monaco, monospace\";\n c.fillStyle = \...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Highlights the value of the input box.
function ui_highlightInputValue(id_inputbox){ var _inputbox = ui_getObjById(id_inputbox); _inputbox.focus(); _inputbox.select(); }
[ "function focusIn() {\n var x, i; // x - the typed text; i - index of the typed string (array)\n // All characters typed in the input field are iterativly converted to light blue colour\n x = document.querySelectorAll(\".highlight1\");\n for (i = 0; i < x.length; i++) {\n x[i].style.color = \"#3ad\"; // the ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Fires event that the search option has changed. passes boatTypeId (value of this.selectedBoatTypeId) in the detail handleSearchOptionChange
handleSearchOptionChange(event) { // Prevents the anchor element from navigating to a URL. //event.preventDefault(); // Creates the event with the contact ID data. //const selectedEvent = new CustomEvent('selected', { detail: this.contact.Id }); // Dispatches the event. //this.dispatchEvent(sele...
[ "handleSearchOptionChange(event) {\n this.selectedBoatTypeId = event.detail.value;\n // Create the const searchEvent\n // searchEvent must be the new custom event search\n const searchEvent = new CustomEvent('search',{detail:{boatTypeId:this.selectedBoatTypeId}});\n this.dispatchE...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function boxSelector() Use this function to select, unselect or invert selection for specified checkbox groups Call: boxSelector(['name1','name2',...,'namen'],action), here action is 'select', or 'unselect', or 'invert'
function boxSelector(list,action) { action = (action == 'select') ? true : (action == 'unselect') ? false : action; for ( var i=0;i<list.length;i++ ) { var group = 'bbDomUtil.getInputElementByName("'+list[i]+'")'; if ( typeof (group = eval(group)) != 'undefined' ) { var j...
[ "function boxSelector(list,action)\r\n{\r\n action = (action == 'select') ? true : (action == 'unselect') ? false : action;\r\n for ( var i=0;i<list.length;i++ )\r\n {\r\n var group = 'bbDomUtil.getInputElementByName(\"'+list[i]+'\")';\r\n if ( typeof (group = eval(group)) != 'undefined' )\r\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
function to add 2 numbers, then see if their result matches the function's internal testing logic (5 + 1 = 6). then, output the Failed or Passed result.
function testAddTwoNumbers() { var x = 5; var y = 1; var sum1 = x + y; var sum2 = addTwoNumbers(5,1); console.log('addTwoNumbers() should return the sum of its two parameters.'); console.log('Expect ' + sum1 + ' to equal ' + sum2 + '.'); if ( sum1 === sum2) return console.log('Passed.'); console....
[ "function addtest(v1, v2, expected) {\n results.total++;\n var r = calculator.addition(v1, v2);\n if (r !== expected) {\n results.bad++;\n console.log(\"Expected \" + expected +\n \", but was \" + r);\n }\n }", "function test__add () {\n // test setup\n const params = [1, 2, 3];\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
checks that bboxa constains bboxb where bbox = [minLat, minLon, maxLat, maxLon]
function contains (bboxa, bboxb) { return bboxa[0] <= bboxb[0] && bboxa[1] <= bboxb[1] && bboxa[2] >= bboxb[2] && bboxa[3] >= bboxb[3] }
[ "function bboxIntersects(a, b) {\n return b.minX <= a.maxX &&\n b.minY <= a.maxY &&\n b.maxX >= a.minX &&\n b.maxY >= a.minY;\n}", "intersects_bbox(b) {\n return ((this.max.x >= b.min.x) && (this.min.x <= b.max.x) &&\n (this.max.y >= b.min.y) && (this.min.y <= b.max.y));\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Fills an index buffer with the indices for the edges of a polygon contour.
function addPolygonEdges(indexBuffer, vertexOffset, vertexStride, polygonContour, polygonContourEdges, isExtruded, addFootprintEdges, wallEdgeSlope) { for (let i = 0; i < polygonContourEdges.length; ++i) { if (polygonContourEdges[i]) { if (isExtruded === true) { const vFootprint0...
[ "_updateEdgeIndices() {\n\t\tif (this._edgeIndicesUpdate) {\n\t\t\tconst gl = this.gl;\n\t\t\tfor (let ID = 0; ID < this.network.indexedEdges.length / 2; ID++) {\n\t\t\t\tlet edgeID = this.network.index2Node.length + ID;\n\t\t\t\tif (this._pickeableEdges.has(ID)) {\n\t\t\t\t\tthis.edgesGeometry.edgesIndexArray[4 * ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Builds a view model for the current props and state. This must return an object of key/value pairs.
getModel(presenterProps: Object, presenterState: Object) { return {} }
[ "getInitialValues() {\n const {model} = this.props;\n\n if (!model) {\n return {};\n }\n\n let v = {};\n\n //Convert stagename for redux-form\n v.is_public = model.is_public;\n // v.gallery_is_public = model.gallery_is_public;\n // v.is_freezed = mo...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Prepare all `.jsscrollindicator` links on the page.
function preparePage() { offsets = []; links = []; $('.js-scroll-indicator').find('a').each((index, el) => { const $link = $(el); // Calculate the element's offset from the top of the page while anchored const $linkTarget = $($link.attr('href')); if ($linkTarget.length) { // Add jQuery obj...
[ "function preparePage() {\n links = [];\n\n $(\".js-scroll-indicator\").find(\"a\").each(function(index, link) {\n prepareIndicator( $(link) );\n });\n }", "function preparePage() {\n offsets = [];\n links = [];\n\n $(\".js-scroll-indicator\").find(\"a\").each(function(index, el) {\n let $lin...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Copy dependencies to ./public/libs
function copy() { gulp.src(npmDist(), { base: './node_modules' }) .pipe(gulp.dest('./assets/libs')); }
[ "function copyLibs() {\n gulp.src(`${devPath}/_dev/libs/*`).pipe(clean({forse: true}));\n \n setTimeout(function () {\n gulp.src(`./node_modules/bootstrap/dist/**/*.*`).pipe(gulp.dest(`${devPath}/_dev/libs/bootstrap/`));\n gulp.src(`./node_modules/jquery/dist/**/*.*`).pipe(gulp.dest(`${devPat...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get BY PROFILE ID ERROR
function _profileGetByIdError(error) { console.log(error); }
[ "get errorId() {\n return this[$errorId];\n }", "getUpdatePersonalDetailsResultError() {\r\n return this.store.pipe(Object(_ngrx_store__WEBPACK_IMPORTED_MODULE_1__[\"select\"])(getProcessErrorFactory(UPDATE_USER_DETAILS_PROCESS_ID)));\r\n }", "getError(errors, prop) {\n try {\n retur...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This function creates the div and canvas we will use in createSheet this is the entry point from the html.index file
function initWB(){ //Create a div to encase the editable area of the sheet (sheet and tabs) var workSpace = document.createElement("DIV"); document.body.appendChild(workSpace); workSpace.setAttribute("id","work_space"); workSpace.setAttribute("style","position: relative; overflow: hidden;"); //Create a canv...
[ "_createCanvas() {\n\n const canvasId = \"xeokit-canvas-\" + math.createUUID();\n const body = document.getElementsByTagName(\"body\")[0];\n const div = document.createElement('div');\n\n const style = div.style;\n style.height = \"100%\";\n style.width = \"100%\";\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
drawReckt und Create Reckt
function drawReckt() { let rechteck = new Rechteck(Math.round(Math.random() * 200), Math.round(Math.random() * 200), Math.round(Math.random() * 200), Math.round(Math.random() * 200), Math.round(Math.random() * 5)); rechteck.draw(); return rechteck; }
[ "function freeDraw() {\n mainDiagram.toolManager.panningTool.isEnabled = false;\n // create drawing tool for mainDiagram, defined in FreehandDrawingTool.js\n var tool = new FreehandDrawingTool();\n // provide the default JavaScript object for a new polygon in the model\n tool.archetypePartData =\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Handler for the mkdir() system call. path: the path of the new folder mode: the desired permissions of the new folder cb: a callback of the form cb(err), where err is the Posix return code.
function mkdir(path, mode, cb) { var err = -2; // -ENOENT assume failure lookup(connection, path, function(dst) { if (dst === 'undefined' ) { connection.createFolder(path, 0); } cb(err); }); }
[ "function mkdir(path, mode, cb) {\n var path = pth.join(srcRoot, path);\n fs.mkdir(path, mode, function mkdirCb(err) {\n if (err) \n return cb(-excToErrno(err));\n cb(0);\n });\n}", "function mkdir(path, mode) {\r\n return promise(function (c) { return fs.mkdir(path, mode, c); });\r\n}", "...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Set up state and event handlers for subforms. This will begin tracking all the subforms on the page, and connect subform visibility to any associated controllers.
_setupSubforms() { const configuredControllers = {}; this._$subforms.each((i, subformEl) => { const $subform = $(subformEl); const controllerID = $subform.data('subform-controller'); const subformID = $subform.data('subform-id'); const enablerID = $subfor...
[ "_setupFormListener() {\n if (!AutoNumericHelper.isNull(this.parentForm)) {\n // Set up the handler function\n this._onFormSubmitFunc = () => { this._onFormSubmit(); };\n this._onFormResetFunc = () => { this._onFormReset(); };\n\n // Check if the parent form alread...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Disables comments on this page
disableComments() { return this.setCommentsOn(false).then(r => { this.commentsDisabled = true; return r; }); }
[ "function wpml_comment_exclude(postid) {\n\tjQuery(\"#wpml_messages\").html('');\n\t// ajax call to itself\n\tjQuery.post(\"../wp-content/plugins/wp-monalisa/wpml_edit.php\", {postid: postid}, \n \t\tfunction(data){jQuery(\"#wpml_messages\").html(data);});\n \n\treturn false;\n}", "function Hiddencomments() {\n\t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Private transform nodes to cover domain nodes an array of nodes Returns an array of nodes.length nodes spanning over domain
function coverDomain(nodes) { var domainLength = domain[1] - domain[0], min = Math.min.apply(Number.MAX_VALUE, nodes), max = Math.max.apply(null, nodes), diff = max - min; return nodes.map(function(n) { return domain[0] + domainLength * (n - min) / diff; }) }
[ "function nodesToArray(nodes) { // 9021\n var results = []; // 9022\n for (var i = 0; i < nodes.length; ++i) { ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Tries to AutoScrobble video if user is logged in, its a music video and the trackinfo was found
function tryAutoScrobble () { if (us_getValue("us_autoscrobble_active", 0) == 1) { var response = getTrackInfo(); isMusicVideo(response, tryAutoScrobbleCallback); } }
[ "function trackVideoUserInitiatedPlay(selectedVideoInfo) {\n\t\tconsole.log(\"OMNITURE -- trackVideoUserInitiatedPlay()\");\n\t\tvar t = this;\n\t\tvar s = isEmbedWindow ? window.self.s : window.parent.s;\n\t\ts.linkTrackVars = \"prop9,prop21,eVar4,eVar9,eVar14,eVar18,eVar28,eVar39,eVar49,eVar55,eVar56,eVar72,event...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
TODO: decide whether return it or other ways update network for `time` ms, then return the spikeTrains
think(time) { for (let t = 0; t < time; t++) { // 从后层开始更新 network, 防止前面更新的影响后面的 for (let i = this._layers.length - 1; i >= 0; i--) { this._layers[i].forEach((neu, neuIndex) => { neu.update(); if (neu._isSpiking) { this._spikeTrains[i][neuIndex].push(t); ...
[ "getTicksAtTime(time) {\n return Math.round(this._clock.getTicksAtTime(time));\n }", "function StartMovingSpikes()\n{\n var cur_t = GetSecondsSinceEpoch();\n for(var i=0; i < MovingSpikeModels.length; ++i)\n {\n var spike = MovingSpikeModels[i];\n if(spike.Physics.crossedScreen == true ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Move files from IE asset folder to build
function ie() { return gulp.src( 'src/assets/ie/*' ) .pipe( gulp.dest( './build/assets/ie/' ) ); }
[ "moveToDist() {\n const targetDir = deployDir(this.folderName)\n const sourceDir = path.join(this.options.cwd, 'dist')\n const assetsDir = `${sourceDir}/${this.folderName}`\n // move assets out\n const assetsList = glob.sync('**', {\n cwd: assetsDir,\n nodir: true\n })\n assetsList.fo...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
React hook that implements the WAIARIA Spin Button widget and used to create numeric input fields. It returns prop getters you can use to build your own custom number inputs.
function useNumberInput(props) { if (props === void 0) { props = {}; } var _props = props, _props$focusInputOnCh = _props.focusInputOnChange, focusInputOnChange = _props$focusInputOnCh === void 0 ? true : _props$focusInputOnCh, _props$clampValueOnBl = _props.clampValueOnBlur, clampVal...
[ "function useNumberInput(props){if(props===void 0){props={};}var _props=props,_props$focusInputOnCh=_props.focusInputOnChange,focusInputOnChange=_props$focusInputOnCh===void 0?true:_props$focusInputOnCh,_props$clampValueOnBl=_props.clampValueOnBlur,clampValueOnBlur=_props$clampValueOnBl===void 0?true:_props$clampVa...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Remove duplicate entries from an array.
function removeDuplicates(array) { var seen = {}; return array.filter(function(item) { return seen.hasOwnProperty(item) ? false : (seen[item] = true); }); }
[ "function removeDuplicateItems(arr) {}", "function removeDuplicate(array) {\n\n}", "function dedupe(arr) {\n return arr.reduce(function(newArray, item) {\n if(newArray.indexOf(item) < 0) {\n newArray.push(item);\n }\n return newArray;\n }, []);\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
If the nsIPermissionManager is being queried and written to for this permission request, set this to the key to be used. If this is undefined, user permissions will not be read from or written to. Note that if a permission is set, in any followup prompting within the expiry window of that permission, the prompt will be...
get permissionKey() { return undefined; }
[ "prompt() {\n // We ignore requests from non-nsIStandardURLs\n let requestingURI = this.principal.URI;\n if (!(requestingURI instanceof Ci.nsIStandardURL)) {\n return;\n }\n\n if (this.permissionKey) {\n // If we're reading and setting permissions, then we need\n // to check to see if ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Pipes the response from downloading an individual file to the appropriate destination stream while decoding gzip content if necessary
pipeResponseToFile(response, destinationStream, isGzip) { return __awaiter(this, void 0, void 0, function* () { yield new Promise((resolve, reject) => { if (isGzip) { const gunzip = zlib.createGunzip(); response.message ...
[ "pipeResponseToFile(response, destinationStream, isGzip) {\n return __awaiter(this, void 0, void 0, function* () {\n yield new Promise((resolve, reject) => {\n if (isGzip) {\n const gunzip = zlib.createGunzip();\n response.message\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
render accordion item in list with appropriate icons generated using the octicon_helper
render(){ return ( <li key={this.props.data.name} className="accordion-item" data-accordion-item> <a href='#' className='accordion-title'> {this.props.data.title} <svg className={"octicon octicon-git-pull-request " + this.pullRequestClass()} viewBox="0 0 12 16" version="1.1" width=...
[ "get renderListItemForHumanName() {\n console.log({ TAG: this.TAG, msg: \"renderListItemForHumanName\" });\n let showAccordion = false;\n let accordionLabel = null;\n let accordionSubLabel = null;\n let accordionIcon = null;\n let defaultNameIndex = 0;\n // Search for default name to show\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
parse "AC, EB50" into [(AC, 100), (EB, 50)]
function parseListIntoVals(value) { var list = value.split(','); for (var i = 0; i < list.length; i++) { list[i] = splitInitialsAndPercent(list[i].trim()); } return list; }
[ "parseString(term) { \n var results = term.split(\",\")\n return results;\n }", "function parse(value) {\n var values = [];\n var input = String(value || empty);\n var index = input.indexOf(comma);\n var lastIndex = 0;\n var end = false;\n var val;\n\n while (!end) {\n if (index === -1)...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Populate test summary content
function populateTestSummary( locator, response ) { var content = '<span id="summary">'; content += '<span id="scenarioCount" class="summary">' + response.summary.total + ' Scenarios</span>'; content += ' (<span id="scenarioCount" class="summary pass">' + response.summary.passed + ' Passed</span>'; cont...
[ "function createTestSummary(testResults) {\n testResults.forEach(testResult => {\n testResult.numTicksMaster = getTicks(testResult.outfileMaster);\n testResult.numTicksPR = getTicks(testResult.outfilePR);\n });\n\n const result = `Component Perf Analysis:\n <table>\n <tr>\n <th>Scenario</th>\n <th>...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }