query
stringlengths
9
34k
document
stringlengths
8
5.39M
negatives
listlengths
19
20
metadata
dict
check user trong database
function checkuserdb(username, callback) { connection.query("select user_id from user where user_name = '" + username + "'", function(err, result, fields) { if (err) { console.log('this.sql', this.sql); //command/query callback(err, null); } else callback(null, result); }...
[ "async function checkUserInDB(uid) {\n\n const check = await UserTable.query().findOne({ uid: uid });\n\n if (check) {\n return true;\n }\n else {\n return false;\n }\n} // end function checkUserInDB", "doesUserExist(uname){\n\t\treturn db.one(`SELECT * FROM user_id WHERE uname=$1`, uname);\n\t}", "f...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns a shallow copy of the contents of the log BEFORE the current marks.
getBefore() { return this.history.slice(0, this.index.start); }
[ "function mark_log() {\n if ( log.innerText.endsWith('-- MARK --\\n') ) {\n clear_log();\n } else {\n update_log('-- MARK --');\n }\n}", "MoveBefore(e, mark) {\n if (e.list !== this || e === mark || mark.list !== this) {\n return;\n }\n this.move(e, mark.prev);\n }", "Inser...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
show possible move checboxes
function showPossibleMove() { let newLocations = game.possibleMoveAt.concat(game.possibleMoveAndKillAt, game.possibleFinish); showPossibleLocationsAndMove(newLocations) saveGameToLocalStorage(); }
[ "function showMoves(piece,position,side){\n\n let intCurRow = parseInt(position[0]);\n let intCurCol = parseInt(position[1]);\n\n if(piece==\"ro\"){ //chess piece: rook\n for(let row = intCurRow+1; row < 8; row++){\n\n if(chessPos[row][intCurCol]==side)\n break;\n\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Change visible view to current view
_changeVisibleView() { if (this._view !== this._visibleView) { this._visibleView = this._view; this._stopTimer(); this._triggerChange(true); return true; } return false; }
[ "_changeCurrentView() {\n\t if (this._view !== this._visibleView) {\n\t this._view = this._visibleView;\n\t this._stopTimer();\n\t return true;\n\t }\n\t return false;\n\t }", "static setViewVisible(visible) {\n\t\tlet displayStatus = (visible) ? 'block' : ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
collection name of the model
static getCollectionName (): string { return collectionName }
[ "get collectionName() {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n return this.s.namespace.collection;\n }", "get name() {\n return this.collectionName;\n }", "static get collectionName () {\n return this.name.toLowerCase().trim() + 's'\n }", "funct...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Converts the Roman numeral entered into an integer so we can perform math operations on them
function roman_to_Int(rom) { if(rom == null) return -1; // Starts the calculation of the number at first roman numeral listed (ei if number is MCD, num = 1000) var num = char_to_int(rom.charAt(0)); // Sets variables for previous and current number calculated in loop var pre, curr; // Starts the ...
[ "function romanToNum(roman) {\n}", "function romanToInteger(r) {\n let num = 0;\n let str = r.split('');\n for (let i = 0; i < str.length; i++) {\n switch (str[i]) {\n case 'M' || 'm':\n num += 1000;\n break;\n case 'D' || 'd':\n n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
_satellite tracking global method
function fireSatellite(eventName) { if(_satellite){ _satellite.track(eventName); } }
[ "function Tracking() {}", "startLocationTracking() {\n\t\tPushwooshModule.startLocationTracking();\n\t}", "function uv_track() {\n\t\n\t//var hours = currentTime.getHours();\n\t//var minutes = currentTime.getMinutes();\n\t//Ti.API.info(hours+':'+minutes);\n\t\n\tTi.API.info('prevLocTime' + prevLocTime);\n\tTi.A...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Render the prerendered canvas.
render() { render(offscreenCanvas); }
[ "renderCanvas() {\n if (this.renderCallback) {\n this.renderCallback(this._canvas);\n }\n }", "render() {\n this.context.drawImage(this.buffer.canvas,\n 0, 0,\n this.buffer.canvas.width,\n this.buffer.canv...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function to get the mapping for a given entity
function getMappingFromEntity(entity) { for (var type in Entity) { if (entity instanceof Entity[type]) { var map = mappings[type]; if (map) { return Util.Promise.buildResolved(map); } else { return Util.Prom...
[ "function getMappingFromType(type)\n {\n for (var i in Entity) {\n if (Entity[i] === type) {\n var map = mappings[i];\n\n if (map) {\n return Util.Promise.buildResolved(map);\n } else {\n return Util.Promise.buil...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
attacht the helper script
function attachHelper(tab){ return tab.attach({ contentScriptFile: self.data.url("helper.js") }); }
[ "function scriptMain() {\n pageSetup();\n\n}", "compileSetupScript(){\r\n\t\tvar code = \"self.currentScript.onSetup(config, data);\";\r\n\t\tthis.onSetupCaller = new util.CompiledScript(code, \"onSetupCaller\", {self: this}, this.timeout);\r\n\t}", "function injectMain() {\r\n debug('Injecting WpkTweak');\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns an array of randomly chosen declensions for this noun, all of which are incorrect for the given phrase.substitution.
getRandomDeclensions(numDeclensions, exludeCase) { // Pick two cases at random, exclude the correct case let availableCases = Object.keys(this._json.singular).filter(word => word !== exludeCase); let incorrectChoices = []; for (let idx = 0; idx < numDeclensions; idx++) { ...
[ "getCorrectAndIncorrectPronounDeclensions() {\n let chosenPronoun = undefined;\n if (this._json.pronounType === \"personal\") {\n chosenPronoun = Dictionary.getRandomPersonalPronoun(this._json.genders);\n } else {\n chosenPronoun = Dictionary.getRandomPossessivePronoun(thi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Captures all the symbols documented near the given AST node, including itself. This includes leading, inner, and trailing comments. This symbols are attached to the symboltree by adding them as a child of parent. The returned symbol is the one backed by the AST node.
function captureSymbols(nodePath: NodePath, parent: Symbol): ?Symbol { const node = nodePath.node; const symbolInfo = {}; extractSymbol(nodePath, parent, symbolInfo); let { name: simpleName, flags, init, initComment, isInit, nodeSymbol, } = symbolInfo; if (nodeSymbol.meta.params) ...
[ "getSymbolTable() {\n let node = this;\n while (node) {\n if (node.symbolTable) {\n return node.symbolTable;\n }\n node = node.parent;\n }\n }", "function list_of_symbols_rec(node)\n{\n\tif(kind(node) == NODE_SYM)\n\t{\n\t\treturn node;\n\t}\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns HTML describing the date range within start and end
function getDateDisplay(start, end) { var dayStart = start.getDate(); var dayEnd = end.getDate(); var monthStart = start.getMonth(); var monthEnd = end.getMonth(); var yearStart = start.getFullYear(); var yearEnd = end.getFullYear(); if (monthStart != monthEnd ...
[ "function updateDateRange(start, end){\n $('#daterange span').html(start.format('MMMM D, YYYY') + ' - ' + end.format('MMMM D, YYYY'));\n}", "formatRange(start, end) {\n // @ts-ignore\n if (typeof this.formatter.formatRange === \"function\") // @ts-ignore\n return this.formatter.formatRange...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Event handler to jump to the first slide. / \param ev the event that triggered the action / / This event handler is attached to a button. It calls activate() / to make element 0 in the `sync_elts` list the current element / and repositions the video accordingly, with seek_video().
function first_slide(ev) { ev.preventDefault(); activate(0); // Move the "active" class // console.log("first: current = "+current+" t -> "+timecodes[current]); seek_video(); }
[ "function prev_slide(ev)\n {\n ev.preventDefault();\n if (current == 0) return; // Already at first element\n activate(current - 1); // Move the \"active\" class\n //console.log(\"prev: current = \"+current+\" t -> \"+timecodes[current]);\n seek_video();\n }", "function next_slide(ev)\n {\n e...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Hide the currently displayed instructional message
function hideInstruction() { document.getElementById("instruction").style.display = "none"; }
[ "function hideInstructions() {\n document.getElementById('info').style.display = 'none';\n}", "function hideInformation() {\n $statusInfo.css(\"display\", \"none\");\n }", "hide() {\r\n this.info = false;\r\n }", "function hideInstructions() {\n const instructions = document.getEleme...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Display BST left to right Function displays all nodes in the BST, a node's parent value and it's own value
display() { // Helper function to recursively iterate through tree. function _iterate(node) { // If the current node exists, print it's parent and current value if (node) { console.log(`Parent: ${node.parent ? node.parent.data : "None"} Current: ${node.data}`); ...
[ "rPrintPreorder(node = this.root){\n if(node){\n console.log(node.val);\n this.rPrintPreorder(node.left);\n this.rPrintPreorder(node.right);\n }\n }", "printPreOrder(node) {\n if (node === null) {\n return;\n }\n console.log(node.value);\n this.pr...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Loads to the given page all projects located between the positions in the first parameter to the second parameter in the data
function load_projects(from_no, to_no) { let temp = document.createElement('div'); temp.classList.add('mb-5'); temp.classList.add('pb-5'); temp.id = 'remove-me'; let some_data = Object.values(data).slice(from_no, to_no + 1); for (let datum of some_data) { if (datum.Abstract !== undefined...
[ "function findURL(name, page_data){\n //find index of projects based on name\n var index = keys.indexOf(name);\n var url = '/projects/' + projects[keys[index]].page;\n updatePage_index(index, page_data);\n //remove project and load current one\n emptyPage();\n loadProject(url);\n\n return;\n}", "loadProje...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Display and Animate Puzzle or Container dynamically
function displayPuzzle(puzzle){ setTimeout(function() { $('html, body').animate({ scrollTop: puzzle.offset().top }, 500); }, 180); }
[ "function onPuzzleComplete() {\n bm.showBackground();\n}", "function displayPuzzle(puzzle) {\n document.getElementById('tileContainer').innerHTML = puzzle;\n}", "function startPuzzle() {\n music.play();\n var instruction = document.getElementById(\"instructions\");\n instruction.style.display = 'none';...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
check the token is valid grap username from mongodb using decrypted token id insert all info about the message to messages mongodb collection finaly notify to all connected clients
saveMessage() { if (!this.message.token || !this.message.message) return; verifyToken(this.message.token, (id) => { if (id === undefined) return; getUsernameById(id, (username) => { const newMessage = new mongo.message({ sender: username, type: "Sent Message", ...
[ "async function validate(token) {\n\tconst userCollection = db.collection('users');\n\tconst decodedToken = jwt.decode(token, 'secret_key');\n\tconst user = await userCollection.findOne({\n\t\tusername: decodedToken.username\n\t});\n\treturn user;\n}", "function checkToken(token, user) {\n console.log('Attemptin...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
TODO: fungsi digunakan untuk menyimpan array absen sesuai NIS
function set_absensi_array(data){ absensi_siswa_arr=[]; for(var i=0;i<getJumlah();i++){ absensi_siswa_arr.push({ status : data[i].charAt(0), id_kelas_siswa : getIdKelas(i), }); } }
[ "function procesarArray() {}", "function addAbsensiSiswa(tanggal, noInduk, absen) {\n const dataSiswa = getDetailSiswa(noInduk);\n\n if (dataSiswa[0] === '00000') {\n console.log('~Tambah data absen gagal, invalid no-induk siswa~\\n');\n } else {\n let arrData = [tanggal, dataSiswa[0], dat...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Put the content from modal.tmp to modal.content
function fillContent() { debug('fillContent'); if (!modal.tmp.html()) return; modal.content.html(modal.tmp.contents()); modal.tmp.empty(); wrapContent(); if (currentSettings.type == 'iframeForm') { $(currentSettings.from) .attr('target', 'nyroModalIframe') .data('processing', 1) ...
[ "function fillContent() {\n debug('fillContent');\n if (!modal.tmp.html())\n return;\n\n modal.content.html(modal.tmp.contents());\n modal.tmp.empty();\n wrapContent();\n\n if (currentSettings.type == 'iframeForm') {\n $(currentSettings.from)\n .attr('target', 'nyroModalIframe')\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
function: REQ_SPEC_MGMT launcher for REQuirement SPECification ManaGeMenT args: returns:
function REQ_SPEC_MGMT(id) { var _FUNCTION_NAME_="REQ_SPEC_MGMT"; var pParams = tree_getPrintPreferences(); var action_url = fRoot+req_spec_manager_url+"?item=req_spec&req_spec_id="+id+args+"&"+pParams; // alert(_FUNCTION_NAME_ + " " +action_url); parent.workframe.location = action_url; }
[ "function REQ_MGMT(id)\n{\n var _FUNCTION_NAME_=\"REQ_MGMT\";\n var pParams = tree_getPrintPreferences();\n var action_url = fRoot+req_manager_url+\"?item=requirement&requirement_id=\"+id+args+\"&\"+pParams;\n\n //alert(_FUNCTION_NAME_ + \" \" +action_url);\n parent.workframe.location = action_url;\n\n}", "f...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Splits current input value into individual strings to grab keys to eliminate from suggestion pool
addExistingKeys() { const items = []; const inputKeys = this.props.uiState.fieldsKvString.split(' '); inputKeys.forEach((item) => { if (item.includes('=')) { items.push(item.substring(0, item.indexOf('='))); } }); this.setState({existingKey...
[ "makeSuggestions(inputValue) {\n //Return no suggestions if input is blank\n if (inputValue == \"\")\n return [];\n\n //Make array of objects with each suggestion name and length of string in common with inputValue\n const suggestionData = this.state.suggestionData.slice();\n var suggestions = [...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
toggle() Toggling Array Values
function toggle(array, valuesToToggle, opt_fnTestEquality) { array = slice(array); valuesToToggle = slice(valuesToToggle); for (var j, i = array.length, valuesCount = valuesToToggle.length; i--;) { for (j = valuesCount; j--;) { if (opt_fnTestEquality ? opt_fnTestEquality(array[i], valuesT...
[ "function toggle(arr, w) {\n\tif(arr[w] == 0) arr[w] = 1;\n\telse arr[w] = 0;\n}", "function fillToggleArray(){\r\n array.forEach(function(m){\r\n arrayToggleOn.push(true);\r\n });\r\n}", "function toggleVisibility(arr) {\n let toggleVisibility = arr.getAttribute(\"data-active\") === \"true\";\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Make sure the terminal cursor doesn't stay hidden after the program exits
function exitHandler() { cliCursor.show() }
[ "function cleanTerminal () {\n term.grabInput(false)\n term.hideCursor(false)\n term.styleReset()\n}", "function restoreCursor() {\n process.stdout.write('\\x1B[?25h');\n}", "showCursor() {\n if (!this.scriptOwner.project) return null;\n this.scriptOwner.project.hideCursor = false;\n }", "checkFo...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Handle autocomplete for search filter "Location".
handleFormLocAutoComplete(searchText) { this.setState({location: searchText}); this.handleLocationAutoComplete(searchText); this.handleLocationAutoCompleteSelect(searchText); }
[ "function setupLocationAutocomplete() {\n\n if (!window.google) {\n // Google Places API not loaded\n return;\n }\n\n var form = $(\"#change-location-form\");\n\n var input = form.find('[name=\"place\"]');\n if (!input.length) {\n return;\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Decodes a CAS from the binary. If the binary is not at all a cassette, returns undefined. If it's a cassette with decoding errors, returns partiallydecoded object and sets the "error" field.
function decodeCassette(binary) { const start = 0; const annotations = []; const cassetteFiles = []; while (true) { let recentBits = 0xFFFFFFFF; let programBinary; let speed; let programStartIndex = 0; for (let i = start; i < binary.length; i++) { cons...
[ "function decodeCassette(binary) {\n const start = 0;\n const annotations = [];\n const cassetteFiles = [];\n while (true) {\n let recentBits = 0xFFFFFFFF;\n let programBinary;\n let speed;\n let programStartIndex = 0;\n for (let i = start; i < binary.length; i++) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get current Guzzlr quest location
function getLocation() { return (0, _property.get)("guzzlrQuestLocation"); }
[ "function LMSGetLessonLocation()\n{\n\treturn(GetValue(\"cmi.location\"))\n}", "function currentLocation() \r\n{\r\n\treturn locations[player.location];\r\n}", "function getLocation() {\n return GPoint(this.x, this.y);\n }", "function getLocation() {\n return findLocation(getStatus());\n}", "get loc...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get CSS from Greasemonkey scriptvals
function Get_CSS_by_GM_getValue(css) { Add_CSS(css); }
[ "function Get_Preview_CSS_by_GM_xmlhttpRequest(url) {\r\n\tcall_GM_xmlhttpRequest(url, get_preview_css_result)\r\n}", "function ParserCSS( ) {\n}", "function get_css_result(res) {\r\n\tvar css = res.responseText;\r\n\tvar status = res.status;\r\nLOG.output(\"HTTP status:\"+status);\r\n\tif ( status != 200 ) {\t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
;; camSetPropulsionTypeLimit(number) ;; ;; On hard and insane the propulsion type can be limited with this. For type II ;; pass in 2, and for type III pass in 3. Hard defaults to type II and ;; insane defaults to type III. If nothing is passed in then the type ;; limit will match what is in templates.json. ;;
function camSetPropulsionTypeLimit(num) { if (!camDef(num)) { __camPropulsionTypeLimit = "NO_USE"; } else if (num === 2) { __camPropulsionTypeLimit = "02"; } else if (num === 3) { __camPropulsionTypeLimit = "03"; } }
[ "set cameraType(value) {}", "static set maxTextureSize(value) {}", "set maximumPossiblePressure(value) {}", "setFramerateLimit (limit) {\n\n\n /**\n * set the limit\n */\n\n this.framerateLimit = limit;\n\n\n }", "function setMaxAllowedRepresentationRatioFor(type, value) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
function that brings the cars back after they vanish
function goBack(){ for (let i = 0; i < carImage.length; i++){ if (CarDisappeared(xCars[i])){ xCars[i] = xCarLoop[i]; } } }
[ "function driveAway() {\n game.pauseGameTimer();\n function moveRight() {\n car.position.x += 50;\n\n if (car.position.x < (game.width + (car.width))) {\n setTimeout(function () { moveRight(); }, 30);\n }\n }\n\n //remove the body of car\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Custom B validation If developer has choosen the survey type as customB, then it should get exception request from white list file.
function checkCustomBExceptionStatus() { var is_valid = false, href = settings.survey.url, i, exception_data; for (i = 0; i < settings.exception.data.length; i++) { exception_data = settings.exception.data[i]; if (exception_data['for'] === "cu...
[ "function validateLine_CheckVBLineType(type)\r\n{\r\n if(type!='item' && type!='expense')\r\n {\r\n return true;\r\n }\r\n \r\n var stBillDistribtn = nlapiGetFieldValue('custbody_svb_vb_to_bell_dist_sched'); \r\n \r\n if(!stBillDistribtn)\r\n {\r\n return true;\r\n }\r\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
configFunction.$inject = ['$routeProvider']; //from angulrroute.js // this line not necessary
function configFunction($routeProvider) { $routeProvider .when('/register', { templateUrl: '/angularapp/auth/register.html', controller: 'AuthController', controllerAs: 'vm' }) .when('/login', { templateUrl: '/angularapp/auth/login.html', controller: 'AuthController', ...
[ "function routeConfig($routeProvider) {\n $routeProvider\n // Authentication\n .when('/login', {\n template: require('../auth/templates/login.html'),\n controller: 'loginController'\n })\n // Functionality\n .when('/beacons', {\n template: requi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
loadAddons() Load addon (3rd party) modules
function loadAddons() { var modules = getActiveAddonModules(), module, options, option, i; for (i = 0; i < modules.length; i += 1) { options = modules[i].split(':'); if (options.length > 1) { module = options.shift(); } else { // no options module = options[0]; } if (options[0].indexOf('privat...
[ "loadEnabledAddons(state) {\n\n let apiFunctions = api.init(state);\n for (let [_, addon] of this._addons) {\n if (addon.enabled) {\n try {\n addon.execute(apiFunctions);\n } catch (error) {\n printPrettyError(\"Executing a...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
saves list of test cases to the specified file path
function saveToCsv (fileName, testCases) { var stringifiedTestCases = testCases.map(x => x.display()); fs.writeFileSync(fileName, stringifiedTestCases.join('\n')); }
[ "function exportSavedTests() {\n\n dialog.showSaveDialog({\n title: 'Choose the location for the exported data',\n defaultPath: app.getPath('home'),\n filters: [{ name: 'CSV', extensions: ['csv'] }]\n }, (filename) => {\n\n // set up ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Goes to the next challenge
function goToNextChallenge() { //Add the current challenge to the answered challenges collection var answeredChallenges = Session.get("answeredChallenges"); answeredChallenges.push(Session.get("currentChallengeId")); Session.set("answeredChallenges", answeredChallenges); //Clear the current challen...
[ "load_next_challenge() {\r\n this.success(\"Good JOB! You solved the question\", \"green\");\r\n if (this.challenges.has_next_challenge()) {\r\n const challenge = this.challenges.next();\r\n this.display_challenge_description();\r\n } else {\r\n this.handle_win(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Start the portfolio updater
function startPortfolioUpdater() { PORTFOLIO_UPDATER = setInterval(updatePortfolio.updatePortfolio, FETCH_INTERVAL); isUpdaterActive = true; console.log('Portfolio updater started'); }
[ "installUpdate() {\n logger.info('Initializing update process (quit & install)');\n autoUpdater.quitAndInstall();\n }", "function stopPortfolioUpdater() {\n\tclearInterval(PORTFOLIO_UPDATER);\n\tisUpdaterActive = false;\n\tconsole.log('Portfolio updater stopped');\n}", "installUpdate() {\n log.info('I...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Scales the given element by the given scale factor.
function scaleElement(element, scaleFactor) { element.css("-webkit-transform", "scale(" + scaleFactor + "," + scaleFactor + ")"); element.css("-moz-transform", "scale(" + scaleFactor + "," + scaleFactor + ")"); element.css("transform", "scale(" + scaleFactor + "," + scaleFactor + ")"); }
[ "function scale(el, val) {\n el.style.mozTransform = el.style.msTransform = el.style.webkitTransform = el.style.transform = 'scale3d(' + val + ', ' + val + ', 1)';\n}", "function scale(currentScaleFactor, newScaleFactor) {\n\n for (var i = 0; i < drawElements.length; i++) {\n drawElements[i].scale(curr...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Fetch All Branch begin
function fetchAllBranches() { console.log("get all branches") BranchService.fetchAllBranches() .then( function (branches) { self.branches = branches; //console.log("get all branches "+self.branches) }, function (errResponse) { console.log('Error while fet...
[ "function fetchAllBranches() {\r\n\t\tBranchService.fetchAllBranches()\r\n\t\t\t.then(\r\n\t\t\t\t\tfunction (branches) {\r\n\t\t\t\t\t\tself.branches = branches;\t\t\t\t\r\n\t\t\t\t\t}, \r\n\t\t\t\t\tfunction (errResponse) {\r\n\t\t\t\t\t\tconsole.log('Error while fetching branches');\r\n\t\t\t\t\t}\r\n\t\t\t\t);\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Checks that a position is not already occupied and that the color taking the position will result in some pieces of the opposite color being flipped.
function checkifvalid(board, pos, color){ var allPieceToFlip = []; for(let i = 0; i <= Board.DIRS.length - 1; i++){ let dir = _positionsToFlip(board, pos, color, Board.DIRS[i], []); allPieceToFlip = allPieceToFlip.concat(dir); } for(let k = 0; k <= allPieceToFlip.length - 1; k++){ if(allPieceToFlip[k] !=...
[ "function notSameColor(pos1, pos2) {\r\n var piece1 = board[pos1[0]][pos1[1]];\r\n var piece2 = board[pos2[0]][pos2[1]];\r\n if (piece1 != nX && piece2 != nX) {\r\n if (piece1.color == piece2.color) {\r\n return false;\r\n }\r\n }\r\n return true;\r\n}", "function hasOppositeChecker(row, col, colo...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
choose a random substition... nonweighted
function pickRandomSubstitution (choiceArray) { var randomNonweightedIndex = Math.floor((Math.random() * choiceArray.length)); return choiceArray[randomNonweightedIndex]; }
[ "function pickRandomSubstitution(choiceArray) {\n var randomNonweightedIndex = Math.floor((Math.random() * choiceArray.length));\n return choiceArray[randomNonweightedIndex];\n}", "weightPerturbation(){\n let signe = 1;\n if(randInt(2) == 0) signe = -1;\n this.weight += signe * (this.we...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Add a mesh to the archive
addMesh(mesh, folder = this.zip) { // Throw an error if mesh is not a Mesh validate({ mesh }, 'Mesh'); // Throw an error if folder is not a folder validate({ folder }, () => (folder && folder.file), `"folder" to be a valid ZIP directory`); // Parse the mesh to an .obj const OBJ = new OBJParse...
[ "AddMesh(mesh) {\n this._meshes.push(mesh);\n }", "function addMesh(t) { // color, url, caption\n var _mesh = new X.mesh();\n var _idx=meshs.length;\n//\n var _color= t['color'];\n if(_color == undefined) {\n _color=getDefaultColor(_idx);\n t['color']=_color;\n }\n _mesh.color = _color;\n//\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns truthy if a declaration has resolved. If the declaration happens to be an array of declarations, it will recurse to check each declaration in that array (which may also be arrays).
function isResolvedDeclaration(declaration) { if (Array.isArray(declaration)) { return declaration.every(isResolvedDeclaration); } return !!resolveForwardRef(declaration); }
[ "function isResolvedDeclaration(declaration) {\n if (Array.isArray(declaration)) {\n return declaration.every(isResolvedDeclaration);\n }\n\n return !!_resolveForwardRef(declaration);\n }", "function isResolvedDeclaration(declaration) {\n if (Array.isArray(declaration)) {\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
ACCESS NUMBERS get product access numbers
function getProductAccessNumbers(maincode){ var myResult = ProdsFactory.getProductAccessNumbers(maincode).then( function(data){ var info = { Name: $scope.item.Name, CountryName: $scope.item.CountryName, CarrierName: $scope.item.CarrierName }; // console.log(accessData); v...
[ "function getProductAccessNumbers(maincode){\n\t\t\tvar myResult = ProdsFactory.getProductAccessNumbers(maincode, userInfo).then(\n\t\t\t\tfunction(data){\n\n\t\t\t\t\tvar info = {\n\t\t\t\t\t\tName: $scope.item.Name,\n\t\t\t\t\t\tCountryName: $scope.item.CountryName,\n\t\t\t\t\t\tCarrierName: $scope.item.CarrierNa...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Created: 22/08/2014 | Developer: reyro | Description: deletes transitions | Request:Ajax
function fnDeleteTransition(id) { jQuery.ajax({ type: 'POST', url: bittionUrlProjectAndController + 'fnDeleteTransition', dataType: 'json', data: { id: id }, success: function(response) { if (response['status...
[ "function confirmDelete() {\n transition(CONFIRM)\n }", "removeMovieFromAjax() { }", "function noTransition() {\n transition = false;\n}", "function removeTransition(e) {\n// console.log(e)// this is just to see what it is removing we should see the transition \n\n// we have 5 lines of Transition...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns a map of cron frequency/schedule configurations
function getCronConfig() { return { daily: `${wakeUpMinute} ${wakeupHour} * * *`, weekly: { sun: `${wakeUpMinute} ${wakeupHour} * * sun`, mon: `${wakeUpMinute} ${wakeupHour} * * mon`, tue: `${wakeUpMinute} ${wakeupHour} * * tue`, wed: `${wakeUpMinute} ...
[ "getSchedule(){\n // return CRON schedule format\n // this sample job runs every 15 seconds\n return '*/15 * * * * *';\n }", "get schedules() {\n return Array.from(this._schedules.values());\n }", "static get schedule() {\n return {\n // interval: '1m', // 1 minute ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
updateBgImages (1) Update "iframes" settings with user input (2) save settings (3) send updated settings to tab.js to modify active tab blur css
function updateBGImages () { settings.bgImages = document.querySelector("input[name=bgimages]").checked browser.storage.sync.set({"settings": settings}) sendUpdatedSettings() }
[ "function setBG(){\r\n setBGBtn.style.borderLeft = '1px solid #4db6ac';\r\n generateBGBtn.style.borderLeft = '1px solid transparent';\r\n generateBGBtn.style.opacity = '.6'\r\n setBGBtn.style.opacity = '1'\r\n\r\n var categoryItems = Array.from(BGCategories.children)\r\n categoryItems.forEach(func...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
do any of the words in a list contains a search string?
function searchList(listOfWords, searchString) { return listOfWords.reduce((tillNow, now) => { return tillNow || searchString.indexOf(now) !== -1; }, false); }
[ "contains(keywords, search){\n for(var i = 0; i < keywords.length; i++){\n if(keywords[i].includes(search)){\n return true;\n }\n }\n return false;\n }", "function check(data, words, searchFields){\n for(let i = 0; i<words.length;i++){\n let word = words[i]\n let flag = false\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
2.CREATION OF THE SEQUENCE. Called by "constructor"> It will create the sequence,that is the maximum of levels. In this case is 10.
sequenceMaker(){ let levelsMax=slider.value; this.LEVEL_MAX= parseInt(levelsMax); this.sequence=new Array(this.LEVEL_MAX).fill(0).map(n=>Math.floor(Math.random()*4)) nMaxLevel.innerText=`${this.LEVEL_MAX}`; }
[ "function generateSeq() {\r\n\r\n}", "function nextLevel(){ alert(\"LEVEL COMPLETE !!!\")\n\t\t\t\t\t\t\t\t\t\t Goal = Goal + 4; // it rise the level of the new sequence of 4 elements\n\t\t\t\t\t\t\t\t\t\t Limit = 1; // it brings back limit value to 1 \n\t\t\t\t\t\t\t\t\t\t stepCounter = 0;\t// it resets stepC...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
5. Find words that contain `is`
function findIs(){ var is = []; for ( i=0; i<strings[i].length; i++ ){ var word = strings[i]; for (count = 0; count < word.length; count++) { if (word[count] === "i" && word[count + 1] === "s"){ is.push(word); } } }return is; }
[ "function findIsWords(strings) {\n var isWords = strings.filter(function(eachString){\n return eachString.indexOf('is') >= 0; //cant figure out why this has to be zero to work.\n });\n return isWords;\n}", "function findWordsContainIs(input){\n\tvar whichElementsContainIs = [];\n\tfor(count = 0; count < inp...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
given two collections, find the first index that has different content. If the two lists are the same, return 1 to indicate no differences were found.
function indexOfDiffereces(a, b) { if (a === b) return -1; var i = 0, aLength = a.length, bLength = b.length ; while (i < aLength) { if (i < bLength && a[i] === b[i]) i++; else return i; } return i === bLength ? -1 : i; }
[ "function firstDiff(A, B) {\n for (var i = 0; i < Math.min(A.length, B.length); i++) {\n if (A[i] !== B[i]) {\n return i;\n }\n }\n return -1;\n}", "function getIndexOfFirstDifference(a, b, equal) {\n for (var i = 0; i < a.length && i < b.length; i++) {\n if (!equal(a[i], b[i])) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Spawns the selenium server if directConnect is not enabled.
function spawnSelenium() { const config = require(getProtractorConfigPath()).config; // Assumes we're running selenium oursevles, so we should prep it if (config.seleniumAddress) { selenium.install({ logger: logger.info }, () => { selenium.start((err, child) => { seleniumServer = child; ...
[ "function start( next, isHeadless, options ) {\n function seleniumStarted() {\n console.log( 'seleniumrc webdriver ready on ' + options.host + ':' + options.port );\n started = true;\n starting = false;\n if ( typeof next === 'function' ) {\n return next();\n }\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Deactivates the line ripple
deactivate() { this.adapter_.addClass(cssClasses$c.LINE_RIPPLE_DEACTIVATING); }
[ "deactivateLineRipple() {}", "deactivateLineRipple() {\n debug(LOG, 'deactivateLineRipple',{});\n\n if (this.element.lineRippleEl) {\n this.element.lineRippleEl.foundation.deactivate()\n }\n }", "activateLineRipple() {}", "deactivate() {\n this.adapter_.addClass(cssClasses$3.LINE_RIPPLE_DEAC...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function that colors class colmd4 red
function myFunction() { document.querySelector(".col-md-4").style.backgroundColor = "red"; }
[ "colorChange() {\n this.col = color ('rgb(180, 38, 136)')\n\n}", "function eleccion_color(){\r\n\r\n }", "function RedDiv(color){}", "function addRedError(field) {\n field.addClass('backgroundred');\n}", "function color(div) {\n var div = div;\n if (div.attr(\"class\") != null ) {\n va...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Updates the number of participants in the contact list button and sets the glow
function updateNumberOfParticipants(delta) { //when the user is alone we don't show the number of participants if(numberOfContacts === 0) { $("#numberOfParticipants").text(''); numberOfContacts += delta; } else if(numberOfContacts !== 0 && !ContactList.isVisible()) { ...
[ "function updateNumberOfParticipants(delta) {\n numberOfContacts += delta;\n if (numberOfContacts === 1) {\n // when the user is alone we don't show the number of participants\n $(\"#numberOfParticipants\").text('');\n ContactList.setVisualNotification(false);\n } else if (numberOfCont...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
actionFunction is a function that will either infect, recover, or kill cells. doThisToNeighbors is a function that will take the actionFunction and perform that action on the surrounding cells.
function doThisToNeighbors(r, c, actionFunction, mut) { var borders = getBorders(r, c); var left = borders.left; var right = borders.right; var top = borders.top; var bottom = borders.bottom; for(var i = top; i<=bottom; i++){ for (var ii = left; ii<=right; ii++) { actionFunct...
[ "surroundingCells(fn) {\n\t\tconst movements = [-1,0,1];\n\n\t\t// Each surrounding cell\n\t\tmovements.forEach(xdir => {\n\t\t\tmovements.forEach(ydir => {\n\t\t\t\tif(xdir !== 0 || ydir !==0) {\n\t\t\t\t\tlet xcoord = this.x + xdir;\n\t\t\t\t\tlet ycoord = this.y + ydir;\n\n\t\t\t\t\tconst coord = this.game.getIn...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Saves a Cookie with the given counterNumber. The Value consists of the countername and its actual count seperated by a space.
function setCookie(counterNumber, html) { var count = html.find(`#counter${counterNumber}`).text(); var name = html.find('input').val(); var cookie = { name: name, count: count }; console.log(cookie); Cookies.set(counterNumber, cookie); }
[ "function saveCount(countValue, localStoreName) {\n json_data = { \"count\" : countValue };\n localStorage.setItem( localStoreName, JSON.stringify(json_data));\n}", "function incrementCounter () {\n const cookie = getCookie('counter')\n if (cookie) {\n const newNumVisit = parseInt(cookie) + 1\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
expand / collapse all logic for model items
function expandAll(model, state) { if (model && model.items) { var items = model.items; angular.forEach(items, function(item){ angular.forEach(item.items, function(i){ i.showDetail = state; }); }); } }
[ "function expandAll(model, state) {\n if (model && model.items) {\n var items = model.items;\n for (var key in items) {\n if (items.hasOwnProperty(key)) {\n var e = items[key];\n e.showDetail = state;\n }\n }\n }\n }", "function expandItem(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns true if the two input stack trace interfaces have the same content
function isSameStacktrace(stack1,stack2){if(isOnlyOneTruthy(stack1,stack2))return false;var frames1=stack1.frames;var frames2=stack2.frames;// Exit early if stacktrace is malformed if(frames1===undefined||frames2===undefined)return false;// Exit early if frame count differs if(frames1.length!==frames2.length)return fal...
[ "function isSameStacktrace(stack1, stack2) {\n\t if (isOnlyOneTruthy(stack1, stack2))\n\t return false;\n\n\t var frames1 = stack1.frames;\n\t var frames2 = stack2.frames;\n\n\t // Exit early if frame count differs\n\t if (frames1.length !== frames2.length)\n\t return false;\n\n\t //...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns callback(errors[], mergedGene[], offsetDescriptor[])
function _createMergedGene(genePath, changeSet, chromosomeName, chromosomeInterval, offset) { var callback = arguments[arguments.length - 1]; if (typeof(callback) !== 'function') callback = function(){}; var changeRows = changeSet.split("\n"); var errors = []; var conflict = {}, recentlySkippedRows = 0; //T...
[ "function callback(){}", "function getAssemblyAndChromosomesFromEutils(callback, recovering) {\n var asmSearchUrl, nuccoreLink,\n asmAndChrArray = [],\n ideo = this,\n context = {callback: callback, recovering: recovering, ideo: ideo};\n\n asmSearchUrl = getAssemblySearchUrl(ideo);\n\n d3.json(asmSear...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
return a random nickname with random "year" suffix
function randomNickname() { var name = names[(Math.random() * names.length) | 0]; return name + '_' + (1980 + ((Math.random() * 30) | 0)); }
[ "function generateRandomYear() {\n return Math.round(Math.random() * 1000 + 1900);\n}", "randomName () {\n\t\treturn 'company ' + RandomString.generate(12);\n\t}", "getRandomName(){\n\t\treturn Math.random().toString(36).replace(/[^a-z]+/g, '').substr(0, 5);\n\t}", "function getRandomAuthor() {\n var ti...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
If the context defines a propertyscoped context for the given key, that context will be returned. Otherwise, the given context will be returned asis. This should be used for valueToTerm cases that are not objects.
async getContextSelfOrPropertyScoped(context, key) { const contextKeyEntry = context.getContextRaw()[key]; if (contextKeyEntry && typeof contextKeyEntry === 'object' && '@context' in contextKeyEntry) { context = await this.parsingContext.parseContext(contextKeyEntry, context.getContextRaw(),...
[ "function getContext(key) {\n return get_current_component().$$.context.get(key);\n }", "function getContext(key) {\n return get_current_component().$$.context.get(key);\n}", "visitKeyOrValueProperties(ctx) {\n\t return this.visitChildren(ctx);\n\t}", "processProperty(context, prop) {\n retur...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
code here can use carName
function myFunction() { // code here can also use carName }
[ "function myFunction() {\r\n\r\n // code here can also use carName\r\n\r\n }", "function myFunction() {\n\n // code here can use carName \n\n}", "function defineCarName() {\n\t. . . //var carName can be used here\n}", "function myFunction() {\n // code here can also use carName\n}", "get c...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
activates the map for polygon editing turns off the navigation tool bar
function activatePolygonEdit() { if (map == null) { alert(mapNotReady); return; } if (map.graphics == null) { alert(mapNotReady); return; } if (!isMovePlotFrameToolActive) { isMovePlotFrameToolActive = true; navToolbar.deactivate(); map.gra...
[ "removeNavigationFromMap() {\n this.map.dragRotate.disable();\n this.map.dragPan.disable();\n this.map.touchZoomRotate.disable();\n this.map.doubleClickZoom.disable();\n this.map.scrollZoom.disable();\n }", "function deactivate() {\n measureApp.toolbar.deactivate();\n clearMa...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Private directive consumed by mdcalendar. Having this directive lets the calender use mdvirtualrepeat and also cleanly separates the month DOM construction functions from the rest of the calendar controller logic.
function mdCalendarMonthDirective() { return { require: ['^^mdCalendar', 'mdCalendarMonth'], scope: {offset: '=mdMonthOffset'}, controller: CalendarMonthCtrl, controllerAs: 'mdMonthCtrl', bindToController: true, link: function(scope, element, attrs, controllers) { var cal...
[ "function mdCalendarMonthDirective() {\n return {\n require: ['^^mdCalendar', 'mdCalendarMonth'],\n scope: {\n offset: '=mdMonthOffset'\n },\n controller: CalendarMonthCtrl,\n control...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Checks if a story is in the user's favorites array
function checkFavorite(story) { return currentUser.favorites.some(function(storyItem){ return storyItem.storyId === story.storyId; }) }
[ "function isFavorited(story) {\n\t\tfor (let favStory of currentUser.favorites) {\n\t\t\tif (story.storyId === favStory.storyId) return true;\n\t\t}\n\t\treturn false;\n\t}", "function isFavorite(story) {\n let favStoryIds = new Set();\n if (currentUser) {\n favStoryIds = new Set(currentUser.favorites....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
rounds tiny numbers to zero
function roundTiny(n){ if(Math.abs(n) < Number.EPSILON) return 0; return n; }
[ "function zero (number) {\n return 0;\n}", "function zero(num){\n return num * 0\n}", "function zeroise($number, $threshold) {\n return sprintf('%0'.$threshold.'s', $number);\n }", "function prefixUnitZero(val) {\n let newVal = val;\n if(val < 0) {\n newVal = val / -1;\n }\n newVal = newVal <...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Launches the interactive menu for serverless.json building.
function _setupMenu() { inquirer.prompt(_questions_region) .then(answers => { if (answers.done == false) { log(`> Aborted by user, "./serverless.json" not saved.`, 'error'); log(`> End.`, 'error'); } else { answers.done = undefined; ...
[ "function onOpen() {\n var ui = SpreadsheetApp.getUi(); // Sheet UI\n ui.createMenu('Purchase Request Workflow')\n .addSubMenu(ui.createMenu('⚙️ Configure')\n .addItem('⚙️ 1) Setup Workflow Config', 'configure')\n .addSeparator()\n .addItem('⚙️ 2) Setup Request Sheet', 'initialize'))\n .addS...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function that deletes the auto sync trigger.
function deleteTrigger() { // Loop through all the available trigger let allTriggers = ScriptApp.getProjectTriggers(); for (const trigger of allTriggers) { if (trigger.getHandlerFunction() === "syncTo_") { // delete the trigger. ScriptApp.deleteTrigger(trigger); // update the menu l...
[ "function remove_trigger()\n {\n var trigger = get_trigger();\n\n trigger.remove();\n }", "function clearTrigger() {\n\tvar triggers = ScriptApp.getProjectTriggers();\n\tfor(var i = 0; i < triggers.length; i++) {\n\t\tif(triggerFunctionList.indexOf(triggers[i].getHandlerFunctio...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
PRODUCTS impressions and actions
function impressions() { if (! $(".ua_addImpression").size()) return; var batchSize = 20; var counter = 0; var properties = ['id', 'name', 'list', 'brand', 'category', 'variant', 'position', 'price']; $(".ua_addImpression").each(function() { markAsSent($(this), 'ua_addImpression'); var fieldsObj = {}...
[ "function promoImpressions() {\n\t\tvar className = \"ua_addPromoImpression\";\n\n\t\tif (! $(\".\" + className).size()) return;\n\n\t\tvar properties = ['id', 'name', 'creative', 'position'];\n\n\t\t$(\".\" + className).each(function() {\n\t\t\tmarkAsSent($(this), className);\n\t\t\tvar fieldsObj = {};\n\t\t\tfor ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
TypeSystemExtension : SchemaExtension TypeExtension TypeExtension : ScalarTypeExtension ObjectTypeExtension InterfaceTypeExtension UnionTypeExtension EnumTypeExtension InputObjectTypeDefinition
function parseTypeSystemExtension(lexer) { var keywordToken = lexer.lookahead(); if (keywordToken.kind === TokenKind.NAME) { switch (keywordToken.value) { case 'schema': return parseSchemaExtension(lexer); case 'scalar': return parseScalarTypeExtension(lexer); case 'type': ...
[ "function parseTypeSystemExtension(lexer) {\n var keywordToken = lexer.lookahead();\n\n if (keywordToken.kind === _lexer.TokenKind.NAME) {\n switch (keywordToken.value) {\n case 'schema':\n return parseSchemaExtension(lexer);\n\n case 'scalar':\n return parseScalarTypeExtension(lexer);\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
FUNCTION ADJUST MOBILE LOGO This will adjust the look/feel of the logo on mobile
function adjustMobileLogo(nav){ var isMobileLogo = nav.find('.mobile-logo'); nav.find('.mobile-logo').remove(); var mxHeight = nav.find('.mobile-menu-items').first().outerHeight(); isMobileLogo.find('img') .css({ 'max-height': mxHeight }); ...
[ "function drawMobileLogo(ctx) {\n var bgColor = \"#e45b15\";\n drawFilledRect(ctx, bgColor, 0, 0, w, h - capH);\n drawIpad(ctx);\n}", "function logoSizeOnSmallScreens(){\n\t\"use strict\";\n\t// 100 is height of header on small screens\n\t\n\tif((100 - 20 < logo_height)){\n\t\t$j('.q_logo a').height(100 - 20);...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get skip markers into temporary cache
async getSkipMarkers(contentId, skip_type, start_inning, start_inning_half) { try { this.debuglog('getSkipMarkers') let skip_markers = [] // assume the game starts in a break let break_start = 0 // Get the broadcast start time first -- event times will be relative to this let ...
[ "skipNext(skipCount) {\n var rv = [];\n var startRange = this.index;\n // var tuplen = note.tupletStack[0].notes.length;\n var endRange = this.index + skipCount;\n rv = this.notes.slice(startRange, endRange);\n this.index = endRange;\n // this.startRange = this.index...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
get Friend page, if fully loaded, globalSignGFL should be [true, true, ...]
function getFriendPage(URL, pageNo){ $.get(URL, {}, function(newdata){ idList = $('div#list-results div.info a',newdata); for (var j=0; j<idList.length; j++){ selection = /profile\.do\?id=\d+/g.exec(idList[j].href); if (selection) { friendid = /\d+/g.exec(selection[0])[0]; globalFriendList.push(frien...
[ "function hasThisPagePublicity() { return getPublicityDiv(); }", "function loadFriendCorner() {\n\t// Fade out the page and change the HTML\n\t$(\"#second-page\").fadeOut(\"fast\", function() {\n\t\t$(\"#second-page\").html(friendCornerHTML);\n\t\tsetTimeout(function() {\n\t\t\tvar c = \"\";\n\t\t\tif((theme == 2...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
LEAP_ISLAMIC Is a given year a leap year in the Islamic calendar ?
function leap_islamic(year) { return (((year * 11) + 14) % 30) < 11; }
[ "_is_leap_year(year) {return year%4==0 && (year%100!=0 || year%400==0);}", "L(date) {\n return Number(isLeapYear(date));\n }", "function fnCheckLeapYear(iYear)\n{\n gaMonthDays[1] = (((!(iYear % 4)) && (iYear % 100) ) || !(iYear % 400)) ? 29 : 28\n}", "function isLeapYear(arg) {\nreturn (((arg % 4 == 0) ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
for Checkout detail submit
function frmCheckoutDetailSubmit() { //$('div#ordercheckoutDiv', this.el).hide(); //$('div#thankyouDiv', this.el).show(); // validate form data var Order = Backbone.Model.extend({ validate: function(attrs, options) { if (attrs.FirstName == '') { return "FirstName"; }else if (attrs.L...
[ "function submitCheckout() {\n const productIds = [];\n \n state.cart.forEach((item) => {\n for (let i = 0; i < item.purchaseQuantity; i++) {\n productIds.push(item._id);\n }\n });\n\n getCheckout({\n variables: { products: productIds }\n });\n }", "function submitCheckout()...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Object that can be used to configure the default options for the LiveAnnouncer.
function LiveAnnouncerDefaultOptions() {}
[ "function LiveAnnouncerDefaultOptions() { }", "function getDefaultOptions() {\n var options = {\n autoPlay: false, // automatically plays when loaded\n controls: true, // show control\n customPlayerSettings: {},\n heuristicProfile: \"Hybrid\", // affects the star...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
the first non repeating character is the first character in the string that occurs only once if the input string doesn't have any non repeating characters, your function should return 1 checking frequencies! good use case for a HASH TABLE!!
function firstNonRepeatingChar(str) { // create hash table to keep track of frequencies of letters in input string const hash = {}; // LOOP 1 // put each char into hash table as key and their total frequency in the input string as their values for (let i = 0; i < str.length; i++) { const currL...
[ "function firstNonRepeatingCharacter(string) {\n let seenHash = {};\n\n for (const char of string){\n if (!seenHash[char]){\n seenHash[char] = 1;\n } else {\n seenHash[char]++;\n }\n }\n\n for (const key in seenHash){\n const value = seenHash[key];\n if (value === 1)return string.indexO...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function to return the indexArray from params.ID, if existent
function returnIndexOfArrayFromId(req, res, next) { const { id } = req.params; req.indexArray = projects.findIndex(p => p.id === id); return next(); }
[ "buscarIndex(id,array){\r\n return array.findIndex((elem) => elem.getId() === id);\r\n }", "static getUserIndexById(id, array){\n for (var i = 0; i < array.length; i++){\n if (array[i].id === id){\n return i;\n }\n }\n return -1\n }", "getIndex (id, array) {\n for (let i = 0; i...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Tests whether switching to the next virtual desktop switches to zero if the current desktop is unavailable.
function testSwitchForwardFromDeletedDesktop() { asyncTestCase.waitForAsync('finishing desktop switch 1/4'); virtualDesktopManager.switchToDesktop(1, 1, true, function() { asyncTestCase.waitForAsync('finishing desktop switch 2/4'); virtualDesktopManager.switchToDesktop(3, 3, true, function() { async...
[ "function testRefuseSwitchingToEmpty() {\n asyncTestCase.waitForAsync('finishing desktop switch 1/1');\n virtualDesktopManager.switchToDesktop(1, 1, false, function() {\n assertEquals(0, currentDesktop);\n assertEquals('normal', windowProvider.windows[1].state);\n assertEquals('normal', windowProvider.wi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
createQuestionSummary Returns the text of the question from the header row for the question. If too long, truncates the question text and adds "...".
function createQuestionSummary(question) { if (question.length > 40) { // truncate the question and add "..." to the end. question = question.substring(0,40) + " ..."; } return question; }
[ "function generateQuestionRow(question) {\n // If the description is too long, cut it and append '...'\n if (question.text.length > 60) {\n question.text = question.text.substr(0, 60) + \"...\";\n }\n\n // Fill the template with the specified data\n var tableRow = Mark.up(templates['QuestionRo...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
_handleFocused changes the focus to enabled state.
_handleFocused(event) { if (this.props.status === 'default') { this._anim.restart(); } this.setState({ focused: true }); if (typeof this.props.onFocus === 'function') { this.props.onFocus(event, { focused: true }); } }
[ "handleFocus() {\n this.focused = true;\n this.updateItemList();\n\n document.addEventListener('click', this._handleClick);\n }", "_focusHandler() {\n const that = this;\n\n if (that.disabled || that._items.length === 0) {\n return;\n }\n\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sets the HTML autocomplete attribute based on the property "inputPurpose".
_setInputPurpose() { const that = this; if (that.readonly) { that.$.input.removeAttribute('autocomplete'); } else { that.$.input.setAttribute('autocomplete', that.inputPurpose); } }
[ "_setAriaAutocomplete() {\n const that = this,\n autoComplete = that.autoComplete,\n input = that.$.input;\n\n if (autoComplete === 'none') {\n input.setAttribute('aria-autocomplete', 'none');\n }\n else if (autoComplete === 'auto' || autoComplete === 'ma...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
adds company values to object and converts to it json
function addCompany() { var company = {}; company.name = document.getElementById('c-name').value; company.email = document.getElementById('c-email').value; company.description = document.getElementById('c-desc').value; company.cvr = document.getElementById('c-cvr').value; company.numEmployees = ...
[ "async CreateCompany(ctx, company) {\n company = JSON.parse(company);\n\n await ctx.stub.putState(company.id, Buffer.from(JSON.stringify(company)));\n\n let allPartners = await ctx.stub.getState(allPartnersKey);\n allPartners = JSON.parse(allPartners);\n allPartners.push(company);...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
_ESAbstract.CreateDataPropertyOrThrow / global CreateDataProperty 7.3.6. CreateDataPropertyOrThrow ( O, P, V )
function CreateDataPropertyOrThrow(O, P, V) { // eslint-disable-line no-unused-vars // 1. Assert: Type(O) is Object. // 2. Assert: IsPropertyKey(P) is true. // 3. Let success be ? CreateDataProperty(O, P, V). var success = CreateDataProperty(O, P, V); // 4. If success is false, throw a TypeError exception. ...
[ "function CreateDataPropertyOrThrow(O, P, V) { // eslint-disable-line no-unused-vars\n\t// 1. Assert: Type(O) is Object.\n\t// 2. Assert: IsPropertyKey(P) is true.\n\t// 3. Let success be ? CreateDataProperty(O, P, V).\n\tvar success = CreateDataProperty(O, P, V);\n\t// 4. If success is false, throw a TypeError exc...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
draw hero score function
function drawStat(){ ctx.font = '25px Helvetica'; ctx.fillStyle = '#333'; var score = 'SCORE:' + heroScore; ctx.fillText(score, 10, 35); var heros = 'LIVES:' + heroCount; var w = ctx.measureText(heros).width; ctx.fillText(heros, canvasWidth-w-10, 35); }
[ "scoreDisplay() {\n fill(this.colorRed, this.colorGreen, this.colorBlue);\n rect(this.scoreX, this.scoreY, width / 3, height);\n }", "function drawVictory() {\n ctx.font = \"2em Arial\"; //score font and size\n ctx.fillStyle = \"#0095DD\"; //score color\n ctx.fillText(\"You...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
classInheritorReplace("color_inheritor", category); classInheritorReplace("background_inheritor", category); classInheritorReplace("button_inheritor", category); SETUP CATEGORY COLORS
function classInheritorReplace(identifier, category) { var htmlClass = document.getElementById(identifier); var re = new RegExp('inheritor', "g"); var categoryClass = category == 'default' ? '' : category + '-'; // ex default returns nothing , football-, baseball- var classes = htmlClass...
[ "function setCategoryColors(category) {\n var color;\n switch (category) {\n case 'football':\n case 'nfl':\n case 'ncaaf':\n case 'nflncaaf':\n category = 'football';\n break;\n case 'basketball':\n case '...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Add new favorited story to user favorites' array, and update API with new favorited data. TODO: What is the story? (instance or a POJO?)
async addFavoriteStory(story){ console.debug("addFavoriteStory input", story) // Add to userFavoriteStoryArray this.favorites.push(story); // Update API with new favorited story await axios.post( `${BASE_URL}/users/${this.username}/favorites/${story.storyId}`, {token: this.loginToken}...
[ "async addStoryToFavorites(storyID) {\n\n // finds instance of story\n const favoriteStory = storyList.findStoryInstance(storyID);\n\n // update user.favorites\n this.favorites.unshift(favoriteStory);\n\n // send post request\n const response = await axios({\n url: `${BASE_URL}/users/${curren...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Lists the property availability changes from a given timestamp YYYYMMDD HH:MM:SS get property ID from listProperties(needs location ID) pullpropertydata
function listPropertyAvailabilityChanges(propertyID, since, authInfo) { return { Pull_ListPropertyAvbChanges_RQ: { ...createAuthentication(authInfo), PropertyID: propertyID, Since: since } } }
[ "function listPropertyPriceChanges(propertyID, since, authInfo) {\n return {\n Pull_ListPropertyPriceChanges_RQ: {\n ...createAuthentication(authInfo),\n PropertyID: propertyID,\n Since: since\n }\n }\n}", "function listPropertiesChangeLog(propertyIds, authInfo...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
updateCaret() sync the caret position internally
function updateCaret() { caret = selection.start - offset; }
[ "tickCaret () {\n this.toggleCaret()\n this._caretTickTimeout = setTimeout(\n () => this.tickCaret(),\n 500\n )\n }", "function putCaret(pos){\n _caret = pos;\n }", "startCaretTick () {\n this.stopCaretTick()\n this.tickCaret()\n }", "ensureCaretInView() {\n this.updateCa...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Parse current_config to evok.conf and upload it evok should take care of save & restart the service
function uploadConfig(){ var conf = {}; $.each(current_config, function(i,row) { obj = {}; content = {}; //add object name var objname = row.devtype.toUpperCase(); if (typeof(row.circuit) !== 'undefined') { objname+='_'+row.circuit; } //and fil...
[ "function upload_config_file()\n{\n let new_config_file = \"mid_screen=\"+String(v_ref)+\"\\n\"+\n \"adjust_gain=\"+String(adjust_gain)+\"\\n\";\n const file_path = path.join(process.env.PORTABLE_EXECUTABLE_DIR,CONFIG_FILE);\n fs.writeFileSync(CONFIG_FILE,new_config_file);\n}", "function updateConfig(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
PROTECTED Adds a mini netork element to the minimap.
function addMiniNetworkElement(ne) { if (ne.bgForm == ROUNDRECT) { var mne = document.createElement("v:roundrect"); mne.setAttribute("arcSize", ne.roundCornerPercentage); mne.setAttribute("id", "mini" + ne.id); document.getElementById(MINIMAP).appendChild(mne); } else if (ne.bgForm == ROMBO) { var mn...
[ "addMine()\n {\n if(empire.canBuild(\"mine\"))\n {\n empire.build(\"mine\");\n this.mines += 1;\n }\n }", "function writeMiniNetworkElement(ne) {\n\t\tvar mnesp = document.getElementById(\"mini\" + ne.id);\n\t\tmnesp.style.position = \"absolute\";\n\t\tmnesp.style.left = eval(ne.x) * this.xRa...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
query user based on username, return userObject
function findUser(username) { var dfd = app.Q.defer(); var userObject = new Object(); app.models.User.findOne({ username: username }, function(err, doc) { if (err) { console.log(err); dfd.reject(err); } console.log(doc); userObject = doc; dfd.resolve(userObject...
[ "function getUserObject(username) {\n\tvar index;\n\tfor (index = 0; index < userlist.length; index++) {\n\t\tvar user = userlist[index];\n\t\tif (username === user.name) {\n\t\t\treturn user;\n\t\t}\n\t}\n}", "getUser(username){\n let targetUser = null;\n targetUser = USERS.find(function (User) {\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
create and display UI elements fills sprinklerSelect with available sprinkler options
displaySprinklerSelect(data) { if (this.sprinklerSelect) {U.removeFirstChildren(this.sprinklerSelect)} this.sprinklerSelect = U.createSelect('sprinkler-type', 'Sprinkler Type', 'sprinkler-type', true, 'required') const select = this.sprinklerSelect.children[1] const options = U.createOptions(data, 'spri...
[ "presentOptions(elements,type=\"element\",title=\"Select an option\",pickerType=\"gizmo\"){// wipe existing\nthis.title=title;this.pickerType=pickerType;var tmp=[];switch(pickerType){// hax gizmo selector\ncase\"gizmo\":for(var i in elements){elements[i].__type=type;tmp[i]={icon:elements[i].gizmo.icon,title:element...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
return true if the event comes with a document snapshot
function isSnapshotEvent(event) { return event.type === 'snapshot'; }
[ "function isDocumentRef(o) {\r\n return o && o.onSnapshot;\r\n}", "function isDocumentRef(o) {\r\n return o && o.onSnapshot;\r\n }", "snapshotExists(documentId, version, cb) {\n this.db.records.count({documentId: documentId, version: version}, function(err, snapshots) {\n if (err) {\n re...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Name : listBoxForCountry Author : Kony Solutions Purpose : Below function will return the ListBox with the countryName list
function listBoxForCountry() { var masterData = []; try{ var listId ="listId"+gListId; masterData = [["key0","Select your country.."],["key1","Argentina"],["key2","Australia"],["key3","Brazil"],["key4","Colombia"],["key5","Czech"],["key6","Greece"],["key7","Hungary"],["key8","India"],["key9","Malaysia"],["k...
[ "function getCountries() {\n $.ajax(\"https://www.liferay.com/api/jsonws/country/get-countries/\")\n .done(function (data) {\n $(data).each(function (index, country) {\n $('#countries').append('<option value=\"' + country.a2 + '\"> ' + country.nameCurrentValue + '</option>')\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Is the motor running?
function is_motor_running() { return mode_reg !== 0; }
[ "isRunning() {\n if (this.module != null) {\n return this.module.state === STATE_RUNNING\n } else {\n return false;\n }\n }", "function isSomRunning() {\n return isRunning;\n}", "isRunning() {\n return this.is_running;\n }", "get isRunning () {\n r...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function to add objective to list
function addObjectiveToList(id, title, description, expectedBy, status, isArchived){ if(isArchived === false || isArchived === 'false'){ $("#reportee-obj-list").append(reporteeObjectiveListHTML(id, title, description, expectedBy, status, isArchived)); } }
[ "function addObjectiveToList(id, title, description, expectedBy, status, isArchived, proposedBy, createdOn){\n\t\tif(isArchived === true || isArchived === 'true'){\n\t\t\t$(\"#obj-archived\").append(objectiveListHTML(id, title, description, expectedBy, status, isArchived, proposedBy, createdOn));\n\t\t}else{\n\t\t\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Deprecated public APIs Get local session descriptor
getLocalSessionDescriptor() { return this.peerConnection.localDescription }
[ "getRemoteSessionDescriptor() {\n return this.peerConnection.remoteDescription\n }", "getLocalSessionDescription() {\n this.logger.debug(\"SessionDescriptionHandler.getLocalSessionDescription\");\n if (this._peerConnection === undefined) {\n return Promise.reject(new Error(\"Peer conn...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Load attendees bound to the requesting user
async function loadAttendees(req, res) { const userEvents = await Event.find({ user: req.user._id, }) .lean() .exec() const attendees = await Attendee.find({ event: { $in: userEvents.map((e) => e._id), }, }) .sort({ firstname: 1, }) .lean() .exec() res.json(atte...
[ "async function getAttendees(req, res) {\n\tconst identity = req.user;\n\tconst { query = '', tags, limit = 10, paging_token } = req.query;\n\t\n\tlet tagIDs\n\tif(tags){\n\t\ttagIDs = await Tag.query()\n\t\t.select('id')\n\t\t.whereIn('pf_tag.key', tags)\t\n\t\t.then((results) => {\n\t\t\treturn results.map(tag =>...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }