query
stringlengths
9
34k
document
stringlengths
8
5.39M
negatives
listlengths
19
20
metadata
dict
interchange2algoliaEntityRecord takes a interchange record and returns a record to be exported to algolia
function interchange2algoliaEntityRecord(interchangeRecord) { let algoliaRecord = {}; let tmpResult; //fist copy the whole interchangeRecord algoliaRecord = JSON.parse(JSON.stringify(interchangeRecord)); algoliaRecord.objectID = interchangeRecord.idName; //algolia must have the unique id in the f...
[ "function transformRecord(Quotes) {\n Quotes = JSON.parse(Quotes).result;\n\n\n var ns_esti = $NS.createRecord(\"Estimate\");\n\n ns_esti.title = Quotes.subject;\n ns_esti.externalId = Quotes.id;\n ns_esti.entity = {\n externalId: getCustomerId(Quotes.related_to)\n };\n ns_esti.itemList ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns content to change mapping function
getMappingFunctionContent() { var calStatus = calibrationDialog.getElementStatus(); var calParams = calStatus.params; var src = calStatus.mappingFunctionSrc || ""; return React.createElement(Mapping, { mappingContent: React.createElement( 'div', ...
[ "function mapTest() {\n return \"Hello\"\n}", "function kahuna_mapFunction()\n {\n }", "toStringWithSourceMap(aArgs) {\n const generated = {\n code: \"\",\n line: 1,\n column: 0\n };\n const map = new SourceMapGenerator(aArgs);\n let sourceMappingActive = false;\n let lastOriginal...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
get string between two characters
function getPart(string,cin,cout) { var temp = string.substring((string.indexOf(cin))+1,string.indexOf(cout)); return temp; }
[ "function extractStringBetween(str, prefix, suffix) {\n try {\n \tlet i = str.indexOf(prefix);\n \tif (i >= 0) {\n \t\tstr = str.substring(i + prefix.length);\n \t}\n \telse {\n \t\treturn '';\n \t}\n \tif (suffix) {\n \t\ti = str.indexOf(suffix);\n \t\tif (i >= 0) {\n \t\t\tstr = str.substring(0, i);\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sets the EventStream object to run in Service Worker mode. This mode has no / dependencies on jQuery or access to a page or DOM
function setServiceWorkerMode() { serviceWorkerMode = true; }
[ "function StartStreamMode() {\n\n // Set flag\n streaming_mode = true;\n\n // Notify other widgets\n}", "async function initServiceWorker() {\n swRegisteration = await navigator.serviceWorker.register(\"/Sw.js\", {\n updateViaCache: \"none\"\n });\n\n // Get Service From Current State\n svcWorker =\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Remove the branch below the nav menu branch corresponding to the given path.
function collapse(path) { console.log("Collapsing path: " + path); var node = $("#" + idFromPath(path).replace( /(:|\.|\[|\])/g, "\\$1" )); console.log(node); node.children().remove("ul"); }
[ "function cutCurrent() {\n var parent = current.parent\n if (tool === 'navOnly') {\n return // Tree editing disabled in navOnly mode\n }\n if (parent) {\n if (confirm('Delete this branch?') === true) {\n parent.removeChild(current)\n current = parent\n // Notify navigation...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This is a StructureMapGroupRuleSource resource
static get __resourceType() { return 'StructureMapGroupRuleSource'; }
[ "static get __resourceType() {\n\t\treturn 'StructureMapGroupRuleTarget';\n\t}", "function filterRulesGroup() {\n\t\t/**\n\t\t * Array of objects containing rule, priority and options.\n\t\t *\n\t\t * @property {Object[]}\n\t\t * @readonly\n\t\t */\n\t\tthis.rules = [];\n\t}", "addGroup() {\n this.mapping.gr...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
The view model for the main content view template. Please note that since this example uses ojModule binding, you do not need to call ko.applyBindings like the JET Cookbook examples. ojModule handles applying bindings for its associated view.
function mainContentViewModel() { var self = this; self.something = ko.observable("This section uses content from it's own 'home' ViewModel. The module is found in the /js/viewModules folder"); }
[ "function viewModel() {\n var templateData = {\n 'footer_links': [\n new navModel('About Oracle', \n 'aboutOracle',\n 'http://www.oracle.com/us/corporate/index.html#menu-about'),\n new navModel('Contact Us', \n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
====================================================================================================================================== car conditions report ================================================================================================================================
function createCarConditionReport(){ let name = document.getElementById('name').value; let add = document.getElementById('address').value; let add1 = document.getElementById('address-1').value; let mob = document.getElementById('contact-no').value; let fromadd = document.getElementByI...
[ "function ConditionCheck(auxillary = false) {\n let element_n = null; let element_u = null;\n\n //For the non-auxillary conditions bar/add stage\n if (!auxillary) {\n for (let c in condset) {\n s = condset[c];\n element_n = document.getElementById(s + \"_n\");\n elem...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Extract PowerPlay data (buffer) from a VBIOS data (buffer). Can return `null` if the given `buf` is not a VBIOS or doesn't point to a PowerPlay table.
function extractPowerPlayFromVBIOS(buf, offset) { const header = loadVBIOSHeader({ buffer: buf, start: offset, filter: function(path) { return "RomTable.MasterDataTable.PowerPlayTable".startsWith(path); } }); if (header === null) return null; const ppTable = header.RomTable.MasterDataTable.PowerPla...
[ "getInterleavedData(buf) {\n let info = api.parseInterleavedHeader(buf);\n if ((info == null)) {\n return null;\n }\n\n if (buf.length < info.totalLength) {\n // not enough buffer\n return null;\n }\n\n info.data = buf.slice(api.INTERLEAVED_HEADER_LEN, info.totalLength);\n\n retu...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
VALIDACIONES Digitos //onkeypress = "return Digitos(event, this);"
function Digitos(e, field) { var teclaPulsada = window.event ? window.event.keyCode : e.which; var valor = field.value; if (teclaPulsada == 08 || (teclaPulsada == 46 && valor.indexOf(".") == -1)) return true; return /\d/.test(String.fromCharCode(teclaPulsada)); }
[ "function validaNumeros(event) {\n if (event.charCode >= 48 && event.charCode <= 57) {\n return true;\n }\n return false;\n}", "function validarNumero(e,punto,id){\n var valor=\"\";\n\t\n\ttecla_codigo = (document.all) ? e.keyCode : e.which;\n\tvalor=document.getElementById(id).value;\n\t\n\t\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
set the level based on the url
function setLevel() { // get the url var url_string = window.location.href; // convert to URL object and get parameters var url = new URL(url_string); var levelNum = url.searchParams.get("level") // only set if the parameter is nonempty if (levelNum != null){ GameNumber.setProblem(...
[ "function getLevel () {\n var val = window.location.search.match(new RegExp('[?&]level=(\\\\d+)'));\n val = val ? val[1] : MIN_LEVEL;\n val = Math.min(Math.max(MIN_LEVEL, val), MAX_LEVEL);\n return val;\n }", "function getLevel() {\n \n // Store the URL\n var url_string = window.lo...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Utility function for estimating the bounding box of canvas text
function getBoundingBoxEstimate( x, y, iWidth, iFontSpec) { var fontSize = iFontSpec['font-size'] || kDefaultFontSize, factors = getFontScaleFactors( iFontSpec); return { top: y - Math.round( (1.0 + factors.ascent) * fontSize), bottom: y + Math.round( facto...
[ "function getLabelBBox(textWidth, textHeight, align, baseline, angle, margin){\n /* text-baseline, text-align */\n \n // From protovis' SvgLabel.js\n \n // In text line coordinates. y points downwards\n var x, y;\n \n switch (baseline) {\n case \"mi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Reads a _projects file and returns the project paths in it.
function pathsFromProjectsFile(projectsFile) { let projectPaths = []; let text = fs.readFileSync(projectsFile, 'utf8'); let regex = /\nproject=([^\n]*)/gm; let match; while ((match = regex.exec(text))) { projectPaths.push(match[1]); } return projectPaths; }
[ "static listProjects(){\n\t\treturn fs.readdirAsync(belaPath+'projects/')\n\t\t.map((projectName) => {\n\t\t\tif (projectName && !projects[projectName] && projectName[0] !== '.'){\n\t\t\t\tprojects[projectName] = new Project(projectName);\n\t\t\t}\n\t\t\treturn projectName;\n\t\t})\n\t\t.catch((err) => console.erro...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Method to hide spell context items
hideSpellContextItems() { if (this.spellContextItems.length > 0) { for (let i = 0; i < this.spellContextItems.length; i++) { let item = document.getElementById(this.viewer.owner.element.id + this.spellContextItems[i].id); if (!isNullOrUndefined(item)) { ...
[ "hide() {\n this.highlighter.contextMenuActive = false;\n $(\"#df-context-menu\").addClass('hidden');\n $(\"input[name = 'translation']\").val('');\n $(\"input[name = 'entity-type']\").val('');\n }", "function hide() {\n\t if (contextMenu != null) {\n\t contextMenu.hide();...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
hide a section on the menu
function hideSection(sectionID) { document.getElementById('mainSection').style.display = "block"; document.getElementById(sectionID).style.display = "none"; }
[ "function hideSection(section) {\n section.classList.remove(\"visible\");\n }", "function hideSection(button, section) {\n $(button).removeClass(\"menuitemselected\");\n $(section).hide();\n}", "hideSection(section) {\n if (section === 'content-top' && !this.contentTopActive) {\n aft...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Mutation pass in row on init, use put to add different values for the remainder
function Mutation(row) { this.row = row; this.updates = []; }
[ "function addMutationRow() {\n\t\t\tconsole.log(\"addMutationRow()\");\n\n\t\t\tif (vm.apiDomain.mutations == undefined) {\n\t\t\t\tvm.apiDomain.mutations = [];\n\t\t\t}\n\n\t\t\tvar i = vm.apiDomain.mutations.length;\n\n\t\t\tvm.apiDomain.mutations[i] = {\n\t\t\t\t\"processStatus\": \"c\",\n\t\t\t\t\"alleleKey\":v...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns a boolean whether the current position lies within a comment or not
function isPositionInComment(document, position) { const lineText = document.lineAt(position.line).text; const commentIndex = lineText.indexOf('//'); if (commentIndex >= 0 && position.character > commentIndex) { const commentPosition = new vscode.Position(position.line, commentIndex); const ...
[ "is_in_comment(offset) {\n for (let comment of this.comments) {\n if (comment[1] <= offset && offset <= comment[1] + comment[0].length) {\n return true;\n }\n }\n return false;\n }", "function isInComment(sourceFile,position,tokenAtPosition){return ts.f...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
PUBLIC Adds an item to the popup menu associated to this map.
function addMapPopupListItem(img, text, action) { this.popupListItems.add(new PopupMenuItem(img, text, action), false); }
[ "function UilContextMenuAdd( item ) {\n this.items[ this.items.length ] = item;\n this.isEmpty = false;\n}", "_add(item) {\n var indent = 20 * (this._getIndentation(item) + 1);\n let elem = new ItemElement(this.x + indent, this.y, this.w - 20 - indent, 26, item.caption); \n Utils.addMenuT...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
After finding a start of a string ('|") this function attempts to find the end; If a variable is encountered along the way, we display it differently when it is encapsulated in a doublequoted string.
function tokenString(stream, state) { var current, prev, found_var = false; while (!stream.eol() && (current = stream.next()) != state.pending) { if (current === '$' && prev != '\\' && state.pending == '"') { found_var = true; break; } prev = current; } if (found_var) {...
[ "function gscStringAfter(str, findMarker)\n{\n localAssert(!gscIsNullOrUndefined(findMarker), \"null marker\");\n localAssert(findMarker.length > 0, \"marker is 0 length\");\n\n var idxFindStr = str.indexOf(findMarker);\n if (idxFindStr == -1) return \"\";\n return str.substring(idxFindStr + findMark...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Open a cursor by index filter.
openCursorByIndex(storeName, indexName, keyRange, mode = DBMode.readonly) { return from(new Promise((resolve, reject) => { openDatabase(this.indexedDB, this.dbConfig.name, this.dbConfig.version) .then((db) => { validateBeforeTransaction(db, storeName, reject); ...
[ "function idbOpenIndex( objStore, index, term ) {\n return objStore.index( index ).openCursor( term );\n }", "async function idbOpenIndex( origin, store, index, term, objStore = idbOpenObjStore( origin, store ) ) {\n objStore = await objStore;\n return objStore.index( index ).openCursor( term );\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Performs a ray/OBB intersection test. Returns either true or false if there is a intersection or not.
intersectsRay(ray) { return this.intersectRay(ray, v1) !== null; }
[ "RayIntersects(ray) { // returns boolean\n let edge1 = this.vertex2.sub(this.vertex1)\n let edge2 = this.vertex3.sub(this.vertex1)\n let h = ray.direction.cross(edge2)\n let a = edge1.dot(h)\n if (a > -0.00001 && a < 0.00001) {\n return false\n }\n let f =...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
close the data HTML inspector
close_dataInspector(){ iziToast.hide({transitionOut: 'flipOutX',onClosed:() => {iziToast.busy = false;}}, document.getElementById("dataEditor") ); // hide HTML data Inspector $stage.interactiveChildren = true; }
[ "function close_dataInspector(dataObj){\n // if is a gui inspectors ?\n dataObj.link.asignDataValues(dataObj);\n dataObj.link.dataObj = dataObj;\n\n /*if(this.dataValues){\n // if cancel, and if old value not have heaven, destroyHeaven\n if(!dataValues && this.dataV...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
void gl.renderbufferStorageMultisample(target, samples, internalFormat, width, height);
renderbufferStorageMultisample(ctx, funcName, args) { const [target, samples, internalFormat, width, height] = args; updateRenderbuffer(target, samples, internalFormat, width, height); }
[ "function setupRenderBufferStorage( renderbuffer, renderTarget ) {\n\n \t\t_gl.bindRenderbuffer( _gl.RENDERBUFFER, renderbuffer );\n\n \t\tif ( renderTarget.depthBuffer && ! renderTarget.stencilBuffer ) {\n\n \t\t\t_gl.renderbufferStorage( _gl.RENDERBUFFER, _gl.DEPTH_COMPONENT16, renderTarget.width, renderTarget...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function to shuffle the Array of players
function shuffleArray(players) { for (var i = players.length - 1; i > 0; i--) { var j = Math.floor(Math.random() * (i + 1)); var temp = players[i]; players[i] = players[j]; players[j] = temp; } return players; }
[ "static shufflePlayers() {\n var currentIndex = players.length, temporaryValue, randomIndex;\n\n // While there remain elements to shuffle...\n while (0 !== currentIndex) {\n\n // Pick a remaining element...\n randomIndex = Math.floor(Math.random() * currentIndex);\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
check if Conf.sourceSysField is present or not
function hasEnv(req) { // check header if (req.headers[Conf.sourceSysField]) return true; // check GET params if (req.query[Conf.sourceSysField]) return true; if (req.session && req.session.returnTo) { var parsed = url.parse(req.session.returnTo, true); if (parsed.query && parsed.query[Conf.sourceSysFiel...
[ "rule_Pd_Source_Fields(component) {\n let pdPortType = component.getElementByName(VIF_ENUMS.PD_Port_Type);\n if (pdPortType.getSelectedIndex() !== 1 || 2 || 3 || 4) {\n return true;\n }\n return false;\n }", "get sourceField() {\n return this._getOption('sourceFiel...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
function to handle edit paypal
function editPayPal() { $( "#load" ).show(); var url = $('#editPayPalForm').attr('action'); var form = new FormData(document.getElementById('editPayPalForm')); var dataString = { id : $("#paypalID").val(), paypal_email : $("#masked_paypal_email").val(), }; $.ajax({ type: "POST", ur...
[ "function paypalEdit(e) {\n e.preventDefault();\n var fields = $('#paypalSettings').serializeForm();\n $.post('https://cs341group4.tk/Checkout/PayPalEdit', fields)\n .done(function(data) {\n alert(data.message);\n location.reload();\n })\n .fail(function(data){\n alert(data.re...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get the transaction info of someone specified by email
async getTransactionInfo() { const email = this.getEmail(); const bills = await this.service.bills.query(['*'], { email }); this.response(200, bills); }
[ "function getAccountByEmail(email) {\n gitkitClient.getAccountByEmail(email, function(err, resp) {\n console.log('getAccountByEmail resp: ' + JSON.stringify(resp) + ' / ' + JSON.stringify(err));\n });\n}", "getUserByEmail(email, cb) {\n\t\tvar query = {\n\t\t\temail: email\n\t\t}\n\t\tthis.getUserDetails(que...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
First way to do Asynchronous function, therefore sum will be undefined
function doWorkAsyncFirst(){ setTimeout(()=>{ let sum=0; for (let index = 0; index < 1000000000; index++) { sum+=index; } console.log('Sum: ',sum); return sum; },10); }
[ "function calculateSum(num1, num2, callback)\n{\n let sum = num1 + num2;\n callback(sum);\n}", "function sumNums(a, b, cb){\n\tsum = a + b;\n cb(sum);\n}", "function sumNums (num1, num2, cb){\n cb(num1 + num2);\n}", "function sumNums (num1, num2, cb)\n{ \n\tvar sum = num1 + num2;\n\tcb(sum); \n}", ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
funzione che trova i primi 5 autori e va a stampare contenuto completo PARAMETRI: url per chiamata ajax, api_key oggetto context utile a handlebars e tipo del contenuto in esame
function aggiungiDettagliAutori(url,api_key,context,type){ $.ajax({ url : url + '/credits', data : { "api_key" : api_key, "language" : "it-IT" }, method : "GET", success : function (data) { var actors = []; var arrayAttori = data.cast; for (var i...
[ "function url() {\n \n //récupération de l'id de chaque ourson\n let getUrl = \"?id=\" + teddies[i]._id; \n\n //redirection vers la page de produit unique\n window.location.href = \"product.html\" + getUrl;\n }", "function ajourIndice() {\r\n var _url = $(location)...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Allocates (registers) a directive into the directive registry within the provided styling context. For each and every `[style]`, `[style.prop]`, `[class]`, `[class.name]` binding (as well as static style and class attributes) a directive, component or template is marked as the owner. When an owner is determined (this h...
function allocateOrUpdateDirectiveIntoContext(context, directiveIndex, singlePropValuesIndex, styleSanitizer) { if (singlePropValuesIndex === void 0) { singlePropValuesIndex = -1; } var directiveRegistry = context[2 /* DirectiveRegistryPosition */]; var index = directiveIndex * 2 /* Size */; // we preem...
[ "function updateContextWithBindings(context, directiveIndex, classBindingNames, styleBindingNames, styleSanitizer) {\n if (context[1 /* MasterFlagPosition */] & 16 /* BindingAllocationLocked */)\n return;\n // this means the context has already been patched with the directive's bindings\n var isNewD...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Makes the "add to calendar" button on the page and sets the on click method.
function makeAddToCalendarButton() { // Make the button const addToCalendarButton = document.createElement("button"); addToCalendarButton.setAttribute("id", "submit-classes-button"); addToCalendarButton.innerHTML = `<i class="fa fa-external-link" aria-hidden="true"></i>Add to Google Calendar`; addToCalendarBu...
[ "openEntryCalendar() {\n $(this.entryDateCalendarButton).click();\n }", "function onAddToCalendarButtonClick() {\n getAndSubmitCalendarFromRequest()\n .then((response) => {\n console.log(\"Final verification that submission succeeded with getting calendar from request.\", response);\n })\n .cat...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Deactivating current view element. This method dispatches exit event for the view.
deactivateView() { if (this.currentView.constructor.is) { this.currentView.dispatchEvent(new CustomEvent('lazy-board-view-exit')); } // The current view is hiding. this.currentView.style.display = 'none'; this.currentView = null; }
[ "async _deactivate () {\n\n if (!this.active) return\n if (this._persist) return\n\n this._dispatch('viewwillexit')\n await this._transition.exit()\n this._dispatch('viewdidexit')\n\n this.active = false\n this._transition.done()\n this._activeModel = null\n\n }", "exit() {\n if (this....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
playSE :: SoundMaster > (String, Map) > IO ()
playSE(keyword, option) { return new M_IO((world) => { let audio = this._seList.filter(a => a.keyword === keyword).nth(0).match({ nothing: () => { world.console.error("Sound Error: " + keyword + " is not registered."); return new Audio(); }, just: (so) => so.audio ...
[ "function PlaySFX(sfxName) {\n sfx[sfxName].play();\n}", "static playSound(name)\n {\n sounds[name].play();\n }", "function playAttackSound()\n{\n\t//print( \"Playing an attack sound....\" );\n\tplaySound( attackNotes );\n}", "function playSound(id){\n \n var sound = new Audio(boardSounds...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Create property from dom attribute
function createProperty(attr) { var name, value, isAttr; // using a map to find the correct case of property name if (propertyMap[attr.name]) { name = propertyMap[attr.name]; } else { name = attr.name; } // special cases for data attribute, we default to properties.attributes.data if (name.indexOf('data-') ...
[ "function createProperty(attr) {\n\tvar name, value, isAttr;\n\n\t// using a map to find the correct case of property name\n\tif (propertyMap[attr.name]) {\n\t\tname = propertyMap[attr.name];\n\t} else {\n\t\tname = attr.name;\n\t}\n\t// special cases for data attribute, we default to properties.attributes.data\n\t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
battleCry() receives 0 arguments and returns "Odin owns you all"
battleCry() { return `Odin Owns You All!`; }
[ "battle() {\n\t\t\t\tlet faceUp1 = this.player1.drawCard(1)[0];\n\t\t\t\tlet faceUp2 = this.player2.drawCard(1)[0];\n\t\t\t\tthis.battleCard = [faceUp1, faceUp2].sort((a, b) => b - a);\n\t\t\t\tif(faceUp1 == faceUp2) {\n\t\t\t\t\tthis.state = \"war\";\n\t\t\t\t} else {\n\t\t\t\t\tlet winner = faceUp1 > faceUp2 ? th...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns Index of first match to `predicate` in `arr`
function findIndex(arr, predicate) { let i = 0; if (!arr || arr.length < 1) { return undefined; } const len = arr.length; while (i < len) { if (predicate(arr[i], i)) { return i; } i++; } return undefined; }
[ "function findIndex(arr, predicate) {\n var i = 0;\n if (!arr || arr.length < 1) {\n return undefined;\n }\n var len = arr.length;\n while (i < len) {\n if (predicate(arr[i], i)) {\n return i;\n }\n i++;\n }\n return undefined;\n}", "function findIndex(a...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
track function for intercom.io
function trackIntercomEvent(eventName, metadata){ //console.log(eventName); //console.log(metadata); Intercom('trackEvent', eventName, metadata); }
[ "function Track() {}", "function Tracking() {}", "function handleTrack(info){\n setInfoTracks(info)\n }", "function uv_track() {\n\t\n\t//var hours = currentTime.getHours();\n\t//var minutes = currentTime.getMinutes();\n\t//Ti.API.info(hours+':'+minutes);\n\t\n\tTi.API.info('prevLocTime' + prevLocTime);\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Represents a grid of checkboxes. json_init: JSON // initialization values that come from a JSON file update_init: JSON // initialization values that come from updating the field
function CheckboxField(json_init, update_init) { GridField.call(this, json_init, update_init); /* Set all checkbox attributes. */ this.field_type = "checkbox"; this.grid_class = 'cb_div'; this.data_uri = "checkboxes"; this.cf_advanced = {flip_training_data : false}; this.cf_map = {empty : false}; if (json_in...
[ "function LoadCheckboxes()\n{\n\tvar data = datajson;\n\t$(\".locationContainer\").html(\"\");\n\tfor(var i = 0; i < data.length; i ++)\n\t{\n\t\t$(\".locationContainer\").append(\"<input type='checkbox' class='\"+data[i].name+\"-checkbox itemCheckbox' /><label>\"+data[i].name+\"</label>\");\n\t}\n\t$(\".itemCheckb...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
def nearest_point(candidate_points, points): """ Given a list of candidate points find the candidate point that is closest to any point in list points Feel free to add a dependency if needed >>> nearest_point([(0.1, 0.1), (2, 2), (2, 3)], [(0, 0), (5, 5), (2, 1), (2, 4)]) (0.1, 0.1)
function nearestPoint(candidatePoints, points) { }
[ "closest(points) {\n if (points.length === 1) {\n return Point.create(points[0]);\n }\n let ret = null;\n let min = Infinity;\n points.forEach((p) => {\n const dist = this.squaredDistance(p);\n if (dist < min) {\n ret = p;\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
function to enable click
function enableClick() { openCards[0].click(toggleCard); }
[ "function EnableClick() {\n openedCards[0].click(toggleCard);\n }", "function _enableClickStep1(enable)\n {\n if (enable)\n $(\"#perc-image-upload\").on(\"click\",function(evt){\n _step1ClickHandler(evt);\n } ).css(\"cursor\", \"pointer\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Go get the tract centroids and supporting data, THEN build a data object (uses jQuery Deferreds)
function init(){ $.when( getTractsInBounds( getBoundParams() ), getTractData( getBoundParams(), getActionTaken( $('#action-taken-selector option:selected').val() ))).done( function(data1, data2){ rawGeo = data1[0]; rawData = data2[0]; createTractDataObj(); redraw...
[ "function makeConcentrationLayerInner(pollutant,callback) {\n//I think i can make this return a promise without messing up the d3 queue things\n var defer = $.Deferred();\n\n// console.log('begin with conc layer');\n var args = {};\n args.file = \"data/spotlight/concentrations/\" + pollutantData[pollutant].fil...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns ORDER BY clause for an SQL query
function orderQuery(sortBy, direction) { reverseDirection = (direction == 'ASC') ? 'DESC' : 'ASC'; orderBy = ' ORDER BY ' + sortBy + ' ' + direction; if (sortBy == 'likes') //sort in order of likes and ~least dislikes orderBy += ', dislikes ' + reverseDirection; return orderBy; }
[ "getOrderBy() {\n\t\treturn this.exprs.ORDER_BY_CLAUSE;\n\t}", "function query_orderby () {\n var i;\n var str = '';\n for (i = 0; i < history_array.length;i++) {\n if (history_array[i].get_type() === 'OrderBy') {\n str += '`' + history_array[i].get_column_name() + '` ' +\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Dispatches listeners to the log "load" event.
static dispatchLoadEvent() { const $log = $(elementSelectors.log); if ($log.length) { loadEventDispatcher.dispatch($log); } }
[ "function processLoad_LogExt(e) {\r\n//\tgetDate_LogExt();\r\n\r\n\t//syncTime_LogExt('firstToken');\r\n\r\n\t/* get size\r\n\t * NS: first case (window.innerWidth/innerHeight available); IE: second case */\r\n\tvar loadWidth, loadHeight;\r\n\tloadWidth \t= (window.innerWidth) ? window.innerWidth : document.body.of...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Display turn count & prepend count with 0 if < 10
function turnCount() { if (state.turnCount >= 10) return $('#turn-count').text(state.turnCount); $('#turn-count').text('0' + state.turnCount); }
[ "function displayCount(){\n if(count.toString().length == 1){\n //add a zero to the beggining number if count is less than 10\n\t $(\".count\").html(\"0\" + count);\n } else {\n\t $(\".count\").html(count);\n }\n }", "function turnIncrement() {\n totalTurns++;\n $turnCounter.html('<p>Tu...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Generic function to rotate the shape right by 90degrees.... Note: After rows are deleted in TETRIS, there might be partial blocks left.... Hence we don't try determining the new rotated value based on the current shape. The new shape is simply computed from the current one
function shapeRotateRight(shape) { var newShape = []; var curWidth = 0; var curHeight = 0; // NOTE: We do not delete blocks from the Shape... we just mark it as 0 // Hence the width and length of the "remaining" Shape can be easily ascertained curWidth = shape[0].length; curHeight = shape...
[ "rotate_shape() {\n switch(this.rot) {\n case 1:\n return this.rotate_cw();\n case 2:\n return this.rotate_180();\n case 3:\n return this.rotate_ccw();\n default:\n return this.shape;\n }\n }", ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
returns the next enemy in the queue, or null if in the buy phase or the enemy queue is out of enemies
giveNextEnemy(){ if (this.enemies.length() == 0){ // need new wave soon this.waveDry = true; this.enemies = this.makeNewEnemyWave(); } if (this.waveDry || this.buyPhase){ return null; } return this.enemies.dequeue(); }
[ "next() {\n return ( this._queue.length ) ? this._queue.shift() : null;\n }", "function getNextIdleItem() {\n var nextItem;\n this.forEachItem(function(item) {\n if (item.state === Queueable.IDLE || item.state === Queueable.RESUMED) {\n nextItem = item;\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Process pre_sections convert pre_sections into beat by beat section titles
process_pre_sections() { for(var i=0; i<pre_sections.length; ++i) { var section_cnt = 0; for(var j=0; j<pre_sections[i][0]; ++j) { //multiply by specified cts for(var k=0; k<pre_sections[i][1]; ++k) { this.sections.push({measure_size:pre_sections[i][1],measure_cnt:k,section_cnt...
[ "function process_pre_sections() {\n for(var i=0; i<pre_sections.length; ++i) {\n var section_cnt = 0;\n for(var j=0; j<pre_sections[i][0]; ++j) {\n //multiply by specified cts\n for(var k=0; k<pre_sections[i][1]; ++k) {\n sections.push({measure_size:pre_sections[i][1],measure_cnt:k,section_...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Check for end of a multiline comment
function end_multi_line_comment(line) { if (single_line_comment(line)) { return false; } return !!line.match(/.*\*\//); }
[ "blockEndOfContentComment() {\n const context = new Parsing.Context(new Parsing.Data.Node('test'), `/*\\r\\n\\tComment test.\\r\\n\\tBlock with end-of-content.`);\n this.isTrue(Language.Comment.block.consume(context));\n this.areSame(context.offset, context.length);\n }", "function isJsDoc...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Numeric sort function used by "sort"
function Numsort(a,b) { return a - b; }
[ "function sortNumeric(val1, val2)\n{\n return val1 - val2;\n}", "function numberSortFunction(a, b) {\n return a - b;\n}", "function numericalArraySortAscending(a, b)\r\n{\r\n return (a-b);\r\n}", "function numericalArraySortAscending(a, b)\n{\n return (a-b);\n}", "numericSort(a, b, invert) {\r\n\t\tif...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
clears and sets up empty divs for each track in the mixer. this makes sure they are in the right order on the screen
function loadMixer() { const mixer = document.getElementById('mixerBox'); mixer.innerHTML= ''; for (let i=0; i < sound.trackInfo.length; i++) { mixer.insertAdjacentHTML('beforeend', ` <td id='Track${i}' class='mixerTrack'>Track ${i}</td> `) } }
[ "function setTracksGridContainer() {\n \n let emptySpaceCount = 0;\n\n for (let i = 0; i < rows; i++) {\n soundGrid[i] = []; // Make soundGrid a 2D array\n for (let j = 0; j < columns; j++) {\n \n let trackEmptySpace = document.createElement(\"div\");\n trackEmptySpace.ondragover = onD...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
2 (Stretch) assignment [8:11] Question: Print a 2d array (list of lists) in spiral form Input: 1 33 3 14 [ [1, 33, 3, 14], 15 16 7 38 [15, 16, 7, 38], 92 10 11 12 [92, 10, 11, 12], 13 14 15 16 [13, 14, 15, 16] ] Output: 1 33 3 14 38 12 16 15 14 13 92 15 16 7 11 10 Note it doesn't have to be a squre matrix. row 0 print ...
function spiralize(matrix) { let row = 0; let col = 0; let right = matrix[0].length; let down = matrix.length - 1; let left = right - 1; let up = down - 1; while (right > 0 || down > 0 || left > 0 || up > 0) { moveRight(); moveDown(); moveLeft(); moveUp(); } function moveRight() { ...
[ "function spiral(n) {\r\n let newArr = []\r\n for (let i = 0; i < n; i++) {\r\n let sub = []\r\n for (let j = 0; j < n; j++) {\r\n sub.push(0)\r\n }\r\n newArr.push(sub)\r\n }\r\n console.log(newArr)\r\n // main function\r\n let top = 0\r\n let bottom = n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
deleteItem() only sets the property rowToDelete on the state to distinguish the one that has to be deleted
_deleteItem(id) { this.setState({ rowToDelete : id }); }
[ "deleteRow(state, rowIndex) {\n state.currentQuestionInfo.rows.splice(rowIndex, 1);\n }", "deleteItem() {\n this.view.removeFromParentWithTransition(\"remove\", 400);\n if (this.item != null) {\n this.itemDao.deleteById(this.item.getId());\n }\n }", "_handleDeleteRow(e){this.deleteRow(e.d...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Draw a line, from and to are a pair of coords [x,y]
function drawline(from, to) { context.beginPath(); context.moveTo(from[0], from[1]); context.lineTo(to[0], to[1]); context.stroke(); }
[ "function drawLine(from, to) {\n context.beginPath();\n context.moveTo(from[0], from[1]);\n context.lineTo(to[0], to[1]);\n context.stroke();\n}", "function drawLine(context, offset, from, to) {\r\n var fromOffset = from.offset();\r\n fromOffset.top += from.outerHeight() / 2;\r\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Draw the line according to the lineType parameter
drawAppropriateLine() { const { width, color } = this._getLineStyle(); this.graphics.lineStyle(width, color); if (this.lineType === EConnectionLineType.SOLID || this.lineType === EConnectionLineType.NODATA) { if (this.drawLineType === EConnectionDrawLineType.STRAIGHT){ this.drawLine(th...
[ "drawingLine(canvas) {\r\n if (this.m_drawStart.x < 0 || this.m_drawStart.y < 0) {\r\n return;\r\n }\r\n const lineColor = this.m_drawParam.getColor(this.m_drawParam.m_color.TT_DRAWING.c);\r\n if(0 <= this.m_drawStart.x && 0 <= this.m_drawStart.y){\r\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
.............................................................................. / === History backup old crawler pageFunction(), synch version === pre2018 version: Supermaster_FIN_current_season_meetings
function pageFunction_Pre2018_currentMeetings_oldCrawler(context) { // called on every page the crawler visits, use it to extract data from it var $ = context.jQuery; var result = []; var curr_year = ''; var curr_month = ''; $('table.calendario tr').each( function() { if ( $(this).find(...
[ "function pageFunction_ForSeason172_oldCrawler(context) {\n // called on every page the crawler visits, use it to extract data from it\n var $ = context.jQuery;\n var result = [];\n var curr_year = '';\n var curr_month = '';\n\n $('table.calendario tr').each( function() {\n if ( $(this).fin...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
xxxxxxxxxx Hide edit profile form xxxxxxxxxx
function hideEditProfileForm(){ document.getElementById("profileSection").style.display = "block"; document.getElementById("editProfileForm").style.display = "none"; }
[ "function hideEditProfileForm() {\n document.getElementById(\"profileSection\").style.display = \"block\";\n document.getElementById(\"editProfileForm\").style.display = \"none\";\n}", "function hideEditProfileForm(){\n document.getElementById(\"profileSection\").style.display = \"block\";\n document.getEleme...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
actionCompleted(); using function to set the funcction (better)
function actionCompleted () { alert('Completed'); }
[ "setActionCompleted() {\r\n this.actionInProgress = false;\r\n this.actionInProgressMessage = '';\r\n }", "completeAction(actionId) {\n RNHyperTrack.completeAction(actionId);\n }", "transitionCompleted() {\n // implement if needed\n }", "setActionDoneCallback(actio...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
validate the response to the test request
validateResponse (data) { Assert.equal(data, '/web/confirm-email-error?error=AUTH-1002', 'improper redirect'); }
[ "validateResponse (data) {\n\t\t// the response will be empty, since there is no change\n\t\tAssert.deepEqual(data, { }, 'expected empty response');\n\t}", "validateResponse (data) {\n\t\tAssert.deepStrictEqual(data, {}, 'empty response not returned');\n\t}", "validateResponse (data) {\n\t\tAssert.notEqual(data...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Checks if qx.debug set used by this.require["debug"]
hasDebug() { return qx.core.Environment.get("qx.debug"); }
[ "function isDebug() {\n\treturn typeof DEBUG != \"undefined\";\n}", "function isInDebugMode() {\n return (typeof config.debug !== 'undefined' && config.debug === true);\n}", "function isDebug() {\n if (null != _cmdline.match(/--release/ig)) {\n return false;\n } else {\n r...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Utility function for appending a newly loaded contact to both its default group and, if necessary, the favorites list.
function appendToLists(contact) { updatePhoto(contact); var ph = createPlaceholder(contact); var groups = [ph.dataset.group]; if (isFavorite(contact)) { groups.push('favorites'); } var nodes = []; for (var i = 0, n = groups.length; i < n; ++i) { ph = appendToList(contact, group...
[ "onFavouriteContact() {\n this.contact.favourite = true;\n this.contactService.saveContact(this.contact);\n }", "function addToGroup(groupName) {\n\t for (i = 0; i < allGroups.length; i++) {\n\t if (allGroups[i].name == groupName) {\n\t var group = allGroups[i];\n\t }\n\t }\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
dog edit button event listener
function dogEditBtnEventListener() { document.addEventListener('click', event => { if(event.target.className === 'edit-btn'){ let dogId = parseInt(event.target.dataset.id) state.selectedDog = state.dogs.find( dog => dog.id === dogId) populateDogForm(state.selectedDog) } }) }
[ "function editDog(dog) {\n // copy dog information to form\n formName.value = dog.name;\n formUrl.value = dog.img;\n formAbout.value = dog.about;\n\n // disable add button\n addButton.disabled = true;\n\n // clear all events update button events\n clearUpdateButtonEvents();\n\n // enable ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
when created, position can be set, and the size is always the same when created
constructor(x, y) { this.position = { x: x, y: y }; this.size = {x: 5, y:5}; }
[ "constructor(width, height, posX, posY){\n this.width = width;\n this.height = height;\n this.posX = posX;\n this.posY = posY;\n }", "grow(){\n this.size.x += 5;\n this.size.y += 5;\n }", "function createPosition() {\n return { x: 0, y: 0 };\n}", "setupPosition()\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
What happens when you select answer btn
function selectAnswer() { }
[ "function onClickAnswer() {\n\t\t$('.btn').on(\"click\", function() {\n\t\t\tvar buttonClick = parseInt($(this).attr('value'));\n\t\t\tif(buttonClick === qsArray[currentIndex].correctanswer) {\n\t\t\t\tcorrectAnswer();\n\t\t\t}\n\t\t\telse {\n\t\t\t\tincorrectAnswer();\n\t\t\t}\n\t\t});\n\t}", "function answerCli...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Thin wrapper around Chai.Assertion.addMethod to permit plugin aliases
function addToChai(names, fn){ for(const name of names) Chai.Assertion.addMethod(name, fn); }
[ "function hookIntoChai(){\n\tif(hooked) return;\n\thooked = true;\n\t\n\tfor(const method of [\"equal\", \"string\"]){\n\t\tChai.Assertion.overwriteMethod(method, function(__super){\n\t\t\treturn function(input, ...rest){\n\t\t\t\t__super.apply(this, [ doUntab(input), ...rest ]);\n\t\t\t}\n\t\t});\n\t}\n}", "func...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sorts the array based on the prices of the objects in the array.
function sortArray(){ /*Uses the built in sort -method that can accept a function that specifies how the array should be sorted. In this case we want the array to be sorted based on the object's price. Lower priced cars go first.*/ function compare(a,b) { if (a.price < b.price) return -1; ...
[ "function sortArray(listOfCars){\n listOfCars.sort(function(a,b){\n return a.price - b.price;\n })\n }", "function sortPriceLowHigh() {\n return productsArray.sort(function(a, b) {\n return a.price - b.price\n });\n\n}", "function sortAllOfTheProductsAscendantlyBasedOnTheNewPrices() {\n\n}",...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
split a vertical flow into 2 vertical flows
function SplitFlowy(e,obj) { myDiagram.startTransaction("Split flow"); Link = myDiagram.selection.first(); toNode = Link.toNode; fromNode = Link.fromNode; MoveSet = toNode.findTreeParts(); myDiagram.model.removeLinkData(Link.data); offsety =null; if ...
[ "createSplits() {\n if (this.opSplit !== null) {\n this.opSplit.destroy();\n }\n if (this.ioSplit !== null) {\n this.ioSplit.destroy();\n }\n\n this.opSplit = Split([\"#opPane\", \"#ioPane\"], {\n sizes: [20, 80],\n minSize: 200\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function scroll check This function checks the amount of scroll in the file area DIV
function scroll_check(ev,tag){ drag_manager.scroll_value = tag.scrollTop; folder_positions_find(); }
[ "function checkScroll() {\n\n if (winScrollTop > startPos) {\n hide();\n } else {\n unhide();\n }\n startPos = winScrollTop;\n\n }", "_onScroll(e) {\n this._checkScroll();\n }", "function checkScroll() {\n\t\t\t// Get the cursor\n\t\t\tvar el = $(outdiv)....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This are two helper functions, they are delcared here for convinience so we can get and set all styles at once and because they are not available in extcore only in ExtJs available in extjs (not extcore) as element.getStyles
function getStyles(el, arguments){ var ret = {}; total = arguments.length ; for (var n=0; n<total; n++ ) ret[ arguments[n] ] = el.getStyle(arguments[n]); return ret; }
[ "static get styles(){return[]}", "static get styles() { return []; }", "applyStyles() {\n if (this.options.styles === {}) return;\n if (this.options.styles.domField) {\n let s = '';\n let styles = this.options.styles.domField;\n let element = document.getElementByI...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
show/hide filters list on mobile devices
function toggleFiltersList() { var $toggleLinks = $('.catalog-filter-label__mob-arrow'); $toggleLinks.on('click', function(){ $(this).parent().siblings('.catalog-filter-list').slideToggle('fast'); }); }
[ "function switchFiltering() {\n\tif (window.innerWidth < 768) {\n\t\tvar filteringColumn = jQuery(\".algemeenfilter\");\n\t\tvar studieFilter = jQuery(\".studiefilter\");\n\n\t\thideOrShow(filteringColumn);\n\t\thideOrShow(studieFilter);\n\t} else {\n\t\tif (window.innerWidth < 992) {\n\t\t\tvar deepLinkingFilter =...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Task used by `git.addTag`
function addTagTask(name) { return { format: 'utf-8', commands: ['tag', name], parser() { return { name }; } }; }
[ "async function createTag(cb) {\n //Get the last committed tag: git describe --tags --abbrev=0\n const lastTag = (await execa('git', ['describe', '--tags', '--abbrev=0'])).stdout\n console.log(`Last committed tag: ${lastTag}`)\n\n // If the last committed tag is different to the required release ...\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
A placeholder can contain have lines of text.
function PlaceholderLine(props) { var className = props.className, length = props.length; var classes = Object(clsx__WEBPACK_IMPORTED_MODULE_1__["default"])('line', length, className); var rest = Object(_lib__WEBPACK_IMPORTED_MODULE_4__["getUnhandledProps"])(PlaceholderLine, props); var ElementType = Obje...
[ "function PlaceholderLine(props) {\n var className = props.className,\n length = props.length;\n var classes = (0, _classnames.default)('line', length, className);\n var rest = (0, _lib.getUnhandledProps)(PlaceholderLine, props);\n var ElementType = (0, _lib.getElementType)(PlaceholderLine, props);\n retu...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
external hash: t > int Provides: ml_z_hash const Requires: bigInt, caml_hash_mix_int
function ml_z_hash(z1) { var a = bigInt(z1).toArray(Math.pow(2, 32)); var acc = 0; for (var i = 0; i < a.value.length; i++) { acc = caml_hash_mix_int(acc, a.value[i]); } if(a.value.length % 2 != 0) { acc = caml_hash_mix_int(acc, 0); } if(a.isNegative){ acc = acc + 1 } return acc | 0 }
[ "function hash() {\n var h = 0;\n for (var i = 0; i < arguments.length; i++) {\n var k = arguments[i];\n h += k;\n h += k << 10;\n h ^= k >> 6;\n }\n h += h << 3;\n h ^= h >> 11;\n h += h << 15;\n return h >= 0 ? h : -h;\n}", "function caml_hash_mix_int64 (h, v) {\n var lo = v[1] | (v[2] << 24...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get the item for the point of origin
function getOriginItem(items) { var target = items[0]; for (var i = 0; i < items.length; i++) { if(target.geometricBounds[1] < items[i].geometricBounds[1]) target = items[i]; } return target; }
[ "get (position){\n return this._thingAt (position.x, position.y);\n }", "getItem(x,y) { return this.getCell(x,y)._mapItem;}", "function itemAt(x, y) {\n return game.items[Math.floor(y/game.rowHeight)][Math.floor(x/game.colWidth)];\n}", "static _positionOnItem(item) {\n return item.bounds.leftCente...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
function Add completed today click handler
function addCompletedTodayClickHandler() { $(document).on("click", "#todo-header-toggle", function() { var $el = $(this); $el.hide(); $("#done-todo-list").hide(); $("#empty-todo-list").hide(); $("#work-todo-list").show(); $("#todo-footer-input").focus(); ...
[ "handleTodayClick() {\n this.datePickerValue = this.today.toISOString();\n this._setFirstWeekDay(this.today);\n this._generateTable();\n }", "function todayHandler() {\n\t\t\t\tcalendar.today = new Date();\n\t\t\t\tif ( !this.showTime ) {\n\t\t\t\t\tcalendar.today.setHours(0);\n\t\t\t\t\tc...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
state.iframeWindow 0: main window 1: create curriculum 2: old curriculum
CreateCurriculum() { if(this.whatsNotFilled().errors.length !== 0) { this.highlightNotFilled(this.whatsNotFilled()); } else this.setState({iframeWindow: 1}); }
[ "function switchToAnimationWindow() {\n document.getElementById(\"Window2\").style.display = \"none\";\n document.getElementById(\"Window3\").style.display = \"block\";\n createInitialStage();\n\n console.log(animationTimeline);\n addStatesToAnimationEntities();\n}", "setFrScheduleNavFrame(){\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates a vector of the idf of the query term in a given document
createIdfModel(query) { query = Array.isArray(query) ? query: query.split(" "); if (this.corpus == null) return null; let model = []; for(let i = 0; i < query.length; i++){ model.push(this.calculateInverseDocumentFrequency(query[i])); } return model; }
[ "function getIDF(term) {\n if(result.numDocs == 0) {\n return 0;\n }\n if(!result.terms.hasOwnProperty(term)) {\n return 0;\n }\n return Math.log(result.numDocs / result.terms[term]);\n }", "createVectorSpaceModel(query, d...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Set percentages of each skill set
function setPercents() { for (i = 0; i < skill.length; i++) { $('#skills ul li' + '#' + skill[i].name).css( {width: skill[i].percent} ); } }
[ "function set_percentage()\n\t\t{\n\t\tfor (var each in $scope.DATA)\n\t\t\t{\n\t\t\tvar ar = $scope.DATA[each];\n\t\t\tvar total = 0;\n\t\t\t//calc total\n\t\t\tar.map(function(el){total = total+el['totalOrders']});\n\t\t\tar.map(function(el)\n\t\t\t\t{\n\t\t\t\tif (!total){el['percentage'] =0;return false;};\n\t\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
drawAdviceCanvas takes in a 2d context of a canvas, a target credit limit, and total owed. It will add text to the context stating the total owed, the target credit limit, the advice based on the total owed with respect to the target credit limit, and draw the gauge based on the given values.
function drawAdviceCanvas(context, creditLimit, totalOwed) { context.font = "22px Arial"; context.fillStyle = "black"; context.fillText("Your total owed is " + totalOwed + ".", 25, 320); var percent = totalOwed/creditLimit; if (percent <= 0.1) { context.fillText("Your credit limit is less than 10%.",...
[ "function drawAdviceCanvas(context, PressureRange, Diastolic) {\r\n context.font = \"22px Arial\";\r\n context.fillStyle = \"black\";\r\n context.fillText(\"Your current Diastolic is \" + Diastolic + \".\", 25, 320);\r\n\r\n if (PressureRange == \"Elevated\") {\r\n context.fillText(\"Your target BP range is:...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Add a click event to the messageBubble chevron. If retract is true then a retract menu option is added. A delete option is always added.
function chevronClick(messageBubble, retract) { var chevron = $('.hoverChevron', messageBubble); //if there is already one open close it first otherwise it can never be closed once popupcloser is overriden if (window.popupcloser) { window.popupcloser(); } if (!messageBubble.dataset.showing...
[ "function mailtomenu_append(item)\n {\n $(item).attr('onclick', '').on('click', function(e) {\n return mailtomenu($('#mailto-menu'), item, e);\n });\n }", "onAfterAttach(msg) {\n const node = this.node;\n node.addEventListener('click', this, true);\n }", "addClick...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
getChildEntries takes in spiffeid of agent, list of agents, and a list of entries returns list of child entries
getChildEntries(spiffeid, globalAgents, globalEntries) { if (typeof globalEntries === 'undefined') { return NaN; } var curAgent = globalAgents.filter(agent => { return this.getAgentSpiffeid(agent) === spiffeid }) var entriesList = globalEntries.filter(entry => { return spiffeid ===...
[ "getChildEntries() {\n\t\treturn Object.entries(this._childs);\n\t}", "getAgentEntries(agent, entries) {\n let nodeEntries = entries.filter(e => e.parent_id.path === \"/spire/server\")\n if(agent === undefined) {\n return [];\n }\n if(agent.selectors === undefined) {\n agent.selectors = [];\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
API 2 Load favorite (or visited) items API end point: [GET] /history?user_id=1111
function loadFavoriteItems() { activeBtn('fav-btn'); // request parameters var url = './history'; var params = 'user_id=' + user_id; var req = JSON.stringify({}); // display loading message showLoadingMessage('Loading favorite items...'); // make AJAX call ajax('GET', url + '?' + params, req, funct...
[ "function loadFavoriteItems() {\n activeBtn('fav-btn');\n\n // request parameters\n var url = './history';\n var params = 'user_id=' + user_id;\n var req = JSON.stringify({});\n\n // display loading message\n showLoadingMessage('Loading favorite items...');\n\n // make AJAX call\n ajax('G...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This function: 1) Inserts new WHERE clauses to ensure that we're only querying over HEADS (this could change later)
function addQueryBounds (parsed) { let where = parsed.where[0].triples let objectVariables = getObjectVariables(parsed) for (let [v] of objectVariables) { let idVar = `?__${v.slice(1)}` /* where.push({ subject: idVar, predicate: consts.graph.seedpod.preds.HEAD, obje...
[ "function addQueryCondition() {\n queryString += optionParams.length > 1 ? ` AND ` : ` WHERE `\n }", "addConditions(op) {\n let { conditions, params } = this;\n let { hash, sort } = this.index;\n if (params.exists === true) {\n conditions.push(`attribute_exists(${hash})`);\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns the "n Items" string for this node, generating and caching it if it hasn't been created yet.
function createItemString(data) { return data.length + ' ' + (data.length !== 1 ? 'items' : 'item'); }
[ "function createItemString(data) {\n return data.length + ' ' + (data.length !== 1 ? 'items' : 'item');\n}", "getItems() {\n let itemString = \"\";\n let index;\n for (index in this.items) {\n itemString += (\"(\" + index + \")\" + \" \" + this.items[index].getName() + '\\n');\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Executes the provided search query, caching the results
searchWithCaching(query, options) { return this.create(Search).usingCaching(options).execute(query); }
[ "function executeQuery(){\r\n\treadRequest(urlBuilder.getSearchURL());\r\n}", "function search() {\n var queryString = $(\"query\").value;\n if(queryString) {\n setResultsView();\n $(\"loading\").classList.remove(\"hidden\");\n var collectionInfo = getCollectionSize(COLLECTION_NAME);\n c...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
To execute, open desired FLA with missing fonts and double click this file to open in Flash. To install as a command, copy this file into: Operating systemLocation Windows 7boot drive\Users\username\AppData\Local\Adobe\Flash CS6\language\Configuration\Commands Windows Vistaboot drive\Users\username\Local Settings\Appli...
function listFonts() { var all_items = dom.library.items; // ---------------------------------------------------------------------------- // Find embedded fonts fl.outputPanel.trace(""); fl.outputPanel.trace(""); fl.outputPanel.trace("Embedded fonts"); fl.outputPanel.trace("==========================...
[ "function launchSWF(p_appPath, p_commands) {\n\tvar dom = fl.getDocumentDOM();\n\tif (dom == null) {\n\t\tshowDialog(\"No Document\", \"Please first open up an FLA file.\", \"false\");\n\t\treturn;\n\t}\n\t\n\t// Create Temp folder\n\tif (!FLfile.exists(EXPORT_URI)) { FLfile.createFolder(EXPORT_URI); }\n\t\n\t// CH...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Generates a count of each specific species within the dataset
function generateSpeciesCount(dataset) { for (let i = 0; i < dataset.length; i++) { let row = dataset[i]; if (speciesMap.has(row.species)) { speciesMap.set(row.species, speciesMap.get(row.species) + 1); if (row.species == "Other") { let otherSpecies = row.bree...
[ "function createCount(data, platform, station, survey, speciesBdmer) {\n\tlet count = {\n\t\tcode: \"\",\n\t\tcodePlatform: platform.code,\n\t\tcodeSurvey: survey.code,\n\t\tcodeStation: station.properties.code,\n\t\tdate: null,\n\t\tmonospecies: null,\n\t\tmesures: []\n\t};\n\n\tif (data.META_INSTANCE_NAME === nul...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Load the users from the users/ directory. The uid is populated on each one.
function loadUsers(callback) { loadDir([ dir, 'users' ].join('/'), function(filename, contents) { var user = yaml.safeLoad(contents); user.cn = user.uid = fileUid(filename); if ( !user.publicKeys ) user.publicKeys = []; return user; }, callback) }
[ "function loadUsers() {\n fs.readdir(usersFilePath, function(err, files) {\n if (err) {\n // failed to read the dir. Maybe logout error?\n }\n else {\n files.forEach(function(file) {\n var nick = file.split(\".\")[0];\n userDict[nick] = {};\n });\n loadSayings(); // go ah...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Draw the shadow of the lander on the ground underneath the lander
function drawShadow(){ shadowsize = (y/11); //x size is roughly double y size, hence shadowsize is halved for y ctx.drawImage(landershadow, x+2, canvas.height-25, shadowsize, (shadowsize/2.25)); }
[ "function shadow() {\n stroke(0, 0, 0);\n translate(2, 2);\n }", "function Shadow() {\n noStroke();\n fill(0, 0, 0, 40);\n ellipse(player1.position.x, player1.position.y + 5, 40, 40);\n for (i = 0; i < zeds.length; i++) {\n ellipse(zeds[i].position.x, zeds[i].position...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Push one of received events stored in 'delayedEvents' array into scope 'events' array so it shows in the observer panel. That pushing cannot occur faster than with interval defined in 'OBSERVER_EVENT_MIN_DELAY' constant.
function pushEvent() { timeoutPromise = null; if (delayedEvents.length === 0) { return; } $scope.events.push(delayedEvents.splice(0, 1)[0]); $scope.isHidden = false; $timeout(function () { ...
[ "function regularEvents() {\n\n if( typeof pys_events == 'undefined' ) {\n return;\n }\n\n for( var i = 0; i < pys_events.length; i++ ) {\n\n var eventData = pys_events[i];\n\n if( eventData.hasOwnProperty('delay') == false || eventData.delay == 0 ) {\n\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Reads All Reservation Documents Residing within specified Collection
getAllReservations() { return this._connection .find({ HotelID: this._HotelID }) .select('-__v -_id -created_date') .lean(); }
[ "async function getAll() {\n const reservationCollections = await reservations();\n const targets = await reservationCollections.find({}).toArray();\n return targets;\n}", "function getAllDocByCollection(){\n console.log(\"################################## GET all properties by collection name ######...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Appends the given Format Tag into the selected text
function appendFormatCode(format, tx) { if(tx.value==tx.getAttribute("prompt")) { tx.focus(); } formatOpen="<"+format+">"; formatClose="</"+format+">"; scr= tx.scrollTop; startPos = tx.selectionStart; endPos = tx.selectionEnd; selectedSubString = tx.value.substr(tx.selectionStart, tx.selectionEn...
[ "function appendFormatCode(format, tx)\r\n{\r\n\tformatOpen=\"[\"+format+\"]\";\r\n\tformatClose=\"[/\"+format+\"]\";\r\n\tscr= tx.scrollTop;\r\n\tstartPos = tx.selectionStart;\r\n\tendPos = tx.selectionEnd;\r\n\tselectedSubString = tx.value.substr(tx.selectionStart, tx.selectionEnd - tx.selectionStart);\r\n\ttx.va...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get the caret position in an textarea
function getCaretPosition(txtarea) { var caretPos = new caretPosition(); // simple Gecko/Opera way if(txtarea.selectionStart || txtarea.selectionStart == 0) { caretPos.start = txtarea.selectionStart; caretPos.end = txtarea.selectionEnd; } // dirty and slow IE way else if(document.selection) { // get c...
[ "function caretPos(){\n\t\tvar element = textbox[ 0 ], pos = 0;\n\n\t\tif ( element.selectionStart ) {\n\t\t\tpos = element.selectionStart;\n\t\t}\n\n\t\treturn pos;\n\t}", "function getCaretPosition() {\n\tvar isTextArea = this.nodeName.toLowerCase() == 'textarea';\n\tvar caretPos = null;\n\tvar range = this.doc...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Pull rdf/xml file and parse to triples with rdfQuery
function fetchTriples(uri, qry, fn) { // Store that we've fetched this URI1 topinfo['done'].push(uri); // Check if we need to go through echo service if (uri.indexOf('http') == 0 && uri.indexOf('www.shared-canvas.org/') == -1) { furi = 'http://www.shared-canvas.org/services/echo/?uri='+uri; } else { ...
[ "async function fetchResults(query, source) {\n\t\n\tmyEngine.query(query, {sources: source,}) // only need to change the query and sources variables if want to alter the query\n\t\t.then(function (result) {\n\t\t\tconsole.log(\"getting data\");\n\t\tresult.bindingsStream.on('data', function (data) {\n\t\t\t// Each...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
fires after addMark(); switches the turn, updates the number of turns that have elapsed and then calls the tracker().
function switchTurn() { if (turn === "X") { turn = "O"; } else { turn = "X"; } turnCounter++; tracker(); }
[ "function update_turn() {\n\tswitch (gamestate.state) {\n\t\tcase GAME_JOIN:\n\t\t\t// check if we should start\n\t\t\t\n\t\t\tbreak;\n\t\tcase GAME_SETUP_CLAIM:\n\t\t\t// check if all territories are claimed\n\t\t\tbreak;\n\t}\n}", "forceTurnEvaluation() {\n this.turnIndicator -= 1;\n this.turnIndi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Registers a routine address or constant value, using the acceleration codes defined in the Glulx specification.
function setSlotGlulx(isParam, slot, value) { if (isParam && slot === 6) { var image = this.image; if (value != image.getRamAddress(SELF_OFFSET)) { throw new Error("Unexpected value for acceleration parameter 6"); } return true; } i...
[ "registerConstant(value, name) {\n const term = this.getHost().toPolar(value);\n __classPrivateFieldGet(this, _Polar_ffiPolar, \"f\").registerConstant(name, term);\n }", "loadValue(register, value) {\n this[_opcodes.Register[register]] = value;\n }", "function register(accelerator, ca...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Set up your camera and your projection matrices
function setUpCamera() { // set up your projection // defualt is orthographic projection let projMatrix = glMatrix.mat4.create(); //glMatrix.mat4.ortho(projMatrix, -5, 5, -5, 5, 1.0, 300.0); glMatrix.mat4.perspective(projMatrix, radians(60), 1, 5, 100); gl.uniformMatrix4fv (program.uProjT, ...
[ "function setupCamera() {\n camera = new PerspectiveCamera(45, config.Screen.RATIO, 0.1, 100);\n camera.position.x = -30;\n camera.position.y = 40;\n camera.position.z = 30;\n camera.lookAt(scene.position);\n console.log(\"Finished setting up Camera...\");\n }", "funct...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
TODO: Allow enabling/disabling of developerMode from `option`.
_initDeveloperMode() { const echo = (eventName, ...args) => { let a = '(no arguments)'; if (args && args.length > 0) { a = '\n'; args.forEach((v, i) => { if (isDefined(v)) { const s = isFunc(v) ? `func: '${v.name || 'anonymous'}'` : v; a += `\t${i}: ${...
[ "function devMode() {}", "enableDeveloperMode() {\n if (!this.developerModeEnabled) {\n this.log.debug('Enabled developer mode');\n FirebaseRemoteConfig.enableDeveloperMode();\n this.developerModeEnabled = true\n }\n }", "function devmode() {\n dev = !dev;\n if (dev) {\n track...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Display one cumulated histograms on a section parent
function buildHisto(parent, ann, dep){ var svg = d3.select(parent), margin = {top: 50, right: 120, bottom: 0, left: 80}, width = +svg.attr("width") - margin.left - margin.right, height = +svg.attr("height") - margin.top - margin.bottom-50, g = svg.append("g").attr("transform", "translate(" + (marg...
[ "function showHistPart() {\n Net.sim_mode(\"hbar_breakout\")\n // ensure bar axis is set\n //showAxis(xAxisBar);\n opacityZero()\n\n g.selectAll(\".hbar_breakout\")\n .transition()\n .duration(600)\n .attr(\"opacity\", 1);\n\n // switch the axis to histogram one\n //Net.sim_mode...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Excluir uma linha da tabela de produtos na tela de venda
function Excluir() { var par = $(this).parent().parent(); //tr par.remove(); $("#total").text(CalcularTotal()); // produtos.splice(i,1); }
[ "function f_ExcluirLinhas(idTabela){\n\t// remove as linhas da tabela\n\tvar tabela\t= document.getElementById(idTabela);\n\twhile (tabela.rows.length>0){\n\t\ttabela.deleteRow(0);\n\t}\n\t\n\treturn tabela;\n}", "function removerDetalhesExcluidosTable() {\n $scope.detalhesExcluir.forEach(detalhe => {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
return a variable scroll offset from given index.
getVarOffset(index, nocache) { const { delta } = this; const cache = delta.varCache[index]; if (!nocache && cache) { return cache.offset; } let offset = 0; for (let i = 0; i < index; i += 1) { const size = this.getVarSize(i, nocache); // If we can't get this...
[ "function GetXOffsetFromIndex(index)\n{\n\tvar multiplier = (index % numberOfRows);\n\treturn 1.0/numberOfRows * multiplier;\n}", "getAnimationOffset(index) {\n return new Vec2_1.default((index % this.numCols) * this.size.x, Math.floor(index / this.numCols) * this.size.y);\n }", "function getPageOffse...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }