query
stringlengths
9
34k
document
stringlengths
8
5.39M
negatives
listlengths
19
20
metadata
dict
adds the ruleSets from RuleSets.js to the select box and set their defaults
function addRulesetTypesToSelect() { var selectBox = document.getElementById("type"); for (let i = 0; i < ruleSets.length; i++) { selectBox.add(new Option(ruleSets[i].name, i)); } updateFieldsWithTypeDefaults(ruleSets[0]); }
[ "getRules(selector, selectorNum) {\n\n // Generate the options for the category dropdown\n var categoryOptions = [\"All\", \"Chicken\",\"Beef\",\"Salad\",\"Soup\",\"Stew\",\"Pasta\",\"Egg\",\"Pork\",\"Fish\",\"Sandwich\",\"Seafood\",\"Baked\",\"Fried\",\"Bread\",\"Pizza\"].map(category => {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function to load the customFonts variable and set the fontsLoaded State to true.
async _loadFontsAsync() { await Font.loadAsync(customFonts); this.setState({ fontsLoaded: true }); }
[ "function loadDefaultFonts() {\n if (!$('link[href=\"fonts.css\"]').length) {\n $(\"head\").append('<link rel=\"stylesheet\" type=\"text/css\" href=\"fonts.css\">');\n const fontsToAdd = [\"Amatic+SC:700\", \"IM+Fell+English\", \"Great+Vibes\", \"MedievalSharp\", \"Metamorphous\", \"Nova+Script\", \"Uncial+A...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Ball bouncing animation It checks if the ball and stick colors match And changes the ball color
bounce() { this.balltween .to('#ball', this.time/2, {y: '+=250px', scaleY: 0.7, transformOrigin: "bottom", ease: Power2.easeIn, onComplete: () => { this.checkColor(); } }).to('#ball', this.time/2, {y: '-=250px', sca...
[ "checkBalls() {\n for(this.i = 0; this.i < balls.length; this.i++){\n if(this !== balls[this.i]){\n if( this.r/2 + balls[this.i].r/2 > 1 + dist(this.x, this.y, balls[this.i].x, balls[this.i].y)){\n if((this.xVel / Math.abs(this.xVel) != balls[this.i].xVel / Math.abs(balls[this.i].xVel)) &&\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
useClickable implements all the interactions of a native `button` component with support for making it focusable even if it is disabled. It can be used with both native button elements or other elements (like `div`).
function useClickable(props) { if (props === void 0) { props = {}; } var { ref: htmlRef, isDisabled, isFocusable, clickOnEnter = true, clickOnSpace = true, onMouseDown, onMouseUp, onClick, onKeyDown, onKeyUp, tabIndex: tabIndexProp, onMouseOver, onMouseLeav...
[ "function useTab(props) {\n var {\n isDisabled,\n isFocusable\n } = props,\n htmlProps = _objectWithoutPropertiesLoose(props, [\"isDisabled\", \"isFocusable\"]);\n\n var {\n setSelectedIndex,\n isManual,\n id,\n setFocusedIndex,\n enabledDomContext,\n domContext,\n selectedIndex\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
resets all input fields in popup
function resetPopup() { newEventNameInput.value = ""; hrSelect.value = "hr"; minSelect.value = "min"; ampmSelect.value = "am"; categorySelect.value = "none"; createEventBtn.style.display = "inline-block"; editEventBtn.style.display = "none"; deleteEventBtn.style.display = "none"; shareEventInput.value = ""; s...
[ "function onClickReset() {\r\n cleanInputs();\r\n resetFieldsUi();\r\n}", "clearInputs() {\r\n titleBook.value = '';\r\n authorBook.value = '';\r\n isbnBook.value = ''; \r\n}", "function clear_form(){\n $(form_fields.all).val('');\n }", "function clearModalFields() {\n $(\"#memberNameEdit...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
return a list [bool, Node, int] 1st element is a bool to check the presence of the value 2nd element is a the node containing the value 3th element is the parent node. Useful for deleting later 4th element is a the depth from the root where is the node containing the value
find(value){ const go = (value, node, parent, depth) => { if(node === null) return [false, null, null, null]; else if(value === node.value) return [true, node, parent, depth]; else return value < node.value ? go(value, node.left, node, ++depth) : go(value, no...
[ "isParent(valueParent, valueChild) {\n //2 same values return false\n if(valueParent === valueChild) return false;\n //Get the node object corresponding to our values\n let [existChild, nodeChild, nodeChildDirectParent, ] = this.find(valueChild);\n let [existParent, nodeParent, , ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Fits the number into specific `min` and `max` bounds.
function fitNumber(value, min, max) { if (value > max) { return max; } else if (value < min) { return min; } return value; }
[ "function minMaxSet() {\n min = parseInt(minRange.value);\n max = parseInt(maxRange.value);\n}", "function bound (n, min, max) {\n return Math.min(max, Math.max(min, n))\n}", "function clamp(n, min, max) {\n return isNumeric(n) ? Math.min(Math.max(n, min), max) : min;\n}", "function constrain(n, min, max)...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
given a timed range, computes an allday range based on how for the end date bleeds into the next day TODO: give nextDayThreshold a default arg
function computeVisibleDayRange(timedRange, nextDayThreshold) { if (nextDayThreshold === void 0) { nextDayThreshold = createDuration(0); } var startDay = null; var endDay = null; if (timedRange.end) { endDay = startOfDay(timedRange.end); var endTimeMS = timedRange...
[ "function calculateRecurDates(rule, from /* utc millis */, to /* utc millis */) {\n var dates = []; /* array of utc millis (number) */\n var runDate = new Date(from);\n var i;\n\n var candidate = null;\n var counter = 0;\n // (open) loop to collect recurrences\n whil...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Format of knockx2 joke
function jokeFormat(question, answer) { return `Knock knock \nWho's there? \n${question} \n${question} who? \n${answer}`; }
[ "function generateJoke() {\n\t\t\t\trand = Math.floor(Math.random() * qty) + 1;\n\t\t\t\t$slip.find('.q').html( data[rand].q);\n\t\t\t\t$slip.find('.a').html( data[rand].a);\n\t\t\t}", "function setupJoke() {\n randomKnockKnockJoke().forEach( stageOfJoke => {\n conversationBacklog.push(stageOfJoke)\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Updates the display message
function update_display_msg(msg) { update_Display(msg, 0); }
[ "function displayItemMessage(msg) {\n document.getElementById('warning-mess').innerHTML = msg;\n}", "function displayHelpMsg(msg) {\n\tExt.getCmp('helpIframe').el.update(msg);\n}", "function rtwDisplayMessage() {\n var docObj = top.rtwreport_document_frame.document;\n var msg = docObj.getElementById(RTW_Tr...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
function to display only text styling options
function showTextStyle(){ viewStyling("none"); var styleBlocks = document.getElementsByClassName("textStyle"); for (var i = styleBlocks.length - 1; i >= 0; i--) { styleBlocks[i].style.display = "inline"; }; }
[ "text() {\n return styles[text[this.id]];\n }", "function styleText(text){ \n\t//console.log(\"style text called\");\n\ttext.style.fontFamily = getFont();\n\ttext.style.color = getColor(0); \n\ttext.style.backgroundColor = getColor(1);\n\tif (border) {\n\t\ttext.style.border = \"solid \"+ getBorder() ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Initialize our Rendr server. We can pass inject various modules and options here to override default behavior: dataAdapter errorHandler notFoundHandler appData
function initServer() { var options = { dataAdapter: new DataAdapter(config.api), errorHandler: mw.errorHandler(), appData: config.rendrApp }; server = rendr.createServer(app, options); }
[ "function app_init() {\r\n global = lib('globals');\r\n server = lib('server');\r\n app = lib('application');\r\n sys = app.sys = lib('system');\r\n req = app.req = lib('request');\r\n res = app.res = lib('response');\r\n req.router = lib('router');\r\n app.model = lib('model');\r\n app.util = lib('util');...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Se validan los niveles y mundo actualizando a el mayor
function validarMundoyNivelMayor(nivelactual,mundoactual){ //caso base que permite avanzar de nivel 5 de x mundo al siguiente restableciendo nivel mayor a 1 del siguiente mundo if(nivelactual==5 && mundoMayor==mundoactual){ this.nivelMundoMayor=1; this.mundoMayor=mundoMayor+1; añadirLocalStorage("Nivel...
[ "function validarDepNumCuenta() {\n var datosCorrectos;\n datosCorrectos = true;\n var error = \"\";\n var cd = document.getElementById('detalleNumId').value,\n cedulaFormato = /^[1-9]-?\\d{4}-?\\d{4}$/, expNumerica = /^[0-1000000]$/;\n var detMonto=document.getElementById(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
get available slots on specific lane
function getAvailableLaneAppointmentTimeSlots(laneId,appointmentId,updateMode,appointmentDay,isEncryptResponse, encryptionPassword){ var bodyRequest = '<sch:getAvailableLaneAppointmentTimeSlotsRequest>'; bodyRequest += '<sch:tlnId>' + laneId + '</sch:tlnId>'; bodyRequest += '<sch:aptId>' + appointmentId + '</sch...
[ "getFreeSlotCount() {\n try {\n const result = this.parkingManager.getAvailabilityCount();\n if(result > 0) {\n console.log(`${result} slots available`);\n } else {\n console.log('Sorry, parking lot is full ');\n }\n } catch (e)...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Retrieves the site design task, if the task has finished running null will be returned
async getSiteDesignTask(id) { const task = await SiteDesignsCloneFactory(this, "GetSiteDesignTask").run({ "taskId": id }); return hOP(task, "ID") ? task : null; }
[ "addSiteDesignTaskToCurrentWeb(siteDesignId) {\n return SiteDesignsCloneFactory(this, \"AddSiteDesignTaskToCurrentWeb\").run({ siteDesignId });\n }", "get task () {\n return this._mem.work === undefined ? null : this._mem.work.task;\n }", "addSiteDesignTask(webUrl, siteDesignId) {\n r...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Simply returns the string to display to initial dialog box
function initialTitle(){ var title = '<dialog title="' + "Welcome PublishAll User" +'" buttons="accept, cancel">'; return String(title); }
[ "function Dialog() {}", "function showQuestion(){\n var lstrMessage = '';\n lstrMessageID = showQuestion.arguments[0];\n lobjField = showQuestion.arguments[1];\n lstrCaleeFunction = funcname(arguments.caller.callee);\n //Array to store Place Holder Replacement\n var larrMessage = new Arr...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Handled the successful subscription to the channel, receiving a list of users that are already online/subscribed to the channel.
function subscriptionSucceeded(members) { console.log('Success!'); // call addMember for each user already subscribed members.each(addMember); }
[ "async function subscribe () {\n for (let ex of tradeExchange) {\n let users = await User.findAllInExchange(ex.name);\n for (let user of users) {\n let userKey = `${user.exchange}:${user.address}:${user.apiKey}`;\n if (!(userKey in subscribedUsers)) {\n ex.subscribe(crypt.decrypt(user.apiKey...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
FUNCTION NAME : newDeviceCancel AUTHOR : Clarice A. Salanda DATE : March 18, 2014 MODIFIED BY : REVISION DATE : REVISION : DESCRIPTION : PARAMETERS :
function newDeviceCancel(id){ $("#devicetypetabs").empty(); $("#manualMainID").remove(); $('#'+id).empty().dialog('destroy'); }
[ "function cancelApplication() {\n return confirm(\"Are you sure you want to cancel your application at this stage?. No record of your current application will be kept.\");\n}", "function callback_deleteDevice(errorCode) {\n console.log('callback_deleteDevice called');\n //Terminates connection with devic...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Parses the config.xml's preferences and configfile elements for a given platform
function parseConfigXml(platform) { var configData = {}; parsePlatformPreferences(configData, platform); parseConfigFiles(configData, platform); return configData; }
[ "function parsePlatformPreferences(configData, platform) {\n var preferences = getPlatformPreferences(platform);\n switch(platform){\n case \"ios\":\n parseiOSPreferences(preferences, configData);\n break;\n case \"android\":\n parseAn...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[14] Expr::= OrExpr [15] PrimaryExpr::= VariableReference | '(' Expr ')' | Literal | Number | FunctionCall e.g. $x, (3+4), "hi", 32, f(x)
function primaryExpr(stream, a) { var x = stream.trypopliteral(); if (null == x) x = stream.trypopnumber(); if (null != x) { return x; } var varRef = stream.trypopvarref(); if (null != varRef) return a.node('VariableReference', varRef); var funCall = functionCall(stream, a); ...
[ "function primaryExpr(stream, a) {\n var x = stream.trypopliteral();\n if (null == x) x = stream.trypopnumber();\n if (null != x) {\n return x;\n }\n var varRef = stream.trypopvarref();\n if (null != varRef) return a.node('VariableReference', varRef);\n var funCall = functionCall(stream, a...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Create Join tournament transaction
static joinToTournament(operationJSON, account, asset, transactionFunctionCallback) { let tr = wallet_api.new_transaction(); tr.add_type_operation("tournament_join", operationJSON); return tr.set_required_fees(asset.id).then(() => { return setTransaction('tournament_join', { ...
[ "async function createProject(name, goalInETH, durationInHours) {\n // Transforming the parameters to the \"contract-friendly\" format\n const goalInWei = goalInETH * ethWei;\n const durationInSeconds = durationInHours * 3600;\n\n // Asking the user to confirm his donation.\n if (!confirm(`Opravdu chcete založ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Checks whether the element is focused.
async isFocused() { await this._stabilize(); return document.activeElement === this.element; }
[ "_containsFocus() {\n const activeElement = _getFocusedElementPierceShadowDom();\n return activeElement && this._element.nativeElement.contains(activeElement);\n }", "function elementIsFocusable(elem)\n{\n while ( elem != null )\n {\n var visibility = getCascadedStyle(elem, \"visibil...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Check if the previous passwords in the array are already used; if they aren't used before then push them into the elements array, otherwise push false instead of the element itself
function getPasswordsNotUsedBefore (array) { let elements = []; for(let i = 0; i < array.length; i++) { if(array.slice(0, i).includes(array[i])) { elements.push(false); } else { elements.push(array[i]); } } return elements; }
[ "function validatePairs(password) {\n const pairs = new Set();\n for (let i = 0; i < password.length - 1; ++i) {\n if (password[i] === password[i + 1]) {\n const pair = password[i].repeat(2);\n pairs.add(pair)\n if (pairs.size === NUM_PAIRS_NEEDED) return true;\n }\n }\n r...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Set a user as inactive Parameters : none Return : none
function setInactiveUser() { jQuery.post( swapchic_ajax.ajax_url, { 'action': 'ajaxSetInactiveUser' }, function(){ } ); }
[ "setInactive() {\n if (this.isActive()) {\n this.element.setAttribute(Constants.DATA_ATTRIBUTE_ACTIVE, false);\n }\n if (this.parentView && this.parentView.setInactive) {\n this.parentView.setInactive();\n }\n }", "setUserInactiveExpiresAt() {\n const value ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Custom function : make secure ivr session
function makeSecureIVRSession(flowId, userData) { console.log('makeSecureIVRSession (flowId,userData)'); if(typeof flowId !== 'string') { console.log('Parameter #1 is not a string'); return; } if(typeof userData !== 'string') { console.log('Parameter #2 is not a string'); return; } let thisCon...
[ "function transferIVRSession() {\r\n\tconsole.log('transferIVRSession (defaults)');\r\n\r\n\tloadConversationList();\r\n\tlet flowId = secureIdentificationFlow;\r\n\tmakeSecureIVRSession( flowId, defaultUserData);\r\n\r\n\tconsole.log('Finish (use defaults)');\r\n}", "function sessionIdCreator() {\r\n let idLeng...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
endregion region addIncomingMessage Reads a resource representing an incoming message and adds a corresponding message model to the collection.
function addIncomingMessage(resource) { var phref = resource.link('participant').href; var sender = getParticipant(phref); if (!sender) throw Error('There is no participant with href=' + phref); ...
[ "ADD_MESSAGE_TO_DISCUSSION (\n state,\n {\n discussion_id,\n message\n }) {\n const discussionPosition = getIndexes.getElementIndex(state.conversations, discussion_id)\n // If there is a problem with message discusion\n if (!message || discussionPosition < 0) {\n r...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
add Stripe Checkout intercept script to page in order to submit via ajax
function addStripeCheckoutInterceptToPage() { if(!document.querySelector('script[data-label=stripeCheckoutIntercept]')) { // only add stripe checkout interceptor if not there already addFunctionToPage(stripeCheckoutSubmitIntercept, 'stripeCheckoutIntercept'); } }
[ "function stripeCheckoutSubmitIntercept() {\n window.addEventListener('beforeunload', () => {\n let token = null;\n let $tokenIdField = document.querySelector('input[name=stripeToken]');\n if($tokenIdField) {\n // build token obj to send via postMessage\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Install prettier eslint config
async function prettierEslintConfig() { // install prettier eslint config await executeCmd(COMMANDS.install.eslint.config.prettier); await executeCmd(COMMANDS.install.eslint.plugin.prettier); }
[ "async function prettierSetup(hasReact) {\n // install prettier\n await executeCmd(COMMANDS.install.prettier);\n\n // check if user already has created .prettierrc\n const prettierrcFilePath = path.resolve(`${PROJECT_ROOT}`, PRETTIERRC);\n\n // get the prettier config file\n const prettierrc = hasReact ? `${P...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Show All Article View
function showArticleList(req,res,next) { res.render('article-list') }
[ "function getAllAuthors(req, res) {\n Author.find({}, function(err, allAuthorsFromDb) {\n res.render('authorsViews/index', { \n allAuthorsReferenceForEJS: allAuthorsFromDb,\n title: 'All Authors'\n })\n })\n}", "function seeAllStories() {\n vm.storyLimit = vm.newsD...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
UTILITY FUNCTIONS / Creates a new jQuery object representing a DOM document. tag: string of the form "" which is the DOM type attributes: object of key/value pairs that are attributes of the DOM text: string which is the content of the DOM $parent: jQuery object that will be the parent (container)
function createJQObject(tag, attributes, text, $parent) { var $jQObj = $(tag, attributes); $jQObj.text(text); $jQObj.appendTo($parent); return $jQObj; }
[ "function createJQObjectNoText(tag, attributes, $parent) {\n var $jQObj = $(tag, attributes);\n $jQObj.appendTo($parent);\n return $jQObj;\n}", "createHTMLElement(parent){\n let htmlElement=document.createElement(this.htmlTagName);\n this.parent=parent;\n this.parent.appendChild(html...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Validates the "version" field of a package manifest object, i.e. a parsed "package.json" file.
function validatePackageManifestVersion(manifest, manifestDirPath) { if (!hasValidVersionField(manifest)) { throw new Error(`${getManifestErrorMessagePrefix(ManifestFieldNames.Version, manifest, manifestDirPath)} is not a valid SemVer version: ${manifest[ManifestFieldNames.Version]}`); } return mani...
[ "function hasValidVersionField(manifest) {\n return semver_utils_1.isValidSemver(manifest[ManifestFieldNames.Version]);\n}", "function validPackages(packageList) {\n\tvar valid = true;\n\n\tpackageList.forEach(function(package) {\n\t\tif (package.indexOf(':') == -1) {\n\t\t\tconsole.error(package + ' is not va...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
funcion para validar la entrada de los datos en un alta de perfil.
function validaAltaPerfil( form ) { var regreso; regreso = true; regreso = validaAlta( form ); if( regreso ) regreso = validaFacultades( form ); return regreso; }
[ "function validaPerfil( form )\n\t{\t\n\t\tvar\t\tmensaje\t\t=\t'';\n\t\tvar\t\tsalida\t\t=\tfalse;\n\t\t\n if( form.slc_perfil.value == '' )\n {\n \t\tmensaje\t=\t' Debe seleccionar un PERFIL para el usuario.\\n';\n \t\tmensajeError( form.slc_perfil , mensaje );\n } \n else\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
array of keg objects > Immutable Map
function kegsToMap(kegs = []) { return new Immutable.Map().withMutations((map) => { kegs.forEach((keg) => { map.set(keg.id, keg); }); return map; }); }
[ "get groupsObject () {\n const result = {}\n for (const [key, val] of this.groups) {\n result[key] = Array.from(val)\n }\n return result\n }", "function Map() {\n this.keys = OrderedSet.create();\n this.values = {};\n}", "geDimensionElements() {\n const elements = {}\n\n _.each(Dim...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Checks whether a string is an error sent by upload.php
function isError(str){ if(str.startsWith("Error: ")){ return true; } return false; }
[ "isValidUrl(string) {\r\n\t\ttry {\r\n\t\t\tnew URL(string);\r\n\t\t\treturn true;\r\n\t\t} catch (_) {\r\n\t\t\treturn false; \r\n\t\t}\r\n\t}", "function validateFileName(fname,path) {\n\tif ( fname == \"\" ) {\n return 1;\n } else {\n var isinvalid = 0;\n if (/^disk[0-2]|disk$/.test(pa...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Class iglooSettings builds settings interface and manages settings storage/handling
function iglooSettings () { this.popup = null; this.settingsEnabled = true; this.isOpen = false; }
[ "createSettings() {\n var settings = {\n Generic: this.isUaGeneric,\n Special: this.isUaSpecial,\n DNT: this.isDNT,\n GPC: this.isGPC,\n Breadth: this.isBreadth,\n Single: this.isSingle\n }\n return settings;\n }", "readSettings() {\n\n this._hue.bridges = this._sett...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
initialiser le tableau qui contiendra les images
function initTable() { var nbLignes = $("#nbLignes").val(); var nbColonnes = $("#nbColonnes").val(); var URL = $("#URL").val(); /* charger l'image en mémoire, puis une fois chargé, commencer a construire le tableau de canvas */ var image = _loadImage(URL); image.onload = function(...
[ "function initImgs(){\n for(var i = 1; i <= datas.nbrOfImages; i++) {\n // génère les images dans l'index.html\n $scope.data.items.push({src: \"img/bd/Case\" + i + \".jpg\"});\n }\n }", "function createTable() {\n $(\"#main\").append(\"<table id='field'>\");\n for (var r = 0; r < dim_max; r++) ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get the context menu options based on the type
function getContextMenuOptions(p_name) { switch (p_name) { default: return { theme: 'vista', shadowColor: 'black', shadowOffsetX: 2, shadowOffsetY: 2, shadowWidthAdjust: 2, ...
[ "getMenuOptions() {\n let menu_options = [];\n\n //push the home option\n menu_options.push({\n text: \"Home\",\n icon: <HomeIcon />,\n action: this.goHome\n });\n\n //push the qr option\n menu_options.push({\n text: \"Scan Code\",\n icon: <QRIcon />,\n action: this.g...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
be more explicit about only reading / writing a gene
function fromGene(name) { }
[ "getRandomGene() {\n return this.genes[Math.floor(Math.random() * this.genes.length)];\n }", "enable_disableMutation(){\n\t\tvar i = Math.floor(Math.random() * this.genes.length)\n\n\t\t//we can only use an available gene\n\t\tif (this.genes[i] != null) {\n\t\t\tthis.genes[i].enabled = !this.genes[i].en...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
The AWS::ECR::Repository resource creates an Amazon Elastic Container Registry (Amazon ECR) repository, where users can push and pull Docker images. For more information, see Amazon ECR Repositories in the Amazon Elastic Container Registry User Guide. Documentation:
function Repository(props) { return __assign({ Type: 'AWS::ECR::Repository' }, props); }
[ "function Repository(props) {\n return __assign({ Type: 'AWS::CodeCommit::Repository' }, props);\n }", "function Repository(nativeRepo) {\n var index, _priv;\n if (!(nativeRepo instanceof NativeRepository)) {\n throw new Error(\"Don't construct me, see gitteh.(open|init)Reposito...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
create buttons with pets that were saved to local storage
function createSavedPetBtns() { let getSavedPetIDArray = JSON.parse(localStorage.getItem("savedPetIDArray")) || []; for (i = 0; i < getSavedPetIDArray.length; i++) { let generatedPetIDLi = document.createElement("li"); generatedPetIDLi.classList.add("generated-pet-ID-li"); generatedPetIDLi.setAttrib...
[ "_createSceneryButton(buttons) {\r\n\t\tlet tokenButton = buttons.find((b) => b.name === 'token');\r\n\t\tif (tokenButton && game.user.isGM) {\r\n\t\t\ttokenButton.tools.push({\r\n\t\t\t\tname: 'scenery',\r\n\t\t\t\ttitle: 'NT.ButtonTitle',\r\n\t\t\t\ticon: 'fas fa-theater-masks',\r\n\t\t\t\tvisible: game.user.isGM...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets the appropriate ol.source element for a given layerID.
getSourceForLayerId(layerId) { let layer = this.mapsInterface.getLayerFromArray(layerId); let olLayer = layer.vectorLayer.getLayersArray()[0]; if (!olLayer) { return null; } return olLayer.getSource(); }
[ "getLayer(name) {\n this._ensureIsInLayeredMode()\n\n const layer = this._layers.get(name)\n if (!layer) {\n throw new Error('No layer with name \"' + name + '\" exists!')\n }\n\n return layer\n }", "get src() {\n this._logService.debug(\"gsDiggThumbnailDTO.src[get]\");\n return this._s...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
3.0.5 Object restructuring stream
function restructureObjectStream (columns, showAllColumns) { return through2.obj(function (obj, enc, callback) { if ((columns.length > 0) && (!showAllColumns)) { var structuredObj = {} columns.forEach((el) => { path.set(structuredObj, el, path.get(obj, el)) }) this.push(structuredO...
[ "function getObjStreams(obj) {\n let stack = [obj]\n let streams = []\n while(stack.length) {\n const vals = R.values(stack.pop())\n streams = R.concat(streams, R.filter(flyd.isStream, vals))\n stack = R.concat(stack, R.filter(isObj, vals))\n }\n return streams\n}", "function Transform() {\n stre...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
sort by date, next id, to showing last notes on top
function sortNotes(){ notesList.sort(function(a,b) { if(a.date < b.date) return 1; if(a.date > b.date) return -1; if(a.date == b.date) { if(a.id < b.id) return 1; if(a.id > b.id) return -1; } ...
[ "function getNotes(req,res,next){\n Note.find()\n .then(notes=>{\n let head;\n let i = notes.length-1;\n let temp = [];\n let j = -1;\n while(i>=0){ \n let note = notes[i];\n\n let next;\n if(i!==notes.length-1){\n next = temp[j];\n } else {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
RestoreNewSystem(restorePath) Restore a new setup from the specified directory
function RestoreNewSystem(restorePath) { // Verify that the directories and files are there if (! CheckFolderExists (restorePath)) { throw "Cannot find folder " + restorePath ; } if (! CheckFolderExists (restorePath + "\\ACP Settings")) { throw "Cannot find folder " + restorePath + "\\ACP Settings...
[ "rollback() {\n while (this._installedFiles.length > 0) {\n let move = this._installedFiles.pop();\n if (move.isMoveTo) {\n move.newFile.moveTo(move.oldDir.parent, move.oldDir.leafName);\n } else if (move.newFile.isDirectory() && !move.newFile.isSymlink()) {\n let oldDir = getFile(mo...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns true if the given key is currently down.
function keyDown(key) { key = key.toUpperCase(); if (keyStatus.hasOwnProperty(key)) { return keyStatus[key]; } return false; }
[ "keyDown(key) {\n if(this.keydowns[key]) {\n return true;\n }\n return false;\n }", "isHeld(key) {\n if(!this.keyStates[key]) {\n return false;\n }\n return this.keyStates[key].isPressed;\n }", "function IsKeyReleased(user_key_index) {\r\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
format val to n number of decimal places modified version of Danny Goodman's (JS Bible)
function formatDecimal3(val, n) { n = n || 2; var str = "" + Math.round ( parseFloat(val) * Math.pow(10, n) ); while (str.length <= n) { str = "0" + str; } var pt = str.length - n; return str.slice(0,pt) + "." + str.slice(pt); }
[ "function formatDecimal4(val, n) {\n n = n || 2;\n var str = \"\" + Math.round ( parseFloat(val) * Math.pow(10, n) );\n while (str.length <= n) {\n str = \"0\" + str;\n }\n var pt = str.length - n;\n return str.slice(0,pt) + \".\" + str.slice(pt);\n}", "fun...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
input + imageObjList => contentparts
function toContentParts(input, images) { let data = [] data.push({ pos: 1, content: input, type: "TEXT", }) if (images) { for (let i = 0, len = images.length; i < len; i++) { data.push({ pos: i + 2, content: images[i]['src'], type: "IMAGE", }) } } retu...
[ "jsonParser(photos){\n let farmIds = [];\n let serverIds = [];\n let ids = [];\n let secretIds = [];\n\n photos.forEach(element => {\n farmIds.push(element.farm);\n serverIds.push(element.server);\n ids.push(element.id);\n secretIds.push(element.secret);\n});\n this.imageLinkBuilder(fa...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Transforms drafts to hold a collection of players and executives for each year
function transformDrafts(data) { const players = data.players; const drafts = {}; players.forEach((player) => { const { executiveId, id: playerId, draftYear } = player; if (!drafts[draftYear]) { drafts[draftYear] = { year: draftYear, players: [playerId], executives: [executi...
[ "function filterByDebut (year) {\n let arr = []\n for (const i of players)\n {\n if (i.debut == year)\n {\n arr.push(i)\n } \n }\n return arr\n}", "function getProposalsAndAwards(next) {\n\tdb.sequelize.query('SELECT p.id, p.Year, p.Number, p.ProposalTitle, p.Category, p.Department, p.Status,...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns all DOM letters
get lettersDOM() { return document.querySelectorAll('.letter'); }
[ "function storeLetters(letters) {\n let letterContainer = document.getElementById(\"letterContainer\");\n for (const char of letters) {\n let underlined = document.createElement(\"div\");\n underlined.setAttribute(\"class\", \"underlined\");\n letterContainer.appendChild(underlined);\n var charContain...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
console.log(quest_2()); Question3 Write a JAVASCRIPT program that sets up an array of integers with capacity 20. It should then generate the 20 entries randomly in turn. Each entry must be an integer between l and 20, however it must also be different from all previous entries in the array. Generate the entries as rand...
function quest_3(){ let randoms=[],x=0; while(true){ x=Math.floor((Math.random() * 20) + 1); if(randoms.indexOf(x)==-1){ randoms.push(x); }else if(randoms.length==20){ randoms=randoms.sort(function(a, b){return a - b}); break; } } return randoms; }
[ "function arrayTwenty() {\n let arr = [];\n let ranNum = 0;\n\n while (true) {\n ranNum = Math.floor((Math.random() * 20) + 1);\n if (arr.indexOf(ranNum) == -1) {\n arr.push(ranNum);\n } else if (arr.length == 20) {\n arr = arr.sort((a, b) => a - b);\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
build table is called on page load, writes all existing trains in database to table, calles getArrival.
function buildTable(){ myDatabase.ref().once("value", function (snapshot) { var latestSnapshot = snapshot.val(); for(var looper in latestSnapshot){ getArrival(latestSnapshot[looper].departTime,latestSnapshot[looper].tripTime); $('#trainTable').append(`<tr>...
[ "function build_custom_trades_table( ) {\n\tif (debug) {\n\t\twindow.location = 'ajax_helper.php'+debug_query+'&'+$('#custom_trades input:visible').serialize( );\n\t\treturn false;\n\t}\n\n\t// send the data\n\t$.ajax({\n\t\ttype: 'POST',\n\t\turl: 'ajax_helper.php',\n\t\tdata: $('#custom_trades input:visible').ser...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Calculate OTUs for an ascent or descent (at a fixed rate)
function calcOTUs(time, maxPO2, minPO2) { var mPO2 = Math.max(0.5, minPO2); var o2Time = time * (maxPO2 - mPO2) / (maxPO2 - minPO2); return(((0.273 * o2Time) / (maxPO2 - mPO2)) * (Math.pow(((maxPO2 - 0.5) / 0.5), 1.833) - Math.pow(((mPO2 - 0.5) / 0.5), 1.833))); }
[ "function getVoltsAO(amp,ohm) {\r\n const volts = amp*ohm\r\n document.querySelector('#ohm-answer').textContent = volts + 'V'\r\n}", "speedUp() {\n if(this.score > 30) {\n return 1.8;\n }\n if(this.score > 20) {\n return 1.7;\n }\n if(this.score > 15)...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function to remove a postcode from the list of postcodes assiociated to the constituency
function removePostcode(postcode){ var element = document.getElementById(postcode); element.parentNode.removeChild(element); }
[ "function remove (list.bookName) {\nif (list.indexOf(bookName) => 0) {\n\nreturn list.filter(item) => !== bookName);\n}\n}", "function remove (bookList, bookName) {\n let mutatedArr = [...bookList];\n let indexToRemove = mutatedArr.indexOf(bookName);\n\n if (indexToRemove >= 0) {\n \n mutatedArr.splice...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
shema value rules obj obj with property which is shema for
function process(shema, obj) { var propName = shema.inputProp || shema.outputProp, objC = obj[propName], otype = _.type(objC); if(shema.type === 'object') { if(otype.is('object')) { for(var prop in shema.value) { if(shema.value.hasOwnProperty(prop)) { if(!process(shema.value[prop],...
[ "function addValidationRules(entity) {\n var entityType = entity.entityType,\n i,\n property,\n propertyName,\n propertyObject,\n validators,\n u,\n validator,\n nValidator;\n\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Retrieve an CuePoint object by id.
static get(id){ let kparams = {}; kparams.id = id; return new kaltura.RequestBuilder('cuepoint_cuepoint', 'get', kparams); }
[ "getById(id) {\n return spPost(TimeZones(this, `GetById(${id})`));\n }", "function getById (id, options, callback) {\n if(_.isFunction(options)) {\n // Check if we want to use the default options\n callback = options;\n options = { limit: 20 };\n } else if(!_.isObject(options)) {\n throw n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
function to insert in dom (step 3) the warning
function insertWarningInDOM() { var oldvalue = ""; document.getElementById("projectWarning").innerHTML = oldvalue + getAvertissement(); }
[ "function insertProblemList(theProblemsArray, idElementToInsert) { \n var rezHtml=\"\";\n for (var i=0; i<theProblemsArray.length; i++) {\n rezHtml+=\n ' <div class=\"item\">'+\n ' <a class=\"topic-problem-link\" href=\"'+theProblemsArray[i].permalink+'\">'+theProblemsArray[i...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Brandon wrote this code draws chimney on top of left side of roof
function drawChimney() { //brown penRGB(139, 69, 14, 1); //starts where it ended after it drew the right window, so moves to where the chimney will be located on the house moveRightWindowToChimney(); //reaches the left slanting side of the roof turnRight(40); moveForward(20); turnTo(0); //draws chimne...
[ "function drawChimneyCode() {\n moveForward(13);\n turnLeft(90);\n moveForward(6);\n turnLeft(90);\n moveForward(18);\n}", "fountain() {\n // draws the foundation of the fountain\n stroke(51, 54, 51);\n strokeWeight(4);\n fill(81, 82, 81);\n // can I use the matrix and rotation + translation t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Decrypte the mnemonic of the wallet.
decrypt (mnemonicEncrypted, password) { let mnemonic try { mnemonic = this.crypto.AES.decrypt(mnemonicEncrypted, password).toString( this.crypto.enc.Utf8 ) } catch (err) { throw new Error('Wrong password') } return mnemonic }
[ "function decipher(e,offset){\n return cipher(e,-offset);\n }", "function mnemonic() {\n try {\n return fs.readFileSync(\"./mnemonic.txt\").toString().trim();\n } catch (e) {\n if (defaultNetwork !== \"localhost\") {\n console.log(\n \"☢️ WARNING: No mnemonic file cre...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
' Name : handle_bp_add_verify_cart_item ' Return type : None ' Input Parameter(s) : req, startTime, apiName ' Purpose : Creating a class to handle the BP_ADD_VERIFY_CART_ITEM API error with following members ' History Header : Version Date Developer Name ' Added By : 1.0 28th Apr,2012 Ravi Raj '
function handle_bp_add_verify_cart_item(req, startTime, apiName) { this.req = req; this.startTime = startTime; this.apiName = apiName; }
[ "function handle_bp_cart_receipt(req, startTime, apiName) {\n this.req = req; this.startTime = startTime; this.apiName = apiName;\n}", "function handle_cm_add_payment_card(req, startTime, apiName) {\n this.req = req; this.startTime = startTime; this.apiName = apiName;\n}", "function handle_bp_...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Resolve the node module with the specified `packageName` that satisfies the specified minimum version.
function resolveWithMinVersion(packageName, minVersionStr, probeLocations, rootPackage) { if (rootPackage && !packageName.startsWith(rootPackage)) { throw new Error(`${packageName} must be in the root package`); } const minVersion = new Version(minVersionStr); for (const location of probeLocatio...
[ "function resolveWithMinVersion(packageName, minVersionStr, probeLocations, rootPackage) {\n\t if (rootPackage && !packageName.startsWith(rootPackage)) {\n\t throw new Error(`${packageName} must be in the root package`);\n\t }\n\t const minVersion = new Version(minVersionStr);\n\t for (const loca...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Converts all Twitter Bootstrap packages to Meteor packages and saves them to dest. Example: exportAllTwbPackages("dschnare", bootstrap", "pacakges", cb); exportAllTwbPackages(twbPackages, dest, callback) exportAllTwbPackages(twbPackages, meteorUser, destPkgPrefix, dest, callback)
function exportAllTwbPackages(twbPackages, meteorUser, destPkgPrefix, dest, callback) { if (arguments.length === 3) { callback = destPkgPrefix; dest = meteorUser; destPkgPrefix = ""; meteorUser = ""; } async.each(Object.keys(twbPackages), function (twbPkgName, cb) { exportTwbPackage(twbPackages[twbPkgName...
[ "async function packageScripts() {\n await runCommand(\n \"mkdir dist/lib/scripts\",\n \"creating the dist/lib/scripts directory if it doesn't exist\"\n );\n await runCommand(\n \"cp lib/scripts/* dist/lib/scripts/.\",\n \"copy the contents of scripts to dist/sripts\"\n );\n}...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Validate the mode and key.
function validateModeKey(mode, sideKey) { if (mode !== "public" && mode !== "private" && mode !== "restricted") { throw new Error("The mode must be public, private or restricted, it is '" + mode + "'"); } if (mode === "restricted") { if (!sideKey) { ...
[ "function validateKey() {\n if ($(this).val()) {\n if ($(this).val().match(/^[A-Za-z0-9]*$/)) return hideError($(this).parent().children(\".error\"));\n else return validationError($(this).parent().children(\".error\"), i18n.KEY_VALIDATION_MESSAGE)\n }\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Adds a data source. Tags nonderived sources with and +. Tags derived sources with +.
function addDataSource(dataCollection, data) { var id = data.id; if (isDerivedDataConfig(data)) { if (!obj.isDef(data.tags)) { data.tags = '+'; } dataCollection[id] = { glDerive: data }; } else { if (!obj.isDef(data.tags)) { data.tags = ['*', '+']; } dataC...
[ "function addSource() {\r\n\r\n // Re-start source selection when we press button\r\n //\r\n CurStepObj.stageInStep = StageInStep.SrcSelectStarted;\r\n doNextStage();\r\n}", "addSource(source, version)\n {\n const self = this;\n if (!version)\n {\n version = \"\";\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Private functions validate salary info object
function _validate(salaryInfo) { if (!_validateText(salaryInfo.firstName)) throw new Error('firstName is required'); if (!_validateText(salaryInfo.lastName)) throw new Error('lastName is required'); if (!_validateText(salaryInfo.payPeriod)) throw new Error('payPeriod is required'); ...
[ "addStudentDataValidation (data) {\n\tconst schema = Joi.object({\n\t\tstudentName: Joi.string().required(),\n\t\tclass: Joi.number().required(),\n\t\troll: Joi.number().required(),\n\t\tschoolId: Joi.string().min(24).required(), // MongoDB Object ID must be 24 characters long\n\t\ttotalMarks: Joi.number().required...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Fonction calculant la distance pour se rendre a chaque fourmi
function calculDistance () { var distanceX = 0; var distanceY = 0; //Pour chaque fourmis for(i=0; i<tableauFourmis.length; i++){ //On calcul la distance entre la tete de notre serpent PC et la fourmi. X ET Y que l'on ajoute distanceX = Math.abs(tableauFourmis[i].xFourm...
[ "function calculateDistance(i){\n var distance = new THREE.Vector2();\n var zero = new THREE.Vector2(0,0);\n distance = zero.distanceTo(allVectors[i]);\n return distance;\n}", "get distance(){\n\t\treturn(google.maps.geometry.spherical.computeLength(this._locations))\n\t}", "getDistance() {\n con...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Initializes a new instance of `XMLComment` `text` comment text
constructor(parent, text) { super(parent); if (text == null) { throw new Error("Missing comment text. " + this.debugInfo()); } this.name = "#comment"; this.type = NodeType.Comment; this.value = this.stringify.comment(text); }
[ "function createTextElement(text) {\n return new VirtualElement(0 /* Text */, text, emptyObject, emptyArray);\n }", "function extractCommentText(text) {\n\t\n\tvar lines = text.split(\"\\n\")\n\n\tvar start = /^\\/\\*+/,\n\t\t\tlineStart = /^[ \\t]*\\*[ ]?/,\n\t\t\tend = /\\*+\\//;\n\n\t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
MixinOptions behaviors Takes care of getting the behavior class given options and a key. If a user passes in options.behaviorClass default to using that. If a user passes in a Behavior Class directly, use that Otherwise delegate the lookup to the users `behaviorsLookup` implementation.
function getBehaviorClass(options, key) { if (options.behaviorClass) { return options.behaviorClass; //treat functions as a Behavior constructor } else if (_.isFunction(options)) { return options; } // behaviorsLookup can be either a flat object or a method if (_.isFunction(Marionette.Behaviors.b...
[ "static _validateMergeStrategy(mergeStrategy) {\n if (!MERGE_STRATEGIES.includes(mergeStrategy)) {\n throw Error(\n `Unrecognized mergeStrategy provided. Options are: [${MERGE_STRATEGIES}]`\n );\n }\n }", "getViewStrategy(value: any): ViewStrategy {\n if (!value) {\n return null;\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
hideMask_Date() ================ Method to remove the Date Mask Parameters Return value
function hideMask_Date(oElement) { var lstrValue = oElement.value; re = new RegExp("/","g"); oElement.value = lstrValue.replace(re,""); oElement.select(); }
[ "function hideMask_YearMonthDate(oElement)\n{\n var lstrValue = oElement.value;\n\n re = new RegExp(\"/\",\"g\");\n oElement.value = lstrValue.replace(re,\"\");\n oElement.select();\n}", "function hideMask_DateTime(oElement)\n {\n var lstrValue = oElement.value;\n\n re = new RegExp(\"/\",\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Convert a pixel X coordinate at a certain zoom level to a longitude coordinate.
pixelXToLongitude(pixelX, zoom) { return 360 * ((pixelX / (this.TileSize << zoom)) - 0.5); }
[ "tileXToLongitude(tileX, zoom) {\n return this.pixelXToLongitude(tileX * this.TileSize, zoom);\n }", "function PixelXYToLatLong( pixelX, pixelY, levelOfDetail)\n\t{\n\t\tvar mapSize = MapSize(levelOfDetail);\n\t\tvar x = (Clip(pixelX, 0, mapSize - 1) / mapSize) - 0.5;\n\t\tvar y = 0.5 - (Clip(pixelY, 0,...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets an observable that emits when the backdrop has been clicked.
backdropClick() { return this._backdropClick; }
[ "function backdropClickHandler(event) {\n if (event.target === event.currentTarget) {\n closeModalHandler();\n };\n}", "closingActions() {\n const backdrop = this.overlayRef.backdropClick();\n const outsidePointerEvents = this.overlayRef.outsidePointerEvents();\n const detachments = this...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
DESCRIPTION: Shows Help/Tips PARAMS: game (I,REQ) Game object selectSound (I,REQ) Sound to play on button click playerData (I,OPT) Player data
function showOptions(game, selectSound, playerData, music) { // ============================== // Camera // ============================== var cameraX = 400; var cameraY = 75; var cameraWidth = 624; var cameraHeight = 551; var mapCamera = game.cameras.add(cameraX, cameraY, cameraWidth, cameraHeight);...
[ "function ex(btn){ \n thePlayerManager.showExercise(btn);\n}", "function OnOptHelp(strObjectID)\n{\n\ntry {\n\tTextBox.Text = strObjectID;\n\tMFBar.WinHelp(8, 131375, \"dvdplay.hlp\");\n}\n\ncatch(e) {\n e.description = L_ERRORHelp_TEXT;\n\tHandleError(e);\n\treturn;\n}\n\n}", "function startChoice() {\n\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
endregion region Init Adds listeners for DOM events for the scheduler and its events. Which events is specified in SchedulerscheduledBarEvents and SchedulerschedulerEvents.
initDomEvents() { const me = this; // Set thisObj and element of the configured listener specs. me.scheduledBarEvents.element = me.schedulerEvents.element = me.timeAxisSubGridElement; me.scheduledBarEvents.thisObj = me.schedulerEvents.thisObj = me; // same listener used for dif...
[ "createEvents() {\n this.slider.addEventListener(this.deviceEvents.down, this.eventStartAll);\n window.addEventListener('resize', this.eventResize);\n }", "setEventListeners() {\n this.on('edit',this.onEdit.bind(this));\n this.on('panelObjectAdded',this.onPanelObjectAdded.bind(this)...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
add points for build2
function build2points() { points += (4 * b2multi); totalpoints += (4 * b2multi); }
[ "function build1points() {\n points += (1 * b1multi);\n totalpoints += (1 * b1multi);\n }", "function build3points() {\n points += (10 * b3multi);\n totalpoints += (10 * b3multi);\n }", "addPoint() {\r\n var point;\r\n if(this.points.length < this.numpoints) {\r\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
dispatch setAccountItems action to update accountItems reducer
setAccountItems(items) { dispatch(setAccountItems(items)); dispatch(itemRefetchFinished()); }
[ "updateActiveAccount (state, activeAccount) {\n state.activeAccount = activeAccount;\n }", "async updateAccount() {\r\n const accounts = await web3.eth.getAccounts();\r\n const account = accounts[0];\r\n this.currentAccount = account;\r\n console.log(\"ACCOUNT: \"+account)\r\n }", ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
A semanticsection (ss) class
function FunH5oSemSection(eltStart) { this.ssArSections = []; this.ssElmStart = eltStart; /* the heading-element of this semantic-section */ this.ssElmHeading = false; this.ssFAppend = function (what) { what.container = this; this.ssArSections.push(what); }; this.ssFAsHTML = fun...
[ "function ExamSection(){\n\tthis.title = \"\";\n\tthis.descr = \"\";\n\tthis.list = [];\t// list of questions for this exam section\n\t\n\treturn this;\n}", "wrapSection (markup, className) {\n return `\n <section class=\"${className}\">\n <ol>\n <li>\n ${markup}\n </li...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
The subdivision of the sequence. This can only be set in the constructor. The subdivision is the interval between successive steps.
get subdivision() { return new _Ticks.TicksClass(this.context, this._subdivision).toSeconds(); }
[ "function Division() {\n\tthis.minCells = 2 // Can operate on a minimum of 2 cells\n\tthis.maxCells = 2 // Can operate on a maximum of 2 cells\n\tthis.symbol = '&divide;'\n}", "get stepWidth() {\n return Math.floor(this.width / this.step) + 1;\n }", "get stepHeight() {\n return Math.floor(this....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Callback function, when active policy is selected in the select active policy page
function handleOnSelectPolicyDone(underPolicyId, underPolicyNo, riskBaseId) { if(underPolicyNo.indexOf("(")>0){ underPolicyNo = underPolicyNo.split("(")[0]; } setInputFormField("externalId", underPolicyId); setInputFormField("externalNo", underPolicyNo); setInputFormField("riskBaseId",...
[ "function confSelected(conf){\n\t\tvar selected = document.conferences[conf].checked;\n\t\tconferences[conf] = selected; \n\t\tif (currentAuthor != undefined){\n\t\t\tauthorClicked(currentAuthor);\n\t\t} else {\n\t\t\tresetSelector();\n\t\t}\n\t}", "_onApplicationSelect() {\n this._selected = 'appsco-appli...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
The entry is still valid if the expiration is more than 5 minutes from the expiration time.
isValid() { return this.expiration - Date.now() > EXPIRATION_BUFFER_MS; }
[ "has_life_expired() {\n if ((this.lifetime !== null) && (this.age >= this.lifetime)) {\n return true;\n } else {\n return false;\n }\n }", "function expired() {\n return (this.token && this.token.expires_at && new Date(this.token.expires_at) < new Date());\n }", "function i...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Choose the artist image, if none available, use placeholder.
chooseArtistImage(data) { var imgSrc; if (data.images.length > 3) { imgSrc = data.images[2].url; } else if (data.images.length > 1) { imgSrc = data.images[0].url; } else { imgSrc = 'http://placehold.it/45x45'; }; return imgSrc; }
[ "static altTextForArtistImage(artist) {\r\n return (`${artist.artistName}`);\r\n }", "static getPhotoOfArtist(artistPage) {\n if (artistImageCache.get(artistPage)) {\n return Promise.resolve(artistImageCache.get(artistPage));\n }\n return fetch(artistPage)\n .then(response => {\n if (!re...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
are randomly grabbed from the allElements array and packaged in groups of four into the transferArray, which pushes itself to newShuffle.
function elementLocations() { let choice; let transferArray = []; let newShuffle = []; for (let i = 0; i < cols; i++) { for (let j = 0; j < rows; j++) { choice = floor(random(allElements.length - 1)); transferArray.push([allElements[choice], 0, 0]); allElements.splice(choice, 1); } ...
[ "shuffleElements() { \n this.deck.shuffle();\n }", "shuffle() {\n \n for (let i = 0; i < this._individuals.length; i++) {\n let index = getRandomInt( i + 1 );\n let a = this._individuals[index];\n this._individuals[index] = this._individuals[i];\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Provides the depth of ``descendant`` relative to ``ancestor``
function getDepth(ancestor, descendant) { var ret = 0; while (descendant !== ancestor) { ret++; descendant = descendant.parentNode; if (!descendant) throw new Error("not a descendant of ancestor!"); } return ret; }
[ "get depth() {\n let d = 0;\n for (let p = this.parent; p; p = p.parent)\n d++;\n return d;\n }", "numDescendants() {\n let num = 1;\n for (const branch of this.branches) {\n num += branch.numDescendants();\n }\n return num;\n }", "function getDepth...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
get player name from local storage
function getName(){ if(localStorage.getItem('player-name') === null){ playerName.textContent = 'Player1'; } else{ playerName.textContent = localStorage.getItem('player-name'); } }
[ "function playerName() {\r\n var player = document.getElementById(\"player\").value;\r\n localStorage.setItem(\"playerName\", player);\r\n}", "function addUserName () {\n let tag = document.querySelector('#player')\n let myHeadline = document.createElement('h2')\n myHeadline.innerText = 'Curently playing:'\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
TODO SEPARATE CRDT: w/ dentry call ZCache.GetMemcacheCrdtDataFromDelta() function fetch_local_crdt(net, ks, dentry, md, next)
function fetch_local_crdt(net, ks, next) { ZDS.ForceRetrieveCrdt(net.plugin, net.collections, ks, next); }
[ "async function main() {\n\n // Login to GDN and Create cache (if not exists)\n fabric = new Fabric(fed_url)\n await fabric.login(guest_email, guest_password)\n await fabric.useFabric(geo_fabric)\n const cache = new Cache(fabric)\n\n //Clean Cache from previous runs\n await cache.purge(keys);\n\n // Use Mac...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
itIT validation function (Codice fiscale (TINIT), persons only) Verify name, birth date and codice catastale validity and calculate check character. Material not in DGTAXUD document sourced from: `
function itItCheck(tin) { // Capitalize and split characters into an array for further processing var chars = tin.toUpperCase().split(''); // Check first and last name validity calling itItNameCheck() if (!itItNameCheck(chars.slice(0, 3))) { return false; } if (!itItNameCheck(chars.slice(3, 6))) { r...
[ "function validaCPFCNPJ(controle) {\r\n //Chama rotina verifica CPF\r\n if (validaCPF(controle)) {\r\n return true;\r\n }\r\n else {\r\n //Chama rotina verifica CNPJ\r\n if (validaCNPJ(controle)) {\r\n return true;\r\n }\r\n else {\r\n alert('CPF ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Invoked when the `initialValue` property changes
initialValueChanged(previous, next) { // If the value is clean and the component is connected to the DOM // then set value equal to the attribute value. if (!this.dirtyValue) { this.value = this.initialValue; this.dirtyValue = false; } ...
[ "async function getInitialValue() {\n try {\n const previousValue = await IDB.getItem(database, storeName, key);\n if (previousValue) {\n setPrivateValue(previousValue);\n } else if (initialValue) {\n await IDB.setItem(database, storeName, key, initialValue);\n s...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
this function changes the value of "currentIndex" the parameter "index" represents the position (within the todolist) of the item the user has been click on
changeIndex(index) { // if the item the user clicks on is already the current item, then this item ceases to be the current item (and thus we hide the corresponding buttons) // if the item the user clicks on is not the current item, then this item becomes the current item (and thus we show the c...
[ "function changeToDo(position, newVal) {\r\ntoDos[position] = newVal;\r\ndisplayToDos();\r\n}", "function indexChanged(index) {\n actions.setTabSelected(index);\n setIndex(index);\n }", "function changeTodo(position, newValue){\n// todos[0] = 'some new value';\ntodos[position] = newValue;\ndisplayTodos()...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function that is called every thirty seconds.
function everyThirty(seconds) { //DEBUG: console.log("tracks = " + tracks); //eventLogAry.shift(); //dataObj.animalTracks += tracks; if(loggedIn == true){ createPackage(); createData(lJson); }; }
[ "function func8() {\r\n setTimeout(function tick() {\r\n let hours = new Date().getHours();\r\n let minutes = new Date().getMinutes();\r\n let seconds = new Date().getSeconds();\r\n console.log(`${hours}:${minutes}:${seconds}`);\r\n setTimeout(tick, 1000);\r\n }, 1000);\r\n}", "function repeatFor...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sort the expomodulesautolinking android config to make it stable from hashing.
function sortExpoAutolinkingAndroidConfig(config) { for (const module of config.modules) { // Sort the projects by project.name module.projects.sort((a, b) => a.name < b.name ? -1 : a.name > b.name ? 1 : 0); } return config; }
[ "function getModuleDependencyLinksHash(d) {\n let links = getModuleDependencyLinks(d)\n let asString = Object.keys(links).map(l => links[l]).sort().join('\\n')\n return crypto.createHash('md5').update(asString).digest('hex').substring(20)\n}", "function sortSources() {\n let screenSources = [];\n l...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Class iglooKeys / iglooKeys manages all the key actions for igloo. There are multiple modes to iglooKeys and for each mode, there are different key shortcuts. Modules can register keystrokes to modes from their own classes, although they can't create modes of their own yet Creds to Mousetrap for being an awesome librar...
function iglooKeys () { this.mode = 'default'; this.keys = ['default', 'search', 'settings']; this.cbs = { 'default': {}, 'search': { noDefault: true }, 'settings': {} }; //This registers a new keybinding for use in igloo //And then executes the function under the right circumstances this.register = ...
[ "_keyboardShortcuts() {\n browser.commands.onCommand.addListener((command) => {\n if (command === 'action-accept-new') {\n this.app.modules.calls.callAction('accept-new')\n } else if (command === 'action-decline-hangup') {\n this.app.modules.calls.callActio...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
change opacity cube slides prev
function opacitySlidesPrev(scrollPos,slides,windowH) { var activeSlide = $(slides).map(function() { if(scrollPos + windowH <= $(this).offset().top + $(this).height()) return this }) if(scrollPos < startAnimateCube.step) { var prevEl = $(slides)[$(slides).length - activeSlide.length - 1]; var curEl = $(activeS...
[ "function imageCubePrev(scrollPos,apiSpritespin) {\n\tif(scrollPos < startAnimateCube.step) {\n\t\tapiSpritespin.prevFrame();\n\t\tstartAnimateCube.step -= 100;\n\t}\n} //end func", "slideNext() {\n super.slideNext();\n this.slides[this.lastSlide].style.opacity = 0;\n this.slides[this._index]...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
End Function printSettings ////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////// Function Title: printArguments Description: This function prints the arguments provided to this program. Parameters: None Returns: None
function printArguments() { var i; console.log(OS.eol + 'Commands provided to function:'); for (i = 0; i < process.argv.length; i += 1) { console.log(i + ': ' + process.argv[i]); } }
[ "function printSettings() {\n var soutput = '', i;\n soutput += 'bhelp: ' + osettings.bhelp + '\\n' +\n 'bpre: ' + osettings.bpre + '\\n' +\n 'srepo: ' + osettings.srepo + '\\n' +\n 'sdest: ' + osettings.sdest + '\\n' +\n 'aign:\\n';\n for (i = 0; i <...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get the currently selected points from all series
function getSelectedPoints() { var points = []; each(series, function(serie) { points = points.concat( grep( serie.points, function(point) { return point.selected; })); }); return points; }
[ "function getPoints() {\n for (var i = 0; i < paths.length; i++) {\n if (paths[i].pathPoints.length > 1) {\n var objPoints = paths[i].pathPoints;\n for (var j = 0; j < objPoints.length; j++) {\n if (objPoints[j].selected == PathPointSelection.ANCHORPOINT) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
set URL address for API call
setURL() { let forecastApiKey = 'f051a3a6eaeb0d3041fa073c40a73a0c'; let forecastApiURL = `https://api.openweathermap.org/data/2.5/forecast?lat=${this.lat}&lon=${this.lon}&units=metric&APPID=${forecastApiKey}`; return forecastApiURL; }
[ "function init_url( url ) {\n\treturn api_url + url;\n}", "apiUrl() {\n const url = this.globalConfigService.getData().apiUrl;\n return url || Remote_1.RemoteConfig.uri;\n }", "function apiUrl({ withTenant, apiBaseUrl, apiDomain, tenant, withFeed, feed }) {\n let result = withTenant\n ? `ht...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Draws a card from the current deck and updates our drawn cards. Displays alert if no cards remaining in deck.
async function drawCard(){ if (deckIsEmpty) { alert("NO CARDS REMAINING"); } else { const resp = await axios.get(`${CARDSAPI}/${deckID}/draw/?count=1`); const newCard = resp.data.cards[0]; setDrawnCards(cards => [newCard, ...cards]) if (resp.data.remaining === 0) setDeckIsEmpty(...
[ "function drawCard (deck,drawnCards) {\n const card = deck.pop();\n drawnCards.push(card);\n return card;\n }", "function draw() {\n\n // Create the endpoint url \n const path = (deckId === '') ? `new/draw/?count=1` : `${deckId}/draw/?count=1`;\n const url = endpoint + path;\n\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Parse a string representation of a floating point and pull out the sign.
function parseSign(s){ var beginning = true; var seenDot = false; var seenSomething = false; var zeros = ""; var leadZeros = ""; var all = ""; var decPlaces = 0; var totalDecs = 0; var pos = true; for (var i=0; i<s.length; i++){ var c = s.charAt(i); if (c>='1' && c<=...
[ "function parseFloats(str) {\r\n var floats = [];\r\n var regex = /[+-]?(?:(?:\\d+\\.?\\d*)|(?:\\d*\\.?\\d+))(?:[eE][+-]?\\d+)?/g;\r\n var match;\r\n while ((match = regex.exec(str))) {\r\n floats.push(parseFloat(match[0]));\r\n }\r\n return floats;\r\n }", ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
set the style for the track line
setStyle() { this.lineStyle = { color: globalStore.getData(keys.properties.trackColor), width: globalStore.getData(keys.properties.trackWidth) } }
[ "function update_relative_speed(line) {\n\n var journey = line.properties.journey;\n var choice;\n // Missing\n if (!journey.travelTime) {\n choice = BROKEN_COLOUR;\n }\n // Worse than normal\n else if (journey.travelTime > 1.2*journey.normalTravelTime) {\n choice = SLOW_COLOUR;\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Heartback callback function for GET: /heartbeat/:ip Bots will hit endpoint repeatedly to inform server if bots are still running and infected Takes the ip query parameter and passes it to the bots heartbeat() controller function Sends the response back from the heartbeat() function Response would include the target URL...
async function heartbeat(req, res) { debug('HEARTBEAT') const { ip } = req.params try { var response = await bots.heartbeat(ip) res.send(response) } catch (error) { console.log(error) res.sendStatus(500) } }
[ "heartBeatHandler(err,msg) {\n var jo=msg.body;\n var sv=simulatorVerticle;\n if (sv.debugHeartBeat)\n console.log(JSON.stringify(jo));\n sv.heartBeatCount++;\n if (sv.onHeartBeat && sv.self) {\n sv.onHeartBeat(sv.self,sv.heartBeatCount);\n }\n }", "function heartbeatCallback(heartbe...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
conditional function Description: increments global token pointer for one conditional or biconditional, and calls disjunction function before and after this token is found Parameters: none Returns: nothing
function conditional(){ disjunction(); if (globalTP < tokens.length && (tokens[globalTP] == "bicond" || tokens[globalTP] == "cond")){ globalTP+=1; disjunction(); } }
[ "function disjunction(){\n conjunction();\n while (globalTP < tokens.length && tokens[globalTP] == \"or\"){\n globalTP+=1;\n conjunction();\n }\n}", "function createConditional(antecedentLine, consequentLine){\n antecedentChars = getCharacters(antecedentLine);\n consequentChars = getCharacters(conseque...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns true if value is hex RGB between '000000' and 'FFFFFF'
function hexRgb (value) { return low.string(value) && rgb.test(value) }
[ "function isHex(value) {\n if (value.length == 0) return false;\n if (value.startsWith('0x') || value.startsWith('0X')) {\n value = value.substring(2);\n }\n let reg_exp = /^[0-9a-fA-F]+$/;\n if (reg_exp.test(value) && value.length % 2 == 0) {\n return true;\n } else {\n retur...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Checks if Tidal is playing a video or song by grabbing the "a" element from the title. If it's a song it sets the track URL as currentURL, If it's a video it will set currentURL to undefined.
function updateURL() { const URLelement = elements.get("title").querySelector("a"); switch (URLelement) { case null: currentURL = undefined; break; default: const id = URLelement.href.replace(/[^0-9]/g, ""); currentURL = `https://tidal.com/browse/track/${id}`; break; } }
[ "function selectteam(targeturl){\n //get target from link in lets play button\n var target = document.getElementById(\"lets-play-btn\").getAttribute(\"href\");\n\n //if team is not set already add it to target url\n if (target.indexOf(\"&team=\") == -1){\n document.getElementById(\"lets-play-btn\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }