query
stringlengths
9
34k
document
stringlengths
8
5.39M
negatives
listlengths
19
20
metadata
dict
Sprite_StateIcon The sprite for displaying state icons.
function Sprite_StateIcon() { this.initialize.apply(this, arguments); }
[ "function Sprite_StateIcon() {\n this.initialize(...arguments);\n}", "function Sprite_StateOverlay() {\n this.initialize.apply(this, arguments);\n}", "function StateShape() { }", "function State() { }", "function UIState() {}", "get iconRenderState() {\n if (this.m_iconRenderStates === undefi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates a RFC4122compliant GUID, see This may not be a good enough random distribution.
function createGUID() { var s = []; var hexDigits = "0123456789abcdef"; for (var i = 0; i < 36; i++) { s[i] = hexDigits.substr(Math.floor(Math.random() * 0x10), 1); } s[14] = "4"; // bits 12-15 of the time_hi_and_version field to 0010 s[19] = hexDigits.substr((s[19] & 0x3) | 0x8, 1); // bits 6-7 of t...
[ "static newGuid() {\n let result = '';\n let i = '';\n for (let j = 0; j < 32; j++) {\n if (j === 8 || j === 12 || j === 16 || j === 20) {\n result = result + '-';\n }\n i = Math.floor(Math.random() * 16).toString(16).toUpperCase();\n r...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Define a function that returns whether a given tree is on fire
function TreeIsOnFire(tree) { return tree.style.backgroundColor === "red"; } // end function TreeIsOnFire(tree)
[ "function NeighborIsOnFire(tree) {\n\n return TopNeighborIsOnFire(tree) ||\n LeftNeighborIsOnFire(tree) ||\n RightNeighborIsOnFire(tree) ||\n BottomNeighborIsOnFire(tree);\n\n}", "isSumTree() {\n\n }", "isTree() {\n return !this.isCyclic() && isConnected();\n }", "function isUn...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Check whether the tuple has been collapsed
function isCollapsed(tuple, collapsed) { var name = tuple.members[0].parentName; for (var idx = 0, length = collapsed.length; idx < length; idx++) { if (collapsed[idx] === name) { console.log(name); return true; } ...
[ "_isCollapsed(data) {\r\n let parent = data.parent;\r\n\r\n while (parent) {\r\n if (!parent.expanded) {\r\n return true;\r\n }\r\n\r\n parent = parent.parent;\r\n }\r\n\r\n return false;\r\n }", "function hasTuple(array) { return !arr...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns an icon for an element. The element should have an entry point and origin in it's dataset.
function getIconByElement(element) { var elEntryPoint = element.dataset.entryPoint; var elOrigin = element.dataset.origin; for (var i = 0, iLen = icons.length; i < iLen; i++) { var icon = icons[i]; if (icon.entryPoint === elEntryPoint && icon.app.origin === elOrigin) { return icon; ...
[ "function addIcon(element){\n var image_path = \"/archibus/schema/ab-core/graphics/icons/tick-white.png\";\n var src = image_path;\n \n var img = document.createElement(\"img\");\n img.setAttribute(\"src\", src);\n img.setAttribute(\"border\", \"0\");\n \n img.setAttribute(\"align\", \"middl...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Test if the current input matches rx, and advance the input if it did (by modifying the variable in parseExprRecursive's closure)
function matches(rx) { if(rx.test(str)) { str = str.substring(RegExp.lastMatch.length); return true; } return false; }
[ "match(rexp, di = 0) {\n return rexp.exec(this.rest(di));\n }", "next() {\n for (let off = this.matchPos - this.curLineStart;;) {\n this.re.lastIndex = off;\n let match = this.matchPos <= this.to && this.re.exec(this.curLine);\n if (match) {\n let from = ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Takes the account which has claimed a transaction.
async updateClaimed(account) { const found = this.stats.find({ account })[0] found.claimed += 1 let bal = await this.eac.Util.getBalance(account) bal = new BigNumber(bal) const difference = bal.minus(found.currentEther) found.currentEther = found.currentEther.plus(difference) this.stats.upda...
[ "async queryAccount() {\n const acc = await this.attachWallet();\n const bal = await acc.balanceOf();\n this.appendMsg(`Account balance is ${bal}`);\n }", "reserveAccount({ accountRef, accountName, clientEmail, clientName }) {\n return __awaiter(this, void 0, void 0, function* () {\n t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Filter events by type
function filterEventsByType(events, type){ var results = []; events.forEach(function(event) { if(event.getTitle().indexOf(type) == 0){ Logger.log('%s (at %s) is an event of type %s', event.getTitle(), event.getStartTime(), type); results.push(event); } }); return results; }
[ "handleEventFiltering() { this.filteredEvents = this.filterByType(this.events, this.eventType); }", "function filterByType(event) {\n const selectedType = event.target.getAttribute(\"data-type\");\n critterLayerView.filter = {\n where: \"critter_type = '\" + selectedType + \"'\"\n };\n }", "funct...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
function to handle errors when posting data to server
function postErrorHandler(xhr, status, error) { console.log('error when posting to server') console.log(`POST Error: ${error}`); console.log(`Status: ${status}`); console.log(`XHR: ${xhr}`); alert(`POST Error ${error}`) }
[ "function update_error(){\n // your code when post failed\n console.log(\"error!\");\n}", "onFail (error) {\n this._submitting = false\n\n if (error.response) {\n this.errors.set(error.response.data)\n } else if (error.request) {\n window.error('There was no response from our server. Ar...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Map the update states from Rally
function setUpdateTypes() { updateStates.complete = 'Completed'; updateStates.accepted = 'Accepted'; updateStates.inprogress = 'In-Progress'; updateStates.blocked = 'Blocked'; updateStates.unblocked = 'Unblocked'; storyUpdateStates.complete = 'COMPLETED'; storyUpdateStates.accepted = 'ACCEPTED'; storyUpdateSta...
[ "function updateStateMaps() {\n // XXX\n }", "mapUpdated () { return {}; }", "updateStates() {\n this._stateTracker.forEach(trackedState => {\n trackedState.update();\n });\n }", "getUpdates() {\n this.hasUpdate = false;\n let updates = [];\n for (let [id, part] of Object.entries(this...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Ends the game, by calling its end closure reference, if there's one.
end() { this.isOver = true; this.isRunning = false; if (typeof this.onGameOver === 'function') { this.onGameOver(); } }
[ "function end() {\n game.end();\n console.log('End!!, thank you for playing');\n }", "function endGame() {\n\n}", "end() {\n this[ENGINE][PROC](new GameEvent('gameend'));\n this[ENGINE].end();\n window.cancelAnimationFrame(this[ENGINE][RAF]);\n this[ENGINE][RAF] = null;\n this[ENGINE][ROOM...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Add spinner stylesheet tag in head section. All stylesheet URL are from CDN. Using Load Awesome CSS Spinner.
addSpinnerStylesheet() { this.setSpinnerStylesheetURL(); let link = document.createElement('link'); link.setAttribute('id', 'loading-overlay-stylesheet'); link.setAttribute('rel', 'stylesheet'); link.setAttribute('type', 'text/css'); link.setAttribute('href', this.spinne...
[ "createSpinner() {\n\t\t$(\"body\").append($(\"<div/>\").addClass(\"aimeos-spinner\"));\n\t}", "function addSpinner () {\n spinner = new CanvasLoader(\"spinner\");\n spinner.setShape(\"spiral\");\n spinner.setDiameter(90);\n spinner.setDensity(90);\n spinner.setRange(1);\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Create the class name for the button icon.
createIconClass(data) { const name = 'jp-Dialog-buttonIcon'; const extra = data.iconClass; return extra ? `${name} ${extra}` : name; }
[ "createIconClass(data) {\n let name = 'jp-Dialog-buttonIcon';\n let extra = data.iconClass;\n return extra ? `${name} ${extra}` : name;\n }", "getIconClassName() {\n return (ToolIcons[this.props.step.component] || 'fa fa-cogs') + ' fa-2x pr-2';\n }", "function getIcon...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns the integer b, 0 <= b < n, such that b is congruent to a mod n. We don't use `a % n` because that gives remainder, not congruence. For example, `1 % 5` returns `1`, whereas `mod(1, 5)` returns `4`.
function mod(a, n) { return (((a % n) + n) % n); }
[ "function mod(a, n) {\n return ((a % n) + n) % n;\n }", "function mod(a,n) {\n return ((a % n) + n) % n;\n}", "function mod(a, b) {\n const result = a % b;\n return result >= _0n ? result : b + result;\n}", "function mod( a, b ){ let v = a % b; return ( v < 0 )? b+v : v; }", "function mod(a...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Create all elements for modal, set respective classes, content; apply everything to DOM; add event listener to button to restart the game
function createModal() { let background = document.createElement('div'); let content = document.createElement('div'); let span = document.createElement('span'); let icon = document.createElement('i'); let text1 = document.createElement('p'); let text2 = document.createEle...
[ "static createModal() {\n const modal = document.createElement(\"div\");\n modal.id = \"uwu__modal1312\";\n modal.classList.add(\"uwu__hide1312\");\n\n modal.onmousedown = function (e) {\n if (e.currentTarget !== e.target) return;\n modal.classList.remove(\"uwu__show1312\");\n };\n\n doc...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns a list of directives extracted from the given view based on the provided list of directive index values.
function getDirectivesAtNodeIndex(nodeIndex,lView,includeComponents){var tNode=lView[TVIEW].data[nodeIndex];var directiveStartIndex=tNode.directiveStart;if(directiveStartIndex==0)return EMPTY_ARRAY;var directiveEndIndex=tNode.directiveEnd;if(!includeComponents&&tNode.flags&1/* isComponent */)directiveStartIndex++;retur...
[ "function getDirectivesAtNodeIndex(nodeIndex, lView) {\n const tNode = lView[TVIEW].data[nodeIndex];\n if (tNode.directiveStart === 0) return EMPTY_ARRAY;\n const results = [];\n for (let i = tNode.directiveStart; i < tNode.directiveEnd; i++) {\n const directiveInstance = lView[i];\n if (!isComponentInsta...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
MSAL JS Library Version
function libraryVersion() { return "1.1.3"; }
[ "function libraryVersion() {\n return \"1.3.3\";\n}", "function getVersion(){\n return VERSION;\n}", "function getVersion(){\n return version\n }", "function jsVersion() {\n _jsVersion(); \n return jsVer;\n}", "function GetVersion() {\r\n return exports.PACKAGE_JSON.version;\r\n}", "...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Checks whether the push notification permission has been granted.
function hasPermission() { var deferred = $q.defer(); $ionicPlatform.ready(function hasPermissionDeviceReady() { if($window.PushNotification) { $window.PushNotification.hasPermission(function getPermission(data) { deferred.resolve(data.isEnabled); }); } else { deferred.reject('Oops!...
[ "function checkPermission() {\n if(! (\"Notification\" in window)) {\n log.w(\"Notifications are not supported\");\n return Promise.resolve(false);\n } else {\n if (Notification.permission !== \"granted\") {\n return Notification.requestPermission()\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
HELPER FUNCTIONS Remove all docs from questions collections
function deleteQs() { return db.Question.remove({}) }
[ "function dropQuestions() {\n common.dropCollection(data.mongo_url.test, 'questqs', dropQuests);\n }", "function resetDoc() {\n for (var qid in questions) {\n var q = questions[qid];\n if (q.sel.length != 0) {\n if (! q.cloning) {\n qReset(q);\n formatQuestion(q);\n }\n }...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
CHECKING IF GHOSTS ARE STILL EDIBLE AND IF YES ADD THE BLINKING CLASS
function checkGhost1() { if (cells[ghost1].classList.contains('edibleGHOST1')) { cells[ghost1].classList.remove('edibleGHOST1') cells[ghost1].classList.add('edibleGHOST1B') } }
[ "function addClasses( element ) {\n\n element.className += ' giflink ready';\n\n if ( element.href ) {\n element.className += ' has-link';\n } else {\n element.className += ' no-link';\n }\n }", "function addToBlushlist(aHost) {\n let key = bpUtil.getKeyForHost(aHost);\n storage.blushlist...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns a native JS wrapper for a C function. This is similar to ccall, but returns a function you can call repeatedly in a normal way. For example: var my_function = cwrap('my_c_function', 'number', ['number', 'number']); alert(my_function(5, 22)); alert(my_function(99, 12));
function cwrap(ident, returnType, argTypes) { var func = getCFunc(ident); return function() { return ccallFunc(func, returnType, argTypes, Array.prototype.slice.call(arguments)); } }
[ "function cwrap(ident, returnType, argTypes) {\r\n var func = getCFunc(ident);\r\n return function() {\r\n return ccallFunc(func, returnType, argTypes, Array.prototype.slice.call(arguments));\r\n }\r\n}", "function cwrap(ident, returnType, argTypes) {\n var func = getCFunc(ident);\n return function ()...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Replace existing content from the start to the current cursor position.
replaceBeforeCursor(start, text) { this.insertBetween(start, this.el.selectionStart, text); }
[ "insert(pos, content) {\n return this.replaceWith(pos, pos, content);\n }", "function updateContent(newContent) {\n if (newContent !== content) {\n content = newContent;\n _lineStartIsDirty = true;\n editRanges = [];\n scriptVersion++;\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
void _Attribute.GetTypeInfo(uint32 iTInfo, uint32 lcid, System.IntPtr ppTInfo)
GetTypeInfo() { }
[ "GetTypeInfoCount() {\n\n }", "function affilate(methodInfo) {\n var abc = methodInfo.abc;\n var body = methodInfo.getBody();\n var code = body.code;\n var q = [];\n var type = 0;\n var lastType = 0;\n var _loop_1 = function (i) {\n var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Constructor for the Desktop module
function Desktop () { this.activeWindow = false this.mouseMoveFunc = this.mouseMove.bind(this) this.mouseUpFunc = this.mouseUp.bind(this) this.windows = [] this.clickX = 0 this.clickY = 0 this.serialNumber = 0 this.zIndex = 0 this.offsetX = 1 this.offsetY = 1 this.launcher = new Launcher(this) }
[ "function Desktop() {\n this.activeWindow = false;\n this.mouseMoveFunc = this.mouseMove.bind(this);\n this.mouseUpFunc = this.mouseUp.bind(this);\n this.windows = [];\n this.clickX = 0;\n this.clickY = 0;\n this.serialNumber = 0;\n this.zIndex = 0;\n this.offsetX = 1;\n this.offsetY =...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Alters the current overlay to a different overlay
function switchOverlay(index) { getOverlay().setVisibility(false); map.layers[index].setVisibility(true); forceRedraw(); }
[ "function _modifyOverlay() {\n\t var overlays = Utils.getElesFromClassName(Constants.OVERLAY_STYLE);\n\t if (Utils.hasELement(overlays)) {\n\t if (overlays.length !== 1) {\n\t overlays.remove();\n\t var overlay = _createOverlayNode({\n\t width: Utils.getFullWindowWi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
handle selecting a specific question from history
function changeQuestion(question){ let li = question.target.closest('li'); let node = Array.from(document.querySelector("#history").children); let index = node.indexOf(li); currentQuestion = index; renderQuestion(quizHistory[index]); }
[ "function setNextHardHistoryQuestion() {\n\n resetState();\n\n showQuestion(hardHistoryQuestionsArray[currentQuestionIndex]);\n}", "function selectPrevQuestion () {\n if (window.store.selected > 0) {\n selectQuestionAndSetButtons(window.store.selected - 1)\n } else {\n selectQuestionAndSetButtons(wi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns the mbean for the given camel context ID or null if it cannot be found
function getCamelContextMBean(workspace, camelContextId) { var contextsFolder = getCamelContextFolder(workspace, camelContextId); if (contextsFolder) { var contextFolder = contextsFolder.navigate("context"); if (contextFolder && contextFolder.children && contextFolder.children.le...
[ "function camelContextMBeansByRouteId(workspace) {\n return camelContextMBeansByRouteOrComponentId(workspace, \"routes\");\n }", "function camelContextMBeansById(workspace) {\n var answer = {};\n var tree = workspace.tree;\n if (tree) {\n var camelTree = tree.navigate(Cam...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
switch loaded units sides
function switchUnitsSides() { var topUnits = new Object(); var bottomUnits = new Object(); // get top units and add them to an object $("#simulator-army-top").find(".simulator-unit-holder.unit-visible").each(function(){ var key = $(this).find(".unit").attr("class").replace(/ /g,"."); ...
[ "modeBtnAction() {\n console.log('Toggling scale mode/unit')\n this._unit = trickler.TricklerUnits.GRAINS === this._unit ? trickler.TricklerUnits.GRAMS : trickler.TricklerUnits.GRAINS\n }", "setUnitVector() {\n let length = Math.sqrt(this.curVector[0][0] ** 2 + this.curVector[1][0] ** 2);\n l...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Lightweight plugin dependency management to require plugins and code mods on demand. This uses the `dependencies` stanza (a `Set`) exposed by `puppeteerextra` plugins.
resolvePluginDependencies() { // Request missing dependencies from all plugins and flatten to a single Set const missingPlugins = this._plugins .map(p => p._getMissingDependencies(this._plugins)) .reduce((combined, list) => { return new Set([...combined, ...list]...
[ "resolvePluginDependencies () {\n // Request missing dependencies from all plugins and flatten to a single Set\n const missingPlugins = this._plugins\n .map(p => p._getMissingDependencies(this._plugins))\n .reduce((combined, list) => {\n return new Set([...combined, ...list])\n }, new Se...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
animation insertion with saturation
function animation_insertion_with_saturation (direction) { str = "show_arrow ("+direction+")"; setTimeout(str, 0); str = "animation_flag_with_saturation ("+direction+")"; setTimeout(str, 3000); str = "animation_direction_overflow_area ("+(gen_inf['free_mem_loc']-1)+")"; setTimeout (str, 5000); str = "hide...
[ "function animation_insertion_with_saturation (direction) { \n var initial = direction;\n var end = gen_inf['mem_loc'];\n \n for (i=0; i< (sel_val['mem_cap']); i++){\n hide_animation (i);\n }\n \n str = \"show_arrow (\"+direction+\")\";\n setTimeout(str, 0);\n str = \"animation_flag_with_saturation...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get the date of a game Returns an array with the date and time in that order
function getMatchDate(match) { var utcSeconds = match['gameCreation']; var d = new Date(utcSeconds); var day = Utilities.formatDate(d, 'JST', "yyyy-MM-dd"); var time = Utilities.formatDate(d, 'JST', "HH:mm"); return [day, time]; }
[ "function determine(){\n var currentTime = new Date();\n var games = [];\n\n var game1 = new Date('September 18, 2015 21:00:00');\n games.push(game1);\n var game2 = new Date('September 19, 2015 13:00:00');\n games.push(game2);\n var game3 = new Date('September 19, 2015 15:30:00');\n games.push(game3);\n va...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
this is to fix a bug in which the laser can hit more than one enemy move the laser from the player to the alien
function moveLaser() { canShoot = false; if(!isGamePaused && !isGameOver) { squares[currentLaserPos].classList.remove("laser"); currentLaserPos -= GRID_WIDTH; squares[currentLaserPos].classList...
[ "function move_enemy_soldiers()\n{\n\tfor (var i = 0; i < eArmy.eFootSoldiers.length; i++)\n\t{\n\t\tif (!eArmy.eFootSoldiers[i].fight)\n\t\t{\n\t\teArmy.eFootSoldiers[i].x -= eArmy.eFootSoldiers[i].speed;\n\t \tif (eArmy.eFootSoldiers[i].img_status < 8)\n\t\t\t{\n\t\t\t\teArmy.eFootSoldiers[i].img_status += 1;\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
convert all mongodb objects in the given day to the corresponding object made with the custom constructor functions
function convertFromMongo(day) { if (day.hotel) { day.hotel = new Hotel(day.hotel, true); } if (day.restaurants.length) { day.restaurants = day.restaurants.map(function(rest) { return new Restaurant(rest, true); }); } if (day.thingsToDo.length) { day.thingsToDo = day.thingsToDo.map(function(thing) { ...
[ "function transformToObject(dayArray){\n const date = dayArray[0].dt_txt;\n let temp_min = dayArray[0].main.temp_min;\n let temp_max = dayArray[0].main.temp_max;\n const weatherArray = [dayArray[0].weather[0].main];\n const descriptionArray = [dayArray[0].weather[0].description];\n const iconArray...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Return whether the given type is builtin
function isBuiltIn(type) { return !!BUILTINS[type]; }
[ "function isBuiltIn(type){return!!BUILTINS[type];}", "function isBuiltIn(type) {\n return !!BUILTINS[type];\n}", "function isBuiltIn(type) {\n return !!BUILTINS[type];\n }", "isBuiltin() {\n return this._is_builtin;\n }", "function isBuiltinType(fn) {\n return (\n // scalars\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Display Logo, and call start function
function logoArt() { console.log(logo(config).render()); start(); }
[ "function start() {\n const logoText = figlet.textSync(\"Employee Database Tracker!\", 'Standard');\n console.log(logoText);\n loadMainPrompt();\n}", "function showSplash() {\n const logo = asciiArtLogo({\n name: \"Employee Tracker\",\n description: \"View and organize departments, roles, and empl...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Calculate seg.forwardCoord and seg.backwardCoord for the segment, where both values range from 0 to 1. If the calendar is lefttoright, the seg.backwardCoord maps to "left" and seg.forwardCoord maps to "right" (via percentage). Viceversa if the calendar is righttoleft. The segment might be part of a "series", which mean...
function computeSlotSegCoords(seg, seriesBackwardPressure, seriesBackwardCoord) { var forwardSegs = seg.forwardSegs; var i; if (seg.forwardCoord === undefined) { // not already computed if (!forwardSegs.length) { // if there are no forward segments, this segment sh...
[ "function computeSlotSegCoords(seg, seriesBackwardPressure, seriesBackwardCoord) {\r\n\tvar forwardSegs = seg.forwardSegs;\r\n\tvar i;\r\n\r\n\tif (seg.forwardCoord === undefined) { // not already computed\r\n\r\n\t\tif (!forwardSegs.length) {\r\n\r\n\t\t\t// if there are no forward segments, this segment should bu...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sets pressed class for button.
function setPressButtonState() { recordBtn.classList.add('pressed'); recordBtnIcon.classList.add('pressed'); }
[ "function touchstarthandler(event)\r\n{\r\n var button= event.target;\r\n button.className =\"pressed\";\r\n}", "function animatePress(currentColor) {\r\n\r\n //jQuery to add the pressed class to the button that gets clicked\r\n $(\"#\" + currentColor).addClass(\"pressed\");\r\n\r\n //remove the pressed ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
decrease quantity by 1
decrement(itemData) { if (itemData.quantity == 0) return; itemData.quantity -= 1 this.props.setItemQuantity(itemData); }
[ "function decrement() {\n setQuantity(+quantity - 1)\n }", "function decrementQuantity(item){\n if(item.quantity != 1)\n {\n item.quantity--;\n }\n }", "function decrement(item) {\n item.quantity--;\n }", "DecrementQuantity() {\n this.quantity--;\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Generate the WebSocket accept key
function generate_ws_accept(headers) { const magic = headers['sec-websocket-key'] + "258EAFA5-E914-47DA-95CA-C5AB0DC85B11"; const hash = crypto.createHash('sha1'); hash.update(magic); return hash.digest().toString('base64'); }
[ "function generateKey (){\n var key = keygen._({\n length: 16\n });\n\n return key;\n}", "function genhostkey() {\n connection.createOffer().then(function(hostdesc) {\n connection.setLocalDescription(hostdesc)\n })\n connection.onicecandidate = function(event) {\n var hostke...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function for changing backup query
changeBackupQuery(event, paramName) {}
[ "function backupDatabase(databaseName, backupType)\n {\n /*\n function \"checkDatabaseExists\" checks that database exists on server\n parameters:\n databaseName: the name of database to be checked\n returns: 0; //database does not exists\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Retrieve a list of active projects.
async getActiveProjects() { return await this.request({ name: 'project.list', page: Page.builder().status('ACTIVE').all() }); }
[ "function getActiveUserProjects() {\n var async = $q.defer();\n // var activeUserId = userSrv.getActiveUser().id;\n\n var projects = [];\n\n const parseProject = Parse.Object.extend('Project');\n const query = new Parse.Query(parseProject);\n query.equalTo(\"userId\", Parse.User.current());\n q...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function editRow Fungsi untuk passing parameter dari table ke field num = Nomor Urut Baris field = list dari field dengan format 'field1field2' value = list dari nilai yang di pass dengan format 'value1value2'
function editRow(num,field,value,freeze) { var fieldJs = field.split("##"); // Extract Updated Value value = ''; for(i=1;i<fieldJs.length;i++) { var tmp = document.getElementById(fieldJs[i]+"_"+num); if(tmp) value += "##"+tmp.getAttribute('value'); } var valueJs = value.split("##"); var add = ...
[ "function edit_tr(obj) {\n if (rowIndex != -1) {\n var type = $('.left')[0];\n var table = $('table')[0];\n\n var stringValue;\n var can_edit_row = false;\n\n if (type.value == 'Integer') {\n stringValue = $('.input_data')[0].value;\n if (!isNaN(parseInt(s...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Step 8: Call Write a function duckCount that returns the number of arguments passed to it which have a property 'quack' defined directly on them.Do not match values inherited from prototypes.
function duckCount() { return Array.prototype.slice.call(arguments) .reduce(function(sum, maybeDuck) { if (Object.prototype.hasOwnProperty.call(maybeDuck, 'quack')) { return sum + 1; } else { return sum; } }, 0); }
[ "function count_ducks(duck_array) {\n\t\n\tvar tot_ducks = 0;\n\n\tfor(i in duck_array) {\n\t\ttot_ducks = tot_ducks + duck_array[i];\n\t}\n\n\treturn tot_ducks;\n\n}", "getArgumentCount() {\n return this.hasAnArrayArgument ? Number.MAX_SAFE_INTEGER : Object.keys(this.arguments).length;\n }", "function arg...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Listing businesses based on their category
list_category(req, res){ return businesses .findAll({ where: { category: req.params.category, } }) .then((result) => res.status(201).send(result)) .catch((error) => res.status(400).send(error)) }
[ "renderBusinesses() {\n let filters = Object.keys(this.state.categories).filter(c => this.state.categories[c]);\n let term = this.state.search;\n \n return this.props.businesses.filter(biz => (filters.includes(biz.category) && (term == \"\" || term == biz.name || term == biz.category || term == biz.coun...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sample 25 Set the src attribute of the element whose ID is sample2img
function sample2_5_1() { var element = document.getElementById('sample-2-img'); element.setAttribute('src', 'img/hub1.jpg'); }
[ "function changeImage(){\r\n //step1 - select the arrays lit\r\n //step2 - choose a random one\r\n //step3 - get the data- atribute\r\n //step4 - change the content/value of data to new src\r\n \r\n var arr = getAllThumbs();\r\n var element = arr[Math.floor(Math.random() * arr.length)];\r\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Deletes one entity instance matching filters.
async deleteOne(filter) { let selectedProfile = await this.findOne(filter); console.log(selectedProfile); await this.db.collection(this.config.collection).doc(selectedProfile.id).delete(); return selectedProfile; }
[ "async deleteFilter() {\r\n try {\r\n let result = await FilterSettings.deleteOne({ _id: this.req.params.filterId });\r\n if (result.ok && result.deletedCount) {\r\n return this.res.send({ status: 1, data: result, message: i18n.__(\"DELETED_SUCCESSFULLY\"), });\r\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
update quiz result orders
function update_quiz_result_orders() { $("#quiz_results_container .panel-quiz-result").each(function (index) { var result_id = $(this).attr('data-result-id'); $('#quiz_result_order_' + result_id).text(index + 1); $('#input_quiz_result_order_' + result_id).val(index + 1); }); }
[ "function updateQuizResultOrders() {\n $(\"#quiz_results_container .panel-quiz-result\").each(function (index) {\n var resultId = $(this).attr('data-result-id');\n $('#quiz_result_order_' + resultId).text(index + 1);\n $('#input_quiz_result_order_' + resultId).val(index + 1);\n });\n}", ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Is a preference set
function betterdouban_isPreferenceSet(preference) { // If the preference is set if(preference) { return betterdouban_getPreferencesService().prefHasUserValue(preference); } return false; }
[ "function rosterprocessor_isPreferenceSet(preference)\n{\n // If the preference is set\n if(preference)\n {\n return Components.classes[\"@mozilla.org/preferences-service;1\"].getService(Components.interfaces.nsIPrefService).getBranch(\"\").prefHasUserValue(preference);\n }\n\n return false;\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Restore the file to a known checkpoint state.
restoreCheckpoint(checkpointId) { const contents = this._manager.contents; const path = this._path; return this._manager.ready.then(() => { if (checkpointId) { return contents.restoreCheckpoint(path, checkpointId); } return this.listCheckpoints...
[ "restoreCheckpoint(checkpointId) {\n let contents = this._manager.contents;\n let path = this._path;\n return this._manager.ready.then(() => {\n if (checkpointId) {\n return contents.restoreCheckpoint(path, checkpointId);\n }\n return this.listChe...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
console.log('Users.js line 36 pre findById');
function findById(id) { console.log('###EXECUTING User_findById'); console.log(_.contains(_.pluck(users, 'id'), id)); console.log(id); console.log(_.contains(_.pluck(users, 'id'), username)); if(_.contains(_.pluck(users, 'id'), username)){ console.log('id found'); return(id); } else { console...
[ "function testFind(){\n UserModel.find(function(err, users){\n console.log('find', err, users)\n })\n UserModel.findOne({_id:'5c016964c01b2f04cc7e514d'}, function(err, user){\n console.log('findOne', err, user)\n })\n}", "function getUserById(id) {\n console.log(\"getUserById(\", id, \"...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates a new main menu dialog.
static createMainMenuDialog(openURL) { return __awaiter(this, void 0, void 0, function* () { if (!(this.singletonInstance instanceof MainMenuDialog)) { this.singletonInstance = new MainMenuDialog(openURL); yield this.singletonInstance.render(); } ...
[ "function createMenu() {\n const application = {\n label: \"Application\",\n submenu: [\n {\n label: \"About Application\",\n selector: \"orderFrontStandardAboutPanel:\"\n },\n {\n type: \"separator\"\n },\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
output: an 8pointed star in an nxn grid Model n = 9 number of space before first star 0, 1, 2, 3, 0, 3, 2, 1, 0 number of space between each star 3, 2, 1, 0, 0, 0, 1, 2, 3 number of star 3, 3, 3, 3, 9, 3, 3, 3, 3 Rule argument is the width and height minimum size is 7 output to console Algorithm upperpart based on the ...
function star(n) { var middlePoint = (n - 1) / 2; var upperPart = []; var star = '*'; var space = ' '; var result, grid, spaneSpace, middlePart, lowerPart; for (var i = 0; i < middlePoint; i++) { spaneSpace = space.repeat(middlePoint - 1 - i); grid = space.repeat(i) + star + spaneSpace + star + spa...
[ "function star(n) {\n var maxSpaces = (n - 1)/2 - 1;\n var spokeLength = (n - 1)/2;\n var increasingArray = [];\n var decreasingArray = [];\n var i;\n for (i = 0; i < spokeLength; i += 1) {\n increasingArray.push(i);\n decreasingArray.push(maxSpaces - i);\n }\n var j;\n for (j = 0; j < spokeLength; j...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Send everything from db to res by jsonp
function sendAll(db, res) { var results = store.get(db); try { res.jsonp(results); } catch (e) { errorHandler(res, e); } }
[ "function getdatabase(req, res) {\n db.query(\n 'SELECT * FROM interaction WHERE '+ req.params.uid,\n function selectCb(err, results, fields) {\n console.log(results.length);\n if('jsonp' in req.query) {\n res.jsonp(results)\n } else {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
used to generate Spikes
function generateSpikes(){ if (frameCount%100===0){ //creating sprites of each spike var spike= createSprite(1250,115,40,10); // 955 used to increase the permissible area of canvas where the spikes can occur instead of 155 spike.x= Math.round(random(45,955)); spike.addImage(spikeImg); spike.scale...
[ "function Spikes () {\r\n this.spikes = new Array();\r\n }", "function generateSpikes(){\n if(frameCount % 70 ===0){\n var spikes=createSprite(random(0,560),0,40,40);\n spikes.addImage(spikesImg);\n spikes.velocityY=2;\n spikes.scale=0.5;\n spikesGroup.add(spikes);\n spikes.lifetime=2...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Initializes editable content. Called when IFRAME is completely loaded
initEditableContent(){ let self = this; this.doc = this.iframe.contentDocument; this.win = this.iframe.contentWindow; // adds stylesheet var link = document.createElement('link'); link.rel = 'stylesheet'; link.type = 'text/css'; link.href = '/assets/html-editor.css'; this.doc.head....
[ "_onContentsLoaded() {\n\t\tthis.isContentsLoaded = true;\n\t\tconsole.log('content loaded', this.$el, this._$iframe.src);\n\t\tthis.$el.trigger('oncontentsloaded');\n\t}", "function edt_body_loaded(idnum) {\n\tvar edt = document.getElementById('edt_'+idnum+'_if');\n\tvar ta = document.getElementById('edt_'+idnum...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
clear all the songs with `location` not in the dbs
function clearNotIn(list) { app.db.songs.remove({location: { $nin: list }}, {multi: true}, function(err, numRemoved) { console.log(numRemoved + ' tracks deleted'); }); }
[ "reset() {\n Object.keys(this.locations).forEach(key => this.locations[key].delete());\n }", "'songs.cleanSoundsSongs' () {\n let songs = Songs.find().fetch()\n\n each(songs, song => {\n Songs.update(song._id, { $set: { sounds: filter(song.sounds, sid => {\n // if the sound still exist kee...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
gets json data using request calls function with html string and passes in this data for display of dynamic station station below the google map
function get_station_dynamic(station_num, timestamp_from, timestamp_to) { var ourRequest = new XMLHttpRequest(); ourRequest.open('GET', '/station/' + station_num + '/' + timestamp_from + '/' + timestamp_to); ourRequest.onload = function() { var ourData = JSON.parse(ourRequest.responseText); renderHTML_Dynamic(...
[ "function get_station(station_num) {\n\tvar ourRequest = new XMLHttpRequest();\n\tourRequest.open('GET', '/station/' + station_num);\n\n\tourRequest.onload = function() {\n\t\tvar ourData = JSON.parse(ourRequest.responseText);\n\t\trenderHTML(ourData, station_num);\n\t};\n\n\tourRequest.send();\n}", "function ren...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
helper to get rid of undesired properties like structuredExample, structuredValue, etc.
function omitUndesired(obj) { return omitDeep(obj, ['structuredExample', 'structuredValue']) }
[ "pruneTemporaryProperties() {\n delete this.isListItem;\n delete this.isListItemOrdered;\n delete this.childIndex;\n delete this.endsWithSig;\n }", "_getPartialProperties(props) {\n const options = this.get(); // remove attributes from the prop that are not in the partial\n\n Object.keys(option...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Open XHR level 1
function openXhr1(callback, error) { var xhr = that.xhr; // state change xhr.onreadystatechange = function(e){ if (xhr.readyState != 4) return; stopTimeout(); // IE9 bug fix (status read if request aborted results in error...) var status; try { status = xhr.status; } catch(e) { ...
[ "_open() {\n if (!this.busy) {\n return;\n }\n\n const parameters = [...arguments],\n [xhr, method, url] = parameters;\n\n parameters.shift();\n\n if (!url || !this.canAllowUrl(url)) {\n delete xhr[XHR_METADATA_KEY];\n this._nativeOpen.call(xhr, ...parameters);\n return;\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Checks for the existance of a repo on GitLab
function checkGL(repo){ console.log('REPO GITLAB ID: -> ', repo.gitlabID); return new Promise((resolve, reject) => { gitlab.getRepo(repo.gitlabID) .then(() => { resolve(repo); }) .catch(err => { reject(['Gitlab',err]) }); }) }
[ "function repoExists() {\n return octokit.repos.get({owner, repo}).then(() => true, () => false);\n}", "function gitExists(name,git){\n\t\trequest(`${site}${name}/${git}`,\n\t\t\tfunction (error, response, body) {\n\t\t\t\tif (debug) {\n\t\t\t\t // Print the response status code\n\t\t\t\t\t console.log(`${site...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Bubble chart series component.
function BubbleChartSeries() { _classCallCheck(this, BubbleChartSeries); for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } /** * previous clicked index. * @type {?number} ...
[ "function componentBubblesMultiSeries () {\r\n\r\n\t/* Default Properties */\r\n\tvar dimensions = { x: 40, y: 40, z: 40 };\r\n\tvar colors = [\"green\", \"red\", \"yellow\", \"steelblue\", \"orange\"];\r\n\tvar classed = \"d3X3domBubblesMultiSeries\";\r\n\r\n\t/* Scales */\r\n\tvar xScale = void 0;\r\n\tvar yScale...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Handles the logic for account deletion
async function handleAccountDeletion(event) { event.preventDefault(); if (isConfirmDialogValid) { setServerError(null); if (isDemoAccount) { setServerError('Cannot delete demo account!'); setConfirmDialog(''); return; } try { await deleteUserAccount(con...
[ "deleteAccount() {\n // Destroy model + Creator profile\n this.model.user.destroyRecord().then(() => {\n // Delete cognito user.\n this.authentication.deleteCognitoUser();\n this.authentication.logout().then(() => this.router.transitionTo(\"index\"));\n }).catch(() =>...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
decorateWith(decoratingFn, fnToDecorate), where log :: fn > fn such as both have same name and possibly throw exception if that make sense to decoratingFn
function decorateWithOne(decoratorSpec, fnToDecorate) { const fnToDecorateName = getFunctionName(fnToDecorate); return NamedFunction(fnToDecorateName, [], ` const args = [].slice.call(arguments); const decoratingFn = makeFunctionDecorator(decoratorSpec); return decoratingFn(args, fnToDecorateName...
[ "function decorateWithOne(decoratorSpec, fnToDecorate) {\n var fnToDecorateName = getFunctionName(fnToDecorate);\n\n return NamedFunction(fnToDecorateName, [], '\\n const args = [].slice.call(arguments);\\n const decoratingFn = makeFunctionDecorator(decoratorSpec);\\n return decoratingFn(args, fnTo...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns the activity (visible) route
function getActivityRoute(activity) { //the activity may be 'boxed' (i.e. multicast) if(isBoxed(activity)){ return activity.parentNode.parentNode; } return activity.parentNode; }
[ "function showDirections(activity){\n\t\t$scope.$parent.destination = activity.agency + ', ' + activity.address;\n\t\t$location.path('/directions');\n\t}", "function getRoutebtn() {\n if (fLat === 0) {\n $(\"#locations-list .alert\").removeClass(\"hidden\");\n return;\n }\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
render 4 random options.
static renderOptions() { let answerDiv = document.getElementById('answerDiv') let randNum = Math.round(Math.random() * 3); let newTypeObj = {...Pokemon.typeObj} for (let i=0; i<4;i++) { if (i === randNum){ Pokemon.renderSingleOption(Pokemon.getAnswerPokemon(), true) } else { ...
[ "function generateRandomOption(){\n \n let i=Math.floor(Math.random()*2);\n return options[i];\n}", "function getOptions () {\n return options[Math.floor(Math.random() * options.length)]\n}", "function randomizeOptions() {\n Math.seedrandom(seed); // reset seed to initial one\n if (!locked(\"regions\")...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
reverts all changes back to their original state (basically telling breeze to ignore changes that we just did
function revertChanges() { return manager.rejectChanges(); }
[ "revert() {\n this.mapStateToModel();\n }", "revertChanges() {\n\t\tconst restorationData = this.restorationData;\n\t\tthis.stopRecordChanges();\n\t\tthis.restoreFrom(restorationData);\n\t}", "RevertChanges() {\n Object.assign(this, this.OriginalObject);\n }", "removeDirty() {\n this.dirty = fa...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Given the key, client, request, (possible value), and current step, begin the request and draw the initial points.
function start_req(k, c, r, v, s) { if (k in store) { // create the request dictionary for the given client store[k][req][c] = {}; // store the request data in the dictionary store[k][req][c][client] = c; store[k][req][c][req] = r; store[k][req][c][val] = v; store[k][req][c][start_s] = s; // draw the ...
[ "function draw_request(r, k, t, v, s) {\n\tvar color = 'black';\n\tvar rsp = 'ACK';\n\n\t// if get request, decide update state\n\tif (r[req] == 'get') {\n\t\tif (!(v == store[k][cur][val])) {\n\t\t\t// not the most recent\n\t\t\tif (v == store[k][prv][val]) {\n\t\t\t\t// but the second most\n\t\t\t\t// TODO: check...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Runs all hook functions serially and calls callback(error) when finished. A hook may return a promise if it needs to execute asynchronously.
function runHooks(hooks, callback) { var promise; try { promise = hooks.reduce(function (promise, hook) { // The first hook to use transition.wait makes the rest // of the transition async from that point forward. return promise ? promise.then(hook) : hook(); }, null); } catch (error) { ...
[ "function runHooks(hooks, callback) {\n try {\n var promise = hooks.reduce(function (promise, hook) {\n // The first hook to use transition.wait makes the rest\n // of the transition async from that point forward.\n return promise ? promise.then(hook) : hook();\n }, null);\n } catch (error) {...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This function takes an ampConfig input (for example [0,1,2,3,4], and uses the Combinatorics library to get all permutations of those values (120 in this case);
function getAmpPermutations(phaseSettings) { var allAmpPermutations = Combinatorics.permutation(phaseSettings).toArray(); return allAmpPermutations; }
[ "function calcPermuation() {\n\tlet permutation = getPermutation()\n\n\t// Run BFS to generate the cycle notation\n\tlet visited = {}, results = []\n\tfor (let i = 0; i < 16; i++) {\n\t\tvisited[i] = false\n\t}\n\tfor (let i = 0; i < 16; i++) {\n\t\tif (!visited[permutation[i]]) {\n\t\t\tlet curr_results = []\n\t\t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
NOT used by listentities. Search for entities that match user filters
_filter (entities, params, inputSearch) { return entities.filter(entity => this._entityVerify(entity, params, inputSearch)) }
[ "filteredList() {\n return this.users.filter(user => {\n return user.username.toLowerCase().includes(this.search.toLowerCase())\n })\n }", "_filterOr (entities, params, inputSearch) {\n\t\treturn entities.filter(entity => this._entityVerifyOr(entity, params, inputSearch))\n\t}", "searchUser(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Change the politician. The elements newpolitician and oldpolitician are optional.
function handleChange(e, newPolitician) { var $oldPosition = e.relatedTarget || e.target; var $newPosition = newPolitician || common.currentPosition; if (!$oldPosition.classList.contains('position')) { if ($oldPosition.tagName !== 'LI') { $oldPosition = $oldPosition.parentNode; } }...
[ "function setNewWife(idir,\n\t\t\t\t newGiven, \n\t\t\t\t newSurname, \n\t\t\t\t newBirth, \n\t\t\t\t newDeath)\n{\n var\tform\t= document.famForm;\n form.IDIRWife.value\t\t= idir;\n form.WifeGivenName.value\t= newGiven;\n form.WifeSurname.value\t= newSurname;\n form.editWife.disabled\t= ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[PUT] Change schedule Course
changeSchedulecourse(req, res) { const _id = req.params._id; const schedule = req.body.schedule; CourseModel.findOne({ _id: _id, isCheck: 0 }) .then((data) => { data.schedule = schedule; data.save(); res.status(200).json({ ...
[ "function updateCourse (req, res, next) {\n // req.course attached via params route findCourse()\n req.course.update(req.body)\n .then(course => {\n middleWare.onSuccessPost(res, course, 204)\n })\n .catch(err => {\n const errMsg = 'in POST create course '\n middleWare.onError(res, errMsg, err, next)\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Applies any filterBoolClauses in the source's settings to an API request.
function applyFilterBoolClausesToRequest(source, data) { if (source.settings.filterBoolClauses) { // Using filter paremeter controls. $.each(source.settings.filterBoolClauses, function eachBoolClause(type, filters) { $.each(filters, function eachFilter() { data.bool_queries.push({ ...
[ "function applyFilterParameterControlsToRequest(data) {\n $.each($('.es-filter-param'), function eachParam() {\n var val = $(this).val();\n // Skip if no value.\n if (val === null || val.trim() === '') {\n return;\n }\n // Skip if unchecked checkbox\n if ($(this).is(':checkbo...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Tests if the given message is a request message
function isRequestMessage(message) { var candidate = message; return candidate && is.string(candidate.method) && (is.string(candidate.id) || is.number(candidate.id)); }
[ "function isRequestMessage(message) {\n const candidate = message;\n return candidate && is.string(candidate.method) && (is.string(candidate.id) || is.number(candidate.id));\n}", "function isRequestMessage(message) {\r\n let candidate = message;\r\n return candidate && is.string(candidate.method) && (...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Delete a task rectangle, all of its relevant components, and remove the event from the JSON
function deleteRect (rectId) { $("#rect_" + rectId).popover("destroy"); $("#rect_" + rectId).remove(); $("#lt_rect_" + rectId).remove(); $("#rt_rect_" + rectId).remove(); $("#title_text_" + rectId).remove(); $("#time_text_" + rectId).remove(); $("#collab_btn_" + rectId).remove(); $("#han...
[ "function deleteEvent(eventId){\n //Hide the editing task modal\n $('#confirmAction').modal('hide');\n\n // Only log before because event won't exist after\n logActivity(\"deleteEvent(eventId)\",'Delete Event - Before', new Date().getTime(), current_user, chat_name, team_id, flashTeamsJSON[\"events\"][g...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
broadcast a single file (any media stream)
function broadcast(file, cb) { getAccessKey(file, (err, key) => { if (err) { cb && cb(err); return } const rtmpUrl = `${ORIGIN}/${key}`; console.info('starting stream', file); // for codecs, we support several - ideall runCmd('ffmpeg', ['-i', file, '-vcodec', 'copy', '-acodec', 'copy', '-f', 'flv', ...
[ "broadcastMedia(val) {\n Instance_Storage.get().message('media');\n }", "function broadcast(clientId, stream, meta) {\n var temporaryStream, cl, inc = 0, clientCount = clients.numClients();\n\n // Don't broadcast if there is a single client connected.\n if (clientCount < 2) return false;\n\n for (cl...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Initialize the country_info table
function initCountryInfo() { var db = connectDB(); db.transaction(function (tx) { tx.executeSql( 'insert into country_info (CommonName,Capital,ISO4217CurrencyCode,ISO4217CurrencyName,ITU_T_TelephoneCode,ISO3166_1_2LetterCode,ISO3166_1_3LetterCode,IANACountryCodeTLD) values ("Afghanistan","Kabul","AFN","Af...
[ "function createCountries() {\r\n var\r\n map,\r\n countries,\r\n randomTable;\r\n\r\n // http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2\r\n map = {};\r\n countries = fakeData.countries;\r\n countries.forEach(function createCountry(countryData) {\r\n var\r\n co...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
game_play becomes false, ending update cycle. canvas is removed from the display. Title card returns with new innerhtml text. interval for enemy_fire is cleared to stop sound effects.
function gameOver() { game_play = false; end_tune.play() canvas.style.display='none'; music.pause(); document.getElementById('game-instructions').style.display = 'none'; title_card.style.display='inherit'; intro_text.innerHTML = 'GAME OVER'; intro_text2.innerHTML = 'press "Enter" to play...
[ "function gameOver(){\n clearInterval(interval)\n interval = null\n ctx.fillStyle = \"red\"\n ctx.font = \"bold 80px Arial\"\n ctx.fillText(\"GAME OVER\", 150,200)\n ctx.fillStyle = \"black\"\n ctx.font = \"bold 40px Arial\"\n ctx.fillText(\"Tu score: \" + Math.floor(frames/60), 280,300)\n}", "function re...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
returns unique projects list
projects() { return _(this._stories) .uniqBy(s => s.projectName) .map(s => s.projectName) .value(); }
[ "function getProjectList(){\n var list = {};\n var projects = getData('project');\n for ( var i in projects ) {\n list[i] = projects[i];\n }\n saveObject(projects, 'project');\n return list;\n}", "function getProjects() {\n return ____awaiter_23(this, void 0, void 0, function () {\n var ids, re...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
contains the loaded tokens using lex.js ] ] [:Functions Loads and waits for the tokens using the lex.js
function main(){ var int1 = setInterval(function(){ if(lex.loaded()){ getLexToks(); clearInterval(int1); }else if(lex.failed()){ clearInterval(int1); clearInterval(int2); } }, 1); var int2 = setInterval(function(){ if(toks != undefined){ start(); clearInterval(int2); } },1); func...
[ "function Assign_Lex_Lex() {\r\n}", "function js_for_meta_lex(window, $, MONTY) {\n\n $(function document_ready() {\n var $progress = $('<div>', {id: 'progress'});\n $(window.document.body).append($progress);\n $progress.append(\"Scanning \");\n window.setTimeout(function () {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
get block with warning
blocklyGetBlockWithWarning() { const blocks = this.blocklyWorkspace.getAllBlocks(); let block; for (let i = 0; (block = blocks[i]); i++) { if (block.warning) { return block; } } return null; }
[ "function blocklyGetBlockWithWarning() {\n var blocks = that.blocklyWorkspace.getAllBlocks();\n for (var i = 0, block; block = blocks[i]; i++) {\n if (block.warning) {\n return block;\n }\n }\n return null;\n }", "function block_(args, callback) ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns the instance of a default Vector2D
static get zero() { return (new Vector2D(0, 0)); }
[ "function Vector2D() {\r\n\t this.x = 0;\r\n\t this.y = 0;\r\n\t }", "static zero () { return new Vector2(0, 0); }", "get Vector2() {}", "function Vector2D(x, y)\r\n{\r\n this.x = x;\r\n this.y = y;\r\n}", "function Vector2D(X, Y) {\n this.X = X;\n this.Y = Y;\n }", ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Checks if a trail is in the current user's list of favorites.
function isInFavorites(trail){ var contains = false; var uniqueId = trail.unique_id; for(t in vm.currentUser.trails){ if(vm.currentUser.trails[t].unique_id == uniqueId){ contains = true; break; } } ...
[ "function checkForFavorites() {\n // grab the favorited story's IDs\n let favoriteIds = currentUser.favorites.map(function(obj) {\n return obj.storyId;\n })\n \n // loop through the stories on the page, check to see if their Id's are one of our favorite story IDs,\n // if so, make their star'...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Highlight quick game vs AI button
function highlightQuickButton() { $('button[name="quick_game"]').effect('highlight', {}, 1000); window.setTimeout(highlightQuickButton, 3000); }
[ "function checkMainMenuButtons() {\n push();\n noStroke();\n textSize(32);\n // single player\n if (mouseX < width / 2) {\n fill(SELECTED);\n textAlign(RIGHT, CENTER);\n text(\"play as one\", width / 2 - 100, height / 2 + 120);\n fill(255);\n textAlign(LEFT, CENTER);\n text(\"play as two\", w...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Copyright 20002006 Adobe Macromedia Software LLC and its licensors. All rights reserved. SERVER BEHAVIOR PATTERNS AND MASKS FUNCTION: getServerData DESCRIPTION: Returns a servermodel specific global variable. Variables storing elements should use the following convention: For ASP: [PATT|MASK|]_Asp[Vb|Js]SpecificId For ...
function getServerData(theType, theId) { var retVal = "", globalVar = "", sName="", sLang=""; var dom = dw.getDocumentDOM(); var serverName = dom.serverModel.getServerName() var serverLang = dom.serverModel.getServerLanguage(); switch (serverName) { case "ASP": sName = "Asp"; break; case "JSP": sName...
[ "function GetServerData(arg, context) {\n var splitArgs = arg.split(\"|\");\n var actionFlag = splitArgs[0];\n\n if (splitArgs.length > 2) {\n alert(splitArgs[2]);\n return;\n }\n\n if (actionFlag == 'od') {\n oneClickDateSelectionSuccess(splitArgs[1]);\n }\n else if (actio...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Displays the modal for editing dance info Also sets the input fields to the current values
function editInfo() { //display modal var modal = document.getElementById("modal_back"); modal.setAttribute("style", "z-index: 1;") //set input values to current values var dance_input = document.getElementById("dance_name_input"); var dance_name = document.getElementById("dance_name"); console.log(dance_name.in...
[ "function edit(transectionID) {\n $(\".modal-content\").show();\n $(\"#modalHeader\").text(\"Edit and Update details / Redigera och uppdatera detaljer\");\n // $(\"#UpdateHeaderlabel\").show();\n // $(\"#OrderNewHeaderlabel\").hide();\n\n $(\"#update_stock_button\").show();\n $(\"#add_stock_button\")....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Begin transition of a characteristic Prevents internal updates from taking effect until a second after the transition completes, to prevent flicking of states while status converges
function _utilBeginTransition(characteristic, callback) { var transition = _utilGetTransition.call(this, characteristic); transition.isRunning = true; // If we have a deferred timeout running already, clear it if (transition.deferredTimeout !== undefined) { clearTimeout(transition.deferredTimeout); tr...
[ "async transition() {\n if (settings.skipTransitions) {\n this.mesh.material.uniforms.transition.value = 1;\n } else {\n this.mesh.material.uniforms.transition.value = 0;\n this.active = true;\n TweenLite.killTweensOf(this.mesh.material.uniforms.transition);\n await animate\n ....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This function joins the given array using the given string
function join(array, string) {}
[ "function join(array, string) {\n //your code here\n}", "function myJoin (arr){\n var joinString = arr.join(\"\");\n return joinString\n}", "function applyJoin(arrayOfStrings, string) {\n\t// create a joinedString variable\n\tlet joinedString;\n\t// assign it to a string which is all of the strings in the in...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Updates a single enemy sprite.
function updateEnemy(sprite) { try { if (!isDead) { var dx = RATIO * ENEMY_SPEED * getMultiplier(); sprite.body.moveFrom(200, -dx, 0); } if (sprite.x <= -sprite.width) { groupEnemy.remove(sprite, true); } } catch (e) {} }
[ "update(sprite) {}", "update(sprite) {\r\n }", "update() {\n this.sprite.update();\n }", "update(player, dt){\n\n this.enemyPosition(player, this, dt);\n \n }", "function updateEnemies() {\n enemies.forEach(function(e) {\n e.move();\n });\n enemiesHit();\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This is the function that apply a given action (from the Actions enum) These actions can be either move, rotate or shoot The action can come either from the networking stack or from the current running session
applyAction(action) { if (Object.keys(Actions).indexOf(action.type) == -1) { throw new Error("Invalid action! Action: " + JSON.stringify(action)); } if(action.health != undefined){ this.stats.health = action.health; } // each frame we remove 1 cd time from each action for(let cd of this[defaultCoold...
[ "function executeAction(context, action) {\n console.log(\"Action: \" + action);\n switch(action) {\n case ROBOT_ACTION_START:\n startIntentHandler(userId, currentRobotName, context);\n break;\n case ROBOT_ACTION_STOP:\n stopIntentHandler(userId, currentRobotName, context);\n break;\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Instantiates an AssemblyScript module from a buffer using the specified imports.
function instantiateBuffer(buffer, imports) { return instantiate(new WebAssembly.Module(buffer), imports); }
[ "async function instantiateBufferAsync(buffer, imports) {\n return postInstantiate(\n preInstantiate(imports || (imports = {})),\n (await WebAssembly.instantiate(buffer, imports)).instance\n );\n }", "function preInstantiate(imports) {\n var baseModule = {};\n\n function g...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns an array of elements based on the value
function getArrayOfElements(value) { if (isElement(value)) { return [value]; } if (isNodeList(value)) { return arrayFrom(value); } if (Array.isArray(value)) { return value; } return arrayFrom(document.querySelectorAll(value)); }
[ "function getArrayOfElements(value) {\n if (isElement$1(value)) {\n return [value];\n }\n\n if (isNodeList(value)) {\n return arrayFrom(value);\n }\n\n if (Array.isArray(value)) {\n return value;\n }\n\n return arrayFrom(document.querySelectorAll(value));\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
FUNCION: RECIBE UNA IP Y DEVUELVE EL PAIS ASOCIADO.
function devolverIP( IPrecibida ) { console.log('FUNCION devolverIP ======================'); //creo una var en la que se guarda el OBJETO entero asociado al IP que le paso. var pais = ip2loc.IP2Location_get_all( IPrecibida ); //Devuelvo la PROPIEDAD 'country_long' del OBJETO pais. return pais; }
[ "function compruebaIP() { \n\n var elemento_IP = document.getElementById(\"IP_equipo\");\n var valor_IP = document.getElementById(\"IP_equipo\").value;\n\n// if( /^((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/.test(valor_IP) ) {\n\n if( /^[1][9][2]\\.[1][6][8]\\.[3][0...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
show todos: process and render todos
function showTodos() { var i, l, html = ''; // process todos for(i = 0, l = todos.length; i < l; i++) { if(showing == 'all' || (todos[i]['completed'] && showing == 'completed') || (!todos[i]['completed'] && showing == 'active')) { ...
[ "function showTodos(todos){\n\t\tvar html = '';\n\t\tfor(var i = 0; i < todos.length; i++){\n\t\t\thtml += '<li id=\"' + todos[i]._id + '\"class=\"list-group-item\"><span class=\"theText\">' + todos[i].text + '</span>' + \n\t\t\t' <a href=\"#\" class=\"delete btn btn-xs btn-danger pull-right\"><i class=\"fa fa-remo...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Collapse the header when the user scrolls down.
function collapseHeader() { /* * Scroll events can fire a lot. So only check the scrolling one time, * 200ms after the scroll. */ $(window).scroll(function () { var timeout, // minimum pixels to scroll before collapsing the header minimumScroll = 50, // duration of t...
[ "function setup_header_collapse() {\n d3.selectAll(\".header\")\n .attr(\"title\",\"Collapse\")\n .on(\"click\", function(d) {\n console.log(\"CLICK\");\n var m = nav_panel.select(\"#\" + d);\n var isVis = (m.style(\"display\") == \"block\");\n if (isVis) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
sets a property of the input object to the input value only if it is different from the preexisting value of that property. Takes in the object which is the parent of the constant being set, the name of the property being set (as a string) and the value it should be set to. Returns true or false depending on whether th...
function setProperty(objConstantParent, strConstantProperty, varConstantValue) { var blnChanged = false; strAction= "getting the current value of the property"; var varCurValue = objConstantParent[strConstantProperty]; strAction = "checking if current value of property is different from the input value"; if...
[ "propertyValueNE( propertyName, value ) {\n let propertyValue = this.object[ propertyName ];\n if ( propertyValue == value )\n throw Error( `${this.objectName}.${propertyName} ( ${propertyValue} ) `\n + `should not be ( ${value} ). ${this.contextDescription}` );\n }", "function hasDifferentValu...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Refresh the names of the users, the associated color of the current user, and the ability to reset the game
function refreshGameUser(data) { var whitePlayerName = (data.white_player_name != null ? data.white_player_name : "White"); var blackPlayerName = (data.black_player_name != null ? data.black_player_name : "Black"); $("#white_player_name").html(whitePlayerName); $("#black_player_name").html(blackPlayerName); $...
[ "function updateUsersInLobby(){\n\t\tshowAdminButtons();\n\n var usersHtml = '';\n for (var i in g.users){\n var u = g.users[i];\n\t\t\tif (u !== null){\n\t usersHtml += '<li class=\"mdl-list__item mdl-list__item--two-line\">';\n\t usersHtml += '<span class=\"mdl-list__item-primary-content\">';...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
moves mouse to target in 10 steps, with animated transition between steps
handleMouseMove(step, target) { const me = this, mouse = me.mouse; mouse.classList.add('quick'); if (me.mouseDown) mouse.classList.add('drag'); let mouseBox = Rectangle.from(mouse, me.outerElement), x = mouseBox.x, y = mouseBox.y, deltaX = 0, deltaY = 0; if (step.to)...
[ "handleMouseMove(step, target) {\n const me = this,\n mouse = me.mouse;\n mouse.classList.add('quick');\n if (me.mouseDown) mouse.classList.add('drag');\n const mouseBox = Rectangle.from(mouse, me.outerElement),\n x = mouseBox.x,\n y = mouseBox.y;\n let deltaX = 0,\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
enable all input fields of current form, disable button event.data should have to fields: f: id of form with fields to be enabled b: id of button to be disabled
function enableFormFields(event) { aForm = event.data.f; aButton = event.data.b console.log('aButton: ' + aButton); $(aForm + ' input[disabled]').removeAttr("disabled"); $(aForm + ' select[disabled]').removeAttr("disabled"); if(aButton) { $(aButton).attr('disa...
[ "enable () {\n var els = this.formEls,\n i,\n submitButton = this.getSubmitButtonInstance();\n this.setPropertyAll('disabled', false);\n // remove disabled css classes\n for (i = 0; i < els.length; i++) {\n els[i].classList.remove('disabled');\n }\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Run the Processing.js components
function runProcessing() { initProcessing(); }
[ "function setup() {\n createCanvas(500,500);\n\n ps=new ParticleSystem();\n}", "main() {\n setup_pixi_stage(600, 400);\n const loader = PIXI.Loader.shared;\n loader.add(\"Resources/meteor2.png\");\n loader.add(\"Resources/dinosaur.png\");\n loader.load(this.load_done.bind(this...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }