query
stringlengths
9
34k
document
stringlengths
8
5.39M
negatives
listlengths
19
20
metadata
dict
Pairfantasyland/traverse :: Applicative f => Pair a b ~> (TypeRep f, b > f c) > f (Pair a c) . . `traverse (_) (f) (Pair (x) (y))` is equivalent to . `map (Pair (x)) (f (y))`. . . ```javascript . > S.traverse (Array) (S.words) (Pair (123) ('foo bar baz')) . [Pair (123) ('foo'), Pair (123) ('bar'), Pair (123) ('baz')] ....
function Pair$prototype$traverse(typeRep, f) { return Z.map (Pair (this.fst), f (this.snd)); }
[ "function Array$prototype$traverse(typeRep, f) {\n var xs = this;\n function go(idx, n) {\n switch (n) {\n case 0: return of(typeRep, []);\n case 2: return lift2(pair, f(xs[idx]), f(xs[idx + 1]));\n default:\n var m = Math.floor(n / 4) * 2;\n return lift2(concat_, g...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Validate that input number is less than a max. If the value is undefined or not capable of being parsed into an integer pass validation
function validateMax(field_value, max) { if (field_value === undefined || field_value === null) { return true; } var int = parseInt(field_value); if (isNaN(int)) { return true; } return int <= max; }
[ "function check_int(val, min, max) {\n assert.ok(typeof(val) == 'number' && val >= min && val <= max && Math.floor(val) === val, \"not a number in the required range\");\n}", "function intCheck(n,min,max,name){if(n<min||n>max||n!==mathfloor(n)){throw Error(bignumberError+(name||\"Argument\")+(typeof n==\"numbe...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
check if the postal address is required and if so is filled out check if business address is filled out
checkAddressReady(){ if(this.state.postal===1 && this.checkBAddress() && this.checkPAddress()){ return true; } else if(this.state.postal===0 && this.checkBAddress()){ return true; } else { return false; } }
[ "function validateAddress(){\n var res = false\n if (myForm.F00000035h.toLowerCase() !== \"berlin\"){\n return false;\n }else if (myForm.F00000035h.toLowerCase() == \"berlin\") {\n if (myForm.bzrnr != '') {\n res = true;\n }\n }else{\n res = false\n } \n\tret...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Add value in localStorage(m+ button)
function addValue(){ var sum = parseInt( localStorage.getItem("M+ Values")); var a = parseInt(document.getElementById("calc").value); sum = sum + a; localStorage.setItem("M+ Values",sum); // console.log("sum : " + sum); }
[ "function addData(key, value) {\n localStorage.setItem(key, value);\n }", "function getValue(){\r\n document.getElementById(\"calc\").value=localStorage.getItem(\"M+ Values\");\r\n}", "function saveMoney() {\n localStorage[\"money\"] = money;\n}", "function nineAmSaveBtnClick(e) {\n e.preventDefault;...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
create the buffer canvas from the size of the original canvas used for display
function createBufferCanvasFronDisplayCanvas(displayCanvas){ var backgroundCanvas = document.createElement('canvas'); backgroundCanvas.width = displayCanvas.width; backgroundCanvas.height = displayCanvas.height; backgroundCanvas.getContext("2d").fillStyle = "rgb(255,255,255)"; backgroundCanvas.getContext("2d").fil...
[ "function _modifyCanvasSize() {\n let width, height;\n if (scene.change_canvas_size) {\n let aspect = (scene.left_eye[1] - scene.left_eye[0])\n / (scene.left_eye[3] - scene.left_eye[2]);\n if (aspect > 1) {\n width = Math.min(200, aspect * 150);\n height = width / aspect;\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Resets the transform to its original values.
Reset() { this.translation = this.originalTranslation.Clone(); this.rotationInRadians = this.originalRotationInRadians; this.scale = this.originalScale.Clone(); this.origin = this.originalOrigin.Clone(); this.dimensions = this.originalDimensions.Clone(); this.isDirty = true; }
[ "resetTransform() {\n this.getContext().setTransform(1, 0, 0, 1, 0, 0);\n }", "function resetTransform() {\n ctx.setTransform(transform);\n}", "resetTransform() {\n if (this.transformInteractor) {\n this.transformInteractor.reset();\n }\n }", "resetTransform() {\n this._targetNode....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Render and initialize the clientside People Picker.
function initializePeoplePicker(eleId) { // Create a schema to store picker properties, and set the properties. var schema = {}; schema['PrincipalAccountType'] = 'User,DL,SecGroup,SPGroup'; schema['SearchPrincipalSource'] = 15; schema['ResolvePrincipalSource'...
[ "function initializePeoplePicker(eleId) {\n // Create a schema to store picker properties, and set the properties.\n var schema = {};\n schema['PrincipalAccountType'] = 'User,DL,SecGroup,SPGroup';\n schema['SearchPrincipalSource'] = 15;\n schema['ResolvePrincipalSource'] = 15;\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Flushes the zindexes. This is a fairly expensive operation, thas's why the info is buffered.
_flushUpdateZIndexOfChilden() { const _this = this; // Iterate over a clone: const _buffer = this.cloneObject(this._updateZIndexOfChildrenBuffer); this._updateZIndexOfChildrenBuffer = []; _buffer .map(_viewId => { const _view = _this.__views[_viewId]; const _isRootView = _viewI...
[ "function _clearIndexes() {\n $.each(_indexList, function (indexName, index) {\n index.fileInfos = [];\n });\n }", "_flush() {\n const centralDirectoryOffset = this._offset;\n let centralDirectorySize = 0;\n for (const i in this._files)\n this._writeCentralDirectoryHeader...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Animation instance / "beforeshow" event handler for each submenu of the MenuBar instance, used to setup certain style properties before the menu is animated.
function onSubmenuBeforeShow(p_sType, p_sArgs) { var oBody, oElement, oShadow, oUL; if (this.parent) { oElement = this.element; /* Get a reference to the Menu's shadow element and set its "height" property to "0px" to syncronize it with the h...
[ "function onAnimationComplete(p_sType, p_aArgs, p_oShadow) {\n\n\t\tvar oBody = this.body,\n\t\t\t\toUL = oBody.getElementsByTagName(\"ul\")[0];\n\n\t\tif (p_oShadow) {\n\t\t\n\t\t\t\tp_oShadow.style.height = this.element.offsetHeight + \"px\";\n\t\t\n\t\t}\n\n\n\t\toUL.style.marginTop = \"\";\n\t\toBody.style.over...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This funtion will choose random time this will animate the mole up and down
function popOut(){ //picking up random time const time= Math.random()*1300 +400; //this hole var is new and independent from above hole variable const hole = pickRandomHole(holes); //CSS will animate its child animate with class mole(.hole.up .mole) it will animate its top value from 0 to 100 ho...
[ "function molePopUp() {\r\n // Generate a random time and hole div\r\n const time = randomInterval(200, 1000);\r\n const hole = randomHole(holes);\r\n // Pop the molue up on the selected hole\r\n hole.classList.add(\"up\");\r\n // Based on the random time\r\n // Remove the up class from the mol...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Definition for type : VelocityControllerRND
function VelocityControllerRND(name, root) { this.name = name; this.root = (root === null)? this : root; this.ready = false; this.bus = (root === null)? new EventEmitter() : this.root.bus; this.build(name); }
[ "get angularVelocity() {}", "get velocity() {}", "get targetVelocity() {}", "set targetVelocity(value) {}", "setVelocity(vel) {\r\n this.velocity = vel;\r\n }", "function VirtualActuator() {\r\n}", "addAngularVelocity (angularVelocity) {}", "get relativeVelocity() {}", "function Velocity(){\n\n\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function to instanciate and setup PointerLockControls
function initControls() { controls = new THREE.PointerLockControls( camera, renderer.domElement); var geometry = new THREE.CircleBufferGeometry( 0.005, 32 ); var material = new THREE.MeshBasicMaterial( { color: 0xaaaaaa } ); reticle = new THREE.Mesh( geometry, material ); reticle.position.set( 0, 0,...
[ "function createPointerLockControls() {\n\n\t// create blocker and instruction divs\n\tjQuery('<div/>', {\n\t id: 'blocker',\n\t}).insertBefore('canvas');\n\n\tjQuery('<div id=\"instructions\"><span style=\"font-size:40px\">Click to play</span><br />(W, A, S, D = Move, SPACE = Jump, MOUSE = Look around)</div>', ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
6. Creating another function called vehicle with age parameter
function vehicle(y, z, age) { let vehicleType; let vehicleAge; if (z === 1) { vehicleType = 'car'; } else if (z === 2) { vehicleType = 'motorbike'; } if (age === 0) { vehicleAge = 'new'; } else { vehicleAge = 'used'; } console.log("a " + y + " " + ...
[ "function vehicule(age) {\r\n\r\n}", "function calculateDogAge(age){\n}", "function vehicle(color, code, age) {\r\n let vehicleAge = \"\";\r\n if (age > 1) { vehicleAge = \"used\"; } else { vehicleAge = \"new\"; }\r\n if (code === 1) {\r\n console.log(\"a\", color, vehicleAge, \"car\");\r\n }\r\n else i...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Below function calls all relevant functions when a user clicks a card, thus making a move
function makeMove(){ $(".card").click(function(e){ showCardSymbol($(e.target)); addToCardCheck($(e.target)); if (cardCheck.length === 2) { checkMatches(); } congratsMessage(); }); }
[ "function turnCard(e){\n // store the moves element in a variable\n let clickedCard = e.target;\n if (clickedCard.classList.contains('card')) {\n if (clickedCard.className === \"card open show\") {\n moves -= 1;\n }\n if (firstClick) {\n stopwatch.start();\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
this function animates the icon container element for the navbar it takes a direction as an arguement to dictate if the animation is adding or removing the element
animateIcons(direction){ if(direction === "in"){ const navIcons = document.getElementById("nav_icons"); navIcons.classList.remove("hide_icons"); navIcons.classList.add("reveal_icons"); } else{ const navIcons = document.getElementById("nav_icons"); ...
[ "function mobileNavAni() {\n $(\"#mobileNav\").slideDown();\n $(\"#menuClick\").css(\"visibility\", \"hidden\");\n $(\"#icon1\").animate({\n right: \"50%\",\n \"margin-right\": \"115px\",\n top: mobileTop\n }, 1000);\n $(\"#icon2\").animate({\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Initialize Javascript variables that correspond to items in the body. Also initialize $window.
function initializeVariables() { $window = $(window); $pageHead = $("#pageHead"); $storyFrame = $("#storyFrame"); storyFrame = $storyFrame[0]; $backArrow = $("#backArrow"); $nextArrow = $("#nextArrow"); newtabLink = $("#newtabLink")[0]; $slideDropdown = $("#slideDropdown"); slid...
[ "function init() {\n initializeVariables();\n initializeHtmlElements();\n}", "function _initScrollVars()\n {\n var elem_body_obj = $('body');\n wizmo.store(\"var_viewport_scroll_t\", elem_body_obj.scrollTop());\n wizmo.store(\"var_viewport_scroll_l\", elem_body_obj.scroll...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
load the staff list file
function findStaffList(ListFile){ //console.log("Looking for filename: "+filename); if (fs.existsSync(ListFile)){ console.log("found staff file"); let rawdata = fs.readFileSync(ListFile); //console.log("raw data: "+rawdatamuddy); stafflist = JSON.parse(rawdata); //console.log("parsed data: "+JSON....
[ "function loadWillList() {\n\twillList = JSON.parse(fs.readFileSync(willListFullPath, 'utf8'));\n}", "function loadData() {\n var fileContent = fs.readFileSync('./data.json');\n members = JSON.parse(fileContent);\n}", "function loadStudents() {\n var empty = \"[]\";\n readFile(\"students.txt\", empty, f...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Example query to get one individual species.
async function example_query_get_one_species(queryResolver) { const query = { get: { species: { // Query for "species" entity. args: { name: "Hutt", // Gets the one species that matches this name. }, }, }, }; const...
[ "async function getVillagerBySpecies(req, res){\n\tconst species = req.params.species;\n\tconsole.log(species);\n\tawait con.query(`SELECT * FROM ${collection} WHERE species = \"${species}\"`, (err, result, fields) => { \n\t\tif (err) throw err;\n\t\tres.json(result);\n\t\t// console.log(result);\n\t});\n\n}", "g...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sets the maximum frequency for a concrete sensor.
setMaximumSupportedFrequency(frequency) { this.max_frequency_ = frequency; }
[ "setMaximumSupportedFrequency(frequency) {\n this.maxFrequency_ = frequency;\n }", "function YMotor_set_frequency(newval)\n { var rest_val;\n rest_val = String(Math.round(newval * 65536.0));\n return this._setAttr('frequency',rest_val);\n }", "function YPwmOutput_set_frequency(newv...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
check the uipanel for userspecified settings
function getUserSettings() { return setUIPanelSettings(); }
[ "_validatePanel() {\n const hasPanelConfig = this.config.panel && (this.config.panel.icon || this.config.panel.header);\n if (!hasPanelConfig) {\n console.warn('Missing panel header and icon, please specify at least one of them.');\n }\n }", "function settingsValidation() {\n\n if (settings.get(\"...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
register a catch functor
catch(func) { this.catchFunctions.push(func); return this; }
[ "catch( fn ) {\n\t\tthis.catchFn = fn;\n\t\treturn( this );\n\t}", "function register(err, handler){\n\thandlersMap[err.name] = handler;\n}", "function _try_catch (f) {\n return function () {\n try {\n f.apply(this, arguments);\n } catch (e) {\n console.error(e);\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Set the textContent If the element is not yet created, store the value and apply it when the element is created
set textContent(text) { if (this.#el) this.#el.textContent = text; else this.#textContent = text; }
[ "set textContent(value) {\n this.nodeValue = value;\n }", "set textContent(value) {\n // Mutation Observation is performed by CharacterData.\n this.nodeValue = value;\n }", "function setContent(element, text){\n\telement.textContent = text;\n}", "setText(text) {\r\n this.te...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
As efficiently as possible, decorate the comment object with .precedingNode, .enclosingNode, and/or .followingNode properties, at least one of which is guaranteed to be defined.
function decorateComment(node, comment) { var childNodes = getSortedChildNodes(node); // Time to dust off the old binary search robes and wizard hat. var left = 0, right = childNodes.length; while (left < right) { var middle = (left + right) >> 1; var child = childNodes[middle]; ...
[ "function decorateComment(node, comment) {\n var childNodes = getSortedChildNodes(node);\n\n // Time to dust off the old binary search robes and wizard hat.\n var left = 0, right = childNodes.length;\n while (left < right) {\n var middle = (left + right) >> 1;\n var child = childNodes[midd...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
checks if the moves list is optimal and returns true/false/undefined
function isOptimal(moves, base) { if (moves && moves.length) { let position = base; const possibilities = {white: true, black: true}; for (let i = 0; i < moves.length; i++) { let move = moves[i]; let bestMove = position && position.s && position.s.length && position.s[0].m; if (move !== ...
[ "function doOptimalMove() {\n var serialized = getSerialized(nodes);\n if (serialized in cache) {\n choice = cache[serialized];\n } else {\n minimax(player, nodes, 0);\n cache[serialized] = choice;\n }\n finishMove(serialized);\n}", "checkAvailableMove() {\n for (let i = 0; i < this.boardSize...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
angular ui accordiongroup mod with plus/minus icon
function accordionGroupMod() { return { restrict: "E", transclude: true, scope: { heading: "@", isOpen: "=?" }, template: '<accordion-group is-open="isOpen"><accordion-heading>' + '<i class="glyphicon" ng-class="{\'glyphicon-minus\': isOpen, \'...
[ "function avAccordionGroup(AV_ACCORDION){\n return {\n restrict: 'A',\n require: '^avAccordion',\n transclude: true,\n replace: true,\n templateUrl: AV_ACCORDION.TEMPLATES.GROUP,\n scope: {\n heading: '@', // Interpolate the heading attribute onto this scope\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Unit Ratio Calculation / When queried, the browser returns (most) CSS property values in pixels. Therefore, if an endValue with a unit type of %, em, or rem is animated toward, startValue must be converted from pixels into the same unit type as endValue in order for value manipulation logic (increment/decrement) to pro...
function calculateUnitRatios () { /************************ Same Ratio Checks ************************/ /* The properties below are used to determine whether the element differs sufficient...
[ "function calculateUnitRatios(){ /************************\n Same Ratio Checks\n ************************/ /* The properties below are used to determine whether the element differs sufficiently from this call's\n previo...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Detects if the current browser is a Garmin Nuvifone.
function DetectGarminNuvifone() { if (uagent.search(deviceNuvifone) > -1) return true; else return false; }
[ "function DetectGarminNuvifone()\n{\n if (uagent.search(deviceNuvifone) > -1)\n return true;\n else\n return false;\n}", "function isThisLGEBrowser(){\r\n\tvar userAgentString = new String(navigator.userAgent);\r\n\tif (userAgentString != null && userAgentString.search(/LG Browser/) > -1) {\r\n\tret...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This module is a function that takes in a food and returns an image url based on the food name It uses "pluralize" and .toLowerCase functions to account for different ways of user entering the food name
function addFoodIcon(food) { switch(pluralize.singular(food.name.toLowerCase())) { case 'apple': return 'apple-1.png'; break; case 'asparagus': return 'asparagus.png'; break; case 'avocado': return 'avocado.png'; break; ...
[ "function moodNameToURL(moodName) {\n switch (moodName) {\n case \"happy\":\n return browser.extension.getURL(\"moods/happy.jpg\");\n case \"sad\":\n return browser.extension.getURL(\"moods/sad.jpg\");\n case \"stoic\":\n return browser.extension.getURL(\"moods/s...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This function sends the position of each of the updated element to the controller file so that database can be updated Also this function removes the positionupdated class from the element whose position is updated in database
function saveNewPositions(url){ var positions = []; $('.position-updated').each(function(){ //Sending data-index and data-position attribute value to controller positions.push([$(this).attr('data-index'), $(this).attr('data-position')]); }); ...
[ "function updateWidgetPosition() {\n\t\n\tvar result = [];\n\tvar widgets = $(\".w_container\");\n\t\n\t// Look for the widgets that have changed positions\n\t$.each(widgets, function() {\n\t\tvar $widget = $(this);\n\t\tvar idx = $widget.index();\n\t\tif (idx == parseInt($widget.data(\"pos\")))\n\t\t\treturn;\n\t\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Moves dropdowns to the Menu.
_moveDropDownsToMenu() { const that = this; for (let i = 0; i < that._containersInBody.length; i++) { const container = that._containersInBody[i]; container.$.unlisten('click'); container.$.unlisten('mouseleave'); container.$.unlisten('mouseout'); ...
[ "_moveDropDownsToMenu() {\n const that = this;\n\n for (let i = 0; i < that._containersInBody.length; i++) {\n const container = that._containersInBody[i];\n\n container.$.unlisten('click');\n container.$.unlisten('mouseleave');\n container.$.unlisten('mouse...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns true if all the tracks have been loaded into the map
function tracksDoneLoading(){ return trackLayerGroup.getLayers().length == Object.keys(tracks).length; }
[ "function areAllLoaded(){\n\tvar allDone = true;\n\tfor(var k in playLists){\n\t\tvar loaded = playLists[k].loaded || playLists[k].list.length == 0;\n\t\tallDone = (allDone && loaded);\n\t}\n\treturn allDone;\n}", "is_loaded() {\n for (const g of this.graphs) {\n if (!g.loadedOk) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Simple test for verifying that MOVE is a valid move number
function isValid(move) { return (move > 10 && move < 89 && move % 10 > 0 && move % 10 < 9); }
[ "function verifyMove( state, move ) {\n\tif ( isNaN( move ) )\n\t\treturn false;\n\tif ( state.players[state.currentPlayer].pos == 1 && move >= 7 && move <= 12\n\t\t&& state.board[move] != 0 )\n\t\treturn true;\n\tif ( state.players[state.currentPlayer].pos == 0 && move >= 0 && move <= 5\n\t\t&& state.board[move] !...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
init properties usually done from the config file text: defualt text string, can be dynamically changed textStyle: css styled text x: x position y: y position
init(properties) { this.text = properties.text || this.text; this.textStyle = properties.textStyle; this.x = properties.x || this.x; this.y = properties.y || this.y; this.visible = true; }
[ "function textStyle()\n{\n if(arguments.length==3) {\n this.font = arguments[0];\n this.text_color = arguments[1];\n this.h_align = arguments[2];\n this.v_align = arguments[3];\n }\n else {\n this.font = \"normal 12pt arial\";\n this.text_color = \"#000000\";\n this.h_align = \"left\";\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
console.log(onlyPeopleOfAge(people)); 03. Underage people
function printUnderagePeople(input) { var result = input.filter(function (item) { return item.age < 18; }); result.forEach(function (item) { console.log(item); }); }
[ "function filterUnderagedPeople(people, ageLimit) {\n \n}", "function getempbyage(){\n let agfactor = company.student.filter((ag)=>{\n return ag.Age >40;\n })\n return agfactor;\n}", "function peopleOfAge(arr) {\n const result = arr.filter(function(str) {\n if (peopleOfAge.age >= 18) ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
List handler for reservation resources
async function list(req, res, next) { try { const reservation = await service.list(); if (reservation) { res.json({ data: reservation }); } next({ status: 404, message: `Reservations cannot be found for this.` }); } catch (err) { console.log(err); next({ status: 500, messag...
[ "async function list(req, res) {\n\tconst date = req.query.date;\n\tconst mobile_number = req.query.mobile_number;\n\n\tconst reservations = await service.list(date, mobile_number);\n\n\tconst response = reservations.filter((reservation) => reservation.status !== \"finished\");\n\n\tres.json({ data: response });\n}...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Retrieves all page instances for website whose _id is websiteId
function findAllPagesForWebsite(websiteId) { return Page.find({ _website: websiteId }); }
[ "function findAllPagesForWebsite(websiteId) {\n return pageModel.find({_website: websiteId});\n}", "function findPageByWebsiteId(websiteId) {\n ret = [];\n for(var p in pages) {\n if (pages[p].websiteId == websiteId) {\n ret.push(pages[p]);\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Mouse over threat category
function mouseOverCategory(d) { if (timer_draw) timer_draw.stop(); mouse_hover_active = true; hover_type = 'category'; current_hover = d; var id = d.id; //Draw the edges from threat category to the elements edges_elements.forEach(function (l) { l.opacity = l.target.id === id ? 0.5 : 0; ...
[ "function doCountyMouseOver() {\n this.bringToFront();\n this.setStyle({\n weight: 3\n });\n\n var this_geoid = this.feature.properties['geoid'];\n d3.selectAll(\".bar[geoid='\"+this_geoid+\"']\")\n .classed({'active':true})\n .style(\"opacity\",0.7);\n}", "function catSelector...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Executes a MySQL query to get all posts from the database. Check the new id whether in the database. If the new post id in the database, return error message. If not, return a Promise that resolves to the ID of the newlycreated user entry.
async function checkPostId(newId){ const [ posts ] = await mysqlPool.query( 'SELECT * FROM posts ORDER BY id' ); if(posts){ for(var i = 0; i < posts.length; i++){ if(posts[i].postId === newId){ return false; } } } return true; }
[ "createPost(post) {\n if (!post.subredditId) {\n return Promise.reject(new Error(\"There is no subreddit id\"));\n }\n\n return this.conn.query(\n `\n INSERT INTO posts (userId, title, url, createdAt, updatedAt, subredditId)\n VALUES (?, ?, ?,...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Draw the line chart in the linechart svg for the country argument (e.g., `Algeria').
function drawLineChart(country) { if(!country) return; var node = document.getElementById('linechart'); node.innerHTML = ""; let year = document.getElementById("year-input").value; // Create country data object let countryData = []; timeData.forEach(d => { if(country in d){ countryData...
[ "function drawLineChart(country) {\n console.log('enter into drawLineChart: ' + country);\n\n\n lineSvg.select('g').remove();\n const xScale = d3.scaleLinear();\n var lineData;\n\n // get the GDP values for countries\n timeData.forEach(d => {\n for (var key in d) {\n if (key == \"Year\")\n d.Ye...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Create a new object that will be used for the chart totals
function objectCreation(chartItems) { chartItems = Array.from(chartItems).sort(); for (let item of chartItems) { chartTotals.push({ item: item, total: 0, color: getLegendColor(item) }); } }
[ "processTotals() {\n let income_statement = this.company.income_statement;\n let results = {\n totals:\n [\n {\n name: \"Revenue\", 'value': income_statement.total_revenue,\n bar: { s...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Handles request to get the target lock state for homekit
getTargetLockState(callback) { this.getLockCurrentState(callback); }
[ "function handleLock(type) {\n\t\t\t//onLockRecived make the locking action according to the status of the object\n\t\t\treturn getLockingObject(type, onLockRecieved)\n\t\t}", "function jsDAV_Locks_LockInfo() {}", "getLockCurrentState(callback) {\n callback(null, this.getDeviceCurrentStateAsHK());\n }...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function to create a timestamp for 9am today
function createTimeStamp8pm(){ let today = new Date(); var ms = today.getTime(); var msPerDay = 86400 * 1000; var msto8pm = 72000000; let eightPMToday = ms - (ms % msPerDay) + msto8pm; return eightPMToday; }
[ "function createTimeStamp9am(){\n let today = new Date();\n \n var ms = today.getTime();\n var msPerDay = 86400 * 1000;\n var msto9am = 32400000;\n let nineAMToday = ms - (ms % msPerDay) + msto9am;\n return nineAMToday; \n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
If for some reason a stream does not have the same number of chunks as the mediaBuffer expects, disable that stream.
function MediaStreamFilter$incorrectChunks(playback) { if (!config.incorrectChunkCountEnabled) { // return nothing, if filter is not enabled return; } var _log = new log.CategoryLog('IncorrectChunks Filter'), invalidStreamMap = {}; function logInvalidStream (stream) { ...
[ "startWithoutRemovingChunks() {\n // Do nothing on stop, just restart the stream\n this.mediaRecorder.onstop = null\n this.mediaRecorder.stop();\n console.log(\"Stop with a null function\")\n\n const stream = this.createNewStream(); \n\n\n // intiates the recorder\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns the list of cells at the given column index
function getCellByCellIndex( opts: Options, // The table table: Block, cellIndex: number ): List<Block> { return table.nodes.map(row => row.nodes.get(cellIndex)); }
[ "function getCellsAtColumn(opts,\n// The table\ntable, columnIndex) {\n return table.nodes.map(function (row) {\n return row.nodes.get(columnIndex);\n });\n}", "function getCellsAtColumn(opts,\n// The table\ntable, columnIndex) {\n return table.nodes.map(function (row) {\n return row.nodes.get(colu...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
parseResponseToField This function takes all the data in data and tries to find an HTML container in fieldContainer to write this data to the screen.
function parseResponseToFields(data, fieldContainer, wrapAround) { wrapAround = wrapAround || {}; if (data == null) return; fieldContainer = $(fieldContainer); $.each(data, function(fieldName, fieldValue) { var cell = fieldContainer.find("." + fieldName).empty(); if (!fieldValue) return; if (fieldVal...
[ "function handleResponse(data) {\n var parsedResponse = JSON.parse(data.currentTarget.response);\n var parsedItems = Object.values(parsedResponse.items);\n var itemTimeslotArray = buildTimeslotArray(parsedItems);\n // pageConstructor(parsedItems, itemTimeslotArray);\n htmlConstructor(parsedItems, itemTimeslotA...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sets the coordinates for the robot based on the direction of Robot Parameters : robot Instance created initially
function updateCoordinates(robotInstance) { let direction = robotInstance.getDirection(); let currentXCoordinate = robotInstance.getXCoordinate(); let currentYCoordinate = robotInstance.getYCoordinate(); switch (direction) { case validDirections.NORTH: robotInstance.setYCoordinate(cu...
[ "function Robot(width, height, x, y) {\n\tthis.width = width;\n\tthis.height = height;\n\tthis.x = x;\n\tthis.y = y; \n\t\t\t\t\n\tthis.newPos = function() {\n this.x = this.x;\n this.y = this.y; \n\t}; \n}", "function Robot() {\n this.coordinates = [0, 0];\n this.directions = ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Draws the snapped polyline (after processing snaptoroad response).
function drawSnappedPolyline() { var lineSymbol = { path: google.maps.SymbolPath.FORWARD_CLOSED_ARROW }; snappedPolyline = new google.maps.Polyline({ path: snappedCoordinates, strokeColor: 'blue', strokeWeight: 3, icons: [{ icon: lineSymbol, offset: '100%' }], }); //snappedPoly...
[ "function drawSnappedPolyline() {\n routePath.setPath(snappedCoordinates);\n}", "function drawSnappedPolyline() {\n let snappedPolyline = new google.maps.Polyline({\n path: snappedCoordinates,\n strokeColor: \"#7094cf\",\n strokeWeight: 6,\n strokeOpacity: 0.9,\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Shows the clear filter button for the given tag.
function showClearFilterBtn(tag) { forEach(".clear-filter-text", function (node) { node.innerHTML = "filter on " + tag; }); SetNodesVisibility(".clear-filter", true); }
[ "function clearFiltering() {\n document.getElementById(\"filter-container\").innerHTML = \"\";\n }", "function clearFilter() {\n for (var i = 0; i < allProducts.length; i++) {\n allProducts[i].style.display = \"block\";\n }\n\n // display filder button\n filterButton.style.display = \"n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
check if mouse is clicked and if the mouse pointer is inside the playbutton.
function checkIfButtonClicked() { // if the mouse pointer is inside the play button then switch the state to level. if (mouseIsPressed && collidePointCircle(mouseX, mouseY, width / 2, height / 2, width / 6)) { state = "level"; clickSound.play(); } // check if store is clicked if it is then change stat...
[ "function mouseClicked() {\n if (mouseX > width / 3 &&\n mouseX < 2 * width / 3 &&\n mouseY > height / 1.3 &&\n mouseY < height / 1.1) {\n sliderDotX = mouseX;\n mySongLength = mySong.duration();\n var timeStamp = map(sliderDotX, width / 3, 2 * width / 3, 0, mySongLength);\n mySong.jump(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates a new JSA CAS Frame from the given binary avatar definition view.
static fromBin(avdv) { var frame; //------- frame = new CASFrame(); frame.setFromBin(avdv); return frame; }
[ "function makeIssueScanningFrame() {\n miro.board.widgets.create([\n {\n type: \"SHAPE\",\n style: {\n shapeType: 3,\n backgroundColor: \"#ffffff\",\n backgroundOpacity: 1,\n borderColor: \"transparent\",\n borderWidth: 24,\n borderOpacity: 1,\n borderS...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
FUNCTION: generateDynamicDataRef DESCRIPTION: Returns a dynamic binding string. ARGUMENTS: sourceName string the name of the dynamic source returned from the findDynamicSources function bindingName string the name of a dynamic source binding returned from generateDynamicSourceBindings RETURNS: string the code to insert...
function generateDynamicDataRef(sourceName, bindingName, dropObject) { var paramObj = new Object(); paramObj.bindingName = bindingName; var retStr = extPart.getInsertString("", "URL_DataRef", paramObj); if (dwscripts.canStripScriptDelimiters(dropObject, true)) { retStr = dwscripts.stripScriptDeli...
[ "function generateDynamicDataRef(sourceName, bindingName, dropObject)\n{\n var retVal = \"\";\n var sbObj = null;\n \n // First check if this recordset datasource is returned from a stored procedure. If so,\n // get the stored procedure SB object which returns the recordset. Otherwise,\n // just grab the ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This class helps to play a collection of DIV child elements under a HTML element with id value refered by 'slideContainer'. To get the best effect, it is recommended to keep the child DIV elements hidden initially. For example: ....content comes here.... ... ... other slides come here ... ...
function Slideshow(slideContainer, options) { // private: input fields this.slideContainer = slideContainer; this.blurringPeriod = options.blurringPeriod; this.displayPeriod = options.displayPeriod; // private: internal variables this.slideIndex = 0; this.selectorExpression = "#"+slideC...
[ "function generateSlides() {\n const parentEle = document.querySelector('#container');\n currentQContent = [dataVizPage[state.q_id], ...sharedContent]\n\n currentQContent.forEach((slide, i) => {\n const slideElement = document.createElement('div');\n //element position absolute\n slide...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Construct a new TitleBar
function TitleBar(target) { _super.call(this, target); this._buttons = 0 /* NoButton */; this.addClass(TitleBar.Class); var icon = this._icon = new porcelain.Component(); icon.addClass(TitleBar.IconClass); var label = this._label = new porcelain....
[ "function Titlebar(u, t, m, g, b, o, r, a){\n this.Username = u;\n this.Title = t;\n this.Message = m;\n this.Group = g;\n this.Background = b;\n this.Border = o;\n this.More = r;\n this.RemoveBars = a;\n}", "static InspectorTitlebar() {}", "function createTitle()\n\t{\n\t\tvar self = th...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
A method decorator that ensures the actor is in the expected state before proceeding. If the actor is not in the expected state, the decorated method returns a rejected promise.
function expectState(expectedState, method) { return function(...args) { if (this.state !== expectedState) { const msg = "Wrong State: Expected '" + expectedState + "', but current " + "state is '" + this.state + "'"; return Promise.reject(new Error(msg)); } return method.appl...
[ "function expectState(expectedState, method) {\n return function(...args) {\n if (this.state !== expectedState) {\n let msg = \"Wrong State: Expected '\" + expectedState + \"', but current \"\n + \"state is '\" + this.state + \"'\";\n return Promise.reject(new Error(msg));\n }\n\n return ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Event handler for test pass
onTestPass(test) { this._passes++; this._out.push(test.title + ': pass'); let status_id = this.qaTouch.statusConfig('Passed'); let caseIds = this.qaTouch.TitleToCaseIds(test.title); if (caseIds.length > 0) { let results = caseIds.map(caseId => { return...
[ "runTests() {\n this.testCorrect()\n this.testComplete()\n }", "function newTestEventHandler() {\n\t$('#test_status').delegate('.newbtn', 'click', function() { \n\t\ttest_review_mode=false;\n\t\ttimed_test_mode=false;\n\t\t//Need to first check to see if there are generated tests that the user\n\t\t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Vote for a local address
function SeenLocal(addr) { // LOCK(cs_mapLocalHost); if (!mapLocalHost[addr]) return false; mapLocalHost[addr].nScore++; AdvertizeLocal(); return true; }
[ "function find_own_vote_address() {\n for(var i=0 ; i < eth.keys.length ; i++) {\n var addr = eth.secretToAddress(eth.keys[i]);\n //Got it.\n if( registeredState(addr) != \"0x\") { return addr; }\n }\n return null;\n}", "function AdvertizeLocal() {\n // LOCK(cs_vNodes)\n vNodes.for...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function CheckUpdate takes an array of the user's starred files and their respective last udated dates and checks to see if the dates have changed. If the dates have changed, the script will log that to the Logger
function CheckUpdate(){ //logging start of method Logger.log("starting CheckUpdate()"); //declaring variables var user = Session.getEffectiveUser(); //returns email address var log = setUp(-1); //returns the Spreadsheet Object of the log var files, curDate, name, file, prevDate; var numFiles = log.g...
[ "function checkUpdate() {\n\tif(file_date(serviceIniFile) > serviceIniFileDate)\n\t\texit(0);\n}", "function checkFileTrackerUpToDate() {\n let currentDate = getDate();\n let keys = Object.keys(roomsFileTracker);\n \n keys.forEach(function(key) {\n console.log(\"Key: \" + key);\n let sam...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns the addition of v1 and v2. Target is the object receiving the values (v1 by default)
static add(v1, v2, target) { if (!target) target = v1.copy(); else target.set(v1); target.add(v2); return target; }
[ "function vAdd(a, b) {\n return vec(a.x + b.x, a.y + b.y);\n}", "plus(other) {\n return new Vector(this.x + other.x, this.y + other.y);\n }", "plusXY(x, y) {\n return v2(this.x + x, this.y + y);\n }", "static add(a,b) {\n if (a.values.length != b.values.length) return...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Prepare the task service
async prepareTask() { this.options.task && (this.task = await this.addService('task', new this.TaskTransport(this.options.task))); if(!this.task) { return; } if(this.options.task.workerChangeInterval) { await this.task.add('workerChange', this.options.task.workerChangeI...
[ "async prepareTask() {\n this.options.task && (this.task = await this.addService('task', new this.TaskTransport(this.options.task)));\n \n if(!this.task) {\n return;\n }\n\n if(this.options.task.calculateCpuUsageInterval) {\n await this.task.add('calculateCpuUsage', this.optio...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Initializes profileData with the contents of the profileentries file, and load synonyms from synonyms.json.
function initializeData() { const profileContents = fs.readFileSync(profileEntriesFile, 'utf8'); const data = jsonic(profileContents); _.each(data, function (entry) { profileData.push(entry); }); filterInterest.initData(); }
[ "function LoadMetadata() {\n if (settings.metadata.hasOwnProperty('members')) {\n settings.member_lines = settings.metadata.members;\n PopulateMembersTable();\n }\n }", "function loadData() {\n var fileContent = fs.readFileSync('./data.json');\n members = JSON.parse(fileCo...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
clear tasks from all local storage
function clearTasksFromLocalStorage(){ localStorage.clear(); }
[ "function clearAllTasksFromStorage() {\n localStorage.clear();\n}", "function clearAllTasksFromLocalStorage() {\n localStorage.clear();\n}", "function clearingAllTasksFromLocalStorage() {\n localStorage.clear();\n}", "function clearAllTaskFromLocalStorage() {\n localStorage.clear();\n}", "function...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Whether this list item should show a ripple effect when clicked.
_isRippleDisabled() { return !this._isInteractiveList || this.disableRipple || !!(this._list && this._list.disableRipple); }
[ "function RippleTarget() { }", "_isRippleDisabled() {\n return this.disabled || this.disableRipple || this.selectionList.disableRipple;\n }", "function RippleTarget() {}", "get disableRipple() {\n return (this.disabled ||\n this._disableRipple ||\n this._noopAnimations |...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
PAN MOVE A GROUP
panMoveGroup(event){ var that = this; var transform = getTransformation(d3.select('#group-'+that.panGroup.id).attr('transform')); var offsetX = event.srcEvent.x - that.lastPosition.x; var offsetY = event.srcEvent.y - that.lastPosition.y; var X = offsetX + transform.trans...
[ "function myMove(group) {\n\tlet c = group[group.length-1];\n\tc.position.x = mouseX;\n\tc.position.y = mouseY;\n}", "function moveToGroup(obj, target, x, y) {\n // move object from its current to the target container\n var oldContainer= obj.parentNode;\n try {\n target.appendChild(obj);\n } c...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This function clears everything under buttons div. Was going to use it before but decided not to
function clear() { $("#buttons").empty() }
[ "function clearButtons() {\n const childList = buttonContainer.getElementsByTagName(\"button\");\n for (let i = childList.length - 1; i >= 0; i--) {\n buttonContainer.removeChild(childList[i]);\n }\n}", "function clearApendix()\r\n {let p = document.getElementsByClassName('specificButtons')...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Configuration NIET GEIMPLEMENTEERD!!!!!!!! save configuration to cookie
function SaveConfiguration() { var cookievalue = ''; // get added wms layers var wmslayers = mapPanel.layers.queryBy(function (record, id) { return record.get("layer").CLASS_NAME.indexOf("WMS") > -1 && !record.get("layer").isBaseLayer; }); var count = wmslayers.getCount(); if (count > 0) { ...
[ "static _saveConfig() {\n console.log(\"Enregistre le json de config des casques\",Casque.configJson);\n fs.writeFileSync(window.machine.jsonCasquesConfigPath, JSON.stringify(Casque.configJson,undefined, 2));\n }", "writeConfigToCookies() { \r\n\r\n var configString = \"\";\r\n\r\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
actualizarCurso('5f39da72b416ba1ca8c83138'); Otro metodo para poder actualizar pagina de mongo db su documentacion
async function actualizarCurso2(id){ const curso = await Curso.findById(id); const resultado = await Curso.update({_id : id}, { $set: { autor: 'Emanuel', publicado: true } }); console.log(resultado); }
[ "function leerDatosCurso(curso) {\n //Nos creamos un objeto con los datos del curso que vamos a comprar\n const infoCurso = {\n imagen: curso.querySelector('img').src,\n titulo: curso.querySelector('h4').textContent,\n precio: curso.querySelector('.precio span').textContent,\n id: ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
= Description Removed an element attribute of a specified markup element that has been bound to this view. = Parameters +_partName+:: The identifier of the markup element. +_key+:: The attribute to remove. = Returns +self+
unsetAttrOfPart(_partName, _key) { const _elemId = this._getMarkupElemIdPart(_partName, 'HView#setAttrOfPart'); if (this.isntNull(_elemId)) { ELEM.delAttr(_elemId, _key); } return this; }
[ "unsetAttr(_key) {\n ELEM.delAttr(this.elemId, _key)\n return this;\n }", "unsetAttr(_key) {\n ELEM.delAttr(this.elemId, _key);\n return this;\n }", "removeAttribute(key) {\n this.setAttribute(key, undefined);\n }", "removeAttribute(name) {\n if ('attributes' in this.fieldNode) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Computes the BLAKE2B hash of a string or byte array Returns an nbyte hash in hex, all lowercase Parameters: input the input bytes, as a string, Buffer, or Uint8Array key optional key Uint8Array, up to 64 bytes outlen optional output length in bytes, default 64
function blake2bHex (input, key, outlen) { const output = blake2b(input, key, outlen) return util.toHex(output) }
[ "function blake2bHex (input, key, outlen) {\n var output = blake2b(input, key, outlen)\n return util.toHex(output)\n}", "function sha256_encode_bytes() {\r\n let j = 0;\r\n const output = new Array(32);\r\n for (let i = 0; i < 8; i++) {\r\n output[j++] = (ihash[i] >>> 24) & 0xff;\r\n outp...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
parse the url parameter and extract the filetype
getUrlFileType(url){ //get the path porion of the url let urlInstance = new URL(url); let urlPath = urlInstance.pathname; //get the fileType from the urlPath return path.extname(urlPath); }
[ "function mime_type (url)\r\n{\r\n var u = url.split (\".\"), n = u.length - 1;\r\n var mime = mime_list [u[n]]; return (mime ? mime : \"\");\r\n}", "function mime_type (url)\r\n{\r\n var u = url.split (\".\"), n = u.length - 1; if (n < 0) return (\"\");\r\n var mime = mime_list [u[n]]; return (mime ? mime : ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
========================================================== [author] Dodzi Y. Dzakuma [summary] Dynamically loads an image to be used to mark an action on the board. [parameters] 1) a marker used to determine which player made the move 2) the type of resource to use (line|box) 3) the x coordinate of the resource to repl...
function replaceResource(playerMarker, resourceType, xCoordinate, yCoordinate) { //-------------------------------------- // safety check //-------------------------------------- if (!coordinatesWithinRange(xCoordinate, yCoordinate)) { return ""; } //-------------------------------------- // initiali...
[ "static updateImagePath() {\r\n if (game.user.isGM) {\r\n let tile = canvas.tiles.placeables.find(t => t.data.flags.turnMarker == true);\r\n if (tile) {\r\n canvas.scene.updateEmbeddedEntity('Tile', {\r\n _id: tile.id,\r\n img: Settin...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
schedule a new fetch every 30 minutes
function scheduleRequest() { js_logger_1.default.info('schedule refresh alarm to 30 minutes...'); chrome.alarms.create('refresh', { periodInMinutes: 2 }); }
[ "function scheduleRequest() {\n\t\tconsole.log('schedule refresh alarm to 30 minutes...');\n\t\tchrome.alarms.create('refresh', { periodInMinutes: 30 });\n\t}", "polling() {\n // let hourInSec = 3600;\n let hourInSec = 32; // For testing purposes make an hour 16 seconds\n\n // Poll every 15 minutes in th...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
var numArray = []; var newString = numbers.split(" "); console.log('newString:: ', newString); var maxVAlue = Math.max(...newString); numArray.push(maxVAlue); console.log('maxVAlue:: ', maxVAlue); var minValue = Math.min(...newString); numArray.push(minValue); console.log('minValue:: ', minValue); console.log('numArray...
function highAndLow(numbers) { numbers = numbers.split(" ").map(Number); console.log('numbers:: ', numbers); console.log('max and min:: ', `${Math.max(...numbers)} ${Math.min(...numbers)}`); return `${Math.max(...numbers)} ${Math.min(...numbers)}`; }
[ "function highAndLow(numbers){\nvar arr = numbers.split(' ');\nreturn Math.max.apply(Math, arr) + ' ' + Math.min.apply(Math, arr);\n}", "function ReturnArrayOf_MaxMin() {\r\n let numbers = EntryCheckForManyNumbers();\r\n let max = numbers [0]; \r\n let min = numbers [numbers.length-1] ;\r\n for (let i...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Update the gravatar url
function updateGravatar() { var gravatarOptions = currentAttrs(); var gravatarUrl = gravatar.generateUrl(gravatarOptions); element.attr('src', gravatarUrl); }
[ "function updateGravatar(email) {\n blockUi(true, $(\"#gravatar\"), \"throbber\");\n $.post(\"/ajax/get-gravatar\",\n {\"email\": email},\n function (response) {\n $(\"#gravatar\").html(response);\n blockUi(false, $(\"#gravatar\"));\n }, \"json\");\n}", "async func...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Validate orders Delivery city field
function ordersDeliveryCityValid(dc_str) { var result = true; if (isEmpty(dc_str)) { alert("Please enter a delivery city for the order."); return false; } if (!isAlphaName(dc_str)) { alert("Please enter valid alphabetics for city name. You entered " + dc_str); return false; } return result; }
[ "function ordersDeliveryCountryValid(dco_str) {\n\tvar result = true;\n\tif (isEmpty(dco_str))\n\t{\n\t\talert(\"Please enter a delivery country for the order.\");\n\t\treturn false\n\t}\n\tif (!isAlphaName(dco_str))\n\t{\n\t\talert(\"Please enter valid alphabetics for country name. You entered \" + dco_str);\n\t\t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Copy range replacing specific value.
function replace_copy(first, last, output, old_val, new_val) { return replace_copy_if(first, last, output, function (elem) { return comparators_1.equal_to(elem, old_val); }, new_val); }
[ "function replaceValue_(sheetObject, value, rowID, columnID) {\n var tempRange = sheetObject.getRange(rowID, columnID);\n //var values = [ value ];\n tempRange.setValue(value);\n return;\n}", "replaceRangeWith(from2, to, node) {\n replaceRangeWith(this, from2, to, node);\n return this;\n }", "overwri...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gera um personagem a partir das classes e niveis.
function GeraPersonagem(modo, submodo) { if (!submodo) { submodo = 'tabelado'; } var classe_principal = gPersonagem.classes[0]; if (tabelas_geracao[classe_principal.classe] == null) { Mensagem(Traduz('Geração de ') + Traduz(tabelas_classes[gPersonagem.classes[0].classe].nome) + ' ' + Traduz('não disponí...
[ "function _GeraFeiticos() {\n for (var i = 0; i < gPersonagem.classes.length; ++i) {\n var classe_personagem = gPersonagem.classes[i];\n var chave_classe = gPersonagem.classes[i].classe;\n // Tabela de geracao da classe.\n if (!(chave_classe in tabelas_geracao)) {\n continue;\n }\n // Tabela...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
methods setFaceColor(face, RGB) inputs face: "All" (String) RBG: [float, float, float]
setFaceColor( face, RGB) { // debug //console.log("atomicGLSphere("+this.name+")::setFaceColor"); var r = RGB[0]; var g = RGB[1]; var b = RGB[2]; // switch face switch(face){ case "All": this.colorsArray = []; for (var latNumber=0; latNumber <= this.latitudeBands; latNumber++) { ...
[ "setFaceColor ( face, RGB) {\n\t\t// debug\n\t\t//console.log(\"atomicGL(\"+this.name+\")::setFaceColor\");\n\t\tvar r = RGB[0];\n\t\tvar g = RGB[1];\n\t\tvar b = RGB[2];\n\n\t\t// switch face\n\t\tswitch(face)\n\t\t{\n\t\t\tcase \"All\":\n\t\t\t\tthis.colorsArray = [];\n\t\t\t\tfor(var i=0;i<=this.yrow;i++)\n\t\t\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Extracts saved places from database and displays them
function displaySavedPlaces() { const placesSnapshot = firebase.database().ref('users/'+ firebase.auth().currentUser.uid + '/places').once('value', function(placesSnapshot){ let placeArray = []; placesSnapshot.forEach((placesSnapshot) => { let place = placesSnapshot.val(); placeArray.push(place); ...
[ "function getPlaces(res, mysql, context, complete){\n\t\tmysql.pool.query('SELECT id, name FROM lotr_place', function(error, results, fields){\n\t\t\tif(error){\n\t\t\t\tres.write(JSON.stringify(error));\n\t\t\t\tres.end();\n\t\t\t}\n\t\t\tcontext.places = results;\n\t\t\tcomplete();\n\t\t});\n\t}", "function get...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
for SUI segmented button control component
function suiSegmentedButtons() { const segmentedControls = document.querySelectorAll('.sui-segmented-button'); for (let segControl of segmentedControls) { //initialize the first option as the selected option segControl.children[0].classList.add('sui-segmented-button-selected'); // assign a click event...
[ "static hostBtnSingleStep_click(btn) {\n /// Must do this first so the text label updates properly\n _SingleStepMode = !_SingleStepMode;\n /// Single Step Mode active\n if (_SingleStepMode) {\n /// Enable the \"Next Step\" button\n document.g...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Handle NPC movement on map
npcMovement() { this.game.npcs.map((npc) => { // Next movement allowed in 2.5 seconds const nextActionAllowed = npc.lastAction + 2500; if (npc.lastAction === 0 || nextActionAllowed < Date.now()) { // Are they going to move or sit still this time? const action = UI.getRandomInt(1, ...
[ "function move() {\n //moving map around\n loc.lat = map.getCenter().lat();\n loc.lng = map.getCenter().lng();\n loc.lat += dir.lat;\n loc.lng += dir.lng;\n map.panTo(loc);\n\n encounter(); //checking if player has walked over heatmap\n\n //checking if player has walked away enough to spawn ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Load a page for setting moderator
function load_add_remove_moderator_page() { page = 'add_remove_moderator'; load_page(); }
[ "function _settings_page() {\n}", "function loadPrivilegeSettingsPage(clearMsgs){\n clearMessages(clearMsgs);\n loadPageData(\"showAcessesPrivilegePage.html\",\"Privilege Settings\");\n}", "function ShowModeratorPage() {\r\n\tBuildApplications();\r\n\tdocument.getElementById(\"formSelector\").style.display ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Exit a parse tree produced by AgtypeParseragType.
exitAgType(ctx) { }
[ "exitParse(ctx) {\n\t}", "exitElementType(ctx) {\n\t}", "exitCompile_type_clause(ctx) {\n\t}", "exitReportGroupTypeClause(ctx) {\n\t}", "endParsing() {\n\n\t\t// Skip ending whitespace\n\t\tthis.skipWhitespace();\n\n\t\t// Check for container to select it as the value\n\t\tif (this.container) {\n\t\t\tthis....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
options: object with text: string pitch: optional number between 0 and 2. prompt: optional boolean (default false), whether to listen for a response after speaking
speak(options, callback) { const utterance = new SpeechSynthesisUtterance(options.text); // Workaround for Chrome garbage collection causing "end" event to fail to fire. // https://bugs.chromium.org/p/chromium/issues/detail?id=509488#c11 window.utterance = utterance; if (typeof options.pitch !== "u...
[ "function speakPolitely(option) {\n option = Object.create(option);\n option.polite = true;\n speak(option);\n }", "function speakHanlder() {\n // Object for speech synthesis\n const utterThis = new SpeechSynthesisUtterance(text.value);\n // Get the voice selected by the user\n const selecte...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
HELPER funcitons Googel Map service, location to geocode
function loc2geocode(query, flag) { console.log(query); $http.get('https://maps.googleapis.com/maps/api/geocode/json?key='+ GOOG_TOKEN+"&address="+query.loc).success(function(data) { // hack around var geocode = data.results[0].geometry.location; // lat, lng ...
[ "function locationToGeoCode() {\n\n }", "function geoCode(lugar){\n //usasmos la funcion axios con su parametro get (en la que hacemos peticion get \"obviously\") y le\n // pasamos nuestra URL de la que consumiremos el servicio, y concatenamos por medio de objetos\n //los parametros\n axios.get('https://maps...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
objectLens(k) Creates a total `lens` over an object for the `k` key.
function objectLens(k) { return lens(function(o) { return store(function(v) { return extend( o, singleton(k, v) ); }, o[k]); }); }
[ "function objectLens(k) {\n return lens(function(o) {\n return store(function(v) {\n return extend(\n o,\n singleton(k, v)\n );\n }, o[k]);\n });\n}", "function lensReduce(obj, keys) {\n const val = keys.reduce(\n (val, key) => (val === u...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets the smallest width this node can be.
get minWidth() { let width = Math.max(this.tree.theme.nodeMinWidth, this.input.minWidth); let title = 0; { let c = this.tree.canvas; let ctx = c.getContext("2d"); ctx.save(); ctx.font = this.tree.theme.headerFontSize + 'px ' + this.tree.theme.headerFontFamily; title = ctx.measureText(this.na...
[ "function widthOf(node) {\n return valOf(node, `.size.width`) * valOf(node, `.scale.x`);\n}", "function getWidth (node) {\n return parseInt(window.getComputedStyle(node).width, 10);\n }", "function getMinWidth(element){\n var thisMinWidth = getStyle(element, \"minWidth\");\n return to...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Constructs a new FilterAndSort.
constructor() { FilterAndSort.initialize(this); }
[ "function AndFilter() {\n this.subFilters = [];\n}", "function createFilters() {\n\n}", "function SourceFilterParser(filterText) {\n // Final output will be stored here.\n this.filter = null;\n this.sort = {};\n this.filterTextWithoutSort = '';\n var filterList = parseFilter_(filterText);\n\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Switch to iframe by iframe selector Elements/widgets ( like dialogs, status bars and more) located inside an iframe has to be switch to it
function switchToFrame(iframeSelector) { chillOut(); Reporter_1.Reporter.debug('Switching to an Iframe'); isExist(iframeSelector); Reporter_1.Reporter.debug(`Get iframe element ${iframeSelector}`); const frameId = tryBlock(() => browser.element(iframeSelector).value, `Failed to g...
[ "function switchToFrame(iFrame) {\n browser.switchToFrame(iFrame)\n }", "function changeIframeToEditor()\n{\n for(var j=0;j<arguments.length;j++)\n {\n var i=0;\n\t while(document.all.tags('iframe')[i])\n\t { \n\t\tif(document.all.tags('iframe')[i].id == arguments[j])\n\t\t { changetoIframeEdit...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get coach timeslot info for a given date
function getTimeslots(date, callback) { const q = ` SELECT user_id, date, time, duration FROM Timeslots WHERE date = ? ;`; const timeslots = {}; db.each(q, [date], (err, row) => { if (err) return callback(err); timeslots[row.user_id] = { starttime: row.time, duration: row.duration, }...
[ "function getTimeslot(date) {\n const minutes = date.getHours() * 60 + date.getMinutes();\n const timeslot = {\n slot: Math.floor(minutes / TSLength),\n day: getDayEncoding(date)\n };\n return timeslot;\n}", "function getClockings(date) {\n return fetch(getPunchUrl(date))\n ....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
helper function that set our sticky header width = parent.style.width
function calcWidth() { stickyHeader.style.width = window.getComputedStyle(document.querySelector(mountQuerySelector), null).getPropertyValue('width'); }
[ "function setOuterWidth() {\n outerWidth = wrap.offsetWidth;\n dragBarPos = calcDragBarPosFromCss() || Math.floor(outerWidth / 2) - 5;\n }", "function adjustHeaderWidth() {\n\tvar header = dom.queryOne('#playing-header');\n\tvar left = dom.queryOne('#radio-seed');\n\tvar right = dom...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Copyright (c) Microsoft Corporation. A helper to decide if a given argument satisfies the Pipeline contract
function isPipelineLike(pipeline) { if (!pipeline || typeof pipeline !== "object") { return false; } const castPipeline = pipeline; return (Array.isArray(castPipeline.factories) && typeof castPipeline.options === "object" && typeof castPipeline.toServiceClientOptions === "functio...
[ "function isPipe(){\n\treturn isMatch(pipe, getPipe());\n}", "static pred(arg) {\n let argtype = Argbind.of(arg);\n switch (argtype) {\n // Returns TRUE if value of arg is included in array of acceptable types:\n case \"ARRAY\":\n return x => arg.includes(x);\n // Assumes we are only m...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
def generate_cubes_until(modulus): """ Generates the cubes of integers greater than 0 until the next is 0 modulo the provided modulus. >>> list(generate_cubes_until(25)) [1, 8, 27, 64] """ pass
function generateCubesUntil(modules) { if (modules === 0) return null; let total = 1; let range = [1]; let i = 2; while (total % modules !== 0) { let cube = i ** 3; total += cube; range.push(cube); i++; } return range; }
[ "function generateCubes(cubeSize, cubeNum) {\n\n //Offset between cubes\n let xOff = 0;\n let yOff = 0;\n let zOff = 0;\n let init = true;\n\n for (let ix = 0; ix < cubeNum; ix++) {\n //delta = cube-size + distance between cubes\n xOff += delta;\n for (let iy = 0; iy < cubeNum; iy++) {\n yOff +=...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Maybe DONT NEED!! Called when a user login Tell frontend the unread message number of this user Use socket.io
UnreadCount (socket, username){ let dboper = new PrivateChatDBOper("", username, url); //emit individual count of unread msg(private) dboper.GetCount_IndividualUnreadMsg(function(statuscode, results){ if(statuscode==success_statuscode) socket.emit("IndividualPrivateUnreadMsgCnt", r...
[ "function update_unread_count() {\n GET(\n\t'/api/user/info/unread',\n\t{},\n\tfunction(xhr) {\n\t var result = JSON.parse(xhr.responseText)\n\t if(result.code == 0) {\n\t\treplyme_link.textContent = printf(\n\t\t '%1(%2)',\n\t\t replyme_link.dataset.content,\n\t\t result.data['reply']\n\t\t);\n\t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Atualiza a quantidade de visitar no site, utilizando o LocalStorage
function updateVisit() { let div = document.getElementById("count"); if (localStorage === null || typeof (Storage) === 'undefined') { document.write("Sem suporte para Web Storage"); } localStorage.count === undefined ? visitCount(div, true) : visitCount(div, false); }
[ "function updateVisit() {\n if (typeof (Storage) != \"undefined\") {\n if(localStorage.count !== undefined) {\n localStorage.count = parseInt(localStorage.count) + 1;\n document.getElementById(\"count\").innerHTML = localStorage.count;\n } else {\n localStorage.count = 1;\n document.getEl...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Helper function that returns a data object used in vis.Network(container, data, options). The object consists of nodes and edges, where there are n nodes, and a random amount of edges
function getRandomNetwork(numberNodes) { nodesArray = new vis.DataSet([]); edgesArray = new vis.DataSet([]); let probability = 0.13; // make n nodes for (let i = 0; i < numberNodes; i++) { nodesArray.add({id: i, label: "Node " + i}); } // populate edges for (let i = 0; i < numb...
[ "function generateNewData() {\n // Reset the data object back to its empty state.\n data.nodes = [];\n data.links = [];\n\n // Create nodes.\n for (let i = 0; i < NUMBER_OF_NODES; i++) {\n let node = {\n index: i,\n color: d3.interpolateRai...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Add a highlight halo to a specified map item(s). svg Root svg element to find things in selector An svg selector for items. filter A predicate run on selected items
function highlightMapLocations(svg, selector, filter, retries) { if (filter === undefined) {filter = function(d,i) {return true;}} var items = svg.selectAll(selector).filter(filter) if (items.empty()) { if (retries === undefined) {retries = 20;} if (retries > 0) { console.error("Retry highlight")...
[ "function identifyHighlights(itemList, filter) {\n if (!Array.isArray(itemList)) {\n return itemList;\n }\n if (!Array.isArray(filter)) {\n if (filter === true || filter === \"all\") {\n filter = [\"all\"]\n } else if (typeof filter === \"object\") {\n filter = Object.keys(filt...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function to get assigned doctors of current user Will be replaced by user.getAssignedDoctors() eventually when server functionality is added
function getAssignedDoctors() { // Make fake doctors for now createDoctor(0, 'password', 'doctor1@gmail.com', '(123) 456 - 7890', 'Doc', 'Tor', 'Cardiology', '123 Fake Street'); createDoctor(1, 'password', 'doctor2@gmail.com', '(123) 456 - 7890', 'Some', 'Doctor', 'Neurology', '123 Fake Avenue'); creat...
[ "function getCompDoctors(compID) {\n var docList = []\n var companion = getCompanion(compID)\n\n if (companion.doctors){\n // loop through each doctor\n for (var docID of companion.doctors) {\n let doc = getDoctor(docID)\n docList.push(doc)\n }\n }\n\n retur...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
objDim This function is shorthand for new Dim(objW(o, w), objH(o, h)) Specifying w as 1 is equivalent to o.style.width = o.offsetWidth Specifying h as 1 is equivalent to o.style.height = o.offsetHeight Prototype: Dim objDim(Object o[,[Dim d][int w, int h]]) Arguments: o ... An HTML Element object d ... An optional Dim ...
function objDim(o) { var w, h; if (arguments.length == 3) { w = arguments[1]; h = arguments[2]; } else if (arguments.length == 2) { w = arguments[1].w; h = arguments[1].h; } var d = new Dim(objW(o, w), objH(o, h)); return d; }
[ "function Dim(a,c){this.w=a;this.h=c;return true}", "function dim( w, h ) {\n return { w: w, h: h };\n}", "function Dim(w, h) {\r\n this.w = w;\r\n this.h = h;\r\n\r\n this.toString = function() {\r\n return this.w + 'x' + this.h;\r\n };\r\n}", "function dim() {\r\n var d = _dfa(arguments);\r\n\r\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Transform a filename into a uid, by splitting on '.'.
function fileUid(filename) { var tokens = filename.split('.'); if ( tokens.length === 0 ) return tokens[0]; return tokens.slice(0, tokens.length-1).join('.'); }
[ "function generate_file_user_ids() {\n let cur_file_id = 0;\n for (let f in path_to_file) {\n filepath_to_id[f] = cur_file_id;\n id_to_filepath[cur_file_id] = f;\n cur_file_id += 1;\n }\n\n let cur_user_id = 0;\n for (let u in all_users) {\n username_to_id[u] = cur_user_id...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Dequeue the next key and set its bit. Return whether a key was processed.
processKeyQueue() { const keyActivity = this.keyQueue.shift(); if (keyActivity === undefined) { return false; } this.shiftForce = keyActivity.keyInfo.shiftForce; const bit = 1 << keyActivity.keyInfo.bitNumber; if (keyActivity.isPressed) { this.keys...
[ "function runKeyQueue() {\n if( keyQueue.length > 0 ) {\n const key = keyQueue.shift();\n keypress.send({ keyCode: key.charCodeAt(0), force: true });\n return false;\n }\n\n return true;\n}", "canDequeue() {\n return Object.keys(this.queue).length && (Object.keys(this.running).len...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }