query
stringlengths
9
34k
document
stringlengths
8
5.39M
negatives
listlengths
19
20
metadata
dict
Gibt die laufende Nummer des ZATs im Text einer Zelle zurueck cell: Tabellenzelle mit der ZATNummer im Text return ZATNummer im Text
function getZATNrFromCell(cell) { const __TEXT = cell.textContent.split(' '); let ZATNr = 0; for (let i = 1; (ZATNr === 0) && (i < __TEXT.length); i++) { if (__TEXT[i - 1] === "ZAT") { if (__TEXT[i] !== "ist") { ZATNr = parseInt(__TEXT[i], 10); } ...
[ "function getTalentFromHTML(cells, colIdxTal) {\n const __TEXT = getStringFromHTML(cells, colIdxTal);\n\n return parseInt((__TEXT === \"wenig\") ? -1 : (__TEXT === \"hoch\") ? +1 : 0, 10);\n}", "get yearText() {\n return 'td:nth-child(2) > font > b';\n }", "function getSeatNr() {\n\tvar c = getContext...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
The transition hooks are attached to the vnode as vnode.transition and will be called at appropriate timing in the renderer.
function resolveTransitionHooks(vnode, props, state, instance) { const { appear, mode, persisted = false, onBeforeEnter, onEnter, onAfterEnter, onEnterCancelled, onBeforeLeave, onLeave, onAfterLeave, onLeaveCancelled, onBeforeAppear, onAppear, onAfterAppear, onAppearCancelled } = props; const key = String(vnode...
[ "function Transition() {}", "function BasicTransition() {}", "function FadeInTransition() {}", "function SlideVerticallyTransition() {}", "_updateAttributeTransition() {\n const attributeManager = this.getAttributeManager();\n\n if (attributeManager) {\n attributeManager.updateTransition();\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Change the product substitutes This function is called on the top tick of substitutes modal box
function change_product_substitutes(product_id) { //Empty the products substitutes for this product while (order_list[product_id].substitutes.length>0) {order_list[product_id].substitutes.pop();} //iterate through HTML and find products which are checked $("#product_view2 input[type=checkbox]").each(function() { ...
[ "function show_product_substitutes(product_id)\n{\n\tvar substitute_html = \"\";\n\t//For each product go throuhg and create the HTML\n\t$.each(products_list, function(product_id, product_details)\n\t{\n\t\tvar img_str = product_details.product_data.image;\n\t\tvar productlabel = product_details.product_data.title;...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Description: Removes all elements from scene. Works in cycle removing first child of scene until all objects are gone array of children ahs zero length. Note: To be called on redrawing scene after node selection.
function emptyScene(scene){ while(scene.children.length > 0){ var objectToRemove = scene.children[0]; scene.remove(objectToRemove); } }
[ "function clearScene() {\n var obj;\n for( var i = scene.children.length - 1; i > 3; i--) {\n obj = scene.children[i];\n scene.remove(obj);\n }\n}", "function clearChildren() {\n while(board.firstChild) {\n board.removeChild(board.firstChild);\n }\n }", "clearScenes() {\n for (let iS...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Render the template inline by sharing the state of the current template. ```js const partialFn = template.renderInline('includes.user') // render and use output partialFn(template, state, ctx) ```
renderInline(templatePath, ...localVariables) { const { template: compiledTemplate } = this.compiler.compile(templatePath, localVariables); return this.wrapToFunction(compiledTemplate, ...localVariables); }
[ "function inline_template(template_id, context) {\n\tvar source = $(template_id).html();\n\tconsole.log(source);\n\tvar template = Handlebars.compile(source);\n\tconsole.log(context);\n\tvar html = template(context);\n\tconsole.log(html);\n\t$(html).insertBefore(template_id);\n}", "render() {\n templateSe...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
getLatestRevision() fetches revision value from Dropbox (not from local value)
async function getLatestRevision() { const result = await getFileRevision({ accessToken, path }); return result; }
[ "async function GetLatest() {\n try {\n const HistoricalQR = await getDB();\n return await HistoricalQR.findOne().sort({ _id: -1 });\n } catch (err) {}\n}", "function fetchCurrentRevision (post, next) {\n RevisionModel.findById (post.currentRevision, function (error, revision) {\n if (!error) {\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Go to card intake, show denials if customer has denials
goToCardIntake() { let url; if (Auth.get(this).user.role === 'corporate-admin') { url = 'main.corporate.customer.intake-revised'; } else { url = 'main.employee.customer.intake-revised'; } if (this.displayData.rejectionTotal) { url = url + '.denials'; } state.get(this).go(ur...
[ "function createCard() {\n inquirer.prompt(createprompt).then(function(response) {\n if(res.type === 'Cloze') {\n var fc = new flashcard(res.front.trim(), res.back.trim(), true);\n\n if(!fc.valudate()) {\n createCard();\n } else {\n return;\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
(private) Updates a property of a MUDObject, checking for correct ownership and nonambiguous naming
function updateProperty(conn, targetName, propertyName, value) { controller.findPotentialMUDObjects(conn, targetName, function(objs) { updatePropertyInternal(conn, objs, propertyName, value); }, true, true); }
[ "function updatePropertyInternal(conn, targets, propertyName, value) {\n\tvar me = controller.findActivePlayerByConnection(conn);\n\n\tif (!Array.isArray(targets)) \n\t\ttargets = [targets];\n\n\tvar ftargets = targets.filter(function(obj) {\n\t\treturn obj.ownerId === me.id;\n\t});\n\n\tif (ftargets.length === 0) ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
PIZA CONSTRUCTOR: TOPPINGS AND SIZE
function Pizza(toppings, size){ this.toppings = []; this.size = size; }
[ "function initPoses() {\n let num = 0;\n this.joints = {\n // wrist\n Wrist: new _JointObject.JointObject(\"wrist\", num++, this),\n // thumb\n T_Metacarpal: new _JointObject.JointObject(\"thumb-metacarpal\", num++, this),\n T_Proximal: new _JointObject.JointObject(\"thumb-phalanx-pro...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Provides a form to locate stores by geographical information. Clears the storelocator form. Gets a ContentModel that wraps the storelocator content asset. Updates the page metadata and renders the store locator page (storelocator/storelocator template).
function find() { isSearched = false; var storeLocatorForm = app.getForm('storelocator'); storeLocatorForm.clear(); var Content = app.getModel('Content'); var storeLocatorAsset = Content.get('store-locator'); var pageMeta = require('~/cartridge/scripts/meta'); pageMeta.update(storeLocatorA...
[ "function findStores() {\n isSearched = true;\n var Content = app.getModel('Content');\n var storeLocatorAsset = Content.get('store-locator');\n\n var pageMeta = require('~/cartridge/scripts/meta');\n pageMeta.update(storeLocatorAsset);\n\n var storeLocatorForm = app.getForm('storelocator');\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
update list on filter changes
function updateFromFilters(){ //$("input").prop('disabled', true); var newList = _(elements) .forEach(function(d){ map.removeLayer(d.marker) }) .filter(computeFilter) .forEach(function(d){ d.marker.addTo(map) }) .value(); updateList(newList); updateFromMap(); }
[ "update_results() {\n this.selected_item = '';\n var obj = this.filters;\n Object.getOwnPropertyNames(obj).forEach(key => {\n this.results = this.results.filter(e => e[key] === obj[key]);\n });\n }", "syncFilterValues() {\n each(th...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Go to live reports button
function goToLiveReports() { clearInterval(state.graphInterval); $("#formSearch").hide(); $("#mainContent").removeClass().addClass("liveReportsPage").empty(); if (!isEnoughCoinsForGraf()) { swal({ title: "No active coins to show", confirmButtonText: "Ok", confirmButtonColor...
[ "function onReportClick(e) {\n\tcommonFunctions.sendScreenshot();\n}", "click_meetingOne_ResultTab_FullReplayButton(){\n this.meetingOne_ResultTab_FullReplayButton.waitForExist();\n this.meetingOne_ResultTab_FullReplayButton.click();\n }", "downloadSummaryStatsTemplate() {\n console....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Legacy Epub 2.0 specification states that a spine element with the 'toc' attribute identifies the idref of the NCX file in the manifest TODO handle relative and absolute urls. resolve path
findNcxFilePath() { const tocId = this.spine.toc; if (tocId) { const ncxItem = this.manifest.findItemWithId(tocId); if (ncxItem) { return FileManager.resolveIriToEpubLocation( ncxItem.href, this.location ); } } return; }
[ "function ADLTOC()\r\n{\r\n}", "function catalogSync() {\n return walkSync(path.resolve(__dirname, 'content'));\n}", "function emlFileOnload(docObj) {\n var loc = docObj.location;\n if (loc.hash) {\n var line = loc.hash.substring(1);\n hiliteEmlLine(docObj, line);\t\t \n }\t\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Now some functions to use as callbacks Prints the type of the item
function getType(item) { console.log(item + ' is a ' + typeof(item)); }
[ "_getSelectionItemType()\n {\n var keys = this.getSelectedItemKeys();\n var itemType = null;\n var urls = [];\n for (var index in keys)\n {\n var item = this.getSelectedItem(keys[index]);\n if (itemType === null)\n {\n itemType = ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Load the main dex page. Note: Testing this would essentially be testing jQuery, so no need to test Inputs: $ reference to jQuery Outputs: (anonymous) A Promise that will be resolved when the page is loaded
static getMainDexPage($) { return $.get('https://pokefarm.com/dex'); }
[ "async function main() {\n\t// Have to wait for this to finish since commonMain loads the STORE and we need it to populate the page\n\tawait commonMain();\n\n\tSTORE.entriesPerPage = ENTRIES_PER_PAGE;\n\tSTORE.pagePrefix = 'projects';\n\tSTORE.displayed = [];\n\tSTORE.projects.forEach( p => p.id = cuid() );\n\n\t$(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Determine "quadrant" of handle drag relative to locked point returns string tl = top left, br = bottom right, etc
getDragQuadrant(x, y) { const relx = this.locked[0] - x const rely = this.locked[1] - y if (relx < 0 && rely < 0) return 'br' else if (relx >= 0 && rely >= 0) return 'tl' else if (relx < 0 && rely >= 0) return 'tr' else return 'bl' }
[ "function getEraserFrontSide(x,y,s){\n\tvar result=\"M\"+(x-s*2/3)+\" \"+(y+s/3)+\",\";\n\tresult=result+\"L\"+(x-s/3*8)+\" \"+(y+s/3)+\",\";\n\tresult=result+\"L\"+(x-s/3*8)+\" \"+(y+s*5/6)+\",\";\n\tresult=result+\"L\"+(x-s*2/3)+\" \"+(y+s*5/6)+\",\";\n\tresult=result+\"Z\";\n\t\n\treturn result;\n}", "function...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Chart Plot Legend A function to generate random data series for the line graphs that jiggle but stay in bounds.
function generate_random_legend_data() { var seed = 5 + Math.random() * 5; var data = []; for (var i = 0; i < 100; i++) { seed += Math.random() - 0.5; if (seed < 0) seed = Math.random(); else if (seed > 10) seed = 10 - Math.random(); data.push(seed); ...
[ "function createLegend(colors) {\n\tvar c, text, xloc, yloc, legendWidth, textWidth\n\t// set width based on longest string....\n\ttext = canvasPlot.plotOptions.legendTitle;\n\tvar legendTitleWidth = text.visualLength() \n\tvar maxLabelWidth = Math.max(...colors.map(c => {return c[0].toString().visualLength()}))\n\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get the components for a hostname
function getComponents(hostname) { let components = { hostname, tld: null, domain: null, subdomain: null, validDomain: false }; let parts = hostname.split(/\./); for (let i = 0; i < parts.length; i++) { let checkTLD = parts.slice(i).join("."); if (...
[ "function get_hosts(url_info, req, res) {\n var m = url_info.pathname.match(/^\\/([A-Za-z0-9_\\-]+)\\/([A-Za-z0-9_]+)\\/hosts$/);\n var collection = db.collection('performance');\n collection.distinct('host', {}, function (err, doc) {\n if( err )\n return error_handler(res, err, 500);\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Takes an array of possible controller ids and chooses two. Can map controller id to redis keys.
function chooseControllers(set,cont){ // It turns out that writing the comparison predicate for the data is just a pain in the ass. Randomly schedule, for now. /* var keys = set.map(function(i){return redisKeys[i];}); redis.mget(keys,function(err,res){ if(err){ console.log("Redi...
[ "register(...controllers) {\n for (let controller of controllers) {\n if (controller.name === 'DEFAULT') {\n throw new Error('\"DEFAULT\" is a reserved controller name, use a different name.');\n }\n this.controllers[controller.name] = new controller(this);\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Filters writer options and provides defaults `options` writer options
filterOptions(options) { var filteredOptions, ref, ref1, ref2, ref3, ref4, ref5, ref6, ref7; options || (options = {}); options = assign({}, this.options, options); filteredOptions = { writer: this }; filteredOptions.pretty = options.pretty || false; filteredOptions.all...
[ "function writeOptions () {\n needsToSave = false\n fs.writeFile('options.json', JSON.stringify(settings, null, 2), 'utf8')\n}", "function normalizeOptions(options) {\n options = options || {};\n return {\n concatMessages: options.concatMessages === undefined ? true : Boolean(options.concatMessages...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Adds directives to a VNode.
function withDirectives(vnode, directives) { const internalInstance = currentRenderingInstance; if (internalInstance === null) { ( true) && warn(`withDirectives can only be used inside render functions.`); return vnode; } const instance = internalInstance.proxy; const bindings = vnod...
[ "enterDirectiveText(ctx) {\n\t}", "function tcbProcessDirective(el, dir, unclaimed, tcb, scope) {\n var id = scope.getDirectiveId(el, dir);\n if (id !== null) {\n // This directive has been processed before. No need to run through it again.\n return id;\n }\n id =...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Show and enable checkbox $(id) if the enable parameter evaluates to true. Hide and disable it otherwise.
function checkAndEnableCheckbox(id, enable) { if (enable) { $(id).removeAttr("disabled"); $(id).prop('checked', true); } else { $(id).prop('checked', false); $(id).attr("disabled", true); } }
[ "function checkAndEnable(id, enable) {\n if (enable) {\n $(id).show();\n } else {\n $(id).hide();\n }\n}", "function markCheckboxes() {\n let check = (id) => {\n if (settings[id] == 'true') {\n $('#' + id).prop('checked', true);\n }\n }\n check('hide-hr-value');\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Grab all songs on the page then callback the js_audioPlayer to create a jpplayer for each post / song
function loadSongs(){ var x = 0; $('.audio-song').each(function(){ x++; var m4a = $(this).find(".jp-audio").data( "audio-ma" ), ogg = $(this).find(".jp-audio").data( "audio-ogg" ); $(this).find(".jp-jplayer").attr('id', 'jquery_jplayer_'+x); ...
[ "onplay(song) { }", "function getSongs() {\n fetch(songsURL)\n .then((response) => response.json())\n .then((songs) => songs.forEach((song) => renderSong(song)));\n}", "function getPlaylistSongs(playlist_id){\n let currentPlaylist = getPlaylistById(playlist_id);\n let url = currentPlaylist.link + \...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Selectors for all rows of My Transaction table
get txnTypesRows() { return ('//div[@class="TransactionRow"]//div[@class="cell"][1]') }
[ "function renderTableSelectors (rows, columns) {\n const tr = doc.createElement('tr')\n tr.className = 'selectors'\n\n // Empty link column\n\n tr.appendChild(doc.createElement('td'))\n\n // Generate selectors.\n\n for (let i = 0; i < columns.length; ++i) {\n const td = doc.createElement('td'...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sets the explication text
function displayExplication() { var text = storage.explication; var exp = text || getExplication(); $('#explication').html(exp); }
[ "function changeText() {\r\n $alertHolder.html(number);\r\n }", "function saveExplication() {\n\tstorage.explication = $('#explication').text();\n}", "function italicText() {\n document.execCommand('italic', false, '');\n browser.storage.local.set({\n key: txtArea.innerHTML\n });\n}", ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Converts canvas to an image
function convertCanvasToImage(canvas) { var image = new Image(); image.src = canvas.toDataURL("image/png"); return image; }
[ "function convert_to_image(image_data)\r\n{\r\n var canvas = document.createElement(\"canvas\");\r\n\tvar c = canvas.getContext(\"2d\");\r\n\tc.putImageData(image_data, 0, 0);\r\n\t\r\n\tvar img = new Image();\r\n\timg.src = canvas.toDataURL(\"image/png\");\r\n\treturn img;\r\n}", "function convertImageToCanva...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Create consumer channel This channel consumes from to_crawl queue
async function createConsumerChannel(stats) { let channel = await new Promise((resolve, reject) => { rmqConnection.createChannel((error, channel) => { if (error) reject(error); else resolve(channel); }); }); let queueName = "to_analyze"; channel.assertQueue(queue...
[ "readStream(){\n redis.consumeFromQueue(config.EVENTS_STREAM_CONSUMER_GROUP_NAME, this.consumerId, 1, config.EVENTS_STREAM_NAME, false, (err, messages) => {\n if (err) {\n this.logger.warn(`Failed to read events. ${err.message}`);\n }\n\n if (messages){\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
IE10 doesn't properly render block elements with the right height until you add contents to them. This fixes that by adding a paddingright to all empty text block elements. See:
function renderEmptyBlocksFix() { var emptyBlocksCSS; // IE10+ if (getDocumentMode() >= 10) { emptyBlocksCSS = ''; each('p div h1 h2 h3 h4 h5 h6'.split(' '), function(name, i) { emptyBlocksCSS += (i > 0 ? ',' : '') + name + ':empty'; }); editor.contentStyles.push(emptyBlocksCSS + '{paddi...
[ "function paddingBlankHTML(node){if(!isVoid(node)&&!nodeLength(node)){node.innerHTML=blankHTML;}}", "maintainImmediateChildren(CE) {\n let blockEls = BlockElements;\n\n let P,\n children = [].slice.apply(CE.childNodes);\n\n children.forEach(child => {\n if(blockEls[child.nodeName]) {\n\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
escapeBlob and unescapeBlob are workarounds for a websql bug: The goal is to never actually insert the \u0000 character in the database.
function escapeBlob(str) { return str .replace(/\u0002/g, '\u0002\u0002') .replace(/\u0001/g, '\u0001\u0002') .replace(/\u0000/g, '\u0001\u0001'); }
[ "encodeSpecials() {\n const value = this.value;\n const regex = /(\\'|\"|\\\\x00|\\\\\\\\(?![\\\\\\\\NGETHLnlr]))/g;\n return value.replace(regex, '\\\\\\\\$0');\n }", "_encodeBlob(blob = iCrypto.pRequired(\"_encodeBlob\"),\n encoding = iCrypto.pRequired(\"_encodeBlob\")){\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Set sound progress Volume slider
function setSoundProgress() { if (video.muted) { video.muted = false; } let theVolume = sliderVolume.value / 10; video.volume = theVolume; if (theVolume === 0) { sound.firstElementChild.className = "fas fa-volume-off fa-2x"; } else if (theVolume === 1) { sound.firstElementChild.className = "fa...
[ "function setMasterVolume(val) {\n if(currentSong !== undefined) {\n // If we are here, then we need to reset the mute all button\n document.querySelector(\"#bsound\").innerHTML = '<span class=\"glyphicon glyphicon-volume-up\"></span>';\n var fraction;\n \n // set its volume to...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
window.location: new location for the window. Redirected to "newPassword.html" which is another interface
function forgotPassword() { window.location = "newPassword.html"; }
[ "function redirectToCreateUser() {\n window.location = \"createUser.html\";\n}", "function changePassword(id) {\n window.location.href = base_url + '/customer/change-password/' + id;\n}", "redirectToLogin () {\n window.location.assign('/login')\n }", "function redirect(url, newWindow) {\n if (new...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
reform back the first exercise by removing the color and decoration
function reform() { ex1.classList.remove("chcolor"); }
[ "function resetChair() {\n // color the chair with default color\n resetChairColors();\n view.renderSelectedColors();\n // remove all features\n view.renderFeatures();\n // remove highlight on all options (features)\n view.resetChosenOptions();\n // clear the selected features ul\n view.resetSelectedFeatur...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Renderer class. Renders HTML and exposes `rules` to allow local modifications.
function Renderer() { this.rules = utils.assign({}, rules); // exported helper, for custom rules only this.getBreak = rules.getBreak; }
[ "function Ruler(rules){\n if (!(this instanceof Ruler)) return new Ruler(rules);\n this.stack = [];\n if (Array.isArray(rules)) {\n rules.forEach(function(obj){\n if ('function' == typeof obj) this.stack.push(obj)\n else this[obj.cmp](obj.path, obj.value)\n }, this);\n }\n\n this.path = null;\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Window_SlotCommand This window is command window for the slot machines.
function Window_SlotCommand() { this.initialize.apply(this, arguments); }
[ "function Window_SlotMachine() {\n this.initialize.apply(this, arguments);\n}", "function Window_SlotInstruction() {\n this.initialize.apply(this, arguments);\n}", "function DeviceSlot() {}", "function Scene_SlotMachine() {\n this.initialize.apply(this, arguments);\n}", "function mySlotChange(event...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Splits strings into an array of its words
words(string) { return string.split(' '); }
[ "function textsplit(){\n\tvar aku = 'saya belajar di pasar';\n\tconsole.log(aku.split());\n\tconsole.log(aku.split(\"\"));\n\tconsole.log(aku.split(\" \"));\n}", "function convertIntoArray(string){\n return string.split(\" \");\n}", "function wordDivide(randomWord) {\n var wordArray = randomWord.split(\"\")...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Expand a 56bit key buffer to the full 64bits for DES. Based on code sample in:
function expandkey(key56) { var key64 = new Buffer(8); key64[0] = key56[0] & 0xFE; key64[1] = key56[0] << 7 & 0xFF | key56[1] >> 1; key64[2] = key56[1] << 6 & 0xFF | key56[2] >> 2; key64[3] = key56[2] << 5 & 0xFF | key56[3] >> 3; key64[4] = key56[3] << 4 & 0xFF | key56[4] >> 4; key64[5] = key56[4] << 3 & 0xFF |...
[ "static Expand(PRK, info, L) {\n const N = Math.ceil(L / HKDF.hashLength);\n const T = [Buffer.alloc(0)]; // T(0)\n for (let i = 1; i <= N; i++) {\n T[i] = crypto.createHmac(HKDF.hashName, PRK).update(HKDF.concat(T[i - 1], info, [i])).digest();\n }\n return HKDF.concat(...T).slice(0, L);\n }", ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Refresh SocialGraph using query and naids. Auto select
function refreshGraph(query, naids) { // if remember na select, this must be done here. var date = new Date().getTime(); // refresh flash var asg = undefined; if (navigator.appName.indexOf("Microsoft") != -1) { asg = window["graphsearch2"] // asg = window[].getElementById("graphsearch"); } else { asg = docu...
[ "function refreshChart(htmlGrpDivId, idGraph, idAssociates, year) {\n //api/associates/19/graphs?year=2018\n \n if (isNaN(idAssociates)) return false;\n \n //Web Service URL\n $.ajax({\n type: \"GET\",\n url: \"api/associates/\" + idAssociates + \"/graphs?graph=\"...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
funcao add 0 em tempo < 10
function addZero(tempo, tipo) { if (tempo < 10) { tempo = '0' + tempo; } switch(tipo) { case 'dia': return dia = tempo; break; case 'mes': return mes = tempo; break; case 'horas': return horas = tempo; ...
[ "function setTempo(newTempo) {\n tempo = newTempo;\n tic = (60 / tempo) / 4; // 16th\n}", "calculate() {\n this.times.miliseconds += 1;\n if (this.times.miliseconds >= 100) {\n this.times.seconds += 1;\n this.times.miliseconds = 0;\n }\n if (this.times.seconds >= 60) {\n this.time...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Longest Word / Have the function LongestWord(sen) take the sen parameter being passed and return the largest word in the string. If there are two or more words that are the same length, return the first word from the string with that length.
function LongestWord(sen) { let longest = ""; sen.split(" ").forEach((element) => { if (element.length > longest.length) longest = element; }); return longest; }
[ "function LongestWord_2(sen) {\n sen = sen.replace(/[.,\\/#!$%\\^&\\*;:{}=\\-_`~()|]/g, \"\");\n\n let longest = \"\";\n sen.split(\" \").forEach((element) => {\n if (element.length > longest.length) longest = element;\n });\n return longest;\n}", "getSongsLongestWords(song) {\n const words = song.spli...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Check whether the node should be considered a newline.
function isNewline(node) { return useNewlineChar ? node.textContent === '\n' : node.tagName === 'BR'; }
[ "function isMultilineDiffBlock ({value}) {\n return value.indexOf('\\n') !== -1\n}", "handleNewLine(editorState, event) {\n // https://github.com/jpuri/draftjs-utils/blob/e81c0ae19c3b0fdef7e0c1b70d924398956be126/js/keyPress.js#L64\n if (isSoftNewlineEvent(event)) {\n return this.addLineB...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Checks whether the specified element has any geometry / rectangles.
function hasGeometry(element) { // Use logic from jQuery to check for an invisible element. // See https://github.com/jquery/jquery/blob/master/src/css/hiddenVisibleSelectors.js#L12 return !!(element.offsetWidth || element.offsetHeight || typeof element.getClientRects === 'function' && element.g...
[ "isAreaEmpty(x, y, width, height) {\r\n return this.engine.isAreaEmpty(x, y, width, height);\r\n }", "function checkGeometry(includeDrawNode) {\n var nopeDisabled = context.surface().classed('nope-disabled');\n var isInvalid = isInvalidGeometry(includeDrawNode);\n\n if (nopeDisabled...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Enter a parse tree produced by Java9ParserpostIncrementExpression.
enterPostIncrementExpression(ctx) { }
[ "enterPostDecrementExpression(ctx) {\n\t}", "function parse_IntExpr(){\n\tdocument.getElementById(\"tree\").value += \"PARSER: parse_IntExpr()\" + '\\n';\n\tCSTREE.addNode('IntExpr', 'branch');\n\n\t\n\tvar tempDesc = tokenstreamCOPY[parseCounter][0]; //check desc of token\n\tvar tempType = tokenstreamCOPY[parseC...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
c) Cuando el usuario marque la tarea como completada marcando el checkbox, deben suceder varias cosas: la tarea debe mostrarse como completada (tachada) debemos modificar su estado (propiedad completed) en el array tasks.
function updateStatus() { for (let i = 0; i < inputs.length; i++) { if (inputs[i].checked === true) { listItems[i].classList.add('completed'); tasks[i].completed = true; } else { listItems[i].classList.remove('completed'); tasks[i].completed = false; } } // d) Tareas totales. Cada vez que una tare...
[ "function set_task_status(task_id, time_done){\n $('#'+task_id).attr('time_done', time_done)\n if (time_done > 0){\n $('#' + task_id).addClass('task-done');\n $('#rm_' + task_id).addClass('hidden');\n $('#checkbox_' + task_id).prop('checked', true)\n }\n else{\n $('#' + task_...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Displays when theres no current song and vote button is pressed
function NoCurrentSongAlert() { if (displayNoCurrentSongAlert) { return ( <div className={styles.voteOverlay}> <Alert variant="dark"> <Alert.Heading> Please add a song before starting a vote. ...
[ "_vote () {\n\t\tif(isUserAuthed()) {\n\t\t\t//update our state to show the different button state\n\t\t\tthis.setState({voted: !this.state.voted});\n\n\t\t\tvar newVoteCount = this.state.vote_count;\n\t\t\t//increment/decrement vote count\n\t\t\tif(this.state.voted) {\n\t\t\t\tnewVoteCount = newVoteCount - 1;\n\t\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
creates a new context with the specified dimensions.
function createContext(width, height,is3d) { var canvas = document.createElement("canvas"); canvas.setAttribute('width', width); canvas.setAttribute('height', height); if (!is3d) { return canvas.getContext('2d'); } return canvas.getContext('3d'); }
[ "function createGLContext() {\n var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n opts = Object.assign({}, contextDefaults, opts);\n var _opts = opts,\n canvas = _opts.canvas,\n width = _opts.width,\n height = _opts.height,\n throwOnError = _opts.throwOnErro...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Updates whether the bot is in attack range of the target or not.
checkRange() { if (!this.target) return; if (this.timeToNextAttack < 0) return; const dist = this.target.position.distanceTo(this.bot.entity.position); if (dist > this.viewDistance) { this.stop(); return; } const inRange = d...
[ "update() {\n this.checkRange();\n if (!this.target)\n return;\n this.timeToNextAttack--;\n if (this.timeToNextAttack === -1)\n this.attemptAttack();\n }", "attemptAttack() {\n if (!this.target)\n return;\n if (!this.wasInRange) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
checkNotesEmpty(notes) checks if the given notes are empty. Notes is an Array(0 .. 8) of Bool that represents a specific cell's notes.
checkNotesEmpty(notes) { for (let i = 0; i < notes.length; i++) { if (notes[i]) { return false; } } return true; }
[ "function emptyNotes() {\n title.val(\"\");\n text.val(\"\");\n }", "function confirmNote(){\n\tvar notes = document.getElementById('NotesVacID').value;\n\tif (notes !== '')\n\t\treturn notes;\n\t\treturn window.confirm(\"Your Notes are Empty, Confirm?\");\n}", "function empty( mixed_var ) {\r\n\treturn ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Removes methods from doc
function reset_methods(doc) { if (_.isArray(doc)) { return _.map(doc).map(reset_methods); } if (NoPgUtils.isObjectNotArray(doc)) { _.forEach(methods, method => { delete doc[method.$name]; }); } return doc; }
[ "function clearAnnotationsInDoc() {\n var documentProperties = PropertiesService.getDocumentProperties();\n documentProperties.deleteProperty('ANNOTATIONS');\n documentProperties.deleteProperty('ANNOTATIONS_TYPE'); \n documentProperties.deleteProperty('ID'); \n documentProperties.deleteProperty('LINKS'); \n /...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
AJAX call for getting the winner details
function getWinner() { $.ajax({ type: 'post', url: 'application/index/getwinner', dataType: 'json', success: function(json) { if (json.status === 1) { if (json.gWinner !== 0) { hidePlayButtons(); hidePlay(); switch(json.gWinner) { case 1: $('#player1Score').html(json...
[ "function newRound() {\n\tif (player != \"\") {\n\t\tif (! roundCont) {\n\t\t\t\n\t\t\tvar geturl = \"/sanaruudukko/rest/sr/process?func=newround&player=\" + player + \"&passcode=\" + passcode;\n\t\t\t$.ajax({\n\t\t\t\tasync: false,\n\t\t\t\tcache: false,\n\t\t\t\ttype : 'GET',\n\t\t\t\turl : geturl,\n\t\t\t\tsucce...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This function compares a given option value to its "former default" the default before an attempted migration. Options aren't always a string, so equivalency won't work. Note that "option" needs to be the actual option object, NOT option.value.
function optionMatchesFormerDefaultValue(option, formerDefaultValue) { if (!option) { option = { type: 'legacy', value: undefined }; } const oldValue = option.value; // keyCodes once customized also save metaKey in a 5th index, but we used // to not store the metakey, so they have a length of ...
[ "mergeSetOptionDefualtOption(option) {\r\n let options = (option && _.isObject(option)) ? _.pick(option, _.keys(this.defaultOptions)) : {};\r\n\r\n options = _.extend(this.defaultOptions, options);\r\n\r\n return this.checkCorrectValueFallback(options);\r\n }", "function initValue(options, property, def...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
added a GalacticTest with a hardcorded testDate so that the tests would not fail if run on another day
function GalacticTest(year,month,day) { this.earthBirthday = new Date(year,month,day) this.testDate = new Date(2019,0,1) this.earthYears = Math.floor(this.dateDifference()/365) }
[ "function setTestRanTrue() {\n testRan = true;\n}", "function addTest(name, exec) {\n tests.push({\n name: name,\n exec: exec\n });\n}", "function MockGoogDate() {}", "onTestResult(result) {\n this.results = this.results.concat(result);\n ResultDbAgent.newTest(this.framework...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Formats the given data, which is at the given incrment level.
function formatData(data, inc){ if (Math.abs(data) < 1e-16){ data = 0; } s = (Math.abs(data)).toPrecision(8).toString(); var i; var len; if (s.search("\\.") === -1){ len = i = s.length; } else{ for (i = s.length - 1; i >= 0; i--){ if (s[...
[ "function formatData(data){\n //var severityNames = [\"unknown\", \"negligible\", \"low\", \"medium\", \"high\", \"critical\"]\n var severityNames = [\"Critical\", \"High\", \"Medium\", \"Low\"];\n var packageNames = [];\n var blockData = [];\n data = data.sort(function(a, b) { \n return (a.Crit...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[Function name]f_ProcessJSONData_CAN [Description]function to analyse input frame data in order to execute the appropriate processing [inputs]frame_can : frame to be processed [jQuery]NO
function f_ProcessJSONData_CAN(frame_can){ //Check AppID and do what fit with that var id = parseInt(frame_can.AppID); switch(id) { case APP_ID.CAN1: //Update GUI for the 'gauge' element gauge.setValue(frame_can.DataValue); gauge.draw(); gRADOME_Conf.GUI_BarGraph[0] = frame_can.DataValue; f_JSOND...
[ "function f_ProcessJSONData_Main(frame){\n\t//\tlog AppID received\t\t\t\n\t//f_RADOME_log(frame.AppID);\n\t//Check AppID and do what fit with that\n\tvar id = parseInt(frame.AppID);\n\tswitch(id) // inspect id found to dispatch the appropriate processing\n\t{\n\t\tcase APP_ID.LIST:\n\t\t\t// load JSON data (into ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
get inner position according the orientation
function getInnerPos(){ var objSize = g_functions.getElementSize(g_objInner); if(g_temp.isNavigationVertical == true) return(objSize.top); else return(objSize.left); }
[ "function getMiddleLocation() {\n return { i: HORIZONTALRADIUS, j: VERTICALRADIUS }\n}", "@computed\n get sideCenterAngles() {\n const sideSum = this.windowDimensions.width + this.windowDimensions.height;\n const topBottom = this.windowDimensions.width / sideSum * Math.PI;\n const leftRigth = Math.ab...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Transforms the given vector coordinates by the given transformation matrix and stores the result in the vector "result" coordinates
static TransformToRef(vector, transformation, result) { const m = transformation.m; const x = vector.x * m[0] + vector.y * m[4] + m[12]; const y = vector.x * m[1] + vector.y * m[5] + m[13]; result.x = x; result.y = y; }
[ "static TransformCoordinatesToRef(vector, transformation, result) {\n return Vector3.TransformCoordinatesFromFloatsToRef(vector.x, vector.y, vector.z, transformation, result);\n }", "transform (m) {\r\n const points = [];\r\n\r\n for (let i = 0; i < this.length; i++) {\r\n const point = t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
output map: class CVietUniCodeMap
function CVietUniCodeMap() { var map = new CVietCharMap(); map.vietchars = new Array("UNICODE", 97, 226, 259, 101, 234, 105, 111, 244, 417, 117, 432, 121, 65, 194, 258, 69, 202, 73, 79, 212, 416, 85, 431, 89, 225, 7845, 7855, 233, 7871, 237, 243, 7889, 7899, 250, 7913, 253, 193, 7844, 7854, 201, 7870, 205, 211, 7888,...
[ "function buildCharMapIndex() {\n // Unicode Blocks\n let basicLatin = []; // Block: 00..7E; Subset: 20..7E\n let latin1 = []; // Block: 80..FF; Subset: A0..FF\n let latinExtendedA = []; // Block: 100..17F; Subset: 152..153\n let generalPunctuation = []; //...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
CLASS WindowsManager DESCRIPTION Handles window creation and manipulation for this application. SAMPLE USAGE N/A (internal use only)
function WindowsManager () { /** * Flag to raise while the main window is open. * @field * @private */ var isMainWindowOpen = false; /** * Returns the default display options for a newly created window. * @method * @private * @return { NativeWindowInitOption...
[ "function WindowManager() {\n if (window_manager_ == null) {\n window_manager_ = new WindowManagerImpl(document.getElementById(\"data_windows\"),\n document.getElementById(\"window_menu\"));\n }\n return window_manager_;\n}", "function createWindow() {\n\tchrome.wi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
The input function passed to the int code computer.
async _inputFn() { // Breathe await new Promise(setImmediate); if (this.inputBuffer.length === 0) { // Slow down when idle. this.onIdle(true); await new Promise(resolve => setTimeout(resolve, 20)); return -1; } this.onIdle(false); const input = this.inputBuffer.shift()...
[ "function createFunctionWithInput(input){\n const x = input;\n function returnInput(){\n return x;\n }\n return returnInput;\n}", "function inputvalue(){\n return input.value\n}", "_applyCallbackToInputs () {\n return math\n .map(this._inputs, (item, cell) => {\n const col = cell[1];\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Toggles application sitemap's side bar in mobile view.
toggleSidebarMobile() { Ember.$('.ui.sidebar.main.menu').sidebar('toggle'); if (Ember.$('.inverted.vertical.main.menu').hasClass('visible')) { Ember.$('.sidebar.icon.text-menu-show').removeClass('hidden'); Ember.$('.sidebar.icon.text-menu-hide').addClass('hidden'); Ember.$('.bgw-opa...
[ "toggleOptionsMenu() {\n // Set the css variable for options width (for desktop only)\n if (window.innerWidth >= this.state.mobileBreakpoint) {\n let optionsSize = this.state.isOptionsMenuShowing ? \"0px\" : \"400px\";\n document.documentElement.style.setProperty('--options-width...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Removes a codeblock both from the server, and after the request comes back, from the codeblock array. This will also remove any timeslots that are linked to this codeblock.
function removeCodeblock() { // Disable the codeblock buttons so they can't be hit multiple times. changeCodeblockButtons(false); jQuery('#codeblock_remove').button('option', 'label', 'Removing...'); // Request the server removes the codeblock. This will also remove any // timeslots that us...
[ "codeRemovedEventHandler () {\n return (event) => {\n const code = event.detail.code\n code.theme.removeCode(code)\n // Reload button container\n this.reloadButtonContainer()\n // Dispatch codebook updated event\n LanguageUtils.dispatchCustomEvent(Events.codebookUpdated, { codebook:...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
shows class_view and sets sessionStorage for class_id and username, then calls groups_get
function login_response(username, class_id) { $login_view.hide(); $class_view.show(); $group_view.hide(); username = username.replace(/&lt;/g,'<').replace(/&gt;/g, '>'); sessionStorage.setItem('class_id', class_id); sessionStorage.setItem('username', username); socket.groups_get(username, ...
[ "function openPage(group)\r\n{\r\n localStorage.setItem(\"group_info\",JSON.stringify(group));\r\n window.location.href = '/group'\r\n}", "function showGroupName(){\n\tvar url = \"https://\"+CURRENT_IP+\"/cgi-bin/NFast_3-0/CGI/RESERVATIONMANAGER/FastConsoleCgi.py?action=getgroupnamelist&query={'QUERY':[{'userna...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Method to go to the path of a selected palette
goToPalette(id) { this.props.history.push(`/palette/${id}`); }
[ "function updateCurrentPalette() {\n updatePaletteColorBar();\n const key = getCurrentPaletteKey();\n $.getJSON('/setpalette', {\n key: key, value: JSON.stringify(palettes[key])\n }, () => { });\n}", "function goToSelectedImages(){\n location.href = \"MyPhotoStockSelected.html\"\n \n }", ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
region Keeps getUserKeep, createUKeep, deleteUKeep, updateUKeep,
async getUserKeeps({commit, dispatch}){ try { let res = await api.get('keeps/user') commit('setKeeps', res.data) } catch(error) {console.log(error)} }
[ "async doSaveCacheTriggers() {\n\t\tlet theUnsaved = this.triggerCache.getUnSaved({});\n\t\tif (!$.isEmptyObject(theUnsaved)) {\n\t\t\tlet doSaves = {'options':{'updates':[], 'keys':[]}, 'rules':{'updates':[], 'keys':[]}, 'data':{'updates':[], 'keys':[]}};\n\t\t\tfor (const dbId of Object.keys(theUnsaved)) {\n\t\t\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Adds a given control item to all displays that are linked to the current display.
_addControlToLinkedDisplays(ctrlItem) { const displays = this._findLinkedDisplays(true); for (const display of displays) { display.addControlFromResource(ctrlItem.resource()); } }
[ "add(item) {\n this.items.add(item);\n }", "_removeControlFromDisplays(uniqueId) {\n const displays = this._findLinkedDisplays(false);\n for (const display of displays) {\n display.removeControl(uniqueId);\n }\n }", "function addControl(ctrl, cType, options) {\n for (var i ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Insert todos from local storage to state.todos
insertTodos(state) { const stored = JSON.parse(localStorage.getItem('todos')); stored.forEach(todo => { todo.isMoved = false }); state.todos = stored; }
[ "_store (tasks) {\n this.onListChanged(tasks);\n localStorage.setItem('tasks', JSON.stringify(tasks));\n }", "function saveToDos() {\r\n localStorage.setItem(TODOS_LS, JSON.stringify(toDos))\r\n}", "function loadTodos() {\n const ul = document.querySelector('.todoList');\n const todos = ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Transform the input XML DOM in HTML and copy it to output. Split text nodes in fragments.
function transform (input, output) { switch (input.nodeType) { case 3: // Text var text = input.wholeText.trim(); if(text) { // Split text elements, making it possible to calculate // line numbers and page breaks with more precision. text.split(' ').forEach(f...
[ "function normaliseContentEditableHTML(html) {\n html = html.replace(openBreaks, '')\n .replace(breaks, '\\n')\n .replace(allTags, '')\n .replace(newlines, '<br>')\n .replace(trimWhitespace, '')\n\n return html\n}", "function textWithUrlsToFragment(str) {\n\t\tvar...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
reverseDateInputFormat Parses the date format in the input boxes back to ISO 8601
function reverseDateInputFormat(date) { //True designates strict parsing var momentDate = moment(date, scope.dateOutputFormat, true); return new Date(momentDate.format()); }
[ "function transformDate(d) {\n return d.substr(6) + '-' + d.substr(3, 2) + '-' + d.substr(0, 2);\n }", "function convertDateInput(input){\n return new Date(input.replace(/-/g, '/'));\n}", "function Date2StandardFmt( date_string ) {\n if (date_string == \"\")\n return;\n var dat...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Author: Gail Chen Created: 7/2 Edit: N/A Description: Get valid inputs from keyboard or buttons. Require: N/A Update: equation, equationcontainer, result, dotExists Return: N/A
function getInput() { update(equation); // Update the equation in #equation-container handleMemory(); // Active buttons associated with memory. // Active keyboard for inputs. document.addEventListener("keypress", keyboardInput, true); // Active buttons for inputs. var backSpace = document.getElementsByClassName...
[ "function checkDecimal(key, equation) {\n let sliced = \"\"; \n\n if (equation.includes(\" \")) { // if there is an operator, checks for\n for (i = equation.length - 1; i >= 0; i--) { // decimal from last operator to\n if (equation[i] == \" \") { //...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This function helps out with some HTML formatting while typing new posts
function htmlHelper(){ $("#postcontent").keypress(function(e) { if(e.which == 13) { var currentHTML = document.getElementById("postcontent").value; var currentHTML = currentHTML + "\n<br /><br />" document.getElementById("postcontent").value = currentHTML; } }); }
[ "function MakePost(text){\nreturn {\n\ttext: text,\n\tdate: new Date()\n}\n}// this function will display posts in the posts div", "function editablePost(){\n var postBody = document.getElementById('postBody');\n var postText = postBody.innerText;\n if(postText.startsWith(\"UPDATED:\\n\"))\n postText = ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
getHistogram use d3's histogram layout to generate histogram bins for our word data
function getHistogram(data) { // only get words from the first 30 minutes var thirtyMins = data.filter(function (d) { return d.min < 30; }); // bin data into 2 minutes chuncks // from 0 - 31 minutes // @v4 The d3.histogram() produces a significantly different // data structure then the old d3.la...
[ "function drawHistogram(svgElem, binData) {\n d3.select(\"svg\").call(drag).transition();\n svgElem.selectAll(\"rect\")\n .data(binData)\n .enter()\n .append(\"rect\")\n .attr(\"class\", \"bar\")\n .attr(\"x\", 10)\n .attr(\"transform\", function(d) {\n return \"translate(\" + x(d.x0) + \",...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns true if the ship was fully refueled
refuel() { if (isDocked(this.action)) { const fuelNeeded = this.ship.refuelUnits(); const price = this.here.fuelPricePerTonne(this); if (fuelNeeded > 0 && this.money > (fuelNeeded * price)) { const [bought, paid] = this.here.buy('fuel', fue...
[ "isOverflight() {\n return this.origin === '' && this.destination === '';\n }", "isLocalOnHold() {\n if (this.state !== CallState.Connected) return false;\n if (this.unholdingRemote) return false;\n let callOnHold = true; // We consider a call to be on hold only if *all* the tracks are on hold\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
printList This function takes an array of automobile objects as a parameter and a boolean value before calling the LogMe function for each automobile object found in an array.
function printList(autoArr, bool) { autoArr.forEach(function(x) { x.logMe(bool) }); }
[ "function display_array(A, list) {\n var d = $('<ul></ul>');\n _.each(A, function(item) { return display_item(item, d); });\n list.append(d);\n}", "function dumplist(l) { \n var i, rv = []; \n \n rv.push(\"has \"+l.length+\" elements:\"); \n for (i=0; i<l.length; i++) { \n rv.push(\" \"+i...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
readonly attribute DOMString? payerEmail;
get payerEmail() { return this[_payerEmail]; }
[ "function validatePaid() {\n var x = document.getElementById(\"cardNumber\").nodeValue;\n if (x == null) {\n// her er brugerens oplysninger hard codet, men det skal importeres fra det samme HTML-form som der refferes til to linjer oppe\n var newUser = new freeUser (this.name, this.birthday, this.gender, th...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
it finds the length of the largest string and creates a new array of strings of the same length as the max length string.
function allLongestStrings(inputArray) { var max = 0; var returnArray = []; //find max length for(var i = 0; i<inputArray.length;i++){ //if a string is longer than the found max if(inputArray[i].length > max){ //empty return array returnArray.length = 0; ...
[ "function allLongestStrings(inputArray) {\n const sorted = inputArray.sort((a, b) => b.length - a.length);\n return sorted.filter((element) => sorted[0].length === element.length);\n}", "function sortByLength(array) {\n\tvar longestLength = 0;\n\tvar longestPhrase = ''; \n\t{\n\tfor (var i = 0; i < array.length...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Choose installment, deposit or full payment
choosePaymentModule(belopp){ let betalning = (`.payment_typelist--component div[class="${belopp}"]`); switch(belopp){ case 'FULL_PAYMENT': //hela beloppet browser.click(betalning); browser.pause(1000); break; case 'INSTALLMENT_PAYMENT': //delbel...
[ "function updatePaymentInfo () {\n\n switch (document.querySelector(\"#payment\").value) {\n\n case \"credit card\":\n document.querySelector (\"#credit-card\").style.display = \"\";\n document.querySelector (\"#paypal\").style.display = \"none\";\n doc...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Merge each size into the fullscreen size provided
function createWindowSizes(fullscreen, sizes) { windowSizes = {}; _.each(sizes, function(size, name) { windowSizes[name] = _.extend({}, fullscreen, size); }); return windowSizes; }
[ "function setFullSize() {\r\n\tappContainer_Fs.css({\r\n\t\t'width' : appContainerWidth_Fs,\r\n\t\t'height' : appContainerHeight_Fs,\r\n\t\t'margin-top': appContainer_marginTop_Fs\r\n\t});\r\n\tappContent.css({\r\n\t\t'width' : appContentWidth,\r\n\t\t'height' : appContentHeight,\r\n\t});\t\r\n}", "function fulls...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
creates and returns a json schema from tsql
async getJsonSchema(obj) { var self = this; // start creating the schema var jsonSchema = { definitions: {}, "$schema": "http://json-schema.org/draft-07/schema#", type: "object", properties: {} } var properties = {} var req...
[ "function createGqlSchema() {\n return tslib_1.__awaiter(this, void 0, void 0, function () {\n var pgClient, newGqlSchema, error_1;\n return tslib_1.__generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n _a.trys.push(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Enter the final scope information into the ste_symbols dict. All arguments are dicts. Modifies symbols, others are readonly.
function update_symbols(symbols, scopes, bound, free, classflag){ var name, itr, v, v_scope, v_new, v_free, pos = 0 /* Update scope information for all symbols in this scope */ for(var name of _b_.dict.$keys_string(symbols)){ var flags = _b_.dict.$get...
[ "indirectsym()\n\t{\n\t\tlet changed;\n\n\t\tdo\n\t\t{\n\t\t\tchanged = 0;\n\t\t\tfor (let sym = 0; sym < this.symbols.length; ++sym)\n\t\t\t{\n\t\t\t\tif (this.symbols[sym].value === null)\n\t\t\t\t\tcontinue;\n\t\t\t\tconst cp = this.symbols[sym].value;\n\t\t\t\tconst [ ind ] = this.findsym(cp, 0);\n\t\t\t\tif (i...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Set the clock's ticks at the given time.
setTicksAtTime(ticks, time) { time = this.toSeconds(time); this._tickOffset.cancel(time); this._tickOffset.add({ seconds: this.frequency.getDurationOfTicks(ticks, time), ticks, time }); return this; }
[ "function tick() {\n document.querySelector('#clocks').replaceChildren(\n createList(clocksConfig)\n );\n // 3b. Repeat the timer - call for the next click\n setTimeout(tick, 1000);\n}", "setTicksPassed(newTicksPassed) {\n this.ticksPassed = newTicksPassed\n }", "function updateTime() {\n let now ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Calculate the HMACSHA1 of a key and some data
function core_hmac_sha1(key, data) { var bkey = str2binb(key); if(bkey.length > 16) bkey = core_sha1(bkey, key.length * chrsz); var ipad = Array(16), opad = Array(16); for(var i = 0; i < 16; i++) { ipad[i] = bkey[i] ^ 0x36363636; opad[i] = bkey[i] ^ 0x5C5C5C5C; } var hash = core_sha1(ipad.concat(st...
[ "function core_hmac_sha1(key, data) \n { \n var bkey = str2binb(key); \n if(bkey.length > 16) bkey = core_sha1(bkey, key.length * chrsz); \n \n var ipad = Array(16), opad = Array(16); \n for(var i = 0; i < 16; i++) \n { ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
logged in user controls
function loggedInCheck() { // ajax call to check that user has a valid, i.e. non-expired, login cookie // if cookie is valid, show logged in user controls var loggedIn = true; if ( loggedIn ) { showUserControls(); } else { hideUserControls(); } }
[ "function userLoggedIn() {\n let username = sessionStorage.getItem('username');\n $('#spanMenuLoggedInUser').text(`Welcome, ` + username + '!');\n $('#viewUserHomeHeading').text(`Welcome, ` + username + '!');\n $('.anonymous').hide();\n $('.useronly').show();\n showView('Us...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
An Avro message. It contains the various types used to send it (request, error, response).
function Message(name, attrs, opts) { opts = opts || {}; if (!types.isValidName(name)) { throw new Error(f('invalid message name: %s', name)); } this._name = name; var recordName = f('org.apache.avro.ipc.%sRequest', name); this._requestType = types.createType({ name: recordName, type: 'record'...
[ "function asMessage( data, id, type, to ) {\n const message = { time: Date.now(), id: id, data: data }\n if (type) message.type = type\n if (to != undefined) message.to = to\n return message\n }", "function MessageTypes() {\n _classCallCheck(this, MessageTypes);\n\n this.types_by_hash =...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
returns boolean indicating whether fsevents can be used
function canUse() { return fsevents && Object.keys(FSEventsWatchers).length < 128; }
[ "supports(name) {\r\n const isEvent = this.supportedEvents.includes(name);\r\n const isMethod = typeof this[name] === 'function';\r\n return isEvent || isMethod;\r\n }", "isValid() {\n try {\n fs.accessSync(CONFIG_FILE_PATH, fs.constants.R_OK | fs.constants.W_OK);...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
imports websocket library executes POST request to endpoint with specific topicID
function publish(message, topicId) { return axios.post(`http://localhost:3001/${topicId}`, message); }
[ "function subscribe(topicID) {\n return new WebSocket(`ws://${SERVER_HOST}:${SERVER_PORT}/${topicID}`);\n}", "function subscribe(topicId) {\n return new WebSocket(`ws://locatlhost:3001/${topicId}`);\n}", "sendMessage(topic,message) {\n this.mqttClient.publish(topic, message);\n }", "function subscribe...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
4. Using filter, write a function startsWithChar that accepts two parameters: an array of strings, and a character (e.g. "a"), and returns an array of only the strings that start with that character:
function startsWithChar(arr, char) { return filter(arr, function(elem) { return elem[0] === char; }); }
[ "function startsWithChar(arr, char) {\n var output = filter(arr, function(element) {\n return (element[0] === char);\n })\n return output;\n}", "function filterByFirstName(arr, letter) {\n}", "function createStartsWithFilter(startsWith) {\n // YOUR CODE BELOW HERE //\n // I = string charac...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Makes offline apps stand out by making other apps transparent.
function offLine() { // var icons = $(".icon"); // for (var i = 0; i < apps.length; i++) { // if (!apps[i].offlineEnabled && apps[i].enabled) { // // The app is not offline-enabled // $(icons[i]).css("opacity", "0.3"); // } // } $("#launcher").addClass("offline"); }
[ "toggleOfflineStatus() {\n // the offline manager(goOnline and synchronizeForOffline) actually does the dirty work of\n // changing the offline state with the networking service.\n if (!this.isOnline()) {\n // We do the go online stuff in our listener for the online state change.\n Services.io.of...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Return the tags for a date according to the criteria introduces before. We say a tag labels a date if: a) tag's start or end refer to the same day as date or b) date is between tag's start and tag's end or c) date is latter then tag's start and there is no tag's end
function getTagsForDate(tags, date) { var time = date.getTime(); var dateTags = []; for (var i = 0, len = tags.length; i < len; i++) { var tag = tags[i]; if (sameDate(date, tag.start) || tag.end && sameDate(date, tag.end) || tag.start.getTime() < time && tag.end === undefined || ...
[ "filterEventListByTags(filter_tags = []) {\n let filtered_events = [];\n let final_filtered_list = [];\n\n for(let event_cycler = 0; event_cycler < this.events.length; event_cycler++)\n {\n let tags_matched = 0;\n for(let tag_cycler = 0; tag_cycler < filter_tags.len...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Return distance in m between positions p1 and p2. lat/lngs in e.g. p1.lat etc
static get_distance_m(p1, p2) { var dLat = this.deg2rad(p2.lat - p1.lat); var dLong = this.deg2rad(p2.lng - p1.lng); var a = Math.sin(dLat / 2) * Math.sin(dLat / 2) + Math.cos(this.deg2rad(p1.lat)) * Math.cos(this.deg2rad(p2.lat)) * Math.sin(dL...
[ "function calcDistance(node1, node2) {\n //could use Math.hypot if it's compliant w/their specs; check\n // return Math.hypot(node1.x-node2.x,node1.y,node2.y)\n var x = node1.x - node2.x;\n var y = node1.y - node2.y;\n return Math.sqrt(x * x + y * y)\n} //calcDistance", "func...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Extract the orderId from the URL.
function getOrderIdFromUrl() { // 1. Store URL of the current page. let currentPage = window.location.href; // 2. Create new object URL. let newURL = new URL(currentPage); // 3. Use URL property searchParams and method get() to get the search parameter after "?"id"=....". return newURL.searchParams.get("ord...
[ "getBookId(url) {\n // match a url like:\n // https://www.safaribooksonline.com/library/view/startup-opportunities-2nd/9781119378181/\n // https://www.safaribooksonline.com/library/view/startup-growth-engines/77961SEM00001/\n let match = url.match(/\\/library\\/view\\/[^\\/]+\\/(\\w+)\\//)\n let book...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get a YAML document via XHR
function getYAML(url,callback) { /*global jsyaml*/ var req = new XMLHttpRequest(); req.open('GET',url,true); req.onreadystatechange = function () { if (req.readyState == 4) if(req.status == 200 || req.status == 304) { callback(null,jsyaml.load(req.responseText)); } else { callbac...
[ "async function fetchYaml() {\n let response = await fetch(yamlPath);\n let yamlData = await response.text();\n yamlData = jsyaml.load(yamlData); // use jsyaml.load() instead of yaml.safeLoad()\n yamlData = yamlData.files[\"packages_list.yaml\"].content;\n yamlData = jsyaml.load(yamlData);\n retur...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Retorna una instancia de NotificationService. Si existe filename, recupera la instancia desde el archivo.
function getNotificationService(filename) { let notificationService = new notmod.NotificationService(); if (fs.existsSync('./' + filename)) { console.log(); notificationService = notmod.NotificationService.load(filename); } return notificationService; }
[ "function saveNotificationService(notificationService, filename) {\n console.log();\n notificationService.save(filename);\n}", "function initializeNotificationModule (filename) {\n var moduleName = toModuleName(filename);\n var module = require('../notification_modules/' + moduleName);\n\n if(util.isFunction...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates the line chart, which plots the 'close' and 'volume' values of a given company.
function setLineChart(stockData) { const lineChart = echarts.init(document.querySelector('#lineChartContainer')); let volData = []; let closeData = []; let dates = []; for (let i = 0; i < stockData.length; i += 1) { volData.push(stockData[i].volume); close...
[ "function createLineChart(period_Data, homeTeam, awayTeam, teams) {\n\t\tvar lineCtx = $myLineChart;\n\t\tvar lineData = {\n\t\t\tlabels: period_Data,\n\t\t\tdatasets: [\n\t\t\t\t{\n\t\t\t\t\tlabel: teams[0],\n\t\t\t\t\tfill: false,\n\t\t\t\t\tlineTension: 0.1,\n\t\t\t\t\tbackgroundColor: \"#ff000a\",\n\t\t\t\t\tbo...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Generate academic references suggestions for user.
function agentSuggestAcademicReferences() { // Get user text content. var usertext = tinyMCE.activeEditor.getContent({ format: 'text' }); if (usertext.trim().length <= 0) { return; } // Get options ARFinder. var options = getOptionsSearchAcademicReferences(); // Check if should display suggested...
[ "function changeSuggest() {\r\n var suggest = \"\";\r\n if(listIndex == -1) {\r\n suggest = curPattern;\r\n } else {\r\n var acList = document.getElementById(\"ac-list\");\r\n if(acList && acList.childNodes.length > listIndex) suggest = acList.childNodes[listIndex].textContent;\r\n }\r\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
is the point p([x, y]) in screen bounds?
function inBounds(p) { // check bounds of display if((p[0]-2*bcr) <= width * 0.1 || //left (p[0]+2*bcr) >= width - (width * 0.1) || //right (p[1]-2*bcr) <= height * 0.1 || (p[1]+2*bcr) >= height - (height * 0.1)) { return false; } return true; }
[ "function isInBounds(point) {\n\t\tif (point >= bounds.sw && point <= bounds.nw) {\n\t\t\tconsole.log(\"point in bounds\");\n\t\t}\n\t}", "function pointIsInCanvas(x, y, w, h) {\n return x >= 0 && x <= w && y >= 0 && y <= h;\n}", "function isInBound(x,y){\n\treturn x>-1&&x<9&&y>-1&&y<9;\n}", "function isPoin...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
blackbox DER encoding function for Bitcoin compatibility. stolen from elliptic.js.
function toDER(r, s) { r = r.toArray() s = s.toArray() function constructLength(arr, len) { if (len < 0x80) { arr.push(len) return } let octets = 1 + (Math.log(len) / Math.LN2 >>> 3) arr.push(octets | 0x80) while (--octets) { arr.push((len >>...
[ "function hex2base58(s){ return Bitcoin.Base58.encode(hex2bytes(s))}", "async function thresholdECDSA(tag, broker, share, pubShares, msg, keyGen) {\n const n = broker.n, f = (n-1)/3|0\n \n // turns a 256-bit byte-string into a scalar from the same equivalence class.\n function truncateToN(msg, truncOnly) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns a lowercase version of the given string
function lowercase(string) { return string.toLowerCase(); }
[ "function lowercase(value) {\n return String(value).toLowerCase();\n}", "function lower(text) {\n return text.toLowerCase();\n }", "function spinalCase(str){\n return str;\n}", "function upper_lower(str) {\n if (str.length < 3) {\n return str.toUpperCase();\n }\n front_part = (str....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Registers a set of actions by default
registerActions() { this.registerAction("read", new read_action_1.default()); this.registerAction("write", new write_action_1.default()); }
[ "setAvailableActions (actions = []) {\n this.getService(\"GameActionService\").setActions(actions);\n this.memory.set(this.getName(\"availableActions\"), actions);\n }", "function fillActions() {\n\tvar actions = pref.getPref(\"actions\");\n\tfor (var id in actions) {\n\t\tactions[id].id = id;\n\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
:: (Object, Object) Construct a serializer with the given configuration. The `nodes` object should map node names in a given schema to function that take a serializer state and such a node, and serialize the node. The `marks` object should hold objects with `open` and `close` properties, which hold the strings that sho...
function MarkdownSerializer(nodes, marks) { _classCallCheck(this, MarkdownSerializer); // :: Object<(MarkdownSerializerState, Node)> The node serializer // functions for this serializer. this.nodes = nodes; // :: Object The mark serializer info. this.marks = marks; }
[ "function markFactory(type, attrs, allowDupes) {\n if (attrs === void 0) { attrs = {}; }\n if (allowDupes === void 0) { allowDupes = false; }\n return function () {\n var content = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n content[_i] = arguments[_i];\n }\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Runs all known problems
async runAll(problems) { for (const p in problems) { const m = problems[p], t0 = Date.now(), r = await m.f.apply(m, Array.isArray(m.p) ? m.p : [m.p]), t1 = Date.now(), formattedTime = `${t1 - t0}`.padStart(6, '.'); console.log(`[${formattedTime}ms] [${p}] >>> ${r} <<< (${this.minifyParams(m.p)})...
[ "function solve() {\n var linter = new Linter();\n var allRules = linter.getRules(); // Getting all latest rules\n var path = process.argv[2]; // Path to the sample project\n var cli = new CLIengine({\n useEslintrc: true,\n });\n var config = cli.getConfigForFile(path); // ESLint Config for the sample...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Given a text function and width function, truncates the text if necessary to fit within the given width.
function truncateText(text, width) { return function(d, i) { var t = this.textContent = text(d, i), w = width(d, i); if (this.getComputedTextLength() < w) return t; this.textContent = "…" + t; var lo = 0, hi = t.length + 1, x; while (lo < hi) { var...
[ "function truncateWords (longText, numWords) {\n\t// 1. Use the split() function to split the String into an Array\n\tvar arrayOfText = longText.split(\" \");\n\t// 2. Use the length attribut to find the number of words in the Array\t\n\tvar lengthOfArray = arrayOfText.length;\n\t// 3. Determine how many words shou...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }