query
stringlengths
9
34k
document
stringlengths
8
5.39M
negatives
listlengths
19
20
metadata
dict
XPATH FOR HORSE PROFILE CAREER CONTENT Xpath for Career This Sseason
get horseProfile_Career_ThisSeason() {return browser.element("//android.view.ViewGroup[11]/android.view.ViewGroup/android.view.ViewGroup[1]/android.widget.TextView[1]");}
[ "get horseProfile_Career_Synth() {return browser.element(\"//android.view.ViewGroup[11]/android.view.ViewGroup/android.view.ViewGroup[4]/android.widget.TextView[1]\");}", "get horseProfile_Career_Good() {return browser.element(\"//android.view.ViewGroup[11]/android.view.ViewGroup/android.view.ViewGroup[6]/android...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns all bitcoin ever received by a bitcoin address
function getReceived(btcAddress) { var response = UrlFetchApp.fetch('http://blockchain.info/address/' + btcAddress + '?format=json'); var json = response.getContentText(); var data = JSON.parse(json); return data.total_received * Math.pow(10,-8); }
[ "static async getEthTransactions() {\n const walletAddress = await this.getWallet().then(wallet =>\n wallet.getAddressString(),\n );\n\n return fetch(\n `https://api.ethplorer.io/getAddressTransactions/${walletAddress}?apiKey=freekey`,\n )\n .then(response => response.json())\n .then...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Helper function to create a new blank JrResult object
static makeNew() { // static helper. return new JrResult(); }
[ "function createOutputJsonInstance()\n{\n\tvar output = \n\t\t{\n\t\t\t\"status\": null,\n\t\t\t\"message\": null,\n\t\t\t\"data\": null\n\t\n\t\t}\n\n\treturn output;\n\n}", "createOrGetResult( label) {\n\t\tif ( !this.RESULTS[label])\n\t\t\tthis.RESULTS[label] = new Result(label);\n\t\treturn this.RESULTS[label...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get the rides from a speciied provider, returns a promise that on completion will return a object containing the ride options and prices
function getRidesFromProvider(start, end, provider) { return new Promise((resolve, reject) => { if (!(Object.keys(PROVIDER_PATHS).includes(provider))) reject(new Error("Invalid provider " + provider)); const path = baseUrl + PROVIDER_PATHS[provider]; // Start the timeout timer set...
[ "getRecipesByRoute(route, queryParams) {\n return new Promise((resolve, reject) => {\n httpClient\n .get(route, {\n params: queryParams\n })\n .then(response => {\n let data = this.parseRecipeResponse(response);\n\n this.processRecipes(data)\n .then...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get string of subscriptions of type
function getSubscriptionNamesOfType(fs, subscriptionType) { return getSubscriptionsOfType(fs, subscriptionType).map(e => e.node.user.displayName).join(', '); }
[ "getTranslationString(type) {\n let userString;\n let tts = this.get('typeToString');\n userString = tts[type];\n\n if (userString === undefined) {\n for (let ts in tts) {\n if (type.toLowerCase().indexOf(ts) !== -1) {\n userString = tts[ts];\n break;\n }\n }\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Given maybeArray, print an empty string if it is null or empty, otherwise print all items together separated by separator if provided
function join(maybeArray, separator) { return maybeArray ? maybeArray.filter(function (x) { return x; }).join(separator || '') : ''; }
[ "function toHumanizedString(array, sep, lastsep) {\n var str = \"\"\n var last = array.length-1\n array.forEach((type, idx) => {\n str +=\n (idx === 0\n ? \"\"\n : (idx === last\n ? (lastsep || \" or \")\n : (sep || \", \")\n )\n )\n + type\n });\n return str\n}",...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Retrieves all pads that have the same id_agency has the current agency
function getpads(agency_id, pad_array) { var current_agency_pads = []; for(var i = 0; i < pad_array.length; i++) { if(pads[i].pad_id_agency == agency_id) current_agency_pads.push(pads[i]); } // If there are more than one of same sample of a pad we remove extra cell for(var j = 0; j < current_agency_pads.length...
[ "agencies(cb) {\n var agencies = [ ];\n\n this._newRequest().query({ command: 'agencyList' }, function(e) {\n switch(e.name) {\n case 'error':\n cb(null, e.data);\n break;\n\n case 'opentag':\n var tag = ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Name: hideAllBoxes Description: Sets display attribute to none for all accordion divisions Input: None Output: None, divisions hidden
function hideAllBoxes(){ for (var i = 0; i < divArray.length; i++) document.getElementById(divArray[i]).style.display = "none"; }
[ "function showAllBoxes(){\n\tfor (var i = 0; i < divArray.length; i++)\n\t\tdocument.getElementById(divArray[i]).style.display = \"block\";\n}", "toggleAll() {\n if (this.display_mode === 'hidden') this.showAll();\n else if (this.display_mode === 'shown') this.hideAll();\n }", "function boxific...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
gives user a hint that is assigned to each wordToGuess; make hint change as wordToGuess changes
function showHint() { clueToGuess = clue[Math.floor(Math.random() * clue.length)]; for (var i = 0; i < clue; i++) { if (correctGuess === wordToGuess) { clue++; } clueToGuess.push(" "); } document.getElementById("hint").innerHTML = ("Hint: " + clueToGuess); }
[ "function suggestGuess(){\n\tif(guess<answer){\n\t\treturn \" guess higher.\";\n\t} else{\n\t\treturn \" guess lower.\";\n\t}\n}", "function generateHints(guess) {\n var guessArray = guess.split('');// split the strings to arrays \n\tvar solutionArray = solution.split('');// split the strings to arrays \n\tvar...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
setScreenPosition: Positions the zoom region to one of the enumerated positions on the screen.
setScreenPosition(inPosition) { switch (inPosition) { case GDesktopEnums.MagnifierScreenPosition.FULL_SCREEN: this.setFullScreenMode(); break; case GDesktopEnums.MagnifierScreenPosition.TOP_HALF: this.setTopHalf(); break; case GDesktopEnums...
[ "set viewport(toSet) {\n this.minX = toSet[0];\n this.maxX = toSet[1];\n this.minY = toSet[2];\n this.maxY = toSet[3];\n this.currentXRange = [this.minX, this.maxX];\n this.currentYRange = [this.minY, this.maxY];\n }", "setFullScreenMode() {\n let viewPort = {};\n viewPort.x = 0;\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Set timer to turn off resources menu (delayed turn off)
function hideResourcesMenu() { resourcesTimeoutId = window.setTimeout("turnOffMenu('" + resourcesMenu + "')", 60 * 3); }
[ "function hideTutorialsMenu()\n{\n\ttutorialsTimeoutId = window.setTimeout(\"turnOffMenu('\" + tutorialsMenu + \"')\", 60 * 3);\n}", "function hideTrainingMenu()\n{\n\ttrainingTimeoutId = window.setTimeout(\"turnOffMenu('\" + trainingMenu + \"')\", 60 * 3);\n}", "function hideBooksMenu()\n{\n\tbooksTimeoutId = ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Helper function for makeAnomalyGraph: takes an existing tool tip number formatting function, and adds a wrapper which appends the anomaly from the specified base series, either as a percent or nominal value.
function addAnomalyTooltipFormatter (oldFormatter, baseSeries, displayPercent) { const newTooltipValueFormatter = function(value, ratio, id, index) { let nominal = oldFormatter(value, ratio, id, index); if(_.isUndefined(nominal)) { //this series doesn't display in tooltip. return undefined; } ...
[ "function makeAnomalyGraph (base, variable_id, graph) {\n\n //anomalies for some variables are typically expressed as percentages.\n //if this is a single variable graph, check the variable configuration \n //to see if this is one of them; if so, display percentages on the chart.\n const displayPercent = !_.isU...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
See if the browser does pixel manipulation normally, or we have to account for premultiplied alpha. see
function canHandleTrPxMan() { var c, s1, s2; c = document.createElement("canvas"); c.width = 2; c.height = 1; c = c.getContext('2d'); c.fillStyle = "rgba(10,20,30,0.5)"; c.fillRect(0,0,1,1); s1 = c.getImageData(0,0,1,1); c.putImageData(s1, 1, 0); s2 = c.getImageData(1,0,1,1); return (s2.data[0] ==...
[ "function pixelEq (p1, p2) {\n const epsilon = 0.002;\n for (let i = 0; i < 3; ++i) {\n if (Math.abs(p1[i] - p2[i]) > epsilon) {\n return false;\n }\n }\n return true;\n}", "function is_retina_device() {\n return window.devicePixelRatio > 1;\n}", "function isPixelEqual(p1, p2) {\n return p1.r ===...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
check which player is active:
function whoIsActive() { if (player1Active) { activePlayer = 2; notActivePlayer = 1; setActivePlayer(player2, player1, damage2); setActiveBoard(notActivePlayer, activePlayer); } else { activePlayer = 1; notActivePlayer = 2; setActivePlayer(player1, player...
[ "function is_playing() {\n return player.getPlayerState() == 1;\n}", "playerWins(){ // i2 - put inline\n\t\tif (this.player === activePlayer && playing === false) {\n\t\t\treturn true;\n\t\t}\t}", "function isInGame(player)\n\t{\n\t\treturn ((player == boardgameserver.p1) || (player == boardgameserver.p2));\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Generates a set of glob patterns based off the source root of the app and its dependencies
function createGlobPatternsForDependencies(dirPath, fileGlobPattern) { const filenameRelativeToWorkspaceRoot = path_1.relative(app_root_1.appRootPath, dirPath); const projectGraph = project_graph_1.readCachedProjectGraph('4.0'); // find the project let projectName; try { projectName = projec...
[ "function match(pattern) {\n var paths = glob.sync(pattern, { cwd: ASSETS_ROOT });\n\n if (paths.length === 0) {\n console.warn('Asset pattern ' + pattern + ' did not match any files');\n }\n\n // @NOTE: we have to explicitly make them relative to conform with commonJs\n // require syntax, otherwise ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Start face detection and return the detected areas
function detectFaces(){ // Start the clock var elapsed_time = (new Date()).getTime(); // use the face detection library to find the face var comp = ccv.detect_objects({ "canvas" : (ccv.pre(c)), "cascade" : cascade, "interval" : 5, ...
[ "async detect() {\n this.counter.innerHTML = (config.countdown / 1000) - Math.floor((Date.now() - this.startTime) / 1000);\n this.loop = requestAnimationFrame(this.detect.bind(this));\n let detections = await faceapi.detectAllFaces(this.videoEl);\n detections = faceapi.resizeResults(dete...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
During execution of guarded functions we will capture the first error which we will rethrow to be handled by the top level error handler.
function rethrowCaughtError(){if(hasRethrowError){var error=rethrowError;hasRethrowError=false;rethrowError=null;throw error;}}
[ "handleExecutorError (error) {\n const priv = privs.get(this)\n if (priv.state === State.Done) return\n priv.state = State.Errored\n priv.error = error\n privm.wrapup.call(this)\n }", "function error(err) {\n if (error.err) return;\n callback(error.err = err);\n }", "function accessErrorT...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Insert new `tStyleValue` at `TData` and link existing style bindings such that we maintain linked list of styles and compute the duplicate flag. Note: this function is executed during `firstUpdatePass` only to populate the `TView.data`. The function works by keeping track of `tStylingRange` which contains two pointers ...
function insertTStylingBinding(tData, tNode, tStylingKeyWithStatic, index, isHostBinding, isClassBinding) { ngDevMode && assertFirstUpdatePass(getTView()); let tBindings = isClassBinding ? tNode.classBindings : tNode.styleBindings; let tmplHead = getTStylingRangePrev(tBindings); let tmplTail = getTStyli...
[ "function normalizeStyleData(data) {\n var style = normalizeStyleBinding(data.style);\n // static style is pre-processed into an object during compilation\n // and is always a fresh object, so it's safe to merge into it\n return data.staticStyle ? extend(data.staticStyle, style) : style;\n }", ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
2 Function login Create a function named `login` which will take a parameter: `password`.
function login(password){ if (password === "test1234"){ return "Login Success!"; } }
[ "function login (password) {\n if (password === \"test1234\") {\n return \"Login Success!\";\n }\n}", "login(username, password) {\r\n return this._call(\"post\", \"login\", { username, password });\r\n }", "function doLogin(username, password){\n\thideOrShow(\"register\", false);\n\n\tif(!username || ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
The main initialization function. The following operations are made: 1. CSS Styles appended to html body 2. sets initial csrf token value (POST_TOKEN), and sets up a global AJAX handler to detect when it changes 3. an anonymous interval function is defined which will do the following: 3a. Checks if we are on an exporta...
function init() { //inject styles $('body').append("<style>\ .cb_export {float: left;}\ #import_export {height: 54px; width: 48%; font: 11px monospace; background-color: #F9F9F9;}\ #import_export_messages {height: 54px; width: 48%; font: 11px monospace; backgr...
[ "setup() {\n // Remove no js class to hide alternative method\n toggleClass(this.elements.content, RECALLS_ACCORDION_CONSTANTS.classNames.contentNoJs, false);\n // Add the ajax endpoint to the state\n this.state.ajaxEndpoint = this.recallsAccordionSectionElement.getAttribute(RECALLS_ACCORDION_CONSTANTS....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Esta funcion tiene el objetivo de mostrar un boton, ocultar otro y eliminar las sustancias correspondientes cuando se pulsa el boton apropiado
function funcionSustanciaBotones(nombrePlaga){ $('#'+nombrePlaga+'boton').show(); $('#'+nombrePlaga+'boton2').hide(); $('#listaSustancias'+nombrePlaga).remove(); }
[ "function funcionProductoBotones(nombreSustancia){\n\t\t$('#'+nombreSustancia+'boton').show();\n\t\t$('#'+nombreSustancia+'boton2').hide();\n\t\t$('#listaProductos'+nombreSustancia).remove();\n\t}", "function botonesNav(boton) {\n boton.onclick = function() {\n botonesNavId.forEach(elemento => elemento....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Create the CPU instance
generateCPU() { return { /** 16 bit counter to iterate through the memory array */ programCounter: 512, /** array representing the register which is 8bit data register and 16 bloc of 8bit long */ register: new Uint8Array(16), /** 16 bit counter to iterate through the Memory array (call...
[ "function Cpu(kernel, number) {\n if (kernel === undefined || number === undefined)\n throw new Error('Missing arguments');\n this.kernel = kernel;\n this.cpuNumber = number;\n this.slices = [];\n this.counters = {};\n this.bounds_ = new tr.b.Range();\n this.samples_ = undefined; // Set du...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Handle FileStation API errors
error(code, api){ // Favorite API specific errors if (api === 'SYNO.FileStation.Favorite') { switch (code) { case 800: return 'A folder path of favorite folder is already added to user\'s favorites.'; break; case 801: return 'A name of favo...
[ "error() {\n const isAbsolute = this.options.fail.indexOf('://') > -1;\n const url = isAbsolute ? this.options.fail : this.options.url + this.options.fail;\n\n this.request(url);\n }", "function defaultDataError(error) {\n// console.log(error+\" error \"+JSON.stringify(error))\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function to stringify description of daily activity to save to JSON Array & local storage (DO NOT USE Session Storage)
function descSave() { localStorage.setItem("dailyDesc", JSON.stringify(dailyDesc)); }
[ "function stored() {\n var storedDay = JSON.parse(localStorage.getItem(\"dailyDesc\"));\n\n if (storedDay) {\n dailyDesc = storedDay;\n }\n\n descSave();\n dispDesc();\n}", "function addActivityLocalStorage(activity) {\n let activities;\n activities = getActivitiesLocalStorage();\n\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get the real plugin path
getPluginPath(plugin) { if (plugin.path) { return plugin.path; } const name = plugin.package || plugin.name; const lookupDirs = []; // 尝试在以下目录找到匹配的插件 // -> {APP_PATH}/node_modules // -> {EGG_PATH}/node_modules // -> $CWD/node_modules lookupDirs.push(path.join(this.op...
[ "function resolvePlugin(name, options) {\n var settings = options || {};\n var prefix = settings.prefix;\n var cwd = settings.cwd;\n var filePath;\n var sources;\n var length;\n var index;\n var plugin;\n\n if (cwd && typeof cwd === 'object') {\n sources = cwd.concat();\n } else {\n sources = [cwd |...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Find the sine of an angle (degrees).
function sin (angle) { return Math.sin(rad(angle)); }
[ "function sine(theta) {\n return Math.sin(theta*(Math.PI / 180));\n}", "function countSinus(x) {\r\n return Math.sin(x)\r\n}", "function SIN(value) {\n\n if (!ISNUMBER(value)) {\n return error$2.value;\n }\n\n return Math.sin(value);\n}", "function theta_oh(o,h) {\n console.log((Math.asin(o/h))*180...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
transition Extras expand borders
function borderExpand(){ $('.completionBorder').animate({ left: '-10px', right: '-10px', top: '-10px', bottom: '-10px' }); }
[ "function expandMoMenu() {\n $(\".headBot\").css({\"overflow\": \"visible\"}); \n $(\".expandMenu\").addClass(\"switchButtonIconOther\");\n $(\".menu\").addClass(\"mobileMenu\");\n mobileMenuState = true;\n }", "function expandedShape(){\n if(Object.keys(currentSelection).l...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
circular constructs have an end bar on the outer most construct
endBarFactory() { if (this.constructViewer.isCircularConstruct() && this.rootLayout) { if (!this.endBar) { this.endBar = new Node2D(Object.assign({ sg: this.sceneGraph, }, kT.verticalAppearance)); this.sceneGraph.root.appendChild(this.endBar); } this.endBar.set({ ...
[ "getCircularEndNode() {\n if (this.constructViewer.isCircularConstruct()) {\n return this.parts2nodes[Layout.backboneEndCapId];\n }\n return null;\n }", "get CircleEdge() {}", "function makeCurlyBrace(x1,y1,x2,y2,w,q)\n\t\t{\n\t\t\t//Calculate unit vector\n\t\t\tvar dx = x1-x2;\n\t\t\tvar dy = y1...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
function para redirecionar para a pagina da lista de podcast
function navigationToListPodcast() { navigation.navigate('ListPodcast'); }
[ "function loadPlayList(entries){\n\tupdateControls(entries.length);\n\tfillVideoList(entries, \"#playlist-list\", function(event) {\n\t\tvar data = $.toJSON(event.data.video);\n\t\tvar playBtn = {\n\t\t\tclick: function () {\n\t\t\t\tvar url = server + \"/control/play\";\n\t\t\t\t$.post(url, data, loadPlayList, \"j...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Heuristic to avoid computing camel case matcher for words that don't look like camel case patterns.
function isCamelCasePattern(word) { var upper = 0, lower = 0, code = 0, whitespace = 0; for (var i = 0; i < word.length; i++) { code = word.charCodeAt(i); if (isUpper(code)) { upper++; } if (isLower(code)) { lower++; } if (isWhitespace(code...
[ "function ignoreCaseComparator(s1, s2) {\n var s1lower = s1.toLowerCase();\n var s2lower = s2.toLowerCase();\n return s1lower > s2lower? 1 : (s1lower < s2lower? -1 : 0);\n}", "match(word) {\n if (this.pattern.length == 0) return [-100 /* NotFull */]\n if (word.length < this.pattern.length) return...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function: goToBranch Jumps to the correct branch and sets the branch to visited Parameters: branchInfo Object, with properties id, trigger, and isComplete Dependencies: , Returns: none Change Log: 2013.01.25ALP Initial version
function goToBranch(branchInfo) { loadPage(branchInfo.id); setBranchComplete(branchInfo); return false; }
[ "function launchBranchJourney() {\n var linkData = {\n campaign: \"campaign cannot be changed\",\n feature: \"feature cannot be changed\",\n channel: \"channel was changed by javascript\",\n stage: \"stage was changed by javascript\",\n tags: [\"tag was changed by javascript\"],\n data: {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function to retrieve project name using project id
function getProjectbyId(project_id){ }
[ "function getProjectbyID() {\n vm.showProjectLoading = true;\n projectsSvc.getProjectByOrgID().then(function(response) {\n vm.projectDetailsObj.savedProjects = [];\n vm.projectDetailsObj.savedProjects = response.data;\n // if ($scope.projectId) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Init an instance element.
function initInstanceElement(el) { const visible = $(el).data('visible'); $(el).addClass('instance') .toggleClass('invisible-instance', visible !== true && visible !== 'true') .on('click', function(e) { e.stopPropagation(); selectInstance(this); }) .on('blur', function(e) { }) ...
[ "init() {\n this._createShadowRoot()\n this._attachStyles()\n this._createElements()\n }", "init() {\n this.#elemetn = this.getElement(this.UiSelectors.timer);\n }", "init () {\n this._initSelectors()\n this._initElements()\n this._initProperties()\n this._initAtt...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Language: Oracle Rules Language
function ruleslanguage(hljs) { return { name: 'Oracle Rules Language', keywords: { keyword: 'BILL_PERIOD BILL_START BILL_STOP RS_EFFECTIVE_START RS_EFFECTIVE_STOP RS_JURIS_CODE RS_OPCO_CODE ' + 'INTDADDATTRIBUTE|5 INTDADDVMSG|5 INTDBLOCKOP|5 INTDBLOCKOPNA|5 INTDCLOSE|5 INTDCOUNT|5 ' + ...
[ "function buildRules( languageNode )\n{\n\tvar contextList, contextNode, sRegExp, rootNode;\t\n\tvar rulePropList, rulePropNode, rulePropNodeAttributes, ruleList, ruleNode;\n\n\trootNode = languageNode.selectSingleNode(\"/*\");\n\t\n\t// first building keyword regexp\n\tbuildKeywordRegExp( languageNode );\t\n\t\n\t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Determine whether the given properties match those of a `CfnServiceLinkedRoleProps`
function CfnServiceLinkedRolePropsValidator(properties) { if (!cdk.canInspect(properties)) { return cdk.VALIDATION_SUCCESS; } const errors = new cdk.ValidationResults(); errors.collect(cdk.propertyValidator('awsServiceName', cdk.requiredValidator)(properties.awsServiceName)); errors.collect(...
[ "function checkRoles(roles){\n var possibleRoles = [\"service provider\", \"device owner\", \"infrastructure operator\", \"administrator\", \"system integrator\", \"devOps\", \"user\", \"superUser\"];\n for(var i = 0, l = roles.length; i < l; i++){\n if(possibleRoles.indexOf(roles[i]) === -1){\n return {...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Remove links that match filterExpression
function filterLinks() { var links = div.getElementsByTagName('a'); for (i = links.length - 1; i >= 0; i--) { if (links[i].href.match(filterExpression)) { links[i].parentNode.removeChild(links[i]); } } }
[ "function filterLinks() {\n var filterRadio = get_current_filter_radio();\n var filterValue = get_current_filter_value();\n\n if (document.getElementById('regex').checked || filterRadio.id != 'custom_filter') {\n visibleLinks = allLinks.filter(function(link) {\n return link.match(filterValue);\n });\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
FIND searches for text within a string
function FIND(find_text) { var within_text = arguments.length <= 1 || arguments[1] === undefined ? '' : arguments[1]; var position = arguments.length <= 2 || arguments[2] === undefined ? 1 : arguments[2]; // Find the position of the text position = within_text.indexOf(find_text, position - 1); // If found ...
[ "function SEARCH(find_text, within_text, position) {\n if (!within_text) {\n return null;\n }\n position = typeof position === 'undefined' ? 1 : position;\n\n // The SEARCH function translated the find_text into a regex.\n var find_exp = find_text.replace(/([^~])\\?/g, '$1.') // convert ? into .\n .replace...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
takes average of 3 numbers
function avg(num1, num2, num3){ return (num1 + num2 + num3)/3; }
[ "function avg(num1, num2, num3){\n return (num1 + num2 + num3)/3;\n}", "function avg(v){\n s = 0.0;\n for(var i=0; i<v.length; i++)\n s += v[i];\n return s/v.length;\n}", "function averages(numbers){\n let avgNums = [];\n if(!numbers) return avgNums;\n for(let i = 1; i < numbers.length; i++){\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
errorManager Called only if there are answered domains on ajax request complete. The function requests the domains once again and then if still there is no answer marks them with no connection error.
function errorManager(){ if(fundamental_vars.retry == true){ //Collect the domains still pending data. Collect all the domains bypassing what the cache says. fundamental_vars.bypass_cache_check = true; createRequests($('.tld-line.asked:has(.spinner)')); fundamental_vars.bypass_cache...
[ "function handleXhrError(response, ioArgs) {\n if(response instanceof Error){\n if(_ldc) _ldc.hide();\n if(response.dojoType == \"cancel\"){\n //The request was canceled by some other JavaScript code.\n console.debug(\"Request canceled.\");\n }else if(response.dojoType == \"timeout\"){\n //...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Visit a parse tree produced by PlSqlParsertemporary_tablespace_clause.
visitTemporary_tablespace_clause(ctx) { return this.visitChildren(ctx); }
[ "visitPermanent_tablespace_clause(ctx) {\n\t return this.visitChildren(ctx);\n\t}", "visitUser_tablespace_clause(ctx) {\n\t return this.visitChildren(ctx);\n\t}", "visitTablespace(ctx) {\n\t return this.visitChildren(ctx);\n\t}", "visitCreate_tablespace(ctx) {\n\t return this.visitChildren(ctx);\n\t}", ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Draw hangman on canvas by wrong guesses by player hierarchy: 0: gallows 1:"head", 2:"body", 3:"legL", 4:"legR", 5:"armL", 6:"armR", 7:"eyeL", 8:"eyeR", 9:"ohno"
function drawHangman(part=""){ //clear screen ctx.clearRect(0, 0, canvas.width, canvas.height); // fill background ctx.fillStyle = "orange"; ctx.fillRect(0, 0, canvas.width, canvas.height); // gallows ctx.beginPath(); ctx.moveTo(5, canvas.height*0.9); ctx.lineTo(canvas.width-5, canv...
[ "function buildHangMan(strikes) {\n if (strikes > 0){\n console.log (\" 0 \");\n if (strikes == 2){\n console.log (\" | \");\n }\n if (strikes == 3){\n console.log (\" (| \");\n }\n if (strikes >= 4){\n console.log (\" (|) \");\n if (strikes == 5){\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
new answer object constructor
function newAnswer(username, answer) { this.username = username; this.answer = answer; }
[ "function initAnswer()\n\t{\n\t\tif (!layout.ansInput)\n\t\t\treturn;\n\n\t\tdrawList.setParam('answerInput', 'type', layout.qType);\n\n\t\tif (layout.qType === 'multi')\n\t\t\tdrawList.setParam('answerInput', 'text', problem.get('a'));\n\t\telse if (layout.qType === 'radio' || layout.qType === 'check')\n\t\t\tdraw...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Find the smallest standard bin size that, when we break up the time period we're given, will result in under MAX_QUERY_RESULTS bins Inputs delta time in miliseconds, returns standard bin size in seconds
function getBins(dt){ // winston.info(dt); if(dt/1000.0 <= MAX_QUERY_RESULTS) return null; var standardBinSizes = bins.stdBinSizes(); // in seconds var smallestBinSize = standardBinSizes[standardBinSizes.length-1]; for(var i = 0; i < standardBinSizes.length; i++){ var numBins = (dt/1000)/standardBinSizes[i]; ...
[ "function getBucketQuantity(startTime, stopTime) {\n return timeToBucket(stopTime) - timeToBucket(startTime);\n}", "function timeToSize(time, timescale, tickSize)\n{\n return ((time * tickSize) / 1000) / timescale;\n}", "function last_chunk_size(lastreq) {\n let tot = 0;\n for (let tt = 0; tt ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
ClosestDistance2DFunction A convienence function to find the closest distance between two 2 dimentional lines
function closestDistance2D( line1, line2 ) { var a0 = [ line1.startX, line1.startY, 0 ], a1 = [ line1.endX, line1.endY, 0 ], b0 = [ line2.startX, line2.startY, 0 ], b1 = [ line2.endX, line2.endY, 0 ]; var result = closestDistanceBetweenLines(a0, a1, b0, b1, true); return { ...
[ "function closestDistance3D( line1, line2 ) { \n //console.log('\\n');\n //console.log( line1, line2 ); \n var a0 = [ line1.startX, line1.startY, line1.startZ ],\n a1 = [ line1.endX, line1.endY, line1.endZ ],\n b0 = [ line2.startX, line2.startY, line2.startZ ],\n b1 = [ line2.endX, lin...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Transfer "NoEther" ether form "FromAddress" to "ToAddress" .
function EtherTransfer(res,ToAddress,NoEther,FromAddress,PrivateKey){ var count = web3.eth.getTransactionCount(FromAddress); var gasPrice = web3.eth.gasPrice; var gasLimit = 21000; var rawTransaction = { "from": FromAddress, "nonce": web3.toHex(count), "gasPrice": web3.toHex(ga...
[ "transferEther(amount, receiverAddress, senderPrivateKey) {\n const senderAddress = `0x${this.getAddressFromPrivateKey(senderPrivateKey).toString('hex')}`\n return this.getNonce(senderAddress).then(nonce => {\n const transaction = {\n from: senderAddress,\n to:...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Once the service worker is registered set the initial state
function initialiseState() { // Are Notifications supported in the service worker? if (!('showNotification' in ServiceWorkerRegistration.prototype)) { console.warn('Notifications aren\'t supported.'); return _alt2['default'].bootstrap(JSON.stringify({ NotificationStore: { enabled:...
[ "function initServiceWorker() {\n if ('serviceWorker' in navigator) {\n navigator.serviceWorker\n .register('../service-worker.js')\n .then(function() { console.log('ServiceWorker Registered');\n }, function(err) {\n console.log('ServiceWorker registration f...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates a test which verifies if |webview| can correctly set |cookieToSet| as a cookie value for |url|.
function createTestToVerifyWebviewSetCookie(webview, url, cookieToSet) { return new Testing.Test(webview.id + ' setting cookie ' + JSON.stringify(cookieToSet) + ' for ' + url, function(resultCallBack) { navigateWebviewAndSetCookie(webview, url, cookieToSet, function() { navigateWebviewAndGetCo...
[ "function createTestToVerifyCookie(webview, url, expectedCookies) {\n return new Testing.Test(\n 'check ' + webview.id + ' has cookies ' + JSON.stringify(expectedCookies),\n function (resultCallBack) {\n navigateWebviewAndGetCookies(webview, url, function(cookies) {\n resultCallBack(isEqu...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Create the chain and enroll users as deployer, assigner, and nonAssigner (who doesn't have privilege to assign.
function setup(cb) { console.log("initializing ..."); var chain = hlc.newChain("testChain"); chain.setKeyValStore(hlc.newFileKeyValStore("/tmp/keyValStore")); chain.setMemberServicesUrl("grpc://localhost:50051"); chain.addPeer("grpc://localhost:30303"); console.log("enrolling deployer ..."); chain....
[ "function deploy(cb) {\n console.log(\"deploying with the role name 'assigner' in metadata ...\");\n var req = {\n fcn: \"init\",\n args: [],\n metadata: \"assigner\"\n };\n if (networkMode) {\n req.chaincodePath = \"github.com/asset_management_with_roles/\";\n } else {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Visit a parse tree produced by PlSqlParsertrigger_name.
visitTrigger_name(ctx) { return this.visitChildren(ctx); }
[ "visitSimple_dml_trigger(ctx) {\n\t return this.visitChildren(ctx);\n\t}", "visitTrigger_block(ctx) {\n\t return this.visitChildren(ctx);\n\t}", "visitTrigger_body(ctx) {\n\t return this.visitChildren(ctx);\n\t}", "visitDrop_trigger(ctx) {\n\t return this.visitChildren(ctx);\n\t}", "visitNon_dml_trigger...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Override mountableMixin::_resizeCallback / because resizePreserveCenter is usually the / expected behaviour
_resizeCallback () { this.resizePreserveCenter() }
[ "_handleResize(e) {\n this.resizeToolbar();\n }", "triggerResize(recenter = true) {\n // Note: When we would trigger the resize event and show the map in the same turn (which is a\n // common case for triggering a resize event), then the resize event would not\n // work (to show the m...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
If a workflow version is checked out by the current user, return it. Otherwise return the published version of the workflow.
function versionFileForRecord(record) { var sysId = record.getUniqueValue(); var gr = new GlideRecord('wf_workflow_version'); gr.addQuery('workflow', sysId); gr.addQuery('checked_out_by', gs.getUserID()) .addOrCondition('published', 'true'); gr.orderByDesc('checked_out_by'); gr.orderByDesc('updated_at'...
[ "workflowVersion(v) {\n return this.version(v);\n }", "local() {\n if (this.sources.local !== undefined) {\n return this.satisfying(\"=\" + this.sources.local.version);\n } else {\n return this.newest();\n }\n }", "async function getLatestRevision() {\n const...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get list of threats
function getAllThreats() { baseRequest.get("threats", function(err, res, body){ if (err) { console.log(err); } else if (!err && res.statusCode == 200) { let info = JSON.parse(body); let data = info.data; data.forEach(t => { let disp = n...
[ "list(req, res) {\n return Chat.findAll({\n where: {\n incidentId: req.params.id\n },\n include: userAttributes\n })\n .then(chat => {\n return res\n .status(200)\n .send({ data: { chats: chat }, status: 'success' });\n })\n .catch(error => {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
The game speeds up based on score The GSAP timeScale() function is called on the timeline to speed up the game This calculates how much shall the game speed up
speedUp() { if(this.score > 30) { return 1.8; } if(this.score > 20) { return 1.7; } if(this.score > 15) { return 1.5; } else if(this.score > 12) { return 1.4; } else if(this.score > 10) { ...
[ "function updateScore() {\n\t\t\t// Score rule: pass level n in t seconds get ((100 * n) + (180 - t)) points \n\tlevelScore = (levelTime + 100) + Math.floor(levelTime * (currentLevel-1));\n\t// Set original \"levelScore\" to extraLevelScore for testing purpose\n\tfinalScore += levelScore + extraLevelScore;\t\t\n\t/...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
FUNCTION NAME : enableSanXML AUTHOR : James Turingan DATE : January 7, 2014 MODIFIED BY : REVISION DATE : REVISION : DESCRIPTION : PARAMETERS :
function enableSanXML(uptable,lowtable){ var enableStat=''; var enableSanityStat=''; var devFlag = false; if(globalInfoType == "XML"){ for(var i = 0; i < uptable.length; i++){ enableStat+="<tr>"; enableStat+="<td>"+uptable[i].getAttribute('HostName')+"</td>"; enableStat+="<td>"+uptable[i].getAttribute('M...
[ "function devSanXML(uptable,lowtable){\n\tvar devStat='';\n\tvar devSanityStat='';\n\tvar devFlag = false;\n\tif(globalInfoType == \"XML\"){\n\t\tfor(var i = 0; i < uptable.length; i++){\n\t\t\tdevStat+=\"<tr>\";\n\t\t\tdevStat+=\"<td>\"+uptable[i].getAttribute('HostName')+\"</td>\";\n\t\t\tdevStat+=\"<td>\"+uptabl...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Executes a MySQL query to fetch information about a single specified artist based on its ID. Does not fetch photo and review data for the artist. Returns a Promise that resolves to an object containing information about the requested artist. If no artist with the specified ID exists, the returned Promise will resolve t...
async function getArtistById(id) { const [ results ] = await mysqlPool.query( 'SELECT * FROM artist WHERE id = ?', [ id ] ); return results[0]; }
[ "async function getArtistDetailsById(id) {\n\n const artist = await getArtistById(id);\n return artist;\n}", "async function getArtistsByOwnerId(id) {\n const [ results ] = await mysqlPool.query(\n 'SELECT * FROM artist WHERE ownerid = ?',\n [ id ]\n );\n return results;\n}", "async function getArtis...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function that load all admin options. It is the one the compose screen's body will call. no inputs returns N/A
function loadAdminOptions() { loadAdminToOptions(); loadAdminFromOptions(); loadAdminCcOptions(); }
[ "function initAdmin() {\n\tinitAgenciesAndPrograms();\n\tinitAdminAgencyDropdown();\n\tinitAdminProgramDropdown();\n\talert('You have selected the \"Administrator\" option. Use this option only to add, delete, or edit programs or agencies and their descriptions.');\n}", "function managerOptions() {\n // prompt...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
returns with the group of planets tha group type is depends on tha match value (true = same, false = different planets allowed)
function find_group(x, y, match) { var planet = map.planets[x][y]; working_array = [planet]; planet.checked = true; var temp_group = []; while(working_array.length > 0) { var current_planet = working_array.pop(); // skip the empty places if(...
[ "function find_floating_group() {\n var inner_groups = [];\n\n // check every planet in the map\n for (var j = 0; j < map.rows; j++) {\n for (var i = 0; i < map.columns; i++) {\n var planet = map.planets[i][j];\n if(planet.type != -1 && !planet.checked) ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Every adapter has errors array and L10n property for localizing messages
constructor () { this.errors = [] this.l10n = new L10n() .addMessages(enUS, Locales.en_US) .addMessages(enGB, Locales.en_GB) .setLocale(Locales.en_US) }
[ "function setGeneralValidationMessages() {\n if (field.hasAttribute('minlength')) {\n validationMessages.tooShort = `Minimaal ${field.getAttribute('minlength')} karakters.`;\n }\n if (field.hasAttribute('maxlength')) {\n validationMessages.tooLong = `Ma...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
cancel an existing image being loaded
_cancelLoadImage(){ if(this.image){ this.image.onload = null; this.image.onerror = null; this.image = null; } }
[ "function cancelUploadedImg() {\n // Close Upload Box\n $(\"#uploadImgContainer\").removeClass('open-upload');\n\n $(\"#uploadImgContainer\").parent('.popup-container').removeClass('show');\n\n // Reset the Default Preview Image\n $('#uploadingPreview').attr('src', $('#uploadingPreview').attr('data-d...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns the tag value associated with specified key.
getTag(key) { return __awaiter(this, void 0, void 0, function* () { return this.workspace.getTag(this.name, key); }); }
[ "kv(key: string) {\n const desc = this.kvDesc(key);\n if (!desc) return null;\n\n return desc.value;\n }", "function getValue(json, key){\n for(var i = 0; i < json.length; i++){\n if (json[i]['key'] == key){\n return json[i]['value'];\n }\n }\n return null;\n}", "get(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns picture to show from `pictures` list based on current `idx`. Returns null if item is not available at `idx`.
_currentPicture() { return this.props.pictures.get(this.state.idx, null); }
[ "function loadNextImage() {\n let next = games.splice(0, 1)[0];\n\n document.getElementById(\"background\").src = next.img;\n document.getElementById(\"jakob\").getElementsByTagName(\"span\")[0].innerText = next.name;\n}", "_getListState(pictures) {\n const isList = List.isList(pictures);\n\n const...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
preyScore() Shows the score of prey being eaten
function preyScore(){ textFont(myFont); textSize(40); textAlign(CENTER, CENTER); text(preyEaten, width/2, height/2); // Strings of if // // Whenever the prey gets eaten, it gets smaller and faster if (preyEaten === 1){ preyRadius = 20; preyMaxSpeed = 5; } if(preyEaten === 3){ preyRadius = 15...
[ "function displayScore() {\n // Make the score disappear when a game over happens\n if (state === \"GAMEOVER\") {\n return;\n }\n push();\n // Setting the aesthetics\n fill(255);\n textFont(neoFont);\n textSize(64);\n // Show the score at the bottom left of the screen\n textAlign(LEFT, BOTTOM);\n text...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Add a random set of 'numToAdd' elements from 'fullSequence' to 'subSequence' where 'subSequence' should be a subsequence of 'fullSequence'. returns object with two array: the new subsequence and the set of elements added.
function extendSubSequence(subSequence, fullSequence, numToAdd) { // extract the positions in the full sequence which are not in the // sub-sequence (elements in the full and sub-sequence are in the same // order). var subPos = 0; var fullPos = 0; var fullLength = fullSequence.length; ...
[ "function createSubSequence(sequence, numToRemove)\r\n{\r\n if(numToRemove >= sequence.length)\r\n return { newSequence: [], removed: [].concat(sequence) };\r\n\r\n var subSequence = [].concat(sequence);\r\n var removed = [];\r\n \r\n for(var i = 0 ; i < numToRemove ; ++i) {\r\n var j =...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Construct the fragment equivalent of a root node.
function buildFragmentForRoot(root: Root): Fragment { return { argumentDefinitions: (root.argumentDefinitions: $FlowIssue), directives: root.directives, kind: 'Fragment', metadata: null, name: root.name, selections: root.selections, type: root.type, }; }
[ "fragment(root, range) {\n if (Text.isText(root)) {\n throw new Error(\"Cannot get a fragment starting from a root text node: \".concat(JSON.stringify(root)));\n }\n\n var newRoot = fn$4({\n children: root.children\n }, r => {\n var [start, end] = Range.edges(range);\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
filterDuplicateQueryParams NOTE: this only works if we dont pass an array as a query param intentionally
function filterDuplicateQueryParams(req, res, next) { for (var key in req.query) { if (Array.isArray(req.query[key])) { req.query[key] = req.query[key][0]; } } next(); }
[ "initializeFilterValuesFromQueryString() {\n this.clearAllFilters()\n\n if (this.encodedFilters) {\n this.currentFilters = Object.keys(this.encodedFilters).map(\n key => ({ name: key, value: this.encodedFilters[key] })\n )\n\n thi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
D3.js projection from GeoJSON bounds
function getProjection(geojson, width, height, projection) { // From: // http://stackoverflow.com/questions/14492284/center-a-map-in-d3-given-a-geojson-object?answertab=active#tab-top // We are using Turf to compute centroid (turf.centroid) and bounds (turf.envelope) because // D3's geo.centroid and path.boun...
[ "function getProjection(geojson, width, height) {\n // From:\n // http://stackoverflow.com/questions/14492284/center-a-map-in-d3-given-a-geojson-object?answertab=active#tab-top\n // We are using Turf to compute centroid (turf.centroid) and bounds (turf.envelope) because\n // D3's geo.centroid and path.bounds ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
listen for submission of the search form, grab the user input, update the filter and render the shopping list
function handleSearch () { $('#js-search').on('submit', function (event){ event.preventDefault(); let usrInput = $(this).find('.js-search-query').val(); setFilter(usrInput); renderShoppingList(); }); }
[ "function renderShoppingList() {\n //check for filters\n let currentFilter = STORE.filter;\n STORE.filteredItems = [...STORE.items];\n\n //check if on nocheckeditems\n if (currentFilter === 'noCheckedItems'){\n STORE.filteredItems=STORE.items.filter((item)=> item.checked === false);\n }\n\n //check if sea...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
when submit form B (on/off)
function submitFormB(){ var runVal = runValue.value; if(runVal == 0){ runAngles.innerHTML = "On"; runValue.value = 1; } else { runAngles.innerHTML = "Off"; runValue.value = 0; } // stor in the database the angles $.post(link + "back-end/runAngles.php", {run: runV...
[ "_submitState() {\n let objFields = Object.values(Object.values(this.testObj));\n let stateArr = objFields.map(f => f.state); // Creates array from test object with state boolean values.\n // Checks if the test array includes false, and changes the submit button according to this result.\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
show current menu when user is logged in
function showLoggedInMenu(){ $('#signup, #login').hide(); $('#logout').show(); }
[ "function userLoggedIn() {\n let username = sessionStorage.getItem('username');\n $('#spanMenuLoggedInUser').text(`Welcome, ` + username + '!');\n $('#viewUserHomeHeading').text(`Welcome, ` + username + '!');\n $('.anonymous').hide();\n $('.useronly').show();\n showView('Us...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Matches a given word (completion) against the pattern (input). Will return null for no match, and otherwise an array that starts with the match score, followed by any number of `from, to` pairs indicating the matched parts of `word`. The score is a number that is more negative the worse the match is. See `Penalty` abov...
match(word) { if (this.pattern.length == 0) return [-100 /* NotFull */] if (word.length < this.pattern.length) return null let { chars, folded, any, precise, byWord } = this // For single-character queries, only match when they occur right // at the start if (chars.length...
[ "match(word) {\n if (this.pattern.length == 0)\n return [0];\n if (word.length < this.pattern.length)\n return null;\n let { chars, folded, any, precise, byWord } = this;\n // For single-character queries, only match when they occur right\n // at the start\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Test: createQueryFromJson(jsonQuery) Creating query for: TOPK
function testCreateQueryFromJsonTopK() { // Call the function to test var generatedOutput = createQueryFromJson(jsonQueryTopK); var expectedOutput = 'Find the top-7 Rep with maximum Total where Units is Greater than 50'; // Checking if generated output is same as expected output assertEquals(expectedO...
[ "function testCreateQueryFromJsonTrend() {\n // Call the function to test\n var generatedOutput = createQueryFromJson(jsonQueryTrend);\n var expectedOutput = \n 'Monthly trend of Sum of Units where Item is In Binder, Pencil, Pen' +\n ' from OrderDate 2019-01-06 to 2019-07-12';\n \n // Checking if generat...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
oAA compute the amount of dissolved oAA, in mg, for a specific hop addition
function compute_oAA_dis_mg(ibu, hopIdx, currVolume) { var AAloss_percent = 0.0; var k = 0.0; var oAA_addition = 0.0; var oAA_fresh = 0.0; var oAA_percent_boilFactor = 0.0; var oAA_percent_init = 0.0; var oAA_percent = 0.0; var ratio = 0.0; var relativeAA = 0.0; // The oAA_percent_init is for cones...
[ "function compute_oBA_dis_mg(ibu, hopIdx, currVolume) {\n var oBA_addition = 0.0;\n var oBA_percent = 0.0;\n\n oBA_percent = 1.0 - ibu.add[hopIdx].freshnessFactor.value;\n oBA_addition = oBA_percent * SMPH.oBA_boilFactor *\n (ibu.add[hopIdx].BA.value / 100.0) *\n ibu.add[hopIdx...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
CREATE RANDOM FLOAT BETWEEN MIN AND MAX
function getRandomFloat(min, max) { return min + Math.random() * (max - min); }
[ "function getRandomFloat(min, max) {\r\n return Math.random() * (max - min + 1) + min;\r\n}", "function getRandomFloat(min, max, fix) {\n\treturn ((Math.random() * (max - min)) + min).toFixedNumber(fix)\n}", "function createRandomNumber(min, max, date){\n var rand = new RandomNumberGenerator(date);\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Add the ruler to the scene
showRuler() { if (!this.mRulerEnabled) this.mSceneController.scene.add(this.mRulerLine); this.mRulerEnabled = true; }
[ "draw() {\n ruler.canvas = SVG()\n .addTo('#ruler')\n .size(editor.width, ruler.height)\n .mousemove(e => {\n if (!playback.playing && e.buttons == 1) playback.position = editor.canvas.point(e.x, e.y).x;\n }).mousedown(e => {\n if (!pl...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sends an email verification to the user.
function sendEmailVerification() { // [START sendemailverification] auth.currentUser.sendEmailVerification().then(function() { // Email Verification sent! // [START_EXCLUDE] alert('Email Verification Sent!'); // [END_EXCLUDE] }); // [END sendemailverification] }
[ "checkEmailVerification() {\n \tif (!this.props.authUserData.email_verified) {\n \t\tthis.props.history.push('/verify');\n \t}\n }", "function sendConfirmationToBotschafter(emailObj = {email: \"neven@n2s.ngo\", body: \"Test Message\", subject : \"Test Subject\"}){\n GmailApp.sendEmail(emailObj.email,...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
REMEMBER: Functions go on prototypes, properties go on constructors. The folloing is the CookieStore constructor function. the storeList = [pike, seatac, seattleCenter, capitolHill, alki] 'this' refers to the object being constructed for you it also changes when you use the 'new' reserved word to make a new instance of...
function CookieStore(storeName, minCust, maxCust, avgCookies) { //var this = {}; this.name = storeName; //return this; this.minCust = minCust; this.maxCust = maxCust; this.avgCookies = avgCookies; //below this holds things not in the constructor but used anyway. this.salesPerHour = []; this.total = 0; ...
[ "function ListStore (args) {\n if (!(this instanceof ListStore)) return new ListStore(args)\n Store.call(this, args)\n}", "constructor() {\n this.#cookieLevel = -1;\n this.#functionalCookie = 2;\n this.#thirdPartyCookie = 4;\n this.#globalObserver = null;\n }", "function Cookie(name)\n{\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
position the strip according the touch drag diff
function handleStripDrag(mousePos){ var diff = g_temp.mousePos - mousePos; var distPos = g_temp.innerPos - diff; //make harder to drag the limits var objLimits = g_parent.getInnerStripLimits(); if(distPos > objLimits.maxPos){ var path = distPos - objLimits.maxPos; distPos = objLimits.maxPos + path...
[ "dragged(vm, dx, dy) {\n // left to implementations\n }", "function moveStripToMousePosition(mousePos){\t\t\n\t\t\n\t\tvar innerPos = getInnerPos(mousePos);\n\t\tg_temp.is_strip_moving = true;\n\t\tg_temp.strip_finalPos = innerPos;\n\t\t\t\t\n\t\tstartStripMovingLoop();\n\t}", "setStartPosition() {\n thi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
win() shows YOU WIN
function win() { displayText(`YOU WIN!`); }
[ "function winGame() {\n flashColor();\n counter.innerHTML = \"GZ!\";\n on = false;\n win = true;\n}", "function toggleWin(winner, name, screen)\n{\n const message = screen.querySelector('.message');\n const winnerName = screen.querySelector('.winner');\n //color of the winner's na...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Parses QL into segments of useful information for nav scanning.
function ParseQL() { var config = JSON.parse(PAL.GetValue(CONFIG_STORAGE_STR)); var i; var ql_items = [ config.ql1, config.ql2, config.ql3, config.ql4]; /* Remove spaces from QL which affect exclusion/targeting, and split each QL into sections. */ for (i = 0; i < ql_items.length; i++) {...
[ "function parseInput(){\n\n if(segments.value){ \n clearSelections();\n clearRowAndColSelections();\n \n var segmArr = segments.value.split(\" \");\n parseInputArray(segmArr);\n\n }else{\n formSelPart();\n }\n}", "function parse(lrc)\n{\n str=lrc.split(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
creates an empty "square" board with the provided dimension
buildEmptyBoard(dimension) { for (let i = 0; i < dimension; i++) { this.boardArray.push(new Array(dimension).fill(0)); } }
[ "constructor (size) {\n\n var i,j;\n var board = [];\n\n //Initialize each space to 0\n for (i=0; i<size; i++) {\n\n var row = [];\n\n for (j=0; j<size; j++) {\n row.push(0);\n }\n\n board.push(row);\n }\n\n this.bo...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Become a Menber of the BadGirlGang
function PrisonBecomeBadGirl() { LogAdd("Joined", "BadGirl"); }
[ "function C101_KinbakuClub_RopeGroup_PlayerWhimperLucy() {\n\tif (C101_KinbakuClub_RopeGroup_LucyIsAnnoyed <= 0) {\n\t\tPlayerUngag();\n\t\tActorChangeAttitude( 1, -1)\n\t} else {\n\t\tif (C101_KinbakuClub_RopeGroup_LucyIsAnnoyed >= 2 || ActorGetValue(ActorLove) >= 1) {\n\t\t\tOverridenIntroText = GetText(\"Annoyed...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Construct an agent from an LLM and a list of tools
static fromLLMAndTools(_llm, _tools, // eslint-disable-next-line @typescript-eslint/no-explicit-any _args) { throw new Error("Not implemented"); }
[ "function parseModel (inputModel) {\n var lines = inputModel.split(/\\r?\\n/);\n var ids = lines[0].split(\" \");\n agents = []\n\n // clear movements array\n movements = []\n\n // create the agents\n var index = 0;\n for (var id of ids) {\n var newAgent = new Agent(id);\n new...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
MEXQ_FillDictKeys ========= MEXA_FillDictResults ============= PR20220121
function MEXA_FillDictResults(grade_dict) { //console.log("===== MEXA_FillDictResults ====="); //console.log("grade_dict", grade_dict); if(grade_dict && grade_dict.ce_exam_result){ // format of ce_exam_result_str is: // grade_dict.ce_exam_result = "1;35#2|2;a|3;a|4;a|5...
[ "function MDUO_FillDict() {\n console.log(\"===== MDUO_FillDict =====\");\n\n b_clear_dict(mod_MDUO_dict);\n\n mod_MDUO_dict.duo_subject_dicts = {};\n\n if(!isEmpty(duo_subject_dicts)){\n for (const [mapid, data_dict] of Object.entries(duo_subject_dicts)) {\n mo...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Ember doesn't know when the web component is finished rendering its HTML. As a workaround we wait for the input element to appear in the DOM.
function webComponentRender() { return waitFor('[data-test-au-date-picker-component] input', { timeout: 2000, }); }
[ "function waitForHtmlOutput() {\n // Since we are using `$wait_for_idle(duration = 500)`,\n // no need for the following logic with a fixed time.\n shinytest2.ready = true;\n return;\n\n // // Old code kept for future reference\n\n // var htmlOutputB...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
List the dedicated.installationTemplate.templatePartitioningSchemes objects [PRODUCTION] [See on api.ovh.com](
PartitioningSchemesAvailableOnThisTemplate(templateName) { let url = `/me/installationTemplate/${templateName}/partitionScheme`; return this.client.request('GET', url); }
[ "function getPricingSchemesList() {\n $.get(\"api/pricing\", function(pricingSchemes) {\n console.log(pricingSchemes);\n });\n\n }", "HardwareRAIDsDefinedInThisPartitioningScheme(schemeName, templateName) {\n let url = `/me/installationTemplate/${templateName}/partitionScheme/${...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Exit a parse tree produced by KotlinParserenumEntry.
exitEnumEntry(ctx) { }
[ "exitEnumConstantName(ctx) {\n\t}", "exitUnannPrimitiveType(ctx) {\n\t}", "exitEnumConstantModifier(ctx) {\n\t}", "visitExit_statement(ctx) {\n\t return this.visitChildren(ctx);\n\t}", "exitEnumConstantList(ctx) {\n\t}", "exitParenthesizedType(ctx) {\n\t}", "exitMultiVariableDeclaration(ctx) {\n\t}", ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
resets the table to display just the legend row
function reset_table(table) { table.innerHTML = ""; var legend_row = table.insertRow(0); legend_row.outerHTML = "<tr class='legend'><th>date/month</th><th onclick='top_column(1)'>cases</th><th onclick='top_column(2)'>tests</th><th onclick='top_column(3)'>test capacity</th><t...
[ "function createLegend(legend, chartData, chartOptions, total, rowIndex) {\n\n var totalText = (chartOptions[0].legend[0].totalText) ? chartOptions[0].legend[0].totalText : \"Total : \";\n var legendTitle = (chartOptions[0].legend[0].title) ? chartOptions[0].legend[0].title : \"\";\n var html =...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
confirm before delete user
function confirmDeleteUser(user_id){ var choice = confirm('Do you really want to delete this user?'); if(choice === true) { delete_user(user_id); return true; } return false; }
[ "function DeleteUser(id) {\n\tvar confirmed = confirm(\"Are you sure you want to remove this user?\");\n\t\n\tif (confirmed) {\n\t\t// We could make an AJAX call here. That goes a little beyond what is expected in CIT 336.\n\t\t// Instead, let's redirect them through some other actions.\n\t\twindow.location = '/?ac...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
return (a^b) mod m
function pow_mod( a, b, m) { let r, aa; r = 1; aa = a; while (1) { if (b & 1) { r = mul_mod(r, aa, m); } b = b >> 1; if (b == 0) { break; } aa = mul_mod(aa, aa, m); } return r; }
[ "function pow_mod(a, b, m)\n{\n var r, aa;\n\n r = 1;\n aa = a;\n while (1) {\n if (b & 1) {\n r = mul_mod(r, aa, m);\n }\n b = b >> 1;\n if (b === 0) {\n break;\n }\n aa = mul_mod(aa, aa, m);\n }\n return ~~r;\n}", "function bnModPowInt( e, m ) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Adds multiple new types.
addTypes(types) { for (const [key, value] of Object.entries(types)) { this.addType(key, value); } return this; }
[ "function addType() {\n\t\tvar args = extract(\n\t\t\t{ name: 'name', test: function(o) { return typeof o === 'string'; } },\n\t\t\t{ name: 'type', parse: function(o) {\n\t\t\t\treturn (o instanceof Type) ? o : new Type(this.name || o.name, o);\n\t\t\t} }\n\t\t).from(arguments);\n\n\t\ttypeList.push(args.type);\n\t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function for checking if a word in an array is inside of a message. message: the message sent by a user keywords: an array of words that are used to call an api
function messageContainsKeyword(message, keywords) { for (var i = 0; i < keywords.length; i++) { if (message.includes(keywords[i])) { return true; } } return false; }
[ "function doesWordExist(wordsArr, word) {\nif(wordsArr.includes(word)){\n return true;\n}else{\n return false;\n}\n}", "checkWord(word){\n this.nonTerminalSymbols.forEach(item => {\n if (word.indexOf(item) !== -1) {\n this.wordExist = true;\n }\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
A stack is a compound data type like an array. The difference between an array and a stack is that in an array you can insert and remove elements in any order you want, but a stack has a rule whereby you can only add new elements at the end and remove the last inserted element. Create a function newStack, that when cal...
function newStack() { let stack = []; return { push: function(value) { stack.push(value); }, pop: function() { stack.pop(); }, printStack: function() { stack.forEach((value) => console.log(value)); }, } }
[ "function SafeStack() {\n\t// Object.create from the prototype is almost like saying \n\t// class A extends B where B is the prototype\n\tconst that = Object.create(SafeStack.prototype);\n\tconst _s = [];\n\n\tthat.push = (value) => {\n\t\t_s.push(value);\n\t};\n\n\tthat.pop = () => {\n\t\tconst removed = _s.pop();...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Resets the animation, which clears the input and output, along with the timer
function reset() { clearInterval(timerId); timeId = null; index = 0; id("output").textContent = ""; id("input-text").value = ""; id("input-text").disabled = false; }
[ "function resetAnimation(){\n animationSteps = [];\n step = 0;\n resetFlowCounter();\n resetTraceback();\n animationSteps.push({\n network: TOP,\n action: \"reveal\",\n pStep: 0\n });\n}", "function stopAnimation() {\n $(\"start\").disabled = false;\n $(\"stop\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Custom type guard for FileType. Returns true if node is instance of FileType. Returns false otherwise. Also returns false for super interfaces of FileType.
function isFileType(node) { return node.kind() == "FileType" && node.RAMLVersion() == "RAML10"; }
[ "is_image() {\n if (\n this.file_type == \"jpg\" ||\n this.file_type == \"png\" ||\n this.file_type == \"gif\"\n ) {\n return true;\n }\n return false;\n }", "function cs_contains_invalid_file_types(files, accepted_file_types){\r\n\t\r\n\tvar uploaded_files = files;\r\n\t\r\n\tvar...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Initializes all comments with listeners
function initComments() { const $comments = $('.comment-item'); $comments.each((ind, comment) => { const $comment = $(comment); initComment($comment); }); }
[ "function init() {\n var elementsArray = getAllElementsFromSelectos(inputAutocompleteSelector);\n //addEventsToElements(elementsArray, \"keydown\", disableChatOnPressReturn);\n\n for (var i = 0; i < elementsArray.length; i++) {\n addEvent(elementsArray...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Note: hydration is DOMspecific But we have to place it in core due to tight coupling with core splitting it out creates a ton of unnecessary complexity. Hydration also depends on some renderer internal logic which needs to be passed in via arguments.
function createHydrationFunctions(rendererInternals) { const { mt: mountComponent, p: patch, o: { patchProp, nextSibling, parentNode, remove, insert, createComment } } = rendererInternals; const hydrate = (vnode, container) => { if (( true) && !container.hasChildNodes()) { warn(`Attempting t...
[ "function _hydrateAndRenderExternalTemplates() {\n const header = new Header(\n './../../../templates/includes/header.jsr'\n );\n const footer = new Footer(\n './../../../templates/includes/footer.jsr'\n );\n const breadcrumb = new BreadCrumb(\n ['Hub', 'Mathématiques', 'PGCD'], ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Match sisters of the person
sisters(person) { var father = person.father; var sons = []; if (father != undefined) { sons = father.sons; } else { return []; } const sister = []; sons.forEach(function (son) { if (son.name != person.name && son.gender...
[ "brotherinlaw(person) {\n if (person.gender === 'male') {\n var spouse = person.ismanof;\n var brother = this.brothers(spouse);\n var sisters = this.sisters(person);\n if (sisters.length > 0) {\n sisters.forEach(function (sis) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates a new clustergram, caching the original data so we can "reset" it later.
function createClustergram(root, data) { var hasCategory = typeof data.network.col_nodes[0]['cat-0'] !== 'undefined', catIdx = hasCategory ? '1' : '0'; addDuplicateHlights(catIdx, data.network.col_nodes, data.network.views); var clustergram = Clustergrammer({ root: roo...
[ "newCluster({mine = false, author = ''}) {\n let cluster = document.createElement('chat-cluster')\n\n // TODO: cross check author name instead of mine flag\n // maybe even have done that check before calling this function\n if (mine) cluster.setAttribute('mine', '')\n\n cluster.innerHTML = `\n <...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
We can repeat an action by chaining a repeater function that executes the same action to the action's promise resolver.
function repeat(action, times, argument) { let count = 0; const repeater = (arg) => { if (count >= times) { return arg; } count++; return action(arg).then(repeater); }; return repeater(argument); }
[ "function wrapAction(name, action) {\r\n return function () {\r\n setActivePinia(pinia);\r\n const args = Array.from(arguments);\r\n const afterCallbackList = [];\r\n const onErrorCallbackList = [];\r\n function after(callback) {\r\n after...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
addToZoomRegion Either add the crosshairs actor to the given ZoomRegion, or, if it is already part of some other ZoomRegion, create a clone of the crosshairs actor, and add the clone instead. Returns either the original or the clone.
addToZoomRegion(zoomRegion, magnifiedMouse) { let crosshairsActor = null; if (zoomRegion && magnifiedMouse) { let container = magnifiedMouse.get_parent(); if (container) { crosshairsActor = this._actor; if (this._actor.get_parent() != null) { ...
[ "addCrosshairs(crossHairs) {\n this._crossHairs = crossHairs;\n\n // If the crossHairs is not already within a larger container, add it\n // to this zoom region. Otherwise, add a clone.\n if (crossHairs && this.isActive()) {\n this._crossHairsActor = crossHairs.addToZoomRegio...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }