query
stringlengths
9
34k
document
stringlengths
8
5.39M
negatives
listlengths
19
20
metadata
dict
Walks up given folder path to return the closest ancestor that has `src` as a child
function getInferredGopath(folderPath) { if (!folderPath) { return; } const dirs = folderPath.toLowerCase().split(path.sep); // find src directory closest to given folder path const srcIdx = dirs.lastIndexOf('src'); if (srcIdx > 0) { return folderPath.substr(0, dirs.slice(0, srcI...
[ "function resolveToSrc() {\n return path.join(rootDir, 'src');\n}", "getWatchedParent(path) {\n path = Path.dirname(path);\n let root = Path.parse(path).root;\n\n while (path !== root) {\n if (this.watchedDirectories.has(path)) {\n return path;\n }\n\n path = Path.dirname(path);\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Cancels the loading state if the lobby was in it (noop if it was not)
_maybeCancelLoading(lobby) { if (!this.loadingLobbies.has(lobby.name)) { return } const loadingData = this.loadingLobbies.get(lobby.name) this.loadingLobbies = this.loadingLobbies.delete(lobby.name) loadingData.cancelToken.cancel() loadingData.deferred.reject(new Error('Game loading cance...
[ "cancel() {\n this.loadQueue = [];\n this.loading.clear();\n }", "function _loadingInactive() {\n\t\t\tloading.active = false;\n\t\t}", "function cancelLobby() {\n sendWsData({\n ...WSHelpers.QUERY.LEAVEGAME,\n gameId: gameId,\n });\n setGameId(null);\n setGame...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Check if a path is after another.
isAfter(path, another) { return Path.compare(path, another) === 1; }
[ "endsAfter(path, another) {\n var i = path.length - 1;\n var as = path.slice(0, i);\n var bs = another.slice(0, i);\n var av = path[i];\n var bv = another[i];\n return Path.equals(as, bs) && av > bv;\n }", "endsBefore(path, another) {\n var i = path.length - 1;\n var as = path.slice(0, i)...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Factory for the chat observer
function getChatObserver() { return new MutationObserver( function (mutationsList) { for (let mutation of mutationsList) { if (mutation.type === 'childList') { handleNewMessage(mutation) } } } ) }
[ "chatter() {\n return new Chatter(this, {});\n }", "function configOpenedChatObserver() {\r\n if (getAriaLive()) {\r\n let callback = (mutationRecord, observer) => {\r\n if (mutationRecord.length == 1) {\r\n let messageElement = mutationRecord[mutationRecord.length - 1].addedNodes[0];\r\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns a position that places the "bounded" region entirely within the "container" region. (i.e. so that the "bounded" region will be bounded by the "container"). The returned position will as close as possible to the "bounded" region's current position. If the "bounded" region is too large in a dimension to fit withi...
function computePositionToContainBounds(bounded, container) { var containerBottom = container.top + container.height; var containerRight = container.left + container.width; return { top: Math.max(container.top, Math.min(bounded.top, containerBottom - bounded.height)), left: Math.max(containe...
[ "_clampInBounds() {\n const offsetMatrix = XR.getOffsetMatrix();\n const position = new Vector3().setFromMatrixPosition(offsetMatrix);\n\n let inBounds = false;\n\n const boundData = {\n distance: Number.MAX_SAFE_INTEGER,\n bound: null\n };\n\n for (let i = 0; i < this.bounds.length; i++...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Recognition data for math input
function MathRecognitionData() { }
[ "function parseInput(math) {\n\t//parse the numbers and operators\n\toperators = math.match(operatorsRegex);\n\n\t//Create our operator priority array\n\tpriority = math.match(priorityRegex);\n\n\t//Doing a loop to compare how many parntheses left brackets and right brackets\n\t//surround an operator,\n\t//and then...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
prefills based on outstandingFields and member, returns true or false to indicate the form can now be safely hidden from the user
prefillAsPossible(options) { if (this.formCanAutocomplete(options.outstandingFields, options.member)) { this.completePrefill(options.member, options.location); if (this.formFieldCount() > 0) { this.showFormClearer(options.member); } this.$el.data('prefilled', true); return true...
[ "resolveOrderFormVisibility () {\n const page = this.page\n const feePaid = !this.hasFeePending()\n const assetsAreSupported = this.assetsAreSupported()\n const base = this.market.base\n const quote = this.market.quote\n const hasWallets = base && app.assets[base.id].wallet && quote && app.assets[...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Set the current members of the chat
handleChatMembers(data) { this.setState({ members: data }); }
[ "function updateMembers(members) {\n members = members || [];\n\n var uniqueMembers = {}, member, memberSelf;\n for (var i = 0; i < members.length; i++) {\n member = members[i];\n if (!publishedFromSelf(member) && !uniqueMembers[member.clientId]) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Handles when the user changes the reCAPTCHA config.
function handleRecaptchaConfigChange() { var newRecaptchaValue = document.querySelector( 'input[name="recaptcha"]:checked').value; location.replace(location.pathname + '#recaptcha=' + newRecaptchaValue); // Reset the inline widget so the config changes are reflected. ui.reset(); ui.start('#...
[ "function handleRecaptchaConfigChange() {\n var newRecaptchaValue = document.querySelector(\n 'input[name=\"recaptcha\"]:checked').value;\n location.replace(location.pathname + '#recaptcha=' + newRecaptchaValue);\n\n // Reset the inline widget so the config changes are reflected.\n ui.reset();\n ui.start(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
get all the books and chapters then concatenate them together into a huge array. Yes, I mean HUGE!
function getBooks(books, callback) { if (Array.isArray(books)) { var arr = []; var i = -1; var len = books.length; var concatArr = []; if (typeof callback === 'function') { for (i = 0; i < len; i++) { arr.push(createArray(books[i])); if (arr.length > 0) { ...
[ "function getBooks() {\n var fromBookIdx = gCurrPageNo * PAGE_SIZE;\n return gBooks.slice(fromBookIdx, fromBookIdx + PAGE_SIZE);\n}", "buildResultsFromData({chapters, matchingBooks, query, chosenVersion}) {\n\n let results = [];\n matchingBooks.forEach((book) => {\n // Ensure that chapter numbers...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Parse a raw theme into rules.
function parseTheme(source) { if (!source) { return []; } if (!source.settings || !Array.isArray(source.settings)) { return []; } var settings = source.settings; var result = [], resultLen = 0; for (var i = 0, len = settings.length; i < len; i++) { var entry...
[ "function parseTokenTheme(source) {\n if (!source || !Array.isArray(source)) {\n return [];\n }\n var result = [], resultLen = 0;\n for (var i = 0, len = source.length; i < len; i++) {\n var entry = source[i];\n var fontStyle = -1 /* NotSet */;\n if (typeof entry.fontStyle ==...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Set Volume using 'datavalue' attribute.
function setVol() { if (typeof $vol_bar.attr('data-value') != 'undefined') { $musicPlayer.volume = (parseInt($vol_bar.attr('data-value')) / 100) } }
[ "set(v) {\n defineProperty(this, 'volume', {\n configurable,\n enumerable,\n writable,\n value: v,\n });\n }", "function _storageVolumeGame(value) { setDataStorage(\"volume\", value); }", "function setVolume(value){\n value = Number(value);\n gainNode...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
If this VoiceReceiver has been destroyed, running `recreate()` will recreate the listener. This avoids you having to create a new receiver. Any streams that you had prior to destroying the receiver will not be recreated.
recreate() { if (!this.destroyed) return; this.voiceConnection.sockets.udp.socket.on('message', this._listener); this.destroyed = false; }
[ "destroy() {\n this.voiceConnection.sockets.udp.socket.removeListener('message', this._listener);\n for (const [id, stream] of this.pcmStreams) {\n stream._push(null);\n this.pcmStreams.delete(id);\n }\n for (const [id, stream] of this.opusStreams) {\n stream._push(null);\n this.opus...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
input: array of objects with from, to, date fields creates a Node for each email address returns an Array of nodes
function parseEmails(data) { var uniqueAddresses = {}; var i, n = data.length, theirEmail; for (i = 0; i < n; i++) { theirEmail = data[i]["from"]; // they sent me an email date = data[i]["date"]; if (theirEmail == myEmail) { theirEmail = data[i]["to"]; // i sent them the email } if (!uniqueAddresses has...
[ "function findEmailList(data){\n var all = new Object();\n for (var i = 1; i <= 12; i++) {\n data[i].map(function(e){\n var to = e.to;\n var from = e.from;\n if (all.hasOwnProperty(to)){\n var num = all[to];\n num = parseInt(num) + 1;\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Loads current View Query and moves the pointer/index to the next View Query in LView.
function ɵɵloadViewQuery() { var index = getCurrentQueryIndex(); setCurrentQueryIndex(index + 1); return loadInternal(getLView(), index - HEADER_OFFSET); }
[ "function ɵɵloadViewQuery() {\n return loadQueryInternal(getLView(), getCurrentQueryIndex());\n}", "function ɵɵloadQuery() {\n return loadQueryInternal(getLView(), getCurrentQueryIndex());\n }", "function ɵɵloadQuery() {\n return loadQueryInternal(getLView(), getCurrentQueryIndex());\n }"...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
see which side of a line another point is (p1)
function line_side(l, p){ var side = ((l[1].x - l[0].x)*(p.y - l[0].y) - (l[1].y - l[0].y)*(p.x - l[0].x)); return side ? side < 0 ? -1 : 1 : 0; }
[ "function sideOfLine( line_p1, line_p2, point ) {\n var val = (line_p1.x-line_p2.x)*(point.y-line_p2.y)-(line_p1.y-line_p2.y)*(point.x-line_p2.x);\n if ( val === 0 )\n return 0;\n return val > 0 ? 1 : -1;\n }", "function getPointOnVectorSide(v1, v2, p) {\n var a1 = getAngleWithX_axis(v...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns the angle (in degrees) closest to theDegrees that is a multiple of incrementAmount. For example, nearestAngle(46.2, 22.5) would return 45.
function nearestAngle(theDegrees, incrementAmount) { // Start at 0 var nearestDegree = 0; if (incrementAmount <= 0) { return nearestDegree; } // Continuously increment by incrementAmount until degrees is passed or met while (nearestDegree < theDegrees) { nearestDegree += increm...
[ "function snapAngle(angleDegrees) \n\t{\n\t\tangleDegrees = angleDegrees % 360;\n\t\tif (angleDegrees < 0)\n\t\t\tangleDegrees += 360;\n\t\t\n\t\tif (angleDegrees >= 0 && angleDegrees < 90) // Quadrant I\n\t\t{\n\t\t\tif (angleDegrees < Math.abs(angleDegrees-90))\n\t\t\t\treturn 0;\n\t\t\telse\n\t\t\t\treturn 90;\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Splits this node into 4 children. pushes points from this node down to children if the tree is configured to do so.
split() { let w = this.range.Width / 2; let h = this.range.Height / 2; this.LL = new PointQuadTree( new Rect(this.range.x1, this.range.y1, this.range.x1 + w, this.range.y1 + h), this.capacity, this._pushToLeaves); this.LH = new PointQuadTree( ...
[ "split()\n {\n if(this.depth >= this.maxDepth)\n {\n return;\n }\n this.children = [];\n let wd2 = this.width / 2;\n let hd2 = this.height / 2;\n this.children[0] = new Quadtree(this.x, this.y, wd2, hd2, this);\n this.children[1] = new Quadtree(t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get the user inputted trends from the search bar
function searchTrends() { var search = $('#inputDefault').val(); // If the bar isn't empty if (search != '') { // save the search for global use currentQ = search; // find out where we are right now var regionplace = currentCountry; // if the user is on the full map then search the world if (curr...
[ "function trendSearch() {\n T.get('trends/place', { id: '2490383' }, function (err, data, response) {\n for (let i = 0; i < data[0].trends.length; i++) {\n trendTopics.push(data[0].trends[i].name);\n }\n for (let j = 0; j < numOfTrending; j++) {\n topicSearch(trendTopics[j]);\n }\n });\n}", ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
function checking for user input on change of date or time, then sending query to gcalendar checking for change of all values. Then console.log values on change and executing request if busy. also coloring according to whether the compartment is busy or not
function availabilityCheck() { if (chosenHours.date !== "" && chosenHours.startTime !== "" && chosenHours.endTime !== "" && (!(freeRooms.length + busyRooms.length === 23))) { //looping through all rooms in compartment and making freebusy query requestConfigure() currentColor = 1; } e...
[ "function requestConfigure(){\n for (compartment of comps) {\n for (let key in compartment) {\n if (compartment.hasOwnProperty(key)) {\n let calendarID = compartment[key];\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Clicks context menu item of id in directory tree.
async function clickDirectoryTreeContextMenuItem(appId, path, id) { const contextMenu = '#directory-tree-context-menu:not([hidden])'; const pathQuery = `#directory-tree [full-path-for-testing="${path}"]`; chrome.test.assertTrue( !!await remoteCall.callRemoteTestUtil('focus', appId, [pathQuery]), 'foc...
[ "function clickDirectoryTreeContextMenuItem(windowId, path, id) {\n return remoteCall.callRemoteTestUtil('focus', windowId,\n [`[full-path-for-testing=\"${path}\"]`]).then(function() {\n // Right click photos directory.\n return remoteCall.callRemoteTestUtil('fakeMouseRightClick', windowId,\n [`[...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
event handler change state.currentVideo to video that is clicked
onVideoEntryClick(vid) { this.setState({ // grab index to selected video in exampleVideoData array currentVideo: vid }); }
[ "function setVideo(e){\n currentVideo = e.detail;\n }", "onVideoClicked(id) {\n\n this.setState({videoPlaying: true});\n this.setState({selectedVideo: id});\n }", "clickOnTitle(clickedVideo) {\n this.setState({\n currentVideo: clickedVideo//data of the video we clicked\n });\n }...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Converts namespace to a path.
function fromNamespace(path, prefix) { path = path.split('.').join('/'); if (prefix) return path_1.join(prefix, path); return path; }
[ "function namespaceToUrl(namespace) {\n\t\tvar pieces = namespace.split('.');\n\n\t\t// the first couple levels of namespaces go in their own folders;\n\t\t// i.e. owl/os/os.js instead of owl/os.js.\n\t\tif ( pieces.length <= 2 ) {\n\t\t\tpieces.push(pieces[pieces.length-1]);\n\t\t}\n\t\t\n\t\treturn pieces.join('/...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
when the manage button clicked in the modal first see whether the `vehicleUpdateOrAdd` is true or false false > vehicleSave() true > vehicleUpdater()
function vehicleSaveStateManager() { clearAllVehicleModalData() if (vehicleUpdateOrAdd) vehicleUpdater() else saveVehicle() }
[ "function handleUpdateRegister() {\n if (vehicleFinded) {\n setTitleUpdate(\"ALTERAR \");\n\n setSearchVehicleBtnInactive(true);\n setUpdateRegister(true);\n setIsReadonly(false);\n } else if (idVehicle.length === 0) {\n notify(\n \"warning\",\n \"Para acessar a alteraçã...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Hide win panel from user and display game panel for new game.
function hideWinPanel(){ let winPanel = document.getElementsByClassName("win-panel")[0]; winPanel.style.display = "none"; }
[ "hideGameOverPanel() {\n\t\tlet panel = document.querySelector('.panel');\n\t\tpanel.style.display = \"none\";\n\t}", "function hideGame() {\n display.show();\n board.end();\n }", "function hideGame() {\n $(\".start-menu\").show();\n $(\".players, .ttt-board, .scoreboard, .p1-win, .p2-win...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
\ Task: Copy everything from scripts/models folder \
function taskScriptsModelsCopy() { logSubtask('scripts/models copy'); return gulp.src(`${SCRIPTS_MODELS_SRC}/**/*.js`) .pipe(plumber()) .pipe(babel(babelConfig)) .pipe(uglify({ compress: { hoist_funs: false, hoist_vars: false } })) .pipe(gulp.dest(SCRIPTS_MODELS_DIST)); }
[ "async function main() {\n const modelManager = await ModelLoader.loadModelManagerFromModelFiles([metaModelCto], {strict: true});\n const visitor = new TypescriptVisitor();\n const fileWriter = new FileWriter(path.resolve(__dirname, '..', 'src', 'generated'));\n const parameters = { fileWriter };\n m...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Return the host window of the current editor.
getWindow(editor) { const window = EDITOR_TO_WINDOW.get(editor) if (!window) { throw new Error('Unable to find a host window element for this editor') } return window }
[ "getWindow(editor) {\n var window = EDITOR_TO_WINDOW.get(editor);\n\n if (!window) {\n throw new Error('Unable to find a host window element for this editor');\n }\n\n return window;\n }", "getWindow(editor) {\n var window2 = EDITOR_TO_WINDOW.get(editor);\n if (!window2) {\n throw new...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
external powm: t > t > t > t Provides: ml_z_powm Requires: bigInt, ml_z_normalize, ml_z_invert, caml_raise_zero_divide
function ml_z_powm(z1, z2, z3) { var zero = bigInt(0); var one = bigInt(1); z1 = bigInt(z1); z2 = bigInt(z2); z3 = bigInt(z3); if(z3.equals(zero)) caml_raise_zero_divide(); if(z3.abs().equals(one)) return 0; if(z2.equals(zero)) return 1; if(z2.lt(0)) { var inv = bigInt(ml_z_invert(z1, z3)); va...
[ "function ml_z_powm(z1, z2, z3) {\n return bigInt(z1).modPow(bigInt(z2), bigInt(z3));\n}", "function ml_z_powm_sec(z1, z2) {\n\n}", "function ml_z_perfect_power(z1, z2) {\n\n}", "function ml_z_pow(z1, i1) {\n i1 = bigInt(i1);\n if (i1.lt(bigInt(0))) {\n caml_invalid_argument(\"Z.pow: exponent must be ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
return: one cause of win that appears at a row type: list eg: ^ ^ ^ return [5, 6, 7]
function winRow(start){ let thewin = []; for(let i = 0; i < Utils.causewin; i++){ thewin = thewin.concat([start + i]); } return thewin; }
[ "findThreats() {\n let threats = [];\n TTTGame.POSSIBLE_WINNING_ROWS.forEach((row) => {\n if (this.board.countMarkersFor(this.human,row) === 2) {\n threats.push(row);\n }\n });\n return threats;\n }", "function winInRow(board) {\n if ((board[0] != '') && \n (board[0] == board...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Modifies variables names of tagged template literals (`"_templateObject"`) from a given string so that they're all unique. This is needed to workaround a potential naming collision when individually transpiled scripts are bundled. See 950.
function replaceTemplateObjectNames(js) { // Breakdown of regular expression to match "_templateObject" variables // // Pattern | Meaning // ------------------------------------------------------------------- // ( | Group1 // _templateObject | Match "_t...
[ "function convertStringTemplate(s, obj) {\n\n s = s.replace(/\\$\\{(.+?)\\}/g, function(x, m1) {return obj[m1]});\n\n // TODO: figure out why below and variants don't work\n // s = s.replace(/\\$\\{(.+?)\\}/g, obj.$1);\n\n return s;\n}", "function generateVariableName(str){\n return str.replace(/ /g...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Here we heuristically define, if range is a row
get isRow() { return this.startRow === this.endRow && this.startColumn === 0 && this.endColumn === null }
[ "isWithinRange(range){\n let {startRow, startCol, stopRow, stopCol} = range;\n return this.startRow >= startRow && this.stopRow <= stopRow && this.startCol >= startCol && this.stopCol <= stopCol;\n }", "function mgrCheckRowBounds(row_num)\n{ \n if (row_num < grade_values_start_row_gbl)\n {\n row_...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Looper (namespace | singleton)
function Looper(userContext) { // singleton if (instance) { return instance; } // force object instantiation if(! (this instanceof Looper)) { return new Looper(userContext); } // instance instance = this; // global audio ...
[ "function iLooper(time){\r\n\tif(!window.iKeepLooping){\r\n\t\tsetTimeout(function(){iLooper(time);}, time);\r\n\t\treturn;\r\n\t\t}\r\n\tif(window.iPageType == 'home')\r\n\t\tsaveFavoritesFromPage('post green');\r\n\tif(window.iPageType == 'favorites')\r\n\t\tsaveFavoritesFromPage('post');\r\n\tsetTimeout(function...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
End of EquipBest this function will loot for the OPC
function Loot() { for (iL = 0; iL < gridArr[OPC.currentPos].loot.length; iL ++) { OPC.backpack.push(gridArr[OPC.currentPos].loot[iL]); // update feedback with a message listing what was discovered } gridArr[OPC.currentPos].loot = []; CalculateEncumberance(); gridArr[OPC.currentPos].loot = []; EquipBest(); OP...
[ "function EquipBest() {\n// Preamble: save existing light data\n\tpreviousLightType = \"\";\n\tif(OPC.lightLoc == \"offHand\") {\n\t\tpreviousLightType = OPC.offHand;\n//\t\tpreviousLightLife = OPC.lightLife;\n\t}\n// Part 1: place all items in the backpack\n\tif(Array.isArray(OPC.mainHand)) {\n\t\tOPC.backpack.pus...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Return all GOCAM activity nodes using the GOCAM activity object (not the bbop node)
getAllActivities() { let nodes = this.bbopGraph.all_nodes(); let activities = nodes.filter(node => node.root_types().some(type => type.class_id() == "GO:0003674")) let betterActivities = []; for(let activity of activities) { betterActivities.push(this.getActivity(activity.id(...
[ "function getGameNodes(){\n\t\n\tvar domnodes = gamerange.children;\n\t\n\treturn domnodes; \n}", "function getFlows(etree){\r\n return etree.findall('./bpmn:process/bpmn:sequenceFlow');\r\n}", "function getAllActivities() {\n var allActivities = [];\n var allActivitiesNames = ['All activities'...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
save the ending board for game state, so that is can be displayed in the winState
saveBoard() { game.endingBoard = [] game.world.forEach(function(item) { game.endingBoard.push(item) }); }
[ "finishGame(board) {\n const boardProperties = this.getProperties(board);\n\n boardProperties.finished = true;\n board.set('finished', true);\n }", "function endGame() {\n var screen = new GameScreen(\"Game Over\",\"(press space to restart)\",\n function() {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
/ Full Screen Page Scripts / Wrapper Height (window height header height)
function wrapperHeight() { var headerHeight = $("#header-container").outerHeight(); var windowHeight = $(window).outerHeight() - headerHeight; $('.full-page-content-container, .dashboard-content-container, .dashboard-sidebar-inner, .dashboard-container, .full-page-container').css({ height: windo...
[ "function fullscreenHeightCalc() {\r\n var pageHeaderOffset = nectarPageHeader.offset().top;\r\n nectarPageHeader.css('height', ( parseInt(window.innerHeight) - parseInt(pageHeaderOffset)) +'px');\r\n }", "function fullscreenHeightCalc() {\n\t\tvar pageHeaderOffset = nectarPageHeader.offset()....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Encontrar la longitud de una lista / longitud: list>number Hallar la longitud de una lista function longitud(list) longitud([1,2,3,4])>4 longitud([])>0 longitud([0])>1
function longitud(list) { if(isEmpty(list)) { return 0; } else { return 1 + longitud(rest(list)); } }
[ "function mergeSort(arr, longitud) { \n \n\t// De acuerdo al tamaño del sub-array que se va a mergear, For current size of subarrays to \n\t// tamaño_actual varía desde 1 a longitud/2 \n\tlet tamaño_actual; \n\t\t\t\t \n\t// Para seleccionar el elemento de inicio del sub-arreglo de la izquierda a ser mer...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Unique ID of the Canvas&039; sorting layer.
set sortingLayerID(value) {}
[ "get sortingLayerID() {}", "get id() {\n return `${this._layer.getID()}-${this._id}`\n }", "function getID(layer)\r\n\t\t\t{\r\n\t\t\t\treturn layer.url ? layer.id : layer.id;\r\n\t\t\t}", "function getID(layer)\n{\n\treturn layer.url ? layer.id : layer.featureCollection.layers[0].id;\n}", "functi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
removes the given body from the list of raycast targets for the player
deleteBody(object) { this.player.removeRaycastTarget(object.body); }
[ "function removeBody(body) {\n setTimeout(function () {\n World.remove(engine.world, body);\n }, 1750);\n}", "function kill(body) {\n bodiesToRemove.push(body);\n }", "onRemoveFromWorld() {\n //game.physicsEngine.world.removeBody(this.physicsObj);\n }", "onRemoveFromWorld() {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Empties the execution queue
function clear() { commandQueue = []; }
[ "clear() {\n this.queue = null;\n }", "clear () {\n this._queue = []\n }", "clear() {\n this.queue = [];\n }", "clear() {\n forEach(this.queue, taskObj => setTimeout(() => Utils.destroyObj(taskObj), 15));\n this.queue.length = 0;\n }", "function clearQueue(){updateQueue.length...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
carica il singolo scenario gli scenari (come insieme di documenti) sono contenuti nelle relative cartelle se nella cartella esiste un file (scenario.json) questo contiene le specifiche
function _loadScenario(info, current, cll) { function __extend(cb) { _extendScenarioInfo(info, function() { if (((current||{}).scenario||{}).folder === info.folder) info._current = true; if (_.isArray(cll)) cll.push(info); cb(); }); } return function(cb) { io.onFile(io.storePath, inf...
[ "function loadScenario(scenario) {\n return new Promise((resolve, reject) => {\n console.log('loading scenario', scenario);\n // implement loadScenario from external datasource.\n // in this example we're loading from local file\n var scenarioPath = path.join(scenariosPath, scenario + '.json');\n \n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
get all horror books
function getHorrorBooks() { let result = myBooks.filter((book) => book.genre === "horror"); return result; }
[ "allBooks(){\n\t\treturn litbooksdb.find();\t\n\t}", "function getBooks() {\n API.getBooksByTitle(searchBook)\n .then(res => {\n\n console.log(res.data.items, \"book\")\n setBooks(res.data.items)\n })\n .catch(err => console.log(err))\n }", ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get Leave Record using username
function getmyLeaveRecord(user) { return new Promise(function(resolve, reject) { db().collection(appconfig.database.collections.leaveCollection, function( err, collection ) { collection.findOne({ user: user }, function(err, data) { if (err) { reject(ERROR_TYPES.RECORD_LEAVE...
[ "function get_on_leave (callback){\n\n\tvar data;\n\n\tnew Model.Leave({status: 1})\n\t.query(\"where\", RawQueryBuilder.raw(\"YEAR(date_from) = YEAR(CURDATE()) AND MONTH(date_from) = MONTH(CURDATE())\"))\n\t.fetchAll({withRelated: ['staff','leave_type']})\n\t.then(function (staff_on_leave) {\n\t\tif (!staff_on_lea...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
To call var endSala of the game
function endSala() { game.endSala(); }
[ "function endSala() {\t\t\t\r\n\t\t//TODO end room, take messages if necessary and restart the game variables\t\r\n\t}", "function end() {\n game.end();\n console.log('End!!, thank you for playing');\n }", "function endGame() {\n\n}", "function endGame() {\r\n\t\tgameOver = true;\r\n\t\tsetMessage2(\"G...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Helper to easily "connect" a component to several Fluxible stores.
function connectToStoresDecorator(stores, callback) { return connectToStores(stores, (context, props) => { const args = [props, context]; stores.forEach(function(store) { args.unshift(context.getStore(store)); }); return callback.apply(null, args); }); }
[ "componentDidMount() {\n for (let i = 0; i < this.stores.length; i += 1) {\n this.stores[i].register(this);\n }\n }", "connectControllers() {\n for (let c of this.controllers) {\n this.store.subscribe(c.onStateUpdated.bind(c));\n this.fastStore.subscribe(c.onFastStateUpdat...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets the insertion indicator position for a tab item.
function getInsertionIndicatorPositionTabItem(event, target, dragData, dropData) { var clientRect = target.getBoundingClientRect(), clientX = event.originalEvent.clientX, width = clientRect.width, sectionEnum, x = clientX - ...
[ "function getInsertionIndicatorPositionNavItem(event, target, dragData, dropData) {\n var clientRect = target.getBoundingClientRect(),\n clientY = event.originalEvent.clientY,\n height = clientRect.height,\n sectionEnum,\n y ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
getIgnoreKeywords_dashReplaceSpaces(args) Given an array of strings, replace all their spaces with dashes. For example: nineteen, twenty, twentyone, twentytwo, etc.
function getIgnoreKeywords_dashReplaceSpaces(args) { var symbols = args.symbols; var dashreplacedsymbols = []; for(var i = 0; i < symbols.length; i++) { var symbol = symbols[i]; var newsymbol = symbol.replace(/ /g, '-'); if(symbol !== newsymbol) { dashreplacedsymbols.push(symbol.replace(/ /...
[ "function replaceSpacesWithDash( str ) {\n\t\treturn str\n\t\t\t// Replace one or more blank spaces with a single dash (-)\n\t\t\t.replace(/ +/g,'-')\n\t\t\t// Replace two or more dashes (-) with a single dash (-).\n\t\t\t.replace(/-{2,}/g, '-');\n\t}", "removeDashWords() {\n //create new array for holding...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
length insert: insert `state` into history, which means adding the current state into `past`, setting the new `state` as `present` and erasing the `future`.
function insert(history, state, limit) { debug('insert', { state: state, history: history, free: limit - length(history) }); var past = history.past; var present = history.present; var historyOverflow = limit && length(history) >= limit; if (present === undefined) { // init history return { ...
[ "function insert(history, state, limit) {\n\t debug('insert', { state: state, history: history, free: limit - length(history) });\n\t\n\t var past = history.past;\n\t var present = history.present;\n\t\n\t var historyOverflow = limit && length(history) >= limit;\n\t\n\t if (present === undefined) {\n\t // i...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
These are library functions This function is called whenever the system receives that a player has successfully buzzed in. We should show which player has buzzed in, and then deactivate the buzzer.
function handleBuzzEvent(topic, data) { data = JSON.parse(data); addPlayerBuzz(data.contestant); // We only want the buzz to show for 3 seconds. buzzer.deactivate(jeopardy.getStatusIndicatorElement()); }
[ "function buzz(){\n if (buzzerEnabled && inBuzzerView && blockerDisabled)\n connectFactory.buzzBuzzTrial(buzzRound);\n $rootScope.$emit(rootScopeEvents.buzzTriggered);\n }", "function buzzerOn()\n{\n buzz.buzzerOn();\n}", "playBuzzer() {\n this.buzzer.triggerAtt...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Evaluates whether operation is empty
static evalOperationIsEmpty(dict) { return (libVal.evalIsEmpty(dict.OperationLstPkr)); }
[ "isEmpty() {\n return (!this.name_ && !this.expressions_.length);\n }", "isEmpty() {\n\t\treturn this._count === 0;\n\t}", "is_empty() {\n\t\treturn this._queue.length === 0;\n\t}", "get isEmpty() {\n return this.statements.length === 0;\n }", "isEmpty() {\n return this.pSet.size === 0;\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Always call after the definition Create a function named printFavoriteFruit. Declare a variable outside of the function and store your favorite fruit as a value. Reassign the variable within the function and print "My favorite fruit is: x".
function printFavoriteFruit() { // Stub function // REASSIGNMENT name = value; favoriteFruit = 'ananas'; // Reassignment name = value console.log('My favorite fruit is: ' + favoriteFruit); }
[ "function printFruit() {\n //log \"strawberry\" to console\n console.log(fruits[0]);\n //favFruit set to \"peach\"\n let favFruit = fruits[1];\n //leastFav is \"banana\"\n let leastFav = fruits[2];\n //function printFavFruit\n function printFavFruit() {\n //log favFruit to console\n console.log(favFru...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Generates an npm install command given a map of strings and a package name
function generateNpmInstallAdapterCommand(stringMappings, adapterNpmName) { // Start with an initial npm install command var installAdapterCommand = 'npm install ' + adapterNpmName; // Append the neccesary arguments to it based on user preferences var _iteratorNormalCompletion = true; var _didIteratorError ...
[ "function installPackage(package_name){\n // sanitize argument\n if (package_name[0] === '.'\n || package_name[0] === '_'\n || /[ <>\\[\\]\\{\\}\\|\\\\\\^\\t\\n\\r\\f\\v\\0%]/.test(package_name)){\n return Promise.reject(new Error('Illegal package name \"'+package_name+'\"; could not install via NPM'));\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
return function that is meta class parentTemplate parent template function (can be null) templateConstructor template function, inheritanceList parent class and interfaces
function make_template(parentTemplate, templateConstructor, inheritanceList) { // supply template with unique identifier templateConstructor.$hash$ = "$zEk$" + ($$$++); templateConstructor.toString = $toString; // if (parentTemplate != null) { templateConstructor.prototype.clazz = templateCons...
[ "function $make_template(instanceOf, templateConstructor, inheritanceList) {\n // supply template with unique identifier that is returned with toString() method\n templateConstructor.$hash$ = \"$zEk$\" + ($$$++);\n templateConstructor.toString = $toString;\n templateConstructor.prototype.clazz = templ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
showDetails(): Display restaurant's name and rating on a small popup that appears when user clicks on a marker
function showDetails(placeResult, marker, status) { console.log(placeResult); if (status == google.maps.places.PlacesServiceStatus.OK) { let placeInfowindow = new google.maps.InfoWindow(); let rating = "None"; if (placeResult.rating) rating = placeResult.rating; placeInfowindow.setCont...
[ "function showInfoWindow() {\n closeInfoWindowSmall();\n let marker = this;\n places.getDetails({\n placeId: marker.placeResult.place_id\n }, function(place, status) {\n if (status !== google.maps.places.PlacesServiceS...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
set report spam reporter for current user
static setReportSpam(userId, reporterUserId) { return new Promise((resolve, reject) => { User.findUserById(userId).then((user) => { /* istanbul ignore next */ if (user.reported_spams == undefined) { user.reported_spams = {}; } ...
[ "function setReport(report) {\n REPORT = report;\n}", "function resetSpamLimit() {\n yeetLimit = 0;\n}", "function listAllSpam(){\n const spamThreads = GmailApp.search(\"is:unread is:spam\"); //GmailApp.getSpamThreads();\n var notification = \"\"\n var htmlNotification = \"\"\n var count = 0;\n for (...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Add an input mask to an input / Requires: / inputElem: Input element to which the mask will be added / mask: String containing characters to be used for the mask. / Optional: / leadingMask: Boolean (default = false). By default masks are placed at / the end of the input text. Setting this to true will place / the mask ...
function addMask({inputElem, mask, leadingMask = false, maskId, extraClasses}) { if (!isDomElem(inputElem)) { return; } if (!mask) { return; } $(inputElem).wrap( '<span class="input-mask-wrapper d-block"></span>'); let inputValue = `<span class="input-value"></span> ...
[ "_setMaskToInput() {\n const that = this;\n let mask = '';\n\n for (let i = 0; i < that._mask.length; i++) {\n const maskElement = that._mask[i];\n let newCharacter;\n\n if (maskElement.type === 'literal' || maskElement.type === 'separator' || maskElement.type =...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Runs the appropriate mock implementation.
function mockImplementation(req, res, next) { if (res.swagger) { // Determine the semantics of this request var request = new SemanticRequest(req); // Determine which mock to run var mock; if (request.isCollection) { mock = queryCollection[req.method] || editCollection[req.met...
[ "mock(callable) {\r\n this.mockImpl = callable;\r\n }", "mock(callable) {\n this.mockImpl = callable;\n }", "function run() {\n // run mocha\n mocha.run();\n\n // before each spec setup common stuff\n beforeEach(function () {\n window._T = publicApi;\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Check if there is just one Airport to suggest
checkAutocomplete() { if (this.airports) { this.filteredAirports = this.filter(this.airports, this.search, this.fields); let keys = Object.keys(this.filteredAirports); if (keys.length == 1 && this.search) { this.autocomplete = this.filteredAirports[keys[0]]; this.aita = this.auto...
[ "hasSuggestions() {\n return this.filteredAirports && Object.keys(this.filteredAirports).length > 1;\n }", "setAutocompleteToAirport() {\n if (this.autocomplete) {\n this.setAirport(this.autocomplete.name, this.autocomplete.iataCode);\n }\n }", "function invalidDeparture() { \n\t\tfor (i=0; i < ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
renderLoginLinks() Returns the href addresses for catalog and research catalog buttons based on different conditions.
renderLoginLinks() { return ( { catalogLink: this.props.catalogLink, researchLink: this.props.researchLink, } ); }
[ "function renderAuthLinks() {\n return (\n <div className=\"row justify-content-center\">\n <Link \n to=\"/login\"\n className=\"btn btn-primary mx-2\" \n >\n Log in\n </Link>\n <Link \n to=\"/signup\"\n className=\"btn btn-primary m...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
close Session hitting "enter"
function closeSession(callback){ //make `process.stdin` begin emitting "keypress" events keypress(process.stdin); //listen for the "keypress" event process.stdin.on('keypress', function (ch, key) { if (key && key.name == 'enter'){ the_session.close(function(err){ if(err) { console.log("ses...
[ "end() {\n this.session.close();\n }", "function onClose() {\n if (sessionExpired) {\n _Redirect(\"Authentication/Login\");\n }\n }", "endSession() {\n this.uSession.end();\n }", "closeSession(){\n\t\tthis.props.closeAllModal();\n\t\tthis.props.resetInitValue(false);\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
SET UP INTERACTIVE ACTIONS FOR MS1 PLOT
function setupMs1PlotInteractions(container) { var placeholder = $(getElementSelector(container, elementIds.msPlot)); var options = container.data("options"); // allow clicking on plot if we have a function to handle the click if(options.precursorPeakClickFn != null) { placeholder.bind("plotclick",...
[ "function plotBtn() {\n expr=currentFormula;\n var buttons = [\n {\n text: '绘制为F1',\n onClick: function () {\n plot('F1',expr);\n }\n },\n {\n text: '绘制为F2',\n onClick: function () {\n plot('F2',expr)\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Parse Grid Data from table.
function _parseGridData(gridTable) { var data = { total : 0, rows : [] }; var fields = getColumnFields(gridTable, true).concat(getColumnFields(gridTable, false)); $f("tbody tr", $(gridTable)).each(function() { data.total++; var row = {}; for ( var i = 0; i < fields.length; i++) { ro...
[ "static parseTable(table) {\n const parsedGrid = [];\n\n for (let i = 0, l1 = table.length; i < l1; i += 1) {\n parsedGrid[i] = [];\n const row = table[i];\n\n for (let j = 0, l2 = row.length; j < l2; j += 1) {\n const cell = row[j];\n\n parsedGrid[i][j] = i === 0 || j === 0 ? tab...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
5. Please write a function that finds all common elements of two arrays(only primitive types as array elements, order doesn't matter) example inputs ['b', 3, 4, 76, 'c'], ['a', 'b', 4, 76, 21, 'e'] example output ['b', 4, 76]
function commonElements(arr1, arr2) { let set1 = [...new Set(arr1)]; let set2 = [...new Set(arr2)]; return [...set1.filter(o => set2.includes(o))] }
[ "function commonElements(array1, array2){\n return [...arguments].reduce((accArr, currArr)=>{\n const resultArr = [];\n return accArr.filter((e1) => {\n return currArr.some((e2) => {\n if (e1 === e2 && !resultArr.includes(e1)) {\n resultArr.push(e1);\n return true;...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
send keyboard bytes to the application (if a connection has been set up)
sendKeyboard(data) { if (this.connection) { this.connection.sendKeyboard(data); } }
[ "sendKeyboard(data) {\n this.webSocket.send('k' + data);\n }", "sendKeyboardCode(code) {\n this._sendTiVoCommand('KEYBOARD', code);\n }", "sendKey(keysym, code, down) {\n if (this._rfbConnectionState !== 'connected' || this._viewOnly) { return; }\n\n if (down === undefined) {\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
To delete duplicates in a linkedlist, transverse over the list and save the value in an array removing the value that has already been saved time complexity O(n^2) space complexity O(n)
function DeleteDuplicateInUnsortedLinkedList(sll){ const track = []; let node = sll.head; while(node){ if(track.indexOf(node.data) >= 0){ sll.size-- }else{ track.push(node.data); } node = node.next; } return track; }
[ "function remove_duplicates() {\n let ptr1 = null;\n let ptr2 = null;\n let dup = null;\n let ptr1 = head;\n\n /* Pick elements one by one */\n while (ptr1 != null && ptr1.next != null) {\n ptr2 = ptr1;\n /*\n * Compare the picked element with rest of the elements\n */\n while (ptr2.next != n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This function should take the JSON for the country and put a H2 tag on the screen containing its capital city /Create a h2 tag on the website using DOM manipulation and add the capital city's name inside it
function addCountryCapital(countryData) { // console.log("country data =", countryData[0].captial); let targetDiv = document.getElementById("content"); let countryH2 = document.createElement("h2"); targetDiv.appendChild(countryH2); countryH2.textContent = `${countryData[0].capital}`; }
[ "function addCountryName(countryData) {\n // console.log(\"country data =\", countryData[0].name);\n \n let targetDiv = document.getElementById(\"content\");\n let countryH1 = document.createElement(\"h1\");\n targetDiv.appendChild(countryH1);\n countryH1.textContent = `${countryData[0].name}`;\n \n}", "fu...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
I played around quite a bit with this one. I think it was the point. I was trying to access the object with the number directly. like list.value[num]. The hint was about using n+1 which just made things more confusing. I also was initially checking for list being null before I realized that the last item in the list wi...
function nth(list, num) { if (!list) { return undefined; } else if (num == 0) { return list.value; } else { return nth(list.rest, num - 1); } }
[ "function nthRecursive (list, number){\n if (number == 0) return list.value;\n \n if (list.rest === null && number > 0) return undefined;\n\n if (number > 0) return nthRecursive(list.rest, number-1); \n}", "function nth(list, n) { //can you explain this function?\n if (!list) {\n\t//console.log('list doesnt ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
selectInkwell(elem) function When given an inkwell SVG element, this function will change the inkwell's default stroke to be dashed (deselecting any previously selected inkwell).
function selectInkwell(elem) { if (elem != null) { // De-highlight any previously selected inkwell... deselectInkwell(); if (selectedInkwell) selectedInkwell.style.strokeDasharray = null; // And remember this new inkwell... selectedInkwell = elem; selectedInkwell.style.strokeDasharray...
[ "function deselectInkwell()\n{\n // De-highlight any previously highlighted inkwell...\n if (selectedInkwell)\n selectedInkwell.style.strokeDasharray = null;\n\n // Stop remembering the inkwell...\n selectedInkwell = null;\n}", "function handlerSetShapeToInkwellCSSClass(evt)\n{\n evt.returnValue = false;\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
draw board on canvas
function drawBoard(ctx){ ctx.beginPath(); ctx.moveTo(0.333, 0.05); ctx.lineTo(0.333, 0.95); ctx.moveTo(0.666, 0.05); ctx.lineTo(0.666, 0.95); ctx.moveTo(0.95, 0.333); ctx.lineTo(0.95, 0.666); ctx.stroke(); }
[ "function drawBoard() {\n board = $(\"#board\");\n board.attr(\"width\", nCols * 30);\n board.attr(\"height\", nRows * 30);\n cnv = $(\"#board\").get(0);\n ctx = cnv.getContext(\"2d\");\n ctx.strokeRect(0, 0, nCols * 30, nRows * 30);\n for (var i = 1; i < nCols; i++) {\n ctx.beginPath();\n ctx.moveTo(i...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This field is set to noversion to specify that the system does not support (server) or use (client) versioning for this resource type. If this has some other value, the server must at least correctly track and populate the versionId metaproperty on resources. If the value is 'versionedupdate', then the server supports ...
get versioning () { return this._versioning; }
[ "[kVersionNegotiation](version, requestedVersions, supportedVersions) {\n const err =\n new ERR_QUIC_VERSION_NEGOTIATION(\n version,\n requestedVersions,\n supportedVersions);\n err.detail = {\n version,\n requestedVersions,\n supportedVersions,\n };\n this.destr...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Tries the JWT from the given key either from a storage or the cookie
function getJWT(tokenKey, cookieKey, storage) { return Promise.resolve(storage.getItem(tokenKey)).then(function (jwt) { var cookieToken = getCookie(cookieKey); if (cookieToken) { return cookieToken; } return jwt; }); }
[ "function getJWT(tokenKey, cookieKey, storage) {\n\t return Promise.resolve(storage.getItem(tokenKey)).then(function (jwt) {\n\t var cookieToken = getCookie(cookieKey);\n\t\n\t if (cookieToken) {\n\t return cookieToken;\n\t }\n\t\n\t return jwt;\n\t });\n\t}", "decodeJWT(key) {\n // if it ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Delete a row with selected posters, update the number of posters in the basket badge in the nav bar, update the cookie storing the number of selected number of posters, and update the cookie storing details about posters
function deleteRowPost(row) { var a_row = row.parentNode.parentNode.rowIndex; //alert("in deleteRow a_row is " + a_row); var del_no = document.getElementById("basket_table").rows[a_row].cells[1].innerHTML; var del_int = parseInt(del_no); //alert("in deleteRow del_no is " + del_no +" del_int "+ del_int); ...
[ "function deleteRowStick(row) {\r\n var a_row = row.parentNode.parentNode.rowIndex;\r\n\t\t\t//\talert(\"in deleteRow a_row is \" + a_row);\r\n\tvar del_no = document.getElementById(\"basket_table\").rows[a_row].cells[1].innerHTML;\r\n\tvar del_int = parseInt(del_no);\r\n\t//alert(\"in deleteRow del_no is \" + de...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Handle when the list of projects changes locally.
handleProjectListChange(projects) { this.saveProjects(projects); this.setState({projects: projects}); }
[ "function handleStatusChange() {\n var newProjectStatus = $(this).val();\n getJobs(newProjectStatus);\n }", "onProjectUpdate(project) {}", "_onDidChangePathList() {\n\t\tthis._projectInfoList.clear();\n\t\tasync.forEach(editor.project.getPaths(), (pathName, callback) => {\n\t\t\tthis._parseConfigFile(pat...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This function clears the substrate and product fields so that if a reaction has 2+ reactants and the next one does not, everything is all good.
function clearReactionFields() { //Substrate firstLabel = subsLabel.firstChild; while(subsLabel.firstChild) { subsLabel.removeChild(subsLabel.firstChild); } subsLabel.appendChild(firstLabel); //Product firstLabel = prodsLabel.firstChild; while(prodsLabel.firstChild) { ...
[ "function clearFields(elProduct, elQtd) {\n elProduct.val(null).change();\n elQtd.val('');\n}", "formulateProducts(type) {\n if (!type.includes(\"none\")) {\n for (let i in type) {\n \n let item = type[i];\n //If the reaction type is a formula\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Update .project file with database details
_updateDotProject() { program.config(this).set(`database:${this.answers.identifier}`, { identifier: this.answers.identifier, database: this.answers.database }); }
[ "function updateFiles() {\n lightjs.info(`${swProjectConst.UPDATE} all files with project meta data`);\n\n const generalConfig = projectConfig.general;\n lightjs.replacement('{{PROJECT.AUTHOR}}', generalConfig.author, [projectPath], true, true, 'node_modules');\n lightjs.replacement('{{PROJECT.DESCRIPTION}}', g...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
import the md5 dynamically we need it only for the style body code
function getMD5Metadata(code) { return import('md5').then((mod) => { const md5 = mod.default; return md5(code); }); }
[ "static io_getmd5(str) {\n if (window.Settings.enableLog)\n WebUtils.log(\"Web.io_getmd5({0})\".format(str));\n return WebUtils.io_getmd5(str)\n }", "function MD5() {\n this.init();\n}", "function _md5() {\n if ( typeof window.md5 === \"function\" ) {\n // The return val...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Set loading state of update posts button.
setUpdatePostsButtonLoading (value) { if (value) $(this.updatePostsButton).addClass('loading'); else $(this.updatePostsButton).removeClass('loading'); }
[ "setCreatePostsButtonLoading (value) {\n\n if (value)\n $(this.createPostsButton).addClass('loading');\n else\n $(this.createPostsButton).removeClass('loading');\n }", "setCleanPostsButtonLoading (value) {\n\n if (value)\n $(this.cleanPostsButton).addClass('loading');\n else\n $(t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets the latitude & longitude from an address, then calls getNearbyLocations()
function getLatLonFromAddress(geocoder, resultsMap) { var address = document.getElementById('address').value; geocoder.geocode({ 'address': address }, function(results, status) { if (status === google.maps.GeocoderStatus.OK) { $("#error-message").html(""); resultsMap.setCenter(results[0].geome...
[ "static async getCoordsFromAddress(address = '') {\n const platform = this.setPlatform();\n let data = {};\n const geocoder = platform.getGeocodingService();\n const geocodingParams = {\n searchText: address\n };\n await geocoder.geocode(geocodingParams, (result) => {\n const locations =...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Find Task for ADMIN,SPV,Planner,Worker for Detail with Note(For Planner) ADMIN DAN PLANNER IF NYA DIPISAH Task List Planner
async findAllTaskPlanner(parent, args, { db }) { try { if (db.payload.result.role === "admin") { return await db.task.findAll(); } else if (db.payload.result.role === "planner") { let data = await db.task.findAll({ include: [ { model: d...
[ "static async searchTask(restriction) {\n /**\n * 1. Search in `TR` by group id\n * 2. Search in `Task` by type\n * 3. Delete shielded tasks\n */\n // let tr_where, task_where;\n restriction = checkParamsAndConvert(restriction, ['range', 'type'])\n console...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Return a single exposure model from its name.
one(name) { if (!this._models.hasOwnProperty(name)) { throw new Error(`Model not found: '${name}'.`) } return this._models[name] }
[ "static getByName(name) {\n if (!name) {\n return null;\n }\n let n = name.toLocaleLowerCase();\n n = n[0].toUpperCase() + n.substr(1) + 'Model';\n return this.MODELS[n] || null;\n }", "model(name) { return this.models[name.name || name]; }", "getModel(name) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
displayAnimalGifs does the "heavy lifting" to do the AJAX call to the GIPHY db and then process and display the results.
function displayAnimalGifs() { var thisAnimal = $(this).attr("animal-name"); var queryURL = myQuery1 + thisAnimal + myQuery2; var gifCount = 0; // Creating an AJAX call for the specific animal button that was clicked $.ajax({ url: queryURL, method: "G...
[ "function displayAnimals(){\n\n\t\tvar animalType = $(this).attr('data-animal');\n\n\t\tvar queryURL = \"http://api.giphy.com/v1/gifs/search?q=\" + animalType + \"&api_key=dc6zaTOxFJmzC&limit=10\";\n\n $.ajax({\n url: queryURL,\n method: 'GET'\n })\n .done(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
include Comparable A string representation of this Version.
toString() { return this.version; }
[ "version(){\n return('Version von ' + this.meta.spezListVersion.slice(0,10) + \" (generiert am \" + this.meta.dateGenerated.slice(0,10) + ')');\n }", "_formatVersion() {\n const parts = []\n\n for (let key in this.version) {\n if (this.version.hasOwnProperty(key)) {\n p...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Mutates req to have an XCSRFToken header with a value of csrftoken if the method of req is an unsafe http method.
function attachCSRF(req, csrftoken) { if (shouldSendCSRF(req.method)) { req.headers['X-CSRFToken'] = csrftoken } return req }
[ "function includeCSRFToken ({ method, csrf=true, headers }) {\n if (!csrf || !CSRF_METHODS.includes(method)) return\n const token = getTokenFromDocument(csrf)\n if (!token) return\n return {\n headers: { ...headers, 'X-CSRF-Token': token }\n }\n}", "function addCsrfHeader(ajaxRequest){\n\tvar header = $(\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Settles a pact synchronously
function _settle(pact, state, value) { if (!pact.s) { if (value instanceof _Pact) { if (value.s) { if (state & 1) { state = value.s; } value = value.v; } else { value.o = _settle.bind(null, pact, state); return; } } if (value && value.then) { value.then(_settle.bind(null, pac...
[ "function settle(m){\n settled = true;\n future = m;\n\n if(future._spawn){\n var tail = future._actions;\n\n while(!tail.isEmpty){\n cold.unshift(tail.head);\n tail = tail.tail;\n }\n\n future = future._spawn;\n }\n\n if(async) drain();\n }", "function _settle(pa...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
utility function, covert an message object to string
function msgToString(msg){ if (msg.asString == undefined) { msg.asString = JSON.stringify(msg); } return msg.asString; }
[ "_stringifyMessageObject(object) {\n return JSON.stringify(object) + common_1.constants.MESSAGE_TERMINATION_CHARACTER;\n }", "toString() {\n var err = _.attempt(_.bind(isValid, this));\n if (err instanceof Error) {\n return \"Message< invalid >\";\n }\n\n var s = \...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Renders the AWS CloudFormation properties of an `AWS::IoTEvents::DetectorModel.Sns` resource
function cfnDetectorModelSnsPropertyToCloudFormation(properties) { if (!cdk.canInspect(properties)) { return properties; } CfnDetectorModel_SnsPropertyValidator(properties).assertSuccess(); return { Payload: cfnDetectorModelPayloadPropertyToCloudFormation(properties.payload), Tar...
[ "function cfnAlarmModelSnsPropertyToCloudFormation(properties) {\n if (!cdk.canInspect(properties)) {\n return properties;\n }\n CfnAlarmModel_SnsPropertyValidator(properties).assertSuccess();\n return {\n Payload: cfnAlarmModelPayloadPropertyToCloudFormation(properties.payload),\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
The function reads a revocation key related data from the REVOCATION_KEY_DATA_FILENAME file. The required data fields are: (a) 'prevRevocationKey' public key. (b) 'revocationKey' public key. (c) 'prevRevocationKeySig' signature.
function readRevocationKeyDataFromFile (aliasName) { const revocationKeyData = _readDataFromJsonFile(aliasName, REVOCATION_KEY_DATA_FILENAME) if (!revocationKeyData) { throw new Error(`Missing "${REVOCATION_KEY_DATA_FILENAME}" config file.`) } _checkRequiredDataField(revocationKeyData, "prevRevocationKey", ...
[ "async function readRevocationKeyDataAndUpdateKeysStatus (aliasName) {\n function _normalisePrevRevocationKey (aliasName, revocationKeyData) {\n let revocationKeyData2 = {}\n // Check if the 'nextDocData' section is available.\n _checkRequiredDataField(revocationKeyData, \"nextDocData\", REVOCATION_KEY_DA...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Refresh tweets: Combine load and render
function refreshTweets() { loadTweets() .then(renderTweets) .catch((err) => console.error(err)); }
[ "function loadTweets() {\n $.get('/tweets', data => {\n const newData = data.filter(tweet => tweet.created_at > lastFetched);\n lastFetched = Date.now();\n renderTweets(newData);\n });\n }", "function reloadTweets() {\n $(\".tweetbox\").empty();\n $.getJSON(\"/tweets\", function(data) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Remove a noninline dialog from the modal service when destroyed.
willDestroy() { super.willDestroy(...arguments); if (!this.args.isInline) { this.modal.removeDialog(this.dialogRegistry); } }
[ "removeModal() {\n this.removaAllEvents();\n this.closeModalPage(this.componentElem);\n }", "ngOnDestroy() {\n this.modalService.remove(this.id);\n this.element.remove();\n }", "destroyModal() {\n if ($('#modal-anchor').length) {\n // Remove event listeners\n $('.modal-blank...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Broadband adoption data may be "withheld". This public method helps other components determine whether to display such data.
displayWithheld() { if (this.getBroadbandSelected() === "None") { return false }; if (this.data) { return this.data.BROADBAND_VARIABLES[this.getBroadbandSelected()].showWithheld; } else { return false; } }
[ "displayUnreliableSuppressed() {\n // Don't display unreliable/suppressed unless the selected maternal health is one of the following values.\n if ([\"Maternal Mortality Rate\", \"Late Maternal Death Rate\"].includes(this.getMaternalHealthSelected())) {\n return true;\n }\n return false;\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Remove the tooltip for an element in the publication toc.
function removeTocTooltip(){ $("#wh_publication_toc>.wh-tooltip-wrapper").remove(); }
[ "remove() { this.tooltip.remove(); this.element.remove(); }", "function OCG_remove_tooltip()\n{\n\tjQuery(\"#tooltip\").remove();\n}", "function deleteTooltip(event) {\n if (tipObj) {\n //delete the tooltip if it exists in the DOM\n document.body.removeChild(tipObj)\n tipObj = null\n }\n}", "functi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
extract the object id from the url
function getObjectidFromUrl(url) { var urlObject = urlUtils.urlToObject(url); if (urlObject.query && urlObject.query.OBJECTID) { return urlObject.query.OBJECTID; ...
[ "function getObjectIdFromUrl(){\n\tvar matcher = location.href.match(/graph\\/([^\\/]*?)[#\\?]?$/)\n\tif(matcher) return matcher[1]\n\treturn ''\n}", "function getUrlId() {\n\tlet url = getUrlString();\n\tlet id = url.slice(url.length - 1, url.length);\n\treturn id;\n}", "function getID(url) {\n // We can us...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Animation Event Handlers Function for the mouse move event. Basically, it will make the ship hover image position match the cursor position.
function changeShipHoverPos(event) { if (state.phase !== 'setup') { return; } shipHoverEl.style.left = `calc(${event.pageX}px - 2vw)`; shipHoverEl.style.top = `calc(${event.pageY}px - 2vw)`; }
[ "mouseMove(){\n }", "function onMouseMove(event){\n moveAt(event.pageX,event.pageY);\n }", "function onMouseMove(event) {\n\tmousePos = event.point;\n}", "function mouseMove(event) {\n update(event);\n }", "mouseMove(x, y) {}", "onMove(event) {\n this.x = event.layerX;\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Tabla de transiciones con input
function crearTablaTransicion(entrada,alfabeto,tablaTransicion){ var tablaPadre = document.createElement('table'), filaTitulo = document.createElement('tr'); for(let i=0; i<transiciones.length ; i++){ var columnaTitulo = document.createElement('td'); columnaTitulo.className='formatoTabla...
[ "function add_translation(translation_object, translations_tbody) {\r\n translation_object = translation_object || {};\r\n var tr = document.createElement(\"tr\");\r\n var td_name = document.createElement(\"td\");\r\n td_name.innerHTML = '<input type=\"text\" />';\r\n td_name.firstChild.value = translation_obj...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
preserve paragraph and offset value for selection
setOffsetValue(selection) { let info = this.selection.getParagraphInfo(selection.start); this.startParagraph = info.paragraph; this.startOffset = info.offset; info = this.selection.getParagraphInfo(selection.end); this.endParagraph = info.paragraph; this.endOffset = info....
[ "getOffsetValue(selection) {\n if (this.startParagraph) {\n let lineInfo = selection.getLineInfoBasedOnParagraph(this.startParagraph, this.startOffset);\n selection.start.setPositionFromLine(lineInfo.line, lineInfo.offset);\n }\n selection.start.updatePhysicalPosition(true...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
init a logger for a particular module. take the module name as parameter and create two log appenders to append all log and one for exclusively errors and above
function configLogger(module) { var errorModule = 'error-'+module; var allModule = 'all-'+module; log4js.loadAppender('file'); log4js.addAppender(log4js.appenders.file('logs/all-'+module+'.log'), allModule); log4js.addAppender(log4js.appenders.file('logs/error-'+module+'.log'), errorModule); var errorlogger = log...
[ "function getLogger(module) {\n let logger = null;\n if (process.env.NODE_ENV === \"production\") {\n // Log to files in production mode.\n logger = winston.createLogger({\n level: \"info\",\n format: winston.format.combine(\n winston.format.splat(),\n winston.format.timestamp(),\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Runs the program. Output is written to output directory as specified in the request.
run() { const outdir = process.env[cxapi.OUTDIR_ENV]; if (!outdir) { process.stderr.write(`ERROR: The environment variable "${cxapi.OUTDIR_ENV}" is not defined\n`); process.stderr.write('AWS CDK Toolkit (>= 0.11.0) is required in order to interact with this program.\n'); ...
[ "function runProgram() {\n if (consoleBox.style.display == \"none\") {\n setConsole();\n }\n if (programRunning) {\n alert(\"Program is already running! Press Kill to cease execution.\");\n return 1;\n }\n\n console.log(\"Running program!\");\n programRunning = true;\n\n va...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
CHECK IF NOTIFICATION NEEDED Using the last checkin, if it was a checkin or a start then compare it to the time and see if a notification needs to be sent
function checkNotification (user, admin, callback) { getLastCheckIn(user, admin, function (err, previous) { if (previous === undefined) { console.log("No Checkins for user"); return callback(null); } var checkInInterval = admin.requiredCheckIn; var reminderTime = admin.reminderTime; var notifyEmergency...
[ "function canNotify() {\n\tvar now = new Date();\n\tvar last_notification_date_time_diff = Math.abs(now.getTime() - simple_storage.storage.last_notification_date.getTime());\n\tvar last_notification_date_time_diff_minutes = Math.ceil(last_notification_date_time_diff / (1000 * 60));\n\n\tif (last_notification_date_t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Line breaks provided below for text alignment inclusively for all invitation formats// Function for getting realtime hostline
function getHost() { var host = document.getElementById('host-line').value; document.getElementById('hostLine').innerHTML = host.replace(/(.{39})/g, "$1<br>"); //breaks line after 39 characters // }
[ "function textWrapRemoteDisplay(message) {\n var spaces = getIndicesOf(\" \", message, false)\n //console.log('message length = ' + message.length)\n if (spaces.length > 0 && message.length > 20) {\n var n = 0;\n while (spaces[n] < 20) {\n n++;\n }\n \n //find ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Generate embed code from video_provider name and video_id Embed code is going to be included in the videocontainer
function generate_embed_code(video_provider, video_id){ var embed_code = ""; if (video_provider == "youtube.com") { embed_code = '<iframe class="youtube-player" type="text/html" width="100%" height="100%" src="http://www.youtube.com/embed/' + video_id + '?enablejsapi=1&playerapiid=ytplayer" frameborder="0" al...
[ "function getVideoEmbedCode() {}", "function insertVideoTag() {\n try {\n var videos = document.querySelectorAll('.byui-video');\n for (var i = 0; i < videos.length; i++) {\n if (videos[i].dataset.source == 'youtube') {\n videos[i]...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }