query
stringlengths
9
34k
document
stringlengths
8
5.39M
negatives
listlengths
19
20
metadata
dict
Die Pseudoklassisch abgeleitete SecureContainer "Klasse"
function SecureContainer (functionArray){ Tool.call(this, functionArray); this.data = require("./MOCK_DATA.json") }
[ "function KeychainAccess() {\n\n}", "constructor() {\n super();\n this.isContainer = false;\n }", "function ArticoloSelezioneGuidata() {\r\n this.BaseCodice = null;\r\n this.Gruppo = null;\r\n this.ArticoloCodice = [];\r\n}", "function CSInterface()\n{\n}", "function extGroup()\n{\n // extG...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets the number of public tasks created by this profile's username
getNumPublicTasks() { return Tasks.find({username:this.username}).count(); }
[ "getNumTasks() {\n return Tasks.find({owner:Meteor.userId()}).count();\n }", "getPublicTasks() {\n if (Template.instance().uiState.get(\"taskSort\") == NAME_TXT)\n return Tasks.find({username:this.username}, {sort:{createdAt:-1}}).fetch();\n return Tasks.find({username:this.username}, {sort:{name:1...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Updates document with the import ID
updateImports(collectionName, document, importNumber) { return this.db.updateImports(collectionName, document, importNumber); }
[ "function updateSyncDoc(service, SyncDoc) {\n service\n .documents(SyncDoc)\n .update({\n data: { temperature: 30,\n humidity: 20 },\n })\n .then(response => {\n console.log(response);\n// console.log(\"== deleteSyncDoc ==\");\n})\n .catch(error => {\n console.log(error...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This function handles an increment event on the socket
function onIncrement(socket) { socket.on("incrementCount", function(data) { count++; io.sockets.in("room1").emit("updatePara", { val: count }); }); }
[ "function sendIncrement() \n{\n\tsdc.increment('counter');\n\tsetTimeout(sendIncrement,TIMEOUT);\n}", "function increment(event){\n if (isRunning){\n return;\n }\n var target = event.data.target;\n // Get the value of the target\n var value = parseInt(readInput(target));\n // Increment it...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
run function fires the entire program. It runs the 6 seconds segments and 5 seconds segments transcoding in 2 seperate shell processes side by side We could also run the processes synchronously...might make console output clearer and each execution more explicit
async function run() { var cmd_6sec = ""; var cmd_5sec = ""; await prepareEnvironment(renditions); try { cmd_6sec = prepare6secSegmentsCMD(inputFilePath, renditions, audioCodec, videoCodec, audioSampleRate); cmd_5sec = prepare5secSegmentsCMD(inputFilePath, renditions, audioCodec, vid...
[ "function main(){\r\n console.log('Main loop started.');\r\n controlLoop();\r\n\tcontrolLoopFast();\r\n}", "async function main() {\n\t\tconst childProcess = spawn(fp_player_path, [swfPath],\n\t\t\t{ stdio: ['ignore', 'pipe', process.stderr] });\n\n\t\tawait echoReadable(childProcess.stdout);\n\n\t\t// get ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Fires the applySettings event to the event core, then saves to local storage.
apply() { localStorage.setItem(SETTINGS_KEY, this.export()); const event = new SettingsEvent(); event.fire(); }
[ "function saveSettings() {\n // Update the sources variable.\n $('.js-social-media-source', modal).each(function () {\n var source = $(this).val();\n\n if (sources.hasOwnProperty(source)) {\n sources[source] = $(this).is(':checked');\n }\n });\n\n // Save settings in cookie.\n i...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Checks the zoom level and displayIntention property in order to determine whether the layer should be visible or not and updates its visibility subsequently.
updateVisibility() { //Get current zoom level let zoomLevel = this.map.getView().getZoom(); let visible = this.isVisibleAtZoomLevel(zoomLevel); //Update visibility super.setVisible(visible); }
[ "function evaluateLayerVisibility()\r\n{\r\n\t//console.log( \"Evaluating visibility\" );\r\n\tvar viewLayers = map.getLayers();\r\n\t\r\n\tif( viewLayers != undefined )\r\n\t{\r\n\t\tviewLayers = viewLayers.getArray();\r\n\t\r\n\t\tvar viewLayer;\r\n\t\tvar mapLayer;\r\n\t\tvar mapShapes;\r\n\t\t\r\n\t\tfor( var i...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
append sentiment icon to twitter feed
function addSentiment(sentiment){ console.log("adding emoticon for sentiment",sentiment); //storing some strings to make code easier to read part1 = "Tweets & the mood is:<i class='fa-2x fa fa-"; part2 = "-o' style='color:gold'></i><link rel='stylesheet' href='https://maxcdn.bootstrapcdn.com/font-awesome/...
[ "function renderTweet (status, element) {\n if (status === TWEET_STATUS.SELF_LIKED) renderSelfLike(element)\n setElementAttribute(element, ego('tweet'), status)\n }", "function addSocialIcons(to) {\n const url = document.head.querySelector(\"[property='og:url'][content]\").content;\n const title = do...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
randomizeArea randomizeAreaX(): Randomizes the specified area of the virtual display. The area will contain random pixels and colours along the Xaxis.
function randomizeAreaX(line, col, lines, cols) { // const colEnd = Math.min(col + cols, COLUMNS) const randomByte = () => Math.floor(Math.random() * 256) // // randomize the colour attributes on one line for (let c = col; c < colEnd; c++) displayColours[line * COLUMNS + c] = rand...
[ "function drawRandomDisplay() {\r\n const c = console\r\n c.time(\"drawRandomDisplay()\")\r\n const d = ZXDisplay\r\n //\r\n // randomize the display\r\n c.time(\"randomizeArea()\")\r\n d.randomizeArea(0, 0, d.LINES, d.COLUMNS)\r\n c.timeEnd(\"randomizeArea()\")\r\n //\r\n // draw the ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Send an API request for each valid ISBN
function loopThroughISBNfile(){ for (var i=0; i<isbnsToProcess.length; i++){ isbn=isbnsToProcess[i]; var url = createURL(isbn); sendRequest(url, isbn, function(){ }); } }
[ "function callBooksAPI() {\n $.ajax({\n url: urlIBN,\n method: \"GET\"\n }).then(function (response) {\n var bibToSearch = '';\n var length = 0;\n if (JSON.parse(response).docs.length <= 3) {\n length = JSON.parse(response).docs.length;\n } else {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
The children of this route in the router state tree
get children() { return this._routerState.children(this); }
[ "constructChildren() {\n\t\t\n\t\t// this.children.push();\n\t}", "get routes() {\n return JSON.parse(JSON.stringify(this._routes));\n }", "closeChildren() {\n var children = this.children || {};\n _.each(children, child => this.closeChildView(child));\n }", "children(person) {\n retur...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Name of the point events to add to the configuration and its corresponding event for the chart element
get __pointEventNames() { return { /** * Fired when the point is clicked. * @event point-click * @param {Object} detail.originalEvent object with details about the event sent * @param {Object} point Point object where the event was sent from */ click: 'point-click', ...
[ "get __chartEventNames() {\n return {\n /**\n * Fired when a new series is added.\n * @event chart-add-series\n * @param {Object} detail.originalEvent object with details about the event sent\n * @param {Object} chart Chart object where the event was sent from\n */\n addSe...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Updates the total quiz length in the navbar
function setTotalQuestionsDOM( quizLength ) { $('#totalQuestions').text( quizLength ); }
[ "function updateCounter() {\n const totalTodosEl = document.querySelector('[data-total-todos]');\n totalTodosEl.innerText = `${todos.length} items left`;\n}", "function queCounter(index){\n const bottom_ques_counter = quiz_box.querySelector(\".total_que\");\n let totalQueCountTag = '<span><p>'+ index ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This functions takes in the FUNDLIST file contents and the connection pool for the MariaDB database. With these, it iterates through each fund company's fund list, picks out the data which goes into the fsrv_prod table and sends the data for each row in batches of 1000 to the database.
async function fsrv_prodParser(err, data, pool) { let result; parser.parseString(data, async function (err, output) { result = output; }); let completedNum = 0; let bulkContent = []; let bulkContentSpot = 0; let curProdArray = []; let selectedProduct = ""; let fundListNum = r...
[ "async function fundlistReader(pool) {\n fs.readFile(__dirname + \"/uploads/FUNDLIST_I110.xml\", 'utf8', async function (err, data) {\n let lock = false;\n lock = await fsrv_prodParser(err, data, pool);\n if (lock) {\n lock = false;\n await fsrv_prod_modelParser(err, da...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
SELECT POST LIST IN DB
function selectPostList(req,cb){ if(! req.body.start) req.body.start = 0 if(! req.body.unit) req.body.unit = 10; connection.execQuery( `SELECT POST_ID AS postId ,POST_CONTENT AS postContent ,POST_HASHTAG AS postHashtag ,REG_DTM AS regDtm ...
[ "function selectAtchFileList(postInfo,cb){\n connection.execQuery(\n `SELECT POST_ID AS postId\n ,FILE_ID AS fileId\n ,FILE_SNM AS fileSnm\n ,FILE_ONM AS fileOnm\n ,FILE_PATH AS filePath\n FROM zoz7184.NB_ATCH_FILE\n WHE...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Takes the JSON data returned from the GET requests and displays them in the post wall main page.
function displayJsonData(json) { var posts = json; $(".blog-main").remove(); var currentUser = $("h1.blog-title").first().text().trim(); for(var i=0; i < posts.length; i++) { var id = posts[i]["guid"]; var postMainDiv = makePostDiv(id, currentUser, posts[i]); ...
[ "function displayAllPosts() {\n \n $.ajax({\n \"url\": \"services/allPosts.php\",\n \"success\": function(jsonResponse) {\n \n $(jsonResponse).each(function(index, element) {\n \n var postId = element.id;\n var po...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
void ExportPartition (string, string, int)
ExportPartition(string, string, int) { }
[ "InstallPartition(string, string, int, string, string, string) {\n\n }", "export() {\n let { output, outputFrozen } = this.appState.data.seizureData;\n\n // Generate CSV\n let csv = 'is-seizure,is-seizure-user-corrected\\n';\n\n for( let i = 0; i < output.length; i++ ) {\n csv += `${Number(out...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Params: A hashable object x This method adds it to the HashTable in the appropriate position. This position is determined by the method evaluatePosition
add(x) { //Only perform if there is space in the table if(x instanceof Hashable) { let position= this.evaluatePosition(x); this.#_arrayOfll[position].insert(x); } else { throw new Error("'add(x):' Only takes a Hashable object as par...
[ "add(key, value) {\n let index = Hash.hash(key, this.sizeLimit);\n let inserted = false;\n\n if (this.hashTable[index] === undefined) {\n this.hashTable[index] = [[key, value]];\n inserted = true;\n } else {\n for (let i = 0; i < this.hashTable[index].length; i++) {\n if (this.hash...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Randomise dot speed and size
randomize(height, width){ const speedRange = 1.75; const sizeRange = 3; this.x = Math.floor(Math.random()*width) this.y = Math.floor(Math.random()*height); this.speed = (Math.random()*speedMax)+speedMin; //this.size = (Math.random()*sizeRange)+1; }
[ "addRandomDot(){\n\n // get random position from our list of free positions\n let rand_pos = this.free_pos[Math.floor(Math.random() * this.free_pos.length)];\n this.addDot(rand_pos.x, rand_pos.y);\n\n }", "addRandomDots(n_dots){\n for(let i= 0; i<n_dots;i++){\n this.addRa...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Render label specified by props and adds to the `elements` passed in. Returns `true` if a label was added.
renderLabel(elements, label, side) { if (!label) return false; const { labelAppearance } = this.props; if (this.labelShouldWrapElement(side)) { elements.addOn(side, label); const labelClass = classNames(labelAppearance, `${side} wrapped`); // wrap in a <label> to get click behavior ...
[ "function isObligatoryLabel(label){\t\r\n\treturn obligatoryDataElementsLabel.includes(label);\r\n}", "_label(label) {\n return `${label}${label && this.required ? '*' : ''}`;\n }", "get hasLabels() {\n return this._hasLabels;\n }", "function addLabelProperties()\n\t{\n\t\t//\tCo...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Resets the timeout for secret links. need to be called before running moveSecretLinks
function resetSecretLinkTimeout() { timeout = 0; }
[ "function resetTimeout() {\n\t\tclearTimeout(timeOut);\n\t\ttimeOut = setTimeout(function() {publicNext();}, timeAutoSlice);\n\t}", "function resetTestTimeout(timeoutDuration) {\n \tclearTimeout(config.timeout);\n \tconfig.timeout = setTimeout$1(config.timeoutHandler(timeoutDuration), timeoutDuration);\n }", ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
It closes the configuration view.
function closeNsConfiguration() { if (validate()) { cur_ns.descriptor = editor.getValue(); updateServiceOnServer(); $("#nsConfigurationContainer").hide(); location.reload(); $("#editorContainer").show(); } }
[ "close() {\n this.nodes.wrapper.classList.remove(BlockSettings.CSS.wrapperOpened);\n\n /** Clear settings */\n this.nodes.toolSettings.innerHTML = '';\n this.nodes.defaultSettings.innerHTML = '';\n\n /** Tell to subscribers that block settings is closed */\n this.Editor.Events.emit(this.events.clo...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
'getStockSymbols' function, job is to get an array of stocks, pull out the symbol from each one of those stocks and put all the symbols in an array and then return it
function getStockSymbols(stocks) { var symbols = [], // empty array that is going to store our symbols counter, // keeps track of the current index in the array stock; // keeps track of the current stock in the array // three parts // first part is what we want to get executed, initializing the count...
[ "getStock(stockSymbol) {\n stockService.data(stockSymbol, (err, data) => {\n if (err) return this.handleError(err);\n\n const stock = JSON.parse(data);\n let stockData = stock.data.reverse().map(info => {\n return [\n (new Date(info[0])).getT...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
hides the route instructions pane, e.g. when no route is available
function hideRouteInstructions() { $('#routeInstructionsContainer').hide(); }
[ "hide() {\n\n let svm = symbologyViewModel;\n let vm = this;\n\n svm.dictionary[svm.currentTab][vm.currentTypologyCode].isRadarDiagramVisible =\n !svm.dictionary[svm.currentTab][vm.currentTypologyCode].isRadarDiagramVisible;\n\n this.isVisible = false;\n\n $('#radarContainerVM').addC...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Retrieves the designator associated to an object.
getDesignator() { return this.designator; }
[ "function getLocator(obj) {\n return obj.locator;\n }", "getObject() {\n return this.object;\n }", "static findProvider(el) {\n if (isDesignSystemConsumer(el)) {\n return el.provider;\n }\n let parent = (0,_utilities_composed_parent__WEBPACK_IMPORTED_MODULE_2_...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Method to read the unique id of the email message from the message body
getMessageId(body){ this.messageId=JSON.stringify(JSON.parse(body).value[0]["id"]); }
[ "morawareJobID() {\n let reg = /(?<=mw-job-id: )\\d*/\n let jobID = this.msg.match(reg)[0]\n return jobID\n }", "getMsgId() {\n errors.throwNotImplemented(\"getting message id (dequeue options)\");\n }", "function messageUserId(e) {\n return $(e).closest('.user-container').dat...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Starts a new chunk upload session and uploads the first fragment. The current file content is not changed when this method completes. The method is idempotent (and therefore does not change the result) as long as you use the same values for uploadId and stream. The upload session ends either when you use the CancelUplo...
async startUpload(uploadId, fragment) { let n = await spPost(File(this, `startUpload(uploadId=guid'${uploadId}')`), { body: fragment }); if (typeof n === "object") { // When OData=verbose the payload has the following shape: // { StartUpload: "10485760" } n = n.StartU...
[ "async continueUpload(uploadId, fileOffset, fragment) {\n let n = await spPost(File(this, `continueUpload(uploadId=guid'${uploadId}',fileOffset=${fileOffset})`), { body: fragment });\n if (typeof n === \"object\") {\n // When OData=verbose the payload has the following shape:\n /...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get the correct healthbar image to display
function getHealthbarImage() { switch (player.health) { case 0: return healthbarEmpty; case 1: return healthbarNearDeath; case 2: return healthbarDamaged; default: return healthbarFull; } }
[ "getDefaultImage() {\n return this.icon_.get(this.getBaseSize());\n }", "imgDisplay(data) {\r\n \r\n const condition = data.weather[0].main;\r\n\r\n if ( condition === 'Clear') {\r\n this.img.setAttribute('src', 'img/pngweather/sun.png');\r\n }else if (condition === 'Drizzle') {\r\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
function for placeholder select
function selectPlaceholder(selectID){ var selected = $(selectID + ' option:selected'); var val = selected.val(); $(selectID + ' option' ).css('color', '#000'); selected.css('color', '#d5d5d5'); if (val == "") { $(selectID).css('color', '#d5d5d5'); }; $(s...
[ "function selectZonaUnica(){\n //if($('#ciudades').select().val() != '')\n //{\n $('#zonas > option').each(function(){\n if($(this).text() == 'Unica')\n {\n $('#zonas').select().val($(this).val());\n }\n });\n //}\n}", "function aSelectToStatic(selector)\n{\n $(selector).find('sele...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
IE doesn't update the display immediately, so reload the page
function reloadIE(id, display, url) { if (!first && $.browser.msie) { // window.location.href = window.location.href; } if (first == false) { var data = { name: 'theme', value: id }; $.post(save_url, data, function(result) { }); } first = false; }
[ "function reinitializeAppropriateDisplay() {\n updateEventVars(getNow());\n displayOnPage();\n }", "function refreshPage() {\r\n var url = location.href;\r\n // Strip of information after the \"?\"\r\n if (url.indexOf('?') > -1) {\r\n url = url.substring(0, url.indexOf('?'));\r\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Converts pixel XY coordinates into tile XY coordinates of the tile containing the specified pixel. Pixel X coordinate. Pixel Y coordinate. Output parameter receiving the tile X coordinate. Output parameter receiving the tile Y coordinate.
function PixelXYToTileXY( pixelXY ) { return [ pixelXY[0] / 256, pixelXY[1] / 256 ]; }
[ "function TileXYToPixelXY( tileXY )\n\t{\n\t\treturn [ tileXY[0] * 256, tileXY[1] * 256 ];\n\t}", "tileYToPixelY(tileY) {\n return tileY * this.TileSize;\n }", "function getTileIndex(x, y) {\n return y * 12 + x;\n}", "getTile(x, y) {\n if (x < 0 || x >= this.gridSize.x || y < 0 || y >= thi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Checks if a module name is included in the list of modules to skip the transformation.
function skipModule (name) { var i, len; if (!skipModules) { return; } for (i = 0, len = skipModules.length; i < len; ++i) { // Accept a path prefix as well. if (name.indexOf(skipModules[i]) === 0) { return true; } } }
[ "function moduleExists(moduleName) {\n modules.some(function(m) { return m.name === moduleName; });\n }", "generateExcludePattern() {\n const transpile = this.transpileModules;\n\n if (transpile === true) {\n return /(\\b@babel|core-js|webpack|(css)-loader)\\b/;\n } else if (!transpile || ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
old hash deeplinking method for old browsers
function DeeplinkingHash() { this.param = 'location'; this.init = function() { var s = this; this.check(0); $(window).on('hashchange', function() { s.check(600); }); } this.check = function(duration) { var id = location.hash.slice(this.param.length + 2); self.showLocation(id,...
[ "function setDeeplinking(event){\r\n\t\twindow.location.hash = $(event.target).data(\"target\");\r\n\t}", "function setUrlHash(hash, include_in_history) {\n // Only clicks on new dots should enter the navigation history.\n if (include_in_history) {\n location.assign('#' + hash);\n } else {\n location.rep...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
converts pulses to the kWh unit.
function pulsesToKwh(pulses) { return (pulses / 3600.0) / 468.9385193; }
[ "function pulsesToWatt(pulses) {\n return pulsesToKwh(pulses * 1000);\n}", "function btuToKcalMs(btu) {\n return btu*.0000000700457\n}", "function imp2kwh(n, imp) {\n return ((METERS[n-1].kwhbase*METERS[n-1].kwhimp)+parseFloat(imp))/METERS[n-1].kwhimp;\n}", "function scalePlayer(unit, scale, direction,...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Any time SurveyList component is rendered to screen, call fetchSurveys() action creator.
componentDidMount() { this.props.fetchSurveys(); }
[ "async function loadOpenedSurveys() {\n const response = await fetch(url + \"/api/surveys\");\n\n if (!response.ok) {\n throw new ResponseExcetion(response.status + \" \" + response.statusText);\n }\n\n const surveys = await response.json();\n\n return surveys.map(s => {\n s = ({ ...s }...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Clean up the names in the header, i.e., make sure that all names are full names instead of nicknames, and that there are also no duplicates.
cleanup_names_in_header(headers) { const convert_to_full_name = (nick) => this.full_name(nick); // Clean up all the names in the headers, just to be on the safe side for (const key in headers) { if (Array.isArray(headers[key])) { headers[key] = headers[key] ...
[ "function normalizeHeader_(header) {\n var key = \"\";\n var upperCase = false;\n for (var i = 0; i < header.length; ++i) {\n var letter = header[i];\n if (letter == \" \" && key.length > 0) {\n upperCase = true;\n continue;\n }\n if (!isAlnum_(letter)) { \n continue;\n }\n if (k...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
details: handle hold submit
function handleHoldSubmit() { let toHold = { order_item_id_list: selJob, hold_info: holdReason } holdJobTablet(toHold, (type, msg) => { clearSelected() toast[type](msg) }) toHold = null }
[ "function holdRelease() {\n\tholdReleaseCurrent++;\n\tif (holdReleaseCurrent >= holdReleaseTarget) {\n\t\t$.holdReady( false );\n\t}\n}", "function holdHandler(e){\n\te.preventDefault();\n\tif(gamePlaying)\n\t{\n\t\t//add current score to GLOBAL score\n\tscores[activePlayer] += roundScore;\n\n\t//update the curre...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
A Mixin for any class that should handle Arrays of Links and Logic. The deal is that Links and Logic have unusual destruction behavior. This Mixin works on simple assumptions: it accepts an Array of Links or Logic in the destructor it will properly destroy each Link/Logic in its corresponding arrays
function LinksAndLogicDestroyableMixin () { /** @member {Array} */ this.linksFromLinking = null; /** @member {Array} */ this.logicFromLinking = null; }
[ "delete () {\n\t\t// This is to call the parent class's delete method\n\t\tsuper.delete();\n\n\t\t// Remove all remaining chain links\n\t\twhile (this.chains.length > 0) this.removeLastChain();\n\n\t\t// Clear the class's hook instance.\n\t\tHook.hookElement = null;\n\t}", "deleteMultiple() {}", "destruct() {\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Switches to bigendian mode for reading and writing multibyte values.
setBigEndian() { this.littleEndian = false; return this; }
[ "function endian() {\n let isBigEndian = new Uint8Array(new Uint32Array([0x12345678]).buffer)[0] == 0x12;\n return (isBigEndian) ? \"Big Endian\" : \"Little Endian\";\n}", "function swap8Bytes (val) {\n return (\n (((val) >> 56) & 0x00000000000000FF) | (((val) >> 40) & 0x000000000000FF00) |\n (((val) >> ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Two versions of running sum. I: [1, 1, 1, 1, 1], O: [1, 2, 3, 4, 5]. I: [1, 3, 5, 7, 9], O: [1, 4, 8, 12, 16];
function runningSum(nums) { let arr = []; for(let i = 0; i < nums.length; i++) { if(i===0) { arr.push(nums[i]) } else { arr.push(nums[i] + arr[i - 1]); }; }; return arr; }
[ "function runningSum(nums) {\n const result = []\n \n nums.reduce((acc, curr) => {\n result.push(acc + curr)\n return acc + curr\n }, 0)\n \n return result;\n}", "function intermediateSums(arr) {\n var lastSet = arr.length % 10;\n var sum = 0;\n for (var i = arr.length - 1; i > arr.length...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Concatenate values (usually strings) on the stack. n values from the top of the stack are concatenated, as strings, and replaced with the resulting string.
concat(n) { this.apiChecknelems(n); if (n >= 2) { this.vmConcat(n, (this._stackSize - this._base) - 1); this.pop(n - 1); } else if (n == 0) // push empty string { this.pushString(""); } // else n == ...
[ "function concat(string, n) {\n n = n || 1;\n var con = '';\n for (var i = 0; i < n; i++) {\n con += string;\n }\n return con;\n}", "function CONCATENATE() {\n for (var _len4 = arguments.length, values = Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {\n values[_key4] = arguments[_key4...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Remove field from store and update the form_rank_id Use form_rank_id to handle both fields in
function _removeField(field) { var removed = false; for (var i = 0; i < _fields.length; i++){ if (removed) { _fields[i].form_rank_id--; } if (!removed && _fields[i].form_rank_id === field.form_rank_id) { removed = true; if (_fields[i].id) { _fieldIdsToDelete.push(_fields[i].id); } _field...
[ "function removeFormField() \n{\n\tid = parseInt(jQuery(\"#cont\").val());\n\tif(id >= 0){\n\t\tid = id - 1;\n\t\t\n\t\t/* pega valor inicial pelas ids dos elementos e guarda em vaiaveis */\n\t\tvar noFaixaEtaria = \"noFaixaEtaria\"+id;\n\t\tvar nuValor\t\t = \"nuValor\"+id;\n\t\t\n\t\tjQuery(\"#\"+noFaixaEtaria)....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Instantiates the correct class version of the passed in module
function instantiate(modulename, version) { var instance; var classname = "v" + version; var moduleObject = require(modulename); if(objArray[modulename+'.'+version] == undefined) { if (moduleObject[classname]) { instance = new moduleObject[classname](); objArray[modulenam...
[ "instantiateModule(name, ModClass, options) {\n if (typeof ModClass === 'object') {\n options = _.cloneDeep(ModClass)\n ModClass = Module\n } else if (ModClass === undefined) {\n ModClass = Module\n }\n\n options = options || {}\n\n if (this['$' + name]) {\n throw new Error('Modul...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Very simple caching helper that naively caches everything and survives a failure to open the cache in the first place. Also supports a super hacky mechanism where if the URL includes "NUKECACHE" in it, the cache gets purged. For now, there's a very poor cache cleanup mechanism. If we find a cached match and it's too ol...
async _cachingFetch(url) { // super-hacky cache clearing without opening devtools like a sucker. if (/NUKECACHE/.test(url)) { this.cache = null; await caches.delete(this.cacheName); this.cache = await caches.open(this.cacheName); } let matchResp; if (this.cache) { matchResp ...
[ "function cachedFetch(cacheKeySelector, fetchFn) {\n return this.scan((cache, item) => {\n const cacheKey = cacheKeySelector(item);\n if (cache.has(cacheKey)) {\n return cache;\n }\n\n return cache.set(cacheKey, fetchFn(cacheKey));\n }, new Map())\n .flatMap(cache => Promise.all(\n cache\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Read 2 bytes of humidity data humidity msb, humidity lsb
function readHumid() { var humidity; sensor.read(2, function(err, res) { if(err) { console.log("readHumid: err: " + err); } // console.log("readHumid: " + res); humidity = ((((res[0]<<8) + res[1]) * 125) / 65536) - 6; // p21 console.log("humidity: " + humidity.toFixed(2)); sendTempCmd(); });...
[ "function readTemp() {\r\n\tvar temperature;\r\n\tsensor.read(2, function(err, res) {\r\n\t\tif(err) {\r\n\t\t\tconsole.log(\"readTemp: err: \" + err);\r\n\t\t}\r\n\t\t// console.log(\"readTemp: \" + res);\r\n\t\ttemperature = ((((res[0]<<8) + res[1]) * 175.72) / 65536) - 46.85;\r\n\t\tconsole.log(\"temperature: \"...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Export the overview of all articles to an excel sheet
exportOverviewToExcel(wb, overviewColumns) { const sheetOverview = wb.addWorksheet('Overview'); sheetOverview.autoFilter = 'A1:Z1'; sheetOverview.views = [ {state: 'frozen', xSplit: 0, ySplit: 1, topLeftCell: 'A2', activeCell: 'A2'} ]; // Write headers let he...
[ "function myExportAllStories(myExportFormat, myFolder){\n\tfor(myCounter = 0; myCounter < app.activeDocument.stories.length; myCounter++){\n fullName = app.activeDocument.fullName + \"\";\n\t\tmyStory = app.activeDocument.stories.item(myCounter);\n\t\tmyID = myStory.id;\n\t\tswitch(myExportFormat){\n\t\t\t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Find articles that contain "tips" on the title.
function haveTipsOnTitle(input) { let output = []; for (let i = 0; i < input.length; i++) { const el = input[i]; for (let j = 0; j < el["articles:"].length; j++) { const ele = el["articles:"][j]; if (ele.title.search(/tips/i) !== -1) { output.push(ele); } } } return output;...
[ "function addTooltips() {\n\t$('#article-text span').each(function() {\n\t\tvar term = $(this).text().toLowerCase();\n\n\t\t$(this).mouseover(function() {\n\t\t\tif (dijit.byId('shicoDialog') !== undefined) {\n\t\t\t\tdijit.byId('shicoDialog').destroy();\n\t\t\t}\n\n\t\t\tvar shicoDialog = new dijit.TooltipDialog({...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
helper function to parse tags from body of post
function parseTags(body) { const tagIndex = body.indexOf("#"); let tags = []; if (tagIndex >= 0) { tags = body.substring(tagIndex, body.length).split("#"); tags = tags.reduce((result, tag) => { tag = tag.trim(); if (tag.length > 0) result.push(tag); ...
[ "function getTags(post) {\n var tags = [];\n post.find('.tags').children('span.label').each(function() {\n tags.push($(this).text());\n });\n return tags;\n }", "function parse(body) {\n var author = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n\n\n //array of links...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Computes the position state based on the specified origin position. This is used if the tab is becoming visible immediately after creation.
_computePositionFromOrigin(origin) { const dir = this._getLayoutDirection(); if ((dir == 'ltr' && origin <= 0) || (dir == 'rtl' && origin > 0)) { return 'left-origin-center'; } return 'right-origin-center'; }
[ "static positionAtDirection(origin, direction) {\n let offsetX = [0, 0, 1, 1, 1, 0, -1, -1, -1];\n let offsetY = [0, -1, -1, 0, 1, 1, 1, 0, -1];\n let x = origin.x + offsetX[direction];\n let y = origin.y + offsetY[direction];\n if (x > 49 || x < 0 || y > 49 || y < 0) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
redirect to add product
function goadd(){ window.location = "/admin/products/add"; }
[ "function redirectToProductList() {\n document.location = location.origin + '/Product';\n}", "function continueShopping() {\n\tsaveFormChanges();\n\twindow.location.href = thisSiteFullurl + backURL;\n}", "changeStep() {\n window.location.assign('#/eventmgmt/shop');\n }", "function onNewPugClick()...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
create a ul of all current inventory items
function listInventory() { Inventory.forEach(function (item) { var list = document.getElementById('inventory'); ul.appendChild(list); list.innerHTML += item.name, item.type; }); }
[ "function displayInventory(){\n // select the document ul element by id heroInventory\n let heroInventoryId = document.getElementById('heroInventory');\n\n // Declare a helper function to create/add the next inventory item as a\n // list item to the web page including an id for later retrieval\n function addHe...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Handle callbacks with either the [obj] or [err, obj] arguments in an adaptive manner. Uses the `cb.length` property to determine the number of arguments expected by `cb`.
function adjustCallback(cb, err, obj) { if (!cb) return; if (cb.length <= 1) { cb(obj); } else { cb(err, obj); } }
[ "function multipleCallbacks (myObject, callback1, callback2){\n var myObject = {status: ['success', 'error']};\n var keyValue = Object.values(myObject.status);\n for (let i=0; i<keyValue.length; i++){\n if (keyValue[i] === 'success'){\n return callback1;\n } else return callback2;\n}\n}", "function getLen...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
transform points with matrix (similar to Point.transform)
transform (m) { const points = []; for (let i = 0; i < this.length; i++) { const point = this[i]; // Perform the matrix multiplication points.push([ m.a * point[0] + m.c * point[1] + m.e, m.b * point[0] + m.d * point[1] + m.f ]); } // Return the requ...
[ "static transformPoint(x, y, matrix) {\r\n return {\r\n x: Math.round(x * matrix[0] + y * matrix[2] + matrix[4]),\r\n y: Math.round(x * matrix[1] + y * matrix[3] + matrix[5]),\r\n };\r\n }", "function transformMatrix_(s, t) {\n return [t[0] * s[0] + t[1] * s[2],\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Include path has a special case for html files, they can be provided without the extension
function getIncludePath(name) { var prefix = "includes/"; if (name.match(/^includes/)) { prefix = ""; } if (name.match(/html$/)) { return prefix + name; } return prefix + name + ".html"; }
[ "function fileincludeTask(cb) {\n return src(['./src/*.html'])\n .pipe(fileinclude({\n prefix: '@@',\n basepath: '@file'\n }))\n .pipe(gulp.dest('./public'))\n .pipe(browserSync.stream());\n cb();\n}", "function extract_include( element ) {\n\tvar inner_text=ele...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Receive the daily payroll if it has been at least a day since the last usage.
daily() { if (this.dead) { throw new BankError('Account is shut down'); } else if (this.closed) { throw new BankError('Account is currently closed'); } else if (this.investing) { throw new BankError('Account is currently investing, so it may not receive daily money'); } let timeRemaining = this.daily...
[ "function checkDailyAvailable(timeSinceLastDaily) {\n const minHours = 18;\n if (!timeSinceLastDaily) return true;\n if (Date.now() - timeSinceLastDaily > minHours * 1000 * 60 * 60) return true;\n\n const timeUntilNextDaily = timeSinceLastDaily + minHours * 1000 * 60 * 60 - Date.now();\n return timeUntilNextDa...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Bind click handler to all inventory links.
function bind_inventory(el) { $('a.inventory', el).click(function(e) { e.preventDefault(); $("#tvd_tabs").tabs( "option", "active", tabIndex_inventory ); }); }
[ "function menuClicks () {\n\n\t\tvar menuIcon = document.getElementById('menu-icon');\n\n\t\tmenuIcon.addEventListener('click', Views.showMenu);\n\t\tmenuLinks();\n\n\t}", "function bindServerEvents(){\n $('a[attr-name]').on('click', function(event){\n var serverName = $(this).at...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Update Volume Thumb position
updateVolumeThumb(volumeThumb, volumeThumbValue) { volumeThumb.style.left = volumeThumbValue + "%"; }
[ "function positionThumbs(){\n\t\t\n\t\tif(g_isVertical == false)\n\t\t\tpositionThumbs_horizontal();\n\t\telse\n\t\t\tpositionThumbs_vertical();\t\n\t\t\t\t \t\t\n\t}", "thumbnailFrame() {\r\n this.currentFrame = this.note.thumbFrameIndex;\r\n }", "function adjustVolume(deltaVolume){\r\n setVol...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Removes the subscription to navigation events created in the `subscribe()` method.
unsubscribe() { window.removeEventListener('vaadin-router-go', this.__navigationEventHandler); }
[ "clearSubscriptions() {\n this.events.clear();\n }", "clearEventSubscriptions(eventType) {\n this.events.delete(eventType);\n }", "function removeAllHistory() {\n const TOPIC_EXPIRATION_FINISHED = \"places-expiration-finished\";\n\n // Set up an observer and a flag so we get notified when ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This function utilizes the Dat().getFullYear element to get the year number and determine if you are in the future or not. If the year is larger than 2020, you are in the future, otherwise, you are not
function get_Future() { if (new Date().getFullYear() >2020) { document.getElementById("Fortune").innerHTML = "You are in the future!"; } else { document.getElementById("Fortune").innerHTML = "You are not in the future :("; } }
[ "function isPresentOrFuture(date) {\n var now = new Date();\n date = new Date(Date.parse(date));\n if (date.getFullYear() > now.getFullYear()) return true;\n if (date.getFullYear() < now.getFullYear()) return false;\n\n if (date.getMonth() > now.getMonth()) return true;\n if (date.getMonth() < now.getMonth())...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Adds websocket handler for device connections. Device connects to /inspector/device and passes device and app names as HTTP GET params. For each new websocket connection we parse device and app names and create new instance of Device class.
_createDeviceConnectionWSServer(): ws$WebSocketServer { const wss = new WS.Server({ noServer: true, perMessageDeflate: true, }); // $FlowFixMe[value-as-type] wss.on('connection', async (socket: WS, req) => { try { const fallbackDeviceId = String(this._deviceCounter++); ...
[ "_createDebuggerConnectionWSServer(): ws$WebSocketServer {\n const wss = new WS.Server({\n noServer: true,\n perMessageDeflate: false,\n });\n // $FlowFixMe[value-as-type]\n wss.on('connection', async (socket: WS, req) => {\n try {\n const query = url.parse(req.url || '', true).que...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns the uptodate proxy prototype.
function get() { return proxy; }
[ "createProxy() {\n\t\treturn new Proxy(this, {\n\t\t\tget(target, prop, receiver) {\n\t\t\t\tlet x = +prop;\n\t\t\t\treturn new Proxy(target, {\n\t\t\t\t\tget(target, prop, receiver) {\n\t\t\t\t\t\tlet z = +prop;\n\t\t\t\t\t\tlet { zSize, data} = target;\n\t\t\t\t\t\treturn data[ x*zSize + z];\n\t\t\t\t\t}\n\t\t\t\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sets the style of the choice list rendered to the user when prompting.
style(listStyle) { this.prompt.style = listStyle; return this; }
[ "function update_style_selection() {\n\tvar style = get_style();\n\tif (style !== null) {\n\t\tvar elem = document.getElementById(\"style_selection\");\n\t\tfor (i = 0; i < elem.options.length; i++) {\n\t\t\tvar option = elem.options[i];\n\t\t\tif (option.value == style) {\n\t\t\t\toption.selected = true;\n\t\t\t}\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Is using v2.3 of vuemeta
get isVueMeta23() { return typeof this.vueMeta.addApp === 'function'; }
[ "getMetaSchema() {\n return META_SCHEMA[this.jsonSchemaVersion];\n }", "meta() {\n return {\n 'display_name': localize('Custom function'),\n 'description' : '',\n };\n }", "get toolVersion() {\n return '0.2.0'\n }", "function createMeta() {\n\t\ttry {\n\t\t\tvar ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Create a substitution map. A param type p can be replaced by type t iff one of the following hold: t <= p and p <= t p^ <= t (and t is sole upper bound of p) t <= p^+ (and t is sole lower bound of p)
collectBounds() { let map = {}; function addToMap(p, t) { map[p.id] = (t.isParam() && t.id in map) ? map[t.id] : t; } let cs = this.constraints.constraints; let lowerParam = cs.filter(c => c.lower.isParam() && !c.lower.noreduce); let upperParam = cs.filter(c...
[ "function ExprFindMapping(lhs, rhs, lhsFreeVars) {\r\n\t// getBoundVar, given a list of {lhs:'a', rhs:'a'} objects\r\n\t// and a variable, finds it on the lhs, and returns the\r\n\t// rhs if available.\r\n\tfunction getBoundVar(boundVars, lhs) {\r\n\t\tfor (var i = 0; i < boundVars.length; i++)\r\n\t\t\tif(boundVar...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Determines if a day is outside the displayed month.
function isOutside(day, displayMonth) { return !isSameMonth(day, displayMonth); }
[ "function hasProperDaysPerMonth(element){\n\t\n\t\t// months of the year\t\n\t\tvar MONTHS_ARRAY = [\"January\", \"February\", \"March\", \"April\", \"May\", \"June\", \"July\", \"August\", \n\t\t\t\"September\", \"October\", \"November\", \"December\"];\n\n\t\t// months with default days per month\t\t\n\t\tvar MON...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
return new, unset BigInteger
function nbi() { return new BigInteger(null); }
[ "function createBigInt(num){if(typeof BigInteger==='undefined'){BigInteger=getBigIntConstructor();}if(BigInteger===null){throw new Error('BigInt is not supported!');}return BigInteger(num);}", "function bigInt2ECKey(i){ return new Bitcoin.ECKey(bigInt2bigIntKey(i)); }", "function bigInt2bigIntKey(i){ return i.m...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Determines if we are done parsing.
function done() { return type === 'EOF'; }
[ "eof() {\n return this.index >= this.tokens.length;\n }", "end() {\n\t\treturn this.prog.length === 0;\n\t}", "isLoadingFinished() {\n return this.isLoadingCompleted() || this.isLoadingError();\n }", "isFinished() {\n\t\treturn this.staircases.every(function(s) {return s.staircase.isComplete();}...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This function creates a node containing the vistA sites set up so they are keyed by stationNumber rather than by siteHash. config: The worker config file. returns The worker config file that has been changed.
function createVistaSitesByStationCombined(config) { if (!_.isObject(config)) { return config; } var vistaSitesByStationCombined = {}; // First pick up the vistaSites items. //------------------------------------ if (_.isObject(config.vistaSites)) { _.each(config.vistaSites, function(vistaSite, siteHash) { ...
[ "createWorkers() {\n let me = this,\n config = Neo.clone(NeoConfig, true),\n hash = location.hash,\n key, value;\n\n // remove configs which are not relevant for the workers scope\n delete config.cesiumJsToken;\n\n // pass the initial hash value as ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
getAuthorByName(authorName, authors): receives an authorName recieves an array of author objects returns the author that matches that name (CASE INSENSITIVE) returns undefined if no matching author is found
function getAuthorByName(authorName, authors) { // Your code goes here let x = authors.find( author => author.name.toLowerCase() === authorName.toLowerCase() ); return x; }
[ "function titlesByAuthorName(authorName, authors, books) {\n // Your code goes here\n // return getBookById(getAuthorByName(authorName, authors).books, books);\n let bookId = getAuthorByName(authorName, authors);\n if (bookId == undefined) {\n return [];\n } else {\n return bookId.books.map(book => getBo...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
find a PBXFileReference on the provided project by its name
function findPbxFileReference(project, pbxFileName) { for (var uuid in project.hash.project.objects.PBXFileReference) { if (uuid.endsWith("_comment")) { continue; } var file = project.hash.project.objects.PBXFileReference[uuid]; if (file.name !== undefined &&...
[ "function find( filePath ){\n\tvar i,\n\t\tpathData = path.parse( filePath ),\n\t\tisAbsolute = path.isAbsolute( filePath ),\n\t\tMap = isAbsolute ?\n\t\t\t{\n\t\t\t\t'$BASE' : pathData.dir,\n\t\t\t\t'$DIR' : '',\n\t\t\t\t'$NAME' : pathData.name,\n\t\t\t\t//If no extension, then use the Current one\n\t\t\t\t'$EXT' ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Atualiza no banco de dados o status dos ramais cadastrados no asterisk data: dados a serem inseridos
function updateStatus(data){ // Limpa a tabela conn.query('TRUNCATE TABLE statusExtens', function(err, rows, fields) {}); //Inserindo os dados na tabela data.forEach(function(e){ var exten = e.ramal.split('/'); var query = "INSERT INTO statusExtens (exten, status) VALUES ('{0}','{1}')".format(exten[1],...
[ "function saveLinkedinStatus(data) {\r\n return new Promise((resolve, reject) => {\r\n let query = 'SELECT * FROM ' + table.LINKEDIN_LIST + ' WHERE luid = ?'\r\n\r\n let values = [\r\n data.status,\r\n data.userId\r\n ]\r\n\r\n db.query(query, [data.userId], (error, rows, fields) => {\r\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Method to get a salted hash. We put this in its own method to keep consistency
function getHash(pw, salt) { return crypto.createHash('sha256').update(pw+salt).digest('hex'); }
[ "function generateHash(string) {\n\treturn crypto.createHash('sha256').update(string + configuration.encryption.salt).digest('hex');\n}", "function generateSalt() {\n return Crypto.randomBytesAsync(256);\n}", "@Method\r\n hashPassword(password) {\r\n if (this.salt && password) {\r\n retu...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Determine whether the given properties match those of a `RedirectRuleProperty`
function CfnBucket_RedirectRulePropertyValidator(properties) { if (!cdk.canInspect(properties)) { return cdk.VALIDATION_SUCCESS; } const errors = new cdk.ValidationResults(); if (typeof properties !== 'object') { errors.collect(new cdk.ValidationResult('Expected an object, but received: ...
[ "function CfnGatewayRoute_GatewayRouteMetadataMatchPropertyValidator(properties) {\n if (!cdk.canInspect(properties)) {\n return cdk.VALIDATION_SUCCESS;\n }\n const errors = new cdk.ValidationResults();\n if (typeof properties !== 'object') {\n errors.collect(new cdk.ValidationResult('Expe...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Save current list to store
saveToStore() { localStorage.setItem(STORAGE.TAG, JSON.stringify(this.list)); }
[ "function save() {\n storage.setItem( LS_CELL_NAME, angular.toJson( wishlist ) )\n }", "_store (tasks) {\n this.onListChanged(tasks);\n localStorage.setItem('tasks', JSON.stringify(tasks));\n }", "function saveData() {\n var self = this;\n\n try {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Navigates to the provided date. With the default calendar we use ISO 8601: 'month' is 1=Jan ... 12=Dec. If nothing or invalid date provided calendar will open current month. Use the `[startDate]` input as an alternative.
navigateTo(date) { this._service.open(NgbDate.from(date ? date.day ? date : Object.assign(Object.assign({}, date), { day: 1 }) : null)); }
[ "function setInitialDate() {\n \n // CREATE A NEW DATE OBJECT (WILL GENERALLY PARSE CORRECT DATE EXCEPT WHEN \".\" IS USED AS A DELIMITER)\n // (THIS ROUTINE DOES *NOT* CATCH ALL DATE FORMATS, IF YOU NEED TO PARSE A CUSTOM DATE FORMAT, DO IT HERE)\n calDate = new Date(inDate);\n\n // IF THE INCOMING D...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates a new CallCredentials object from a given function that generates Metadata objects.
static createFromMetadataGenerator(metadataGenerator) { return new SingleCallCredentials(metadataGenerator); }
[ "static createFromGoogleCredential(googleCredentials) {\n return CallCredentials.createFromMetadataGenerator((options, callback) => {\n let getHeaders;\n if (isCurrentOauth2Client(googleCredentials)) {\n getHeaders = googleCredentials.getRequestHeaders(options.service_url...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
clears the credit card form
function clearCreditCardForm() { $('input[name$="_cardNumber"]').data('cleave').setRawValue(''); $('select[name$="_expirationMonth"]').val(''); $('select[name$="_expirationYear"]').val(''); $('input[name$="_securityCode"]').val(''); }
[ "function creditClear(){\n CCT.index.creditClear();\n \n document.mForm.mCreditTransID.value = \"\";\n document.mForm.mCreditCustNum.value = \"\";\n document.mForm.mCreditCustName.value = \"\";\n document.mForm.mCreditCSNum.va...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns the logical OR between Series and other. Supports element wise operations and broadcasting.
or(other) { if (other === undefined) { throw new Error("Param Error: other cannot be undefined"); } const newValues = []; if (other instanceof Series) { if (this.dtypes[0] !== other.dtypes[0]) { throw new Error("Param Error must be of same dtype"); } if (this.shape[0] ...
[ "and(other) {\n\n if (other === undefined) {\n throw new Error(\"Param Error: other cannot be undefined\");\n }\n const newValues = [];\n\n if (other instanceof Series) {\n if (this.dtypes[0] !== other.dtypes[0]) {\n throw new Error(\"Param Error must be of same dtype\");\n }\n\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
url, show, tip, loading, loaded, interactive, completed
function ajax_gethtml(){ if(arguments.length == 0) return false; var url = arguments.length > 0 ? arguments[0] : ""; var show = arguments.length > 1 ? arguments[1] : ""; var tip = arguments.length > 2 ? arguments[2] : ""; var loading = arguments.length > 3 ? arguments[3] : ""; var loaded = arguments.length ...
[ "function loadPreview(options, callback)\r\n {\r\n var idToLoad = currentId;\r\n\r\n // object already in cache?\r\n if (cache.hasOwnProperty(idToLoad))\r\n {\r\n $tooltip.qtip(\"api\").set(\"position.target\", $label);\r\n callback(ca...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get the region code of the nationaltiy.
getRegionCode(){ return this.dataArray[3]; }
[ "getRegion(regionName) {\n var regions = this._regions || {};\n return regions[regionName];\n }", "getRegion(region) {\n if (region) {\n return this.promise.resolve(region);\n }\n return this.avRegions\n .getCurrentRegion()\n .then(\n (response) =>\n response && resp...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Adds a new Tree node with the input value to the current Tree node
addChild(value) { const newTreeNode = new Tree(value); this.children.push(newTreeNode); }
[ "addNode(value) {\r\n // create a new node\r\n const node = new Node(value)\r\n // add node to the nodes map\r\n this.nodes.set(node, new Map())\r\n // return the new node\r\n return node;\r\n }", "insert(value) {\n let newNode = new TreeNode(value);\n let current;\n this.size++;\n\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Check or Uncheck All timesheet approver CheckBox
function selectAllTimesheetApproverMenuCheckBox(){ if(document.getElementById('timesheetApproverMenuSelectAllId').checked==true){ document.getElementById('timesheetApproverMenuAddId').checked=true; document.getElementById('timesheetApproverMenuViewId').checked=true; document.getElementById('timesheetApproverMe...
[ "function selectAllLeaveapproverMenuCheckBox(){ \n\tif(document.getElementById('leaveapproverMenuSelectAllId').checked==true){\n\n\t\tdocument.getElementById('leaveapproverMenuAddId').checked=true;\n\t\tdocument.getElementById('leaveapproverMenuViewId').checked=true;\n\t\tdocument.getElementById('leaveapproverMenuU...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Pluralize a singular name using common English language pluralization rules Examples: "company" > "companies", "employee" > "employees", "tax" > "taxes"
pluralize(name) { const plural = this.pluralNames[name]; if (plural) { return plural; } // singular and plural are the same if (uncountable.indexOf(name.toLowerCase()) >= 0) { return name; // vowel + y } else if (/[aeiou]y$/.tes...
[ "function pluralise(n, noun, suffix){\n suffix = (typeof suffix === 'undefined') ? 's' : suffix;\n if (suffix == 'ies') {\n return `${n} ` + noun.substring(0, noun.length - 1) + suffix;\n }\n if (n == 1) {\n return `${n} ${noun}`;\n }\n return `${n} ${noun}${suffix}`;\n}", "set nom...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
When one image has loaded, check to see if all images have loaded, and if so, start the slideshow.
loadImage() { this.imagesLoaded++; if (this.imagesLoaded >= this.slides.length) { this.playSlideshow() } }
[ "function checkImages(){ //Check if the images are loaded.\n\n if(game.doneImages >= game.requiredImages){ //If the image loads, load the page to the DOM.\n\n init();\n }else{ //loop until the images are lo...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Open dialog for excluding projects
function openExcludeProjPopup(resource_id) { $.post(app_path_webroot+'ExternalLinks/excluded_projects_ajax.php', { ext_id: resource_id, action: 'view' }, function(data){ if (data == '0') { alert(woops); } else { // Make checkbox appear $('#exclude_project-parent').html(data); // Inject link labe...
[ "showDeleteProjectDialog() {\n // hide project options dialog\n this.shadowRoot.getElementById(\"dialog-project-options\").close();\n\n // open delete dialog\n this.shadowRoot.getElementById(\"dialog-delete-project\").open();\n }", "openProject(event) {\n const controller = event.data.controll...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function: _fnReDraw Purpose: Redraw the table taking account of the various features which are enabled Returns: Inputs: object:oSettings dataTables settings object
function _fnReDraw( oSettings ) { if ( oSettings.oFeatures.bSort ) { /* Sorting will refilter and draw for us */ _fnSort( oSettings, oSettings.oPreviousSearch ); } else if ( oSettings.oFeatures.bFilter ) { /* Filtering will redraw for us */ _fnFilterComplete( oSettings, oSettings.oPrevi...
[ "function reDrawConfig(skip_table) {\r\n\r\n if (NewGridObj.beingReConfig) { // if grid size re-config \r\n\tdrawGrid(NewGridObj, CurIndObj, CurHtmlGridId, true);\r\n\tdrawGridReConfigMenu(NewGridObj);\r\n\r\n } else {\r\n\r\n\tdrawGrid(NewGridObj, null, CurHtmlGridId, true);\r\n\r\n\tif (NewGr...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Discards any unflushed buffered data, clears any error, and resets b to write its output to w.
reset(w) { this.err = null; this.n = 0; this.wr = w; }
[ "async flush() {\n if (this.err !== null)\n throw this.err;\n if (this.n === 0)\n return;\n let n = 0;\n try {\n n = await this.wr.write(this.buf.subarray(0, this.n));\n }\n catch (e) {\n th...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns the Fbt enum module name for a given variable name (if any)
getModuleName(name /*: string */) /*: ?string */ { return fbtEnumMapping[name]; }
[ "function moodEnumToName(moodEnum)\n{\n switch(moodEnum)\n {\n case 0:\n return \"great\";\n break;\n case 1:\n return \"good\";\n break;\n case 2:\n return \"ok\";\n break;\n case 3:\n return \"neutral\";\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Delete an object with the given id
deleteById(id) { return this.del(this.getBaseUrl() + '/' + id); }
[ "function remove(id) {\n return db(\"todos\")\n .where({ id })\n .del();\n}", "delete(id) {\n return this.send(\"DELETE\", `events/${id}`);\n }", "function deleteTictactoe(id) {\n console.log(\"delete Tictactoe: \" + id);\n return axios\n .delete(\"/api/tictactoe/\" + id)\n .the...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
test authentication for a bucket by asking for the document count, if no permissions error 10000 comes back
function testAuth(bucket, success, failure) { // start by getting the document count for each bucket queryText = "select count(*) cnt from `" + bucket.id + '`'; res1 = executeQueryUtil(queryText, false, false) .then(function successCallback(resp) { var data = resp.data, status = resp.st...
[ "checkBucket(){\n if(this.bucketTotal >= this.bucketLimit){\n console.log(\"Yay! The bucket limit has been reached.\")\n let sortedWishList = this.rankWishes()\n this.fillBucket(sortedWishList)\n } else {\n console.log(\"Bucket is not full yet – more donatio...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Associates a subnet with a route table. Documentation:
function SubnetRouteTableAssociation(props) { return __assign({ Type: 'AWS::EC2::SubnetRouteTableAssociation' }, props); }
[ "async function virtualHubRouteTableV2Put() {\n const credential = new DefaultAzureCredential();\n const client = createNetworkManagementClient(credential);\n const subscriptionId = \"\";\n const resourceGroupName = \"rg1\";\n const virtualHubName = \"virtualHub1\";\n const routeTableName = \"virtualHubRouteT...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
library set pazzle coins
function setPazzleCoins(){ while(true){ to_next_coin = Math.floor(Math.random() * (COIN_DISTANCE_MAX+1-COIN_DISTANCE_MIN)) + COIN_DISTANCE_MIN; total_coin_length = total_coin_length + to_next_coin; if(total_coin_length > total_cource_length){ break; } // T...
[ "function coinCombo(cents) {\n return 'TODO'\n}", "function generateCoinChange(amount){\n let quarters = Math.round(amount / 25)\n amount = amount % 25\n let dimes = Math.round(amount / 10)\n amount = amount % 10\n let nickels = Math.round(amount / 5)\n amount = amount % 5\n pennies =...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns true if the element should be shown based on the current timeframe.
isElementShowing(e) { return this.props.time >= e.start_time && this.props.time <= e.end_time; }
[ "isCurrentlyDisplayed() {\n //Get current zoom level\n let zoomLevel = this.map.getView().getZoom();\n //Check visibility\n return this.isVisibleAtZoomLevel(zoomLevel);\n }", "showRecent() {\n const lastUpdate = this.props.course.updates.la...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Adjust canvas coordinate space taking into account pixel ratio, to make it look crisp on mobile devices. This also causes canvas to be cleared.
function resizeCanvas() { // When zoomed out to less than 100%, for some very strange reason, // some browsers report devicePixelRatio as less than 1 // and only part of the canvas is cleared then. var ratio = Math.max(window.devicePixelRatio || 1, 1); // This part causes the canvas to be cleared ...
[ "function resizeCanvas() {\n\t\t\t// When zoomed out to less than 100%, for some very strange reason,\n\t\t\t// some browsers report devicePixelRatio as less than 1\n\t\t\t// and only part of the canvas is cleared then.\n\t\t\tvar ratio = Math.max(window.devicePixelRatio || 1, 1);\n\t\t\tcanvas.width = canvas.offs...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Using the lookup table above, convert a color for the NES to its RGBA equivalent, so Jimp can understand.
function nesToRgb(id) { return Jimp.rgbaToInt(nesRgbLookup[id*3], nesRgbLookup[id*3+1], nesRgbLookup[id*3+2], 255); }
[ "function acp_get_alpha_value_from_color( value ) {\n var alphaVal;\n\n // Remove all spaces from the passed in value to help our RGBa regex.\n value = value.replace( / /g, '' );\n\n if ( value.match( /rgba\\(\\d+\\,\\d+\\,\\d+\\,([^\\)]+)\\)/ ) ) {\n alphaVal = parseFloat( value.match( /rgba\\(\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
The displaySalary function displays the combinedMonthlySalary only if it is > 0
function displaySalary() { if (combinedMonthlySalary > 0) { return $('.total-monthly-salary').text("Total Monthly Salary: " + combinedMonthlySalary); }else { return $('.total-monthly-salary').text(" "); } }
[ "function calTotalSalary (employeeArray) {\n\n var totMonthSalary = 0;\n for (var i = 0; i < employeeArray.length; i++){\n var empSalary = employeeArray[i].base_salary;\n // console.log(empSalary, totMonthSalary);\n totMonthSalary += parseInt(empSalary) / 12;\n // console.log('totMonthSalary = ', totM...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Send window scroll to iFrame
function scroll(e) { $iFrame.contentWindow.postMessage({ sender: sender, type: 'scroll', scroll: { left: ($window.pageXOffset || $documentElement.scrollLeft) - ($documentElement.clientLeft || 0), top: ($window.pageYOffset || $documentElement.scrollTop) - ($documentElement.clientTo...
[ "function scroll (e) {\n var xyS = scrollXY(iwin) // iframe scroll\n var ifrPos = xy.add(xyS, lastMousePos)\n coords.show(xy.str(ifrPos))\n }", "function mousemove(e) {\n var ifrPos = eventXY(e) // mouse from iframe origin\n var xyOI = iframeXY(iframe) // iframe from window origin\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
check if two colors are close enough
function closeEnough(a, b) { function close(c, d){ return Math.abs(c - d) < 0.01; } return close(a.red, b.red) && close(a.green, b.green) && close(a.blue, b.blue); }
[ "function colorMatch(a, b) {\r\n return a.r === b.r && a.g === b.g && a.b === b.b && a.a === b.a\r\n }", "oppositeColors(x1,y1,x2,y2){\r\n if(this.getColor(x1,y1) !== 0 && this.getColor(x2,y2) !== 0 && this.getColor(x1,y1) !== this.getColor(x2,y2)){\r\n return true;\r\n }\r\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
disable_sort() Takes the target_id select box and grays out options that have been chosen in sb1 and sb2.
function disable_sort(sb) { if ($(sb).val() == '') return; var sbval = $(sb).val().replace(/^-/, ""); $('dl.sorting select[id!="'+$(sb).attr('id')+'"]').find( 'option[value="'+sbval+'"], option[value="-'+sbval+'"]' ).attr('disabled', 'disabled'); }
[ "function datagrid_toggle_sort_selects() {\n var jq_dds = $('.datagrid .header .sorting dd');\n if (jq_dds.length == 0) return;\n var dd1 = jq_dds.eq(0)\n var dd2 = jq_dds.eq(1)\n var dd3 = jq_dds.eq(2)\n var sb1 = dd1.find('select');\n var sb2 = dd2.find('select');\n var sb3 = dd3.find('sel...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Generate a mapping from absolute names to objects. If one or more variables has the object as its canonical value, the first alphabetical variable will be become the canonical name. All other names, and the number of the object in its scope, will be added as secondary names.
function generate_canonical_map ( mod ) { var map = scope.make ( ); function add_secondary_name ( obj, name ) { if ( obj.secondary_names !== undefined ) { obj.secondary_names = []; } obj.secondary_names.push ( name ); } // We want the alphabetically first ("smallest") name. function add_...
[ "function Map_Object (variable) { \n var id = variable['syc-object-id'];\n\n // Reset the mapping\n object_map[id] = [];\n\n for (var property in variable) { \n Map_Property(variable, property);\n }\n}", "function mapping(letters) {\n\tlet y = letters.reduce((acc, elem) => {\n acc[elem] = elem.toUpperCas...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }