query
stringlengths
9
34k
document
stringlengths
8
5.39M
negatives
listlengths
19
20
metadata
dict
Return true if we are on the canvas view
function isCanvas() { return !isHome(); }
[ "checkVisibility () {\n const vTop = window.pageYOffset\n const vHeight = window.innerHeight\n if (vTop + vHeight < this.box.top ||\n this.box.top + this.canvasHeight < vTop) {\n // viewport doesn't include canvas\n this.visible = false\n } else {\n // viewport includes canvas\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Fetch each chapter using it's ID, process the text if we get it, and notify the progress handler.
loadChapters() { if(this.getSpecification() === undefined) throw "Specification isn't done loading, can't fetch chapters."; else if(this.getSpecification() === null) throw "Specification failed to load, can't fetch chapters"; // Request all of the chapter content... this.ge...
[ "async getChapter() {\n try {\n if (this.props.downloaded) {\n this.getDownloadedContent();\n } else {\n if (this.props.baseAPI != null) {\n var content = await vApi.get(\n \"bibles\" +\n \"/\" +\n this.props.sourceId +\n \"/\" +\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Visit a parse tree produced by PlSqlParsercreate_sequence.
visitCreate_sequence(ctx) { return this.visitChildren(ctx); }
[ "visitSeq_of_statements(ctx) {\n\t return this.visitChildren(ctx);\n\t}", "visitAutogenerated_sequence_definition(ctx) {\n\t return this.visitChildren(ctx);\n\t}", "visitAlter_sequence(ctx) {\n\t return this.visitChildren(ctx);\n\t}", "visitSequence_start_clause(ctx) {\n\t return this.visitChildren(ctx);\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[3] RelativeLocationPath::= Step | RelativeLocationPath '/' Step | | AbbreviatedRelativeLocationPath [11] AbbreviatedRelativeLocationPath::= RelativeLocationPath '//' Step e.g. p/a, etc.
function relativeLocationPath(lhs, stream, a, isOnlyRootOk) { if (null == lhs) { lhs = step(stream, a); if (null == lhs) return lhs; } var op; while (op = stream.trypop(['/', '//'])) { if ('//' === op) { lhs = a.node('/', lhs, a.node('Axis', 'descendant-or-...
[ "function relativeLocationPath(lhs, stream, a, isOnlyRootOk) {\n if (null == lhs) {\n lhs = step(stream, a);\n if (null == lhs) return lhs;\n }\n var op;\n while (op = stream.trypop(['/', '//'])) {\n if ('//' === op) {\n lhs = a.node('/', lhs, a.node('Axis', 'descendant-or-self', '...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Display tab content loader
function displayTabContentLoader() { var $el = $("#tab-content-loader"); var nextUpdate, currentTime = new Date().getTime(); var currentTab = getSettingsBackgroundTabId(); if (currentTab == 0) { nextUpdate = localStorage.getItem("flixel-themes-data-next-update"); if (!nextUpdate ||...
[ "function appAddLoader()\n\t{\n\t\tif (jQuery('#TB_load').size() != 0) return;\n\t\t\n\t\tjQuery('body').append('<div id=\"TB_load\" style=\"display: block;\"><div class=\"loader\"></div></div>');\n\t}", "function showLoading() {\n loader.hidden = false;\n quoteContainer.hidden = true; \n}", "function sho...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Computes a new Color4 converted from the current one to linear space
toLinearSpace() { const convertedColor = new Color4(); this.toLinearSpaceToRef(convertedColor); return convertedColor; }
[ "toLinearSpace() {\n const convertedColor = new Color3();\n this.toLinearSpaceToRef(convertedColor);\n return convertedColor;\n }", "clone() {\n return new Color4(this.r, this.g, this.b, this.a);\n }", "function ColorConvertFloat4ToU32(in_) {\r\n return bind....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
build the batch of knetikcloud api calls
assembleBatchData(event, response) { const batchData = []; const batchJsapiApp = event.opts.get_batch_data.batch_config.jsapi_app; const batchJsapiEnv = event.opts.get_batch_data.batch_config.jsapi_env; const batchApi = event.opts.get_batch_data.batch_config.api; const batchFunct...
[ "getV3RunnersAll(incomingOptions, cb) {\n const Gitlab = require('./dist');\nlet defaultClient = Gitlab.ApiClient.instance;\n// Configure API key authorization: private_token_header\nlet private_token_header = defaultClient.authentications['private_token_header'];\nprivate_token_header.apiKey = 'YOUR API...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Adds any new subreddits into the user's subreddit list.
addSub(name) { let newSubredditList = this.props.subreddits; newSubredditList.push(name); this.props.callbackFromParent(newSubredditList); }
[ "function getSubreddits(callback) {\n // Load reddit.com/subreddits.json and call back with an array of subreddits\n}", "updateList(res, subreddit) {\n document.querySelector('.errors').textContent = '';\n\n if (res) {\n let updated = this.state.subreddits;\n if (!this.state.subreddits.includes(`...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
The container HUD widget is used for interaction with chests to display and drag their contents. This is remarkably similar to the Containerwidget and both could probably be extended from some common ancestor. This widget is less complex
function Containerwidget(hud_instance) { MessageBase.call(this, hud_instance); this.container = null; this.name = "Chest"; }
[ "function Container3d() {\n Container.call(this);\n}", "function Widget() {\n this._m_flags = 0;\n this._m_extra = createExtra();\n this._m_parent = null;\n this._m_layout = null;\n this._m_children = [];\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns map of card type to number of unflipped cards in that card type.
getCardsLeft() { var cardsLeft = {}; for (var key in this.cards) { const card = this.cards[key]; const cardType = card.cardType; if (card.isFlipped) continue; if (cardType in cardsLeft) cardsLeft[cardType]++; else cardsLeft[cardType] = 1; } return cardsLeft; }
[ "flipped(cards) {\n\t\tlet flipped = [];\n\t\tfor ( let i = 0; i < 16; i++) {\n\t\t\tif (cards[i].flipped) {\n\t\t\t\tflipped.push(i);\n\t\t\t}\n }\n return flipped;\n }", "getPlayersCardNums(state) {\n let players = (state || this).players, playerCardNums = {}\n for (let i in players) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Fetches submissions by measureID
fetchSubmissionsByMeasure(measureId) { this.props.crudActions.fetchRemote(config.apiUrl + 'measures/' + measureId + '/submissions'); }
[ "getSubmissionsByMeasure(measureId, count = 3) {\n return this.props.submissions.filter((submission) => submission.measureId === measureId).sort((a, b) => {\n return b.datetime > a.datetime\n }).slice(0, count);\n }", "getSingle(_id, submissions = []) {\n let submission;\n if(_id) {\n submi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Records an operation trace with its name and duration
trace(correlationId, component, operation, duration) { this.logTrace(correlationId, component, operation, null, duration); }
[ "trace() {\n const tracing = remote.contentTracing;\n const opts = {\n categoryFilter: '*',\n traceOptions: 'record-until-full,enable-sampling,enable-systrace',\n };\n return tracing.startRecording(opts, () => {\n console.log('Tracing started');\n return setTimeout(() =>\n tra...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
returns a function that calls the doSomething function for each target and collects the results into a single stream the config target is passed to the doSomething callback, which is expected to return a stream or a falsy result if nothing was done This is called at init time when the tasks are defined, so it returns a...
function forAllTargets(doSomething) { return function() { var streams = []; for (var target in config) { streams.push(doSomething(config[target])); } return mergeStreams(streams); } }
[ "function forAllTargetsWatch(getSources, tasks) {\n return function() {\n var src = [];\n for (var target in config) {\n src = src.concat(getSources(config[target]));\n }\n watcher = gulp.watch(src, tasks);\n watcher.on('change', function(event) {\n consol...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Reload the character panel
function reloadCharacterDetailsPanel(contextPath) { if(charId > 0) { loadSpan('characterDetailsFrame',contextPath+'/play/character/'+charId); } }
[ "function reloadDungeonPanel(contextPath) {\r\n\tif(dungeonId > 0 && $(\"[id^=equipmentdungeonsFrame]\").length < 1) {\r\n\t\tloadSpan('dungeonsFrame',contextPath+'/play/dungeon/'+dungeonId);\r\n\t}\r\n}", "function reshowAllGuiGenes() {\n updateGuiGenes();\n}", "updatePanel() {\n document.getElementB...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
sam to bam for single files samtools.ls("/data").then(d => console.log(d)) samtoBam("/data/out_1.sam") samtools.exec("index /data/out_1.bam")
async function samtoBam(samfile){ // samfile full path console.log("sam file is: ", samfile); let bamfile = samfile.replace(".sam", ".bam"); console.log("bam file is: ", bamfile); document.getElementById("sort").innerHTML = "... Making bam file " + bamfile; // await samtools.ls("/data").then(console...
[ "async function transferSam(){\n // Initialize samtools and output the version\n // await samtools.init()\n // .then(() => samtools.exec(\"--version\"))\n // .then(d => console.log(\"Samtools: \", d.stdout, \"\\nSTDERR\\n\", d.stderr));\n let files = await bwa.ls(\"/data\"); // an array of files\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Retrieves SLP TX details
async txDetails (txid) { try { wlogger.silly('Entering slp.txDetails().') await this.waitForWalletInit() const result = await this.bchjs.PsfSlpIndexer.tx(txid) const txData = result.txData // console.log(`txData: ${JSON.stringify(txData, null, 2)}`); const isValidSlp = txData....
[ "async tokenTxInfo (txid) {\n try {\n wlogger.silly('Entering slp.tokenTxInfo().')\n\n const result = await this.txDetails(txid)\n // console.log(`tokenTxInfo: ${JSON.stringify(result, null, 2)}`)\n\n // Return false if this is not a valid SLP token.\n if (!result.isValidSlp) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Export an order (PurchaseOrder or SalesOrder) Display a simple form which presents the user with export options
function exportOrder(redirect_url, options={}) { var format = options.format; // If default format is not provided, lookup if (!format) { format = inventreeLoad('order-export-format', 'csv'); } constructFormBody({}, { title: '{% trans "Export Order" %}', fields: { ...
[ "function open_export_dialog(event) {\n var id = this.dom.table.id + \"-export-dialog\";\n var modal = $(\"#\" + id);\n var amount = $(\".active\", this.dom.table).length;\n\n if (amount === 0) {\n // No rows selected: we're exporting all items.\n amount = $(this.do...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
TURN GRAY SCALE OFF ALL RANGED HEROES
function rangedGrayScaleON(){ var rangedHero = document.getElementsByClassName("ranged"); for (var i = 0; i < rangedHero.length; i++) { rangedHero[i].style.filter = "grayscale(100%)"; } }
[ "function rangedGrayScaleOFF(){\n var rangedHero = document.getElementsByClassName(\"ranged\");\n for (var i = 0; i < rangedHero.length; i++) {\n rangedHero[i].style.filter = \"grayscale(0%)\";\n }\n}", "function meleeGrayScaleOFF(){\n var meleeHero = document.getElementsByClassName(\"melee\");\n for (var...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Listener responsible for setting the picket style into the view model
function setPicketStyle() { vm.design.picketStyle = _orderPicketStyleField.value; }
[ "function setPicketSize()\n{\n\tvm.design.picketSize = _orderPicketField.value;\n\n\t// Disable the picket styling fields should this order not need any pickets\n\tif (_orderPicketField.value === '')\n\t{\n\t\t_orderPicketStyleField.disabled = true;\n\t\t_orderPicketStyleDescription.disabled = true;\n\n\t\t_orderPi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates the column upate protion of a SQL SET clause, and the matching values, by reading the key/value pairs in the dataToUpdate param. By defualt the keys in dataToUpdate will be used as the column names but the propertyToColumnNameMap arg can be used to override the column name for a specific property.
function sqlForPartialUpdate(dataToUpdate, propertyToColumnNameMap = {}) { const keys = Object.keys(dataToUpdate); if (keys.length === 0) throw new BadRequestError("No data"); // {firstName: 'Aliya', age: 32} => ['"first_name"=$1', '"age"=$2'] const cols = keys.map( (dataPropertyName, idx) => `"${pro...
[ "function sqlForPartialUpdate(dataToUpdate, jsToSql) {\n // get keys from data to update object\n const keys = Object.keys(dataToUpdate);\n if (keys.length === 0) throw new BadRequestError('No data');\n\n /* get an array of strings where each string is the corresponding db column name for each key\n * set equ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
A margin top is needed to prevent
function clearMarginTop() { const $header = getHeader(); $body.style.marginTop = ""; if ($header) { $header.style.marginTop = ""; } }
[ "function marginControll() {\r\n if (window.matchMedia('(min-width: 540px)').matches) {\r\n\r\n $('.direction').css('margin-top', -$('.direction__list').height() / 2 - 27);\r\n \r\n }\r\n }", "function marginCardioBox() {\n var gymCol = $('.col--gym').outerHeight();\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
3. The 2013 Revenue element on the Employee records needs to be updated with the "revenue2013" list of data. Chelsea Chastain manages a team of employees her 2013 Revenue number should be derived from the total revenue of all of the employees she manages. Store the resulting value in a new key on the employee object.
function update2013Revenue() { var i; var update2013Revenue =""; for (c in employees) employees[c]['2013 Revenue'] = ""; // RESETTING OLD REVENUE2013 VALUES //TABLE HEADER update2013Revenue += "<table><th>Internal ID</th><th>Name</th><th>Supervisor</th><th>2012 Revenue</th><th>2013 Revenue</th>"; //CALCULATING ...
[ "function ratioRevenue() {\n\nvar i;\nvar ratioRevenue =\"\";\nfor (c in employees) employees[c]['2013 Revenue'] = \"\"; // RESETTING OLD REVENUE2013 VALUES\n\n//TABLE HEADER\n\tratioRevenue += \"<table><th>Internal ID</th><th>Name</th><th>Supervisor</th><th>2012 Revenue</th><th>2013 Revenue</th><th>Revenue Ratio...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Put body of "Show optimization opportunities" to queries.showoptbody Add contents to this function when adding more advice type of checks
function setupShowOpt() { queries.showoptbody = $(">div#showoptbody", queries.fcnlist); }
[ "function showSearchParameters() {\n $('.searchParameters').html(`\n <h2 class=\"searchTerm\">Search Term: ${searchResults.params.q}</h2>\n <p class=\"advSearch\">Search Refined By</p>\n <ul>\n <li class=\"bull\"><strong>Calories - </strong>${calValue}</li>\n <li class=\"bull\"><stron...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Deletes the 'dist' folder for heroku.
function CleanUpHerokuDistFolder(){ del.sync(`${deploymentPaths.HEROKU_DIST_FOLDER}/**`); }
[ "function removeDeploy(cb){\n del(distPath, cb);\n}", "function DistClean(){\n\t// return del([delHtml,delStatic]);\n}", "function setupDistBuild(cb) {\n context.dev = false;\n context.destPath = j('dist', context.assetPath);\n del.sync('dist');\n cb();\n}", "function clean_assets() {\n return del([\"./...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
get a random number not already in elements supplement is used to add or subtract values before the random number is added or subtracted
function getRandomNumberNotInElements(elements, range, supplement, operator=null) { let n = supplement[0]; while (n == supplement[0]) { for (let i = 1; i < supplement.length; i++) { if (operator != null) { switch(operator) { case "+": ...
[ "function getRandomElement() {\n let element = surprises[Math.floor(Math.random() * surprises.length)];\n return element;\n}", "function randomNum() {\n random = Math.floor(Math.random() * answerList.length);\n}", "function getRandomUnusedCard() {\n //if length of usedcards us equal to reuse factor\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
ajax to rate user
function rateUser(userID, gameID, sport, skill, sportsmanship, best, noShow, notSure) { var options = {userID: userID, sport: sport, skill: skill, sportsmanship: sportsmanship, bestSkill: best, gameID: gameID, noShow: noShow, notSure: notSure}; $...
[ "function rateUpAlbum(album_id){\n makeAjaxRequest('rate_album_up', statechange_rateUp, 'album_id', album_id, 'temp', '');\n}", "function request_credit_score() {\n\n $.ajax({\n url: credit_amount_url\n }).done(function (data) {\n $('#credit-num').text(data.credit_amount);\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Validates a members details
function validateMemberDetails(fName, lName, nName, pass, dob, selectedDate, country, city, email, phoneNo) { var errors = []; if(!customerHasValidFirstName(fName)) { errors.push('invalid first name'); } if(!customerHasValidLastName(lName)) { errors.push('invalid last name'); } i...
[ "function validateMember(member) {\r\n const schema = {\r\n name: Joi.string().min(5).max(255).required(),\r\n email: Joi.string().min(5).max(255).required().email(),\r\n password: Joi.string().min(8).max(16).required(),\r\n age: Joi.number().min(18).required(),\r\n sex: Joi.st...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Attempt to refresh auth
function refreshAuth() { try { mySense.getAuth(); } catch (error) { console.log(`Re-auth failed: ${error}. Exiting.`); process.exit(); } }
[ "function resetAuth() {\n getOAuthService().reset();\n}", "changeCredentialsToRefreshCredentials({ refresh_token }) {\n this.credentials = OAuthRefreshCredentials.from(\n this.credentials.credentials.client_id,\n this.credentials.credentials.client_secret,\n refresh_toke...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Commit this command, and only this command (i.e., not its dependencies), by calling `commit_unlink` on the backend object. Assumes that this command has run, but has not yet committed.
async localCommit() { return await env.backend.commit_unlink( this.entity1::pick('class', 'id'), this.key, this.entity2::pick('class', 'id') ); }
[ "static discardOldCommit() {\n fs.unlink(tmpCommitPath, () => {})\n }", "commit(transaction_id) {\n this.sendCommand('COMMIT', {'transaction': transaction_id});\n this.log.debug(`commit transaction: ${transaction_id}`);\n }", "function unlinkHookFn () {\n fqHookFilename = fqProjDirname + '/.git/ho...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
util function to fetch current inf signing status inf_signing_status
function get_inf_status(brand_campaign_id, account_id){ const reco_inf_profile = campaign.access_influencer_subcollection(brand_campaign_id).doc(account_id); return reco_inf_profile.get() .then(snapshot => { const data = snapshot.data(); return {inf_status: data.inf_signing_statu...
[ "function check_contract_signing_status(brand_campaign_id, account_id){\n return get_inf_status(brand_campaign_id, account_id)\n .then(res => {\n if (res.inf_status && res.inf_status.indexOf('contract') !== -1){\n return true;\n }\n return false;\n })...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sets bookmark layout based on situation and page type
_setBookmark() { const { isLogged, type } = this._props; const { bookmarkLoggedinTemplate, bookmarkNotLoggedTemplate, bookmarkSavednewsTemplate, cardBookmark, } = this._blockElements; const bookmarkNode = this._domElement.querySelector(cardBookmark); let template; if (isLogged && type ===...
[ "function applyLayoutPref()\n{\n\n\tif (readCookie('nnwlayout') == \"traditional\")\n\t{\n\t\tobjBody.id = \"traditionalViewBody\";\n\t\t$(\"#ui\").addClass(\"layout\");\n\t}\n\telse if (readCookie('nnwlayout') == \"wide\")\n\t{\n\t\tobjBody.id = \"widescreenViewBody\";\n\t\t$(\"#ui\").addClass(\"layout\");\n\t}\n}...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
numero de quadras de uma faixa de um album
function numQuad(b, a, f) { var banda = docXML.getElementsByTagName("banda")[b].getElementsByTagName("discografia")[0]; var album = docXML.getElementsByTagName("album")[a].getElementsByTagName("faixas")[0]; var faixa = album.getElementsByTagName("faixa")[f].getElementsByTagName("letra")[0]; return faixa...
[ "getNumSongs(data) {\n let num = 0;\n data.sets.set.forEach((set) => num += set.song.length)\n return num;\n }", "function numVersos(b, a, f, q) {\n var banda = docXML.getElementsByTagName(\"banda\")[b].getElementsByTagName(\"discografia\")[0];\n var album = docXML.getElementsByTagNa...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
split url into [host, dir, file, tail]
function split_url(u) { // FIXME: can't we just use the builtin parser like url_hostname() ? // http://www.joezimjs.com/javascript/the-lazy-mans-url-parsing/ u = strip_http(u); var a = u.match(/^([^/]*)(\/|\/.*\/)([\w-.]*)([^/]*)$/); assert(a, "split_url(): couldn't parse url:\n" + u); return a.slice(1...
[ "function splitURL(url) {\n // Let the browser do the work\n var l = document.createElement(\"a\");\n l.href = url;\n // see .protocol, .hostname, and .pathname of returned object\n return l\n}", "function segmentize(url) {\n\t\treturn strip(url).split('/');\n\t}", "function extractHostname(t) {\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Given a new message string and an array of videos, detects each emoticon position in the string, replaces them with the videos and shows them to the user two word/video at a time
function receiveTwo(msg, videos, color){ console.log("videos"); console.log(videos); var outerDiv = document.createElement("div"); outerDiv.style.color = color; if(videos === undefined){ outerDiv.style.margin = "20px 0 0 0 "; } else{ if(videos.length == 0){ outerDiv.style.margin = "20px 0 0 0 ...
[ "function emoticons(html){\n for(var emoticon in emotes){\n for(var i = 0; i < emotes[emoticon].length; i++){\n /* css class of images is emoticonimg for styling them*/\n html = html.replace(\" \" + emotes[emoticon][i], \" <img src=\\\"\"+icon_folder+\"/\"+emoticon+\"...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
The debounce function TimeoutID is initialised but not assigned a value. The debounce function returns a function that will check if the variable timeoutID has been assigned anything. If so then it will clear the timeout. After clicking on the button once, the debounceFunction runs, timeoutID is checked and it doesn't ...
function debounceFunction(fn, delay) { let timeoutID; return function(...args){ if (timeoutID) { clearTimeout(timeoutID) } timeoutID = setTimeout(() => fn(...args), delay) } }
[ "function debounce() {\n var date = Date.now();\n return function(timeToPass) {\n var dateTest = Date.now();\n var timePassed = dateTest-date;\n\n if (timePassed > timeToPass) {\n date = Date.now();\n return true; \n }\n else {\n return false...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Export all the patients
function exportPatients(owner){ _exportSql = []; db.transaction( function(transaction) { transaction.executeSql( 'SELECT * FROM patients', [], function (transaction, result) { var emptyList = true; for (var i=0; i < result.rows.length; i++) { var row = result.rows...
[ "function exportTables(id, owner){\r\n\t\r\n\t//New unique ID for a patient\r\n\tvar newId = UUID.generate();\r\n\t\r\n\t// If owner already exists, don't reassign an UUID\r\n\tif (owner != '')\r\n\t\tnewId = '';\r\n\r\n\t// Get all the tables\r\n\texportTable(\"patients\",id,newId,owner);\r\n\texportTable(\"vitals...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
after timeout, follow the next activity link
function afterTimeout(){ console.log(next_button.attr('href')); window.location = next_button.attr('href'); }
[ "function next () {\n var a = actions.shift()\n if ( a ) {\n a( function ( err ) {\n if ( err ) throw err\n // setTimeout( next, ACTION_INTERVAL )\n } )\n } else {\n setTimeout( finish, ACTION_INTERVAL )\n }\n }", "function visitNextPage() {\n\t var...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
combine 2 matrixes m1, m2 [a, b, c, d, e, g]
function combine(m1, m2) { return [ m1[0] * m2[0] + m1[2] * m2[1], m1[1] * m2[0] + m1[3] * m2[1], m1[0] * m2[2] + m1[2] * m2[3], m1[1] * m2[2] + m1[3] * m2[3], m1[0] * m2[4] + m1[2] * m2[5] + m1[4], m1[1] * m2[4] + m1[3] * m2[5] + m1[5] ]; }
[ "function matrixAdd(m1,m2){\n mR = [[0,0],[0,0]];\n for (var x=0;x<2;x++){\n for (var y=0;y<2;y++){\n mR[x][y]+=m1[x][y]+m2[x][y];\n }\n }\n return mR;\n }", "static mxAdd(a,b) { \r\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
List upload token by filter with pager support. When using a user session the service will be restricted to users objects only.
static listAction(filter = null, pager = null){ let kparams = {}; kparams.filter = filter; kparams.pager = pager; return new kaltura.RequestBuilder('uploadtoken', 'list', kparams); }
[ "static list_user_tokens({ organizationId, userId, page, count }) {\n return new Promise(\n async (resolve) => {\n try {\n resolve(Service.successResponse(''));\n } catch (e) {\n resolve(Service.rejectResponse(\n e.message || 'Invalid input',\n e.status ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
process favorite answer params object value params object id return void
function handleFavoriteAnswer(id, callback) { appAjax( '/thich-cau-tra-loi', 'post', {id: id}, 'json', function(response) { callback(response); if (!response.error) { console.log('success'); } else { console.log('error'); } } ); }
[ "function process_answer_submission(){\n var user_answer = given_answer(); \n update_question_result(is_correct_answer(user_answer));\n i++;\n count_to_end();\n}", "_updateHint(voted){\n if(voted) {\n return(<p>Check your choosed candidate!</p>);\n }\n return(<p>You can choose your candidate!</p...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
ISO 7730:2005(E) Predicted mean vote (PMV) REF: Arguments: m Metabolic rate (met) w External work (met) ta Air temperature (deg C) tr Mean radiant temp (deg C) icl thermal insulation (clo) of the clothing icl (m^2 K/W) = 0.155 clo, where clo is the clothing va air velocity (m/s) rh relative humidity (%)
function PMV(m, w, ta, tr, icl, va, rh) { // Conversion from relative humidity to saturated vapour pressure (kPa) var esat = (t) => { if(t < 0) { var a = 21.874; var b = 7.66; } else { var a = 18.269; var b = 35.86; } return 611 * Math.exp(a * t / (t + 273...
[ "function getVoltsAO(amp,ohm) {\r\n const volts = amp*ohm\r\n document.querySelector('#ohm-answer').textContent = volts + 'V'\r\n}", "function compute_maltPP_beer(ibu) {\n var factor = 0.0;\n var IBU_malt = 0.0;\n var IBU1 = 0.70;\n var pH = ibu.pH.value;\n var points = 0.0;\n var PP_malt = 0.0;\n va...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Process query product information response
function queryProductInfoResponse(res) { var result = res.result; //response code var message = res.message; //response message if (result == "success") { $('#productsList').html(""); if (res.productinfo && res.productinfo.length > 0) { $.each(res.pro...
[ "function viewProductCatalogue(){\n let sqlQuery = \"SELECT * FROM product\";\n connection.query(sqlQuery, function (err, response) {\n if (err) {\n console.log(\"Error displaying products: \" + err);\n connection.end();\n } else {\n console.log(\"------------------------------\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
25. Write a Javascript program to check two nonnegative integer values and return true if they have the same last digit.
function compareLastDigitsOfNumbers({ first, second }) { if (first < 0 || second < 0 ) { throw new Error("Please enter positive integers"); } const last1 = +first.toString().split("").pop(); const last2 = +second.toString().split("").pop(); return (last1 === last2); }
[ "function checkSame(num1,num2,num3) {\n //are all three integers positive?\n if (((num1 < 0) || (num2 < 0)) || (num3 < 0)) {\n console.log(\"At least one of those numbers is not a positive integer.\")\n } else {\n string1 = num1.toString() //convert to strings to grab last char\n strin...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Apply sbox0 to each byte in w.
function subw(w) { return ((SBOX0[(w >>> 24) & 0xff]) << 24) | ((SBOX0[(w >>> 16) & 0xff]) << 16) | ((SBOX0[(w >>> 8) & 0xff]) << 8) | (SBOX0[w & 0xff]); }
[ "function makeZero() {\n\t\tvar m = arguments[0];\n\t\tvar rows = m.length;\n\t\tvar cols = m[0].length;\n\t\tfor(var r = 0; r < rows; r++) {\n\t\t\tfor(var c = 0; c < cols; c++) {\n\t\t\t\tm[r][c] = 0;\n\t\t\t}\n\t\t}\n\t}", "loadZero()\n\t{\n\t\tvar TcI,TcJ;\n\t\tfor (TcI = 0; TcI < 4; TcI++)\n\t\t{\n\t\t\tfor ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
If headerFixed is `true` set datatable height Call this function to manually update the datatable height
setDatatableFixedHeight() { var holder = this.shadowRoot.querySelector('#datatable-holder'); if (this.headerFixed && this.height && this._datatable) { if (!this._datatable.headerFixed) { var header = this.shadowRoot.querySelector('#topBlock'); holder.style.hei...
[ "function i2uiAssignHeaderHeight(tableid, headerheight, relatedid)\r\n{\r\n var headeritem = document.getElementById(tableid+\"_header\");\r\n if (relatedid != null)\r\n {\r\n var relatedheaderitem = document.getElementById(relatedid+\"_header\");\r\n headerheight = relatedheaderitem.rows[0].style.he...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets all the friend requests of this veteran to render on the screen.
async getVeteranFriendRequests() { const id = this.state.sessionUser.id; const route = APIRoutes.veteranFriendRequestsPath(id); try { let { json, headers } = await BaseRequester.get(route); this.setState({ friendRequests: json }); } catch (error) { console.error(error); } }
[ "get friends() {\n this._logService.debug(\"gsDiggEvent.friends[get]\");\n return this._friends;\n }", "function getDirectFriendsArray() {\n var selectedPersonId = getPersonIndex();\n\n friends = data[selectedPersonId - 1].friends;\n\n return friends;\n }", "function listOfPending...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This function collides and edge and a polygon, taking into account edge adjacency.
function CollideEdgePolygon(manifold, edgeA, xfA, polygonB, xfB) { // Algorithm: // 1. Classify v1 and v2 // 2. Classify polygon centroid as front or back // 3. Flip normal if necessary // 4. Initialize normal range to [-pi, pi] about face normal // 5. Adjust normal range according to adjacent edges // 6....
[ "function b2CollidePolygons(manifold,\n\t\t\t\t\t polyA, xfA,\n\t\t\t\t\t polyB, xfB)\n{\n\tmanifold.pointCount = 0;\n\tvar totalRadius = polyA.m_radius + polyB.m_radius;\n\n\tvar edgeA = [0];\n\tvar separationA = b2FindMaxSeparation(edgeA, polyA, xfA, polyB, xfB);\n\tif (separationA > totalRadius)\n\t\treturn;...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
newGame sets the puzzleGrid empty and fills 9 length 9 lists and fills them all 0s and fills n(seeds) valid numbers.
function newGame(seeds) { //re new solutionCount solutionCount = 0; //check if the seeds is valid if(seeds<0||seeds>80) return false; //assign seeds seeds = seeds; //create new puzzleGrid generateGrid(); //add valid random numbers to the grid let rand,randX,randY; while(seeds-->0){ //find the valid...
[ "function createGameGrid() {\n var grid = new Array(Constants.numberOfRows);\n for (var row = 0; row < Constants.numberOfRows; row++) {\n grid[row] = new Array(Constants.numberOfColumns);\n for (var col = 0; col < Constants.numberOfColumns; col++) {\n grid[row][col] = {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Make a Graph API call to Facebook. Basically the FB.api callback wrapped in a promise.
function FB_API() { let edge = arguments[0]; let prot; let opts; if(arguments.length == 3) { prot = arguments[1]; opts = arguments[2]; } else { prot = "GET"; opts = arguments[1]; } return new Promise(function(resolve, reject) { FB.api(edge, prot, opts, function(res) { if(!res || res.error) { ...
[ "function callMSGraph(theUrl, accessToken, callback) {\n var xmlHttp = new XMLHttpRequest();\n xmlHttp.onreadystatechange = function () {\n if (this.readyState == 4 && this.status == 200)\n callback(JSON.parse(this.responseText));\n }\n xmlHttp.open(\"GET\", theUrl, true); // true for ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Build a ToolTip config based on bindings (if any) Arguments and modifiers take precedence over passed value config object / istanbul ignore next: not easy to test
static ParseBindingss(bindings) { // We start out with a basic config const NAME = 'BTooltip'; let config = { delay: getComponentConfig(NAME, 'delay'), boundary: String(getComponentConfig(NAME, 'boundary')), boundaryPadding: parseInt(getComponentConfig(NAME, '...
[ "function ToolTips(){\n\t\n\t// connector divs\n\tthis.createConnectors();\n\t\n\t// over lap of connector and trigger \n\tthis.overlapH = 10;\n\tthis.overlapV = -5;\n\n\t// time delay\n\tthis.showDelay = 500; // milliseconds\n\t\n\t// current showing tip\n\tthis.currentShowingEl = 0;\n}", "function tooltips ( ) ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Params: args: the everchanging presentation object Starts the show
function happycol_presentation_theShow(args){ if(args.stageManager==true){ happycol_stageManager(args); } }
[ "function happycol_presentation_beginShow(args){\n\t//check for preshow\n\thappycol_enable_controls(args);\n\tif( \n\t\t\n\t\t//list of conditions for a preshow\n\t\targs.lightingDesigner == true \n\t\t\n\t\t){\n\t\thappycol_presentation_preshow(args);\n\t}else{\n\t\thappycol_presentation_theShow(args);\n\t}\n}", ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Set the notification configuration in the component state
_setConfig() { this.setState({ config: AuthStore.notifications }); }
[ "notify(){\n new Notification(this.tache, {body:`Commence à ${this.hstart} et finit à ${this.hend}.`, icon:ICON_PATH})\n this.notified = true\n }", "handleMainPropertyChange(key, value) {\n const state = this.state;\n state.configuration[key] = value;\n this.setState(state);\n t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
hash the transactions data using merkle tree
static hashTransactions(transactionDatas){ let data = []; transactionDatas.forEach(transaction => { data.push(JSON.stringify(transaction)); }); // use sha256 to create a merkle tree let tree = merkle("sha256").sync(data); // return the merkle root return tree.root(); }
[ "calculateDirectoryHash(dirpath,contentslist){\n var lowerLevel = Array();\n for (var content of contentslist) {\n lowerLevel.push(content.split(\":\")[1]);\n }\n\n merkleTools.addLeaves(lowerLevel);\n merkleTools.makeTree()\n const root = merkleTools.getMerkleRo...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Assert can navigate to the related AccountType
function NavToAccountType(data) { var entity = data.results[0]; var type = data.query.fromEntityType.shortName; if (!entity) { ok(false, "a query failed to return a single " + type); } else if (typeof entity.AccountType !== 'function') { ok(false, type + " doesn...
[ "function NavToAccountTypeOnDemand(data) {\n var entity = data.results[0];\n var type = data.query.fromEntityType.shortName;\n\n if (!entity) {\n ok(false, \"a query failed to return a single \" + type);\n return false;\n }\n\n if ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Add all currently avaliable currencies to the table
function addAllCurrencies(){ for(k = 0; k < denominations.length; k += 1){ if(usedCurrencies.includes(""+k)){continue;} addCurrency(""+k); } }
[ "getData(base, date) {\n this.currencies = [];\n \n fetch(`https://api.exchangeratesapi.io/${date}?base=${base}`)\n .then(response => response.json())\n .then(json => {\n // console.log(json);\n for (const currency in json.rates) {\n this.curre...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Create a batch command invocation baesd on criteria.
function createBatchCommandByCriteria(axios$$1, options, payload) { var query = ''; query += options.scheduleToken ? '?scheduleToken=' + options.scheduleToken : ''; return restAuthPost(axios$$1, '/batch/command/criteria' + query, payload); }
[ "function createBatchCommandInvocation(axios$$1, payload) {\n return restAuthPost(axios$$1, '/batch/command', payload);\n }", "function compile(batch, opts, cb) {\n var res = getResultObject(batch, opts)\n , i, ix, ox, cmd;\n for(i = 0;i < batch.exec.length;i++) {\n ix = batch.exec[i], ox = {};\n i...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Save Member History button handler. It will handle both create/update
function saveHistoryBtnClickHandler(e) { var historyUrl = memberHistoryUrl; e.preventDefault(); var paramData = { member_id: currentMemberId, started_at: $('#history_started_at').val(), finished_at: $('#history_finished_at').val(), title: $('#history_title').val(), m...
[ "function historyTableCellClickHandler(field, column, row, rec) {\n if (column === 'edit') {\n $('#history_id').val(rec.id);\n $('#history_memberId').val(currentMemberId);\n $('#history_title').val(rec.title);\n $('#history_started_at').val(rec.started_at);\n $('#history_finish...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Tokenizes a number literal
readNumberLiteral() { const location = this.getLocation(); let value = ''; // Check for an integer format if (this.peekChar() === '0' && /[a-z]/.test(this.peekChar(1))) { value += this.readChar(); value += this.readChar(); } while (/[0-9]/.test(thi...
[ "NumericLiteral() {\n const token = this._eat(\"NUMBER\");\n return factory.NumericLiteral(Number(token.value));\n }", "parse_number() {\n let vals = this.find_some(tk.NUMBER, tk.COLON);\n return Ex(pr.Number, vals);\n }", "parseOptionalNumber() {\n const next = this.tok.peek();\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Read carefully, focus and test your code :) ... /\ HaPPy HaCkInG /\ 1implement the function mult that takes a single parameter n, and computes the multiplication of all integers up to n starting from 0, e.g.: mult(3); // => 6 mult(4); // => 24
function mult(n){ var mult=0; for (var i = 1; i < n; i++) { mult =mult+mult*i; } return mult ; }
[ "function multiplyByOne1() {\n for (i = 0; i < 11; i++) {//sintaxa pentru for: parcurgem loop-ul de la 0-10, acestea fiind valorile contorului i si incrementam pentru fiecare apelare a functiei\n var x = 1;//declaram variabila x, reprezentand numarul cu care vom inmulti contorul nostru si ii assignam valo...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
imitation api endpoint for getting album by id
function getAlbum (id) { return $http({ url: 'local.json', method: 'GET' }).then(function(response) { return _.find(response.data, {'id': parseInt(id, 10)}); }); }
[ "loadAlbumsDetails() {\n this._ApiFactory.getAlbumDetails(this.albumId).query({}, (response) => {\n\n this.album = {\n name: response.name,\n images: response.images\n }\n }, (response) => {\n if (response.status === 401 || response.status === 403 || response.status === 419 || res...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
TODO : check if formly or easy form generato fields model by default or if both > easy for generator is chosen
function loadFieldsModel() { var initialFieldsModel = angular.isArray(scope.edaEasyFormViewerEasyFormGeneratorFieldsModel) ? loadExistingConfigurationModel(scope.edaEasyFormViewerEasyFormGeneratorFieldsModel) //translate easy form generator to formly fields model : {}; return initialFieldsModel; }
[ "function emptyEdaFieldsModel() {\n\t var emptyModel = [{\n\t line: 1,\n\t activeColumn: 1,\n\t columns: [{\n\t numColumn: 1,\n\t exist: true,\n\t control: {\n\t type: 'none',\n\t key: 'none'\n\t }\n\t }]\n\t }];\n\t ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
removes a node, regardless of its position in the ast (via key or index) Removes a node from the ast. Whether it is in an object or array. Lots of decisions are made each time we remove a node, so inefficient algo.
function removeNode(node, key, index) { Array.isArray(node[key]) ? node[key].splice(index, 1) : delete node[key] }
[ "removeNode(node) {\n if (this.graph[node]) {\n delete this.graph[node]\n }\n }", "function deleteNode() {\n nodeToDelete = deleteNodeInp.value();\n nodes.splice(nodeToDelete,1);\n numnodes -= 1;\n //nodes.remove[0];\n //numnodes -= 1;\n}", "_removeNode(tree, path) {\n if(tre...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Strip a price from a piece of text
function getPriceOnly(text) { if (text.indexOf("stop loss") > -1) { text = text.substring(0, text.indexOf("stop loss")); } return text.replace(/[^0-9.]/g, ""); }
[ "function stripText(text) {\n return text.replace(/<[^>]+>|[!.?,;:'\"-]/g, ' ').replace(/\\r?\\n|\\r|\\s+|\\t/g, ' ').trim()\n }", "function cleanCashString(str) {\n return str.replace(\"$\", \"\");\n}", "function getPrice(idPriceLabel) {\n var price = document.getElementById(idPriceLabel).innerText...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Takes the index of an array item and collects the appropriate information to populate a modalcontent div, appends the div to the modal div and changes the display of the modal to block to make it visible. Calls the modal specific event listener function with the same index number.
function displayEmployeeModal(index) { let employee = employees[index]; let firstName = capitalize(employee.name.first); let lastName = capitalize(employee.name.last); let address = formatAddress(employee); let dob = formatDateOfBirth(employee.dob); let modalContent = '<div class="modal-content">'; modalC...
[ "function addEventListenersToModal(idNumber) {\n // close button listener\n $('.close').click(function() {\n $('.modal').css('display', 'none');\n $('.modal-content').remove();\n })\n\n // back button listener\n $('.back').click(function() {\n let last = idNumber - 1;\n if (idNumber > 0) {\n $...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
function to shuffle the puzzle
function shuffle(){ if(position == 0){ return; } game.removeAttribute('category'); //Remove the class attribute from the puzzle position = 0; var prevBox; var i = 1; var stop = setInterval(function(){ if(i <= 100){ var next = findNextBoxs(findEmptyBox()); if(prevBox){ for(var j...
[ "shuffleElements() { \n this.deck.shuffle();\n }", "_shuffle() {\n\tif (!this.currentQuestion) throw \"No questions to shuffle.\";\n\tthis.orderChoices = [\n\t this.currentQuestion.correctAnswer,\n\t this.currentQuestion.wrongAnswer\n\t];\n\tif (Math.floor(Math.random() * 2) == 0) {\n\t this.or...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Print out our tracks
function printTracks(tracks) { if (tracks.length > 1) console.log("-----TRACKS-----"); else console.log("-----TRACK-----"); for (var j = 0; j < tracks.length; j++) { var artists = "" for (var i = 0; i < tracks[j].artists.length; i++) { artists += tracks[j].art...
[ "dumpTrack() {\n const strs = [];\n const perSize = Math.floor(TRACK_MAX_SIZE / 2);\n const tracks = (this._tracks.length > TRACK_MAX_SIZE) ?\n this._tracks.slice(0, perSize).concat([' ... ']).concat(this._tracks.slice(-perSize)) :\n this._tracks;\n let ud = '';\n for (const el of tracks) {...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Hides the landing page, and adds first two images to the view
function renderImages() { $('.landing-page').addClass('hidden'); $('.img-round').removeClass('hidden'); updateSrcs(); currentOffset+=100; }
[ "function hidelandingpage() {\n $(\"#landingpagecontainer\").fadeOut();\n $(\"#mainbodyofblog\").fadeIn();\n}", "hideSplashScreen()\n {\n this.changeView(\"appMainViews\", \"app-view-app\")\n }", "function hideSceneImages() {\n for (let i = 0; i < extractImages.length; i++) {\n\n extrac...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Register a plugin that performs an external analysis on the selection in a separate window pluginName: The string that appears in the menu symbolName: the symbol in the meta data that will be used to identify the points callback: a callback function that starts the analysis. The callback signature is: ([type list] symb...
registerExternalAnalysisPlugin (pluginName, symbolName, callback) { this.analysisPluginMap.set(pluginName, { type: SelectionContextMenu.PluginTypeEnum.EXTERNAL_WEBSITE_ANALYSIS, symbol: symbolName, callback: callback}); this.refreshAnalysisMenu(); }
[ "async onPluginRegistered() {\r\n // noop\r\n }", "function Plugin(option) {\n return this.each(function () {\n var $this = $(this)\n var data = $this.data('wun.AwesomeVisuals')\n var options = typeof option == 'object' && option\n\n if (!data && option == 'destroy') return\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Section 2 Splines and candlestick
function section2() { ///update animation duration to 1000, hide the item series const f1 = function () { demoChart.update({ chart: { animation: { duration: 1000 } } }); demoChart.series[0].update({ ...
[ "drawCandlesAndStems() {\n \n d3.select(\"#candles\").selectAll(\"rect\").remove();\n this.candles.selectAll(\"rect\")\n .data(this.filterPriceArray(this.dataPointer-this.noCandles, this.dataPointer))\n .enter().append(\"rect\").attr(\"class\", d => (d.Open <= d.Close) ? \"can...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
===== END: AUTOPLAY VIDEO ===== =====POPUP INFO IMAGES====
function PopupInfoImages() { this.mainBlock = document.body; this.images = this.mainBlock.querySelectorAll('.js-img-wrap img'); this.typeImages = ['png', 'jpg', 'gif']; this.typeVideos = ['mp4', 'webm']; // Add hover for all image with attr data-src for(let i = 0; i < this.images.length; i++) {...
[ "function showInfo() {\n\tif (DEFDESCR) {\n\t\taddedby=$(\".queue_active\").attr(\"title\");\n\t\tduration=$(\".queue_active .qe_time\").html();\n\t\t$_mediainfo.html(addedby+' ['+duration+']');\t\n\t} else {\n\t\tvar arr=new Array();\n\t\ttext='Playing Next:';\n\t\tli1=$(\".queue_active\").next();\n\t\tli2=li1.nex...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Slides left the slider of the active section. Optional `section` param.
function moveSlideLeft(section){ moveSlide('left', section); }
[ "slideLeft() {\n let index = this.state.currentPane > 0 ? this.state.currentPane - 1 : this.state.maxSlides - 1 ;\n this.setState({currentPane : index});\n\n }", "subSlideLeft() {\n\n let newSlide = this.state.mainActiveSlide > 0 ? (this.state.mainActiveSlide - 1) : (this.state.mainMaxSlid...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
output: index/indicies PSEUDOCODE FOR LINEAR SEARCH Step 1: define a function linearSearch Step 2: loop through search array If the search object and current object are the same, return index of current object If search object doesn't match any obj in search array, return undefined PSEUDOCODE FOR GLOBAL LINEAR SEARCH i...
function linearSearch(searchObj, searchArr){ for(let index = 0; index < searchArr.length; index++){ if(searchArr[index] === searchObj){ return index } } return undefined }
[ "function searchLinear(array, target){\n\tfor(let i = 0;i<array.length;i++){\n\t\tif(target == array[i]){\n\t\t\treturn i;\n\t\t}\n\t}\n\n\treturn -1\n}", "function linearSearch(list, key) {\n let index = -1;\n for (let i = 0; i < list.length; i++) {\n if (list[i] == key) {\n index = i;\n break;\n }\n }\n return ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
check if a specific revision of a doc has been deleted metadata: the metadata object from the doc store rev: (optional) the revision to check. defaults to winning revision
function isDeleted(metadata, rev) { if (!rev) { rev = winningRev(metadata); } var id = rev.substring(rev.indexOf('-') + 1); var toVisit = metadata.rev_tree.map(getTrees); var tree; while ((tree = toVisit.pop())) { if (tree[0] === id) { return !!tree[1].deleted; } toVisit = toVisit.con...
[ "function isDocumentUnsaved(doc){\n\t\t// assumes doc is the activeDocument\n\t\tcTID = function(s) { return app.charIDToTypeID(s); }\n\t\tvar ref = new ActionReference();\n\t\tref.putEnumerated( cTID(\"Dcmn\"),\n\t\tcTID(\"Ordn\"),\n\t\tcTID(\"Trgt\") ); //activeDoc\n\t\tvar desc = executeActionGet(ref);\n\t\tvar ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Retrieves render parent for a given view. Might be null if a view is not yet attached to any container.
function getContainerRenderParent(tViewNode, view) { var container = getLContainer(tViewNode, view); return container ? container[RENDER_PARENT] : null; }
[ "function parentFrom(window) {\n if (window.parent !== window) return window.parent;\n}", "get parent() {\n return tag.configure(ContentType(this, \"parent\"), \"ct.parent\");\n }", "parent() {\n var selection = this.selected.anchorNode;\n // prevent '#text' node as element\n if ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Update the positions of verticies based on velocity and timestep
function updateVerticies(count, size, fps) { //There are "count" many verticies each of dimension "size" //For each we update their position based on their velocity for (i = 0; i < count; i++) { for (j = 0; j < size; j++) { //The average velocity is .5 //So if we update the...
[ "updateVelocity(newVelocity) {\r\n this.v = newVelocity;\r\n }", "update(dt) {\n\t // update velocity first <- It's important to update first, as\n\t // we're using the current value of acceleration.\n\t // Remember v = v0 + a * dt\n\t this.velocity = this.velocity.add(this.accel.mul(dt));\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
If a field isn't a mine increment number
function incrementFieldNumber(field){ // If field isn't a mine increment field number if(!field.mine){ field.number += 1; } }
[ "_addNumbersToMinefield(minefield) {\n for (let row = 0; row < minefield.length; row++) {\n for (let col = 0; col < minefield[0].length; col++) {\n if (minefield[row][col] === RSGame.MINE_CELL) {\n let neighbors = this._getNeighboringCells({row, col}, minefield);\n neighbors.forEach...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Render a "sub" node of a semtree those looking like a label with a leftpointing arrow Parameters SemTree: the semantic screen data structure i ; number of the main node node in the SemTree j : number of the subnode to render in that main node x,y : position where to render Scale ; scale
function RenderSubNode(SemTree, i, j, x, y, Scale) { var Html = ""; var X = (SemTree[i].x - XOffset) * Zoom * Scale + x; var Y = (SemTree[i].y - YOffset) * Zoom * Scale + y; var XX = (SemTree[i].subnodes[j].x - XOffset) * Zoom * Scale + x; var YY = (SemTree[i].subnodes[j].y - YOffset) * Zoom * Scale...
[ "function RenderMainNode(SemTree, i, x, y, Scale) {\n var Html = \"\";\n var X = (SemTree[i].x - XOffset) * Zoom * Scale + x;\n var Y = (SemTree[i].y - YOffset) * Zoom * Scale + y;\n UniqueId += 1;\n if (HighlightNode == i) {\n SVG_SetPen(2);\n } else {\n SVG_SetPen(1);\n }\n i...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get title and author from 245 field
function getTitleInfo(){ var titleStr=''; for (var i=0; i<obj['subfield'].length; i++){ if (obj['subfield'][i][parserPrefix]['code']=='a') { titleStr = obj['subfield'][i]['_']; var exp = new RegExp(/ :$/); // if there is a colon, move to a logical place: no space titleStr = t...
[ "function rssAuthor(s,author) {\n author.QueryInterface(Ci.nsIFeedPerson);\n // check for RSS2 string format\n var chars = s.trim();\n var matches = chars.match(/(.*)\\((.*)\\)/);\n var emailCheck = \n /^([a-zA-Z0-9_\\.\\-])+\\@(([a-zA-Z0-9\\-])+\\.)+([a-zA-Z0-9]{2,4})+$/;\n if (matches) {\n var match1 ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
linkMouseOver function linkMouseOut This function is called if the mouse moves off a forward or backward hyperlink on the invoking page. Parameters: thiselement the mouse moved on to
function linkMouseOut() { if (helpDiv) { helpDiv.style.display = 'none'; helpDiv = null; } } // linkMouseOut
[ "function elementMouseout(e){\n\t\t\tapplyBg(this,\"jQueryMultipleBgStaticSelector\");\n\t\t}", "onElementMouseOut(event) {\n super.onElementMouseOut(event);\n\n const me = this;\n\n // We must be over the event bar\n if (event.target.closest(me.eventInnerSelector) && me.resolveTimeSpa...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
When a list item is mouse enter, change the `hover` boolean to true The component's `render` method will run again
onListItemMouseEnter() { // update the state this.setState({ hover: true }); }
[ "onListItemMouseLeave() {\n // update the state\n this.setState({\n hover: false\n })\n }", "onMouseEnter() {\n\t\tthis.props.hoverAction('true');\n\t}", "function li_mouseover() {\n // if (!dragActive) {\n // clearListItemStyles();\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Style used for the leftmost button in a horizontal button group.
static get miniButtonLeft() {}
[ "static set miniButtonLeft(value) {}", "get leftArrowButton() {\n return 'a:nth-child(1) > b';\n }", "static set miniButtonMid(value) {}", "buttonPosition(index, columnStart) {\n const style = {\n position: 'relative',\n float: 'left',\n width: '4em',\n l...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
HELPERS Returns the volume of an island depending on distance to center and zoom level, constrained to MIN_VOLUME
distPx2Volume(dist, distanceThreshold = 1) { // Scale to normalize px distance depending on threshold const distPx2Normalized = d3_scaleLinear() .domain([0, this.maxDistancePx * distanceThreshold]) .range([0, 1]) .clamp(true); const distNormal = distPx2Normalized(dist); const distPow =...
[ "getVolume() {\r\n return this._muted ? 0 : this._volume;\r\n }", "get ConeVolume() {}", "get rootVolumeSizeGib() {\n return this.getNumberAttribute('root_volume_size_gib');\n }", "function calcForecastVolumeIn(data){\n\t\t\treturn data.forecasts.map(elem=>parseInt(elem.volume_in)).red...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
ISREF returns true when the value is a reference.
function ISREF(value) { if (!value) return false; return value.isRef === true; }
[ "function Reference() {}", "function reference_equals( a, b ) {\n var object_references = [];\n \n return ( reference_equals = _reference_equals )( a, b );\n \n function _reference_equals( a, b ) {\n var l = object_references.length;\n \n while ( l-- )\n if (...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Saves the variable websites in the localStorage
function storeWebsites(){ localStorage.removeItem("websites"); localStorage.websites=JSON.stringify(websites); chrome.alarms.clearAll(); websites.forEach(setAlarms); }
[ "function saveStoredThings(){\n localStorage.setItem('fronter_fixes_links', links);\n}", "function saveToLocalStorage() {\n localStorage.setItem(\"startTime\", startTime);\n localStorage.running = running;\n localStorage.paused = paused;\n localStorage.tableSize = tableSize;\n localStorage.setItem(\"histo...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This function setups the counter service.
setupCounter() { let logger = Logger.create("setupCounter"); logger.info("enter"); this.init = this.init.then(() => { return Counter.setupCollection(Mongo.db).then(() => { new Counter({shared: true}); }); }); }
[ "function startCounter() {\n timer = window.setInterval(updateCounter, 1*1000);\n }", "function start() {\n\n service.gapi = gapi.client.init({\n 'apiKey': GOOGLE_API_KEY,\n 'discoveryDocs': [GOOGLE_API_LANGUAGE_URL]\n });\n \n if (cb) {\n cb();\n }\n \n }", "async _initial...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
function to add ball using button
function addBall(){ let size = random(50,70); let ball = new Ball( random(0 + size, width - size), random(0 + size, height - size), random(-15,15) * globalSpeed, random(-15,15) * globalSpeed, 'rgb(' + random(0,333) + ',' + random(0,220) + ',' + random(0,360) +')', size ); balls.push(ba...
[ "drawBall() {\n fill('#FFFFFF');\n circle(this.x, this.y, 2 * this.radius);\n }", "function displayBall() {\n rect(ball.x, ball.y, ball.size, ball.size);\n}", "function moveBall() {\n ballX += ballSpeedX;\n ballY += ballSpeedY;\n}", "function addBoidAtClick(event){\n\tvar mousePos \t= getMousePos( c...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
precondition: current question is a threshold question returns: boolean
function isAboveThreshold(thisAnswer) { if (questionObj["question-preset"] == "NUMERIC_SCALE") return parseInt(thisAnswer) >= 8; if (questionObj["question-preset"] == "YES_NO_SCALE") return thisAnswer == "Yes"; return false; }
[ "moreQuestionsAvailable() {\n\treturn (this.progress.qAnswered < this.progress.qTotal);\n }", "static evalIsOverflowNotEmptyAndOverflowGreaterThanReading(context, dict) {\n if (!libThis.evalIsCounterOverflowEmpty(dict)) {\n return (libLocal.toNumber(context, dict.CounterOverflow) > libLocal.t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Helper function to create fullcalendar events given schedules
function _schedulesToEvents(schedules) { var scheduleEvents = []; // Create fullcalendar event corresponding to schedule for (var i=0;i<schedules.length;i++) { var fullCalEvent = _scheduleToFullCalendarEvent(schedules[i], 1); scheduleEvents.push(fullCalEvent); } return scheduleEve...
[ "function _scheduleToFullCalendarEvent(schedule, eventRow) {\r\n var schedulePk = schedule[\"id\"];\r\n var startDateTime = schedule[\"start_datetime\"];\r\n var endDateTime = schedule[\"end_datetime\"];\r\n var hideStart = schedule[\"hide_start_time\"];\r\n var hideEnd = schedule[\"hide_end_time\"];...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
sets the parameters for the api search
setParams(params){ searchParameters.setParams(params); }
[ "function getSearchParams() {\n return { searchScript: optScript, searchTones: optTones };\n }", "searchDocuments() {\n\n let searchObj = {}\n if (this.searchType === 'query') {\n searchObj.query = this.query;\n } else if (this.searchType === 'field') {\n searchObj.f...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Shorthand for `action('error', ...)`.
error(err, options = {}) { this.action('error', _.extend({}, options, {err})); }
[ "function error(id) {\n var item = itemDictionary()[id];\n if (item && item.inputValue && item.inputValue.error) {\n return item.inputValue.error();\n }\n }", "error() {\n return this._send(format.apply(this, arguments), SysLogger.Severity.err);\n }", "...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Checks if board has any of the 8 win patterns, return: 0 if nobody wins USER if user wins AI if AI wins
function checkWin() { var winPattern = [board[0] + board[1] + board[2], board[3] + board[4] + board[5], board[6] + board[7] + board[8], // Horizontal 0,1,2 board[0] + board[3] + board[6], board[1] + board[4] + board[7], board[2] + board[5] + board[8], // Vertical 3,4,5, board[0] + board[4] + board[8], board[...
[ "function check_game_winner(state) {\n\n //Patters variable is an array of patterns with each pattern itself an array of x/y co-oridinates.\n //In order to create the pattern matching technique, every possible winning pattern had to be identified with the co-ordinates recorded.\n //Each individual array is a set...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Methode pour selection d'un user connecter
static selecteUsreConnected(input, CallBack) { connexion.query("SELECT * FROM utilisateur WHERE idUtil =?", [input], (err, result) => { if (err) { // mal de connection mot de passe ou pseudo peut etre faut CallBack("error"); } else { // ...
[ "getSelectedUser() {\n if (myself.selectedUser) {\n return myself.selectedUser;\n } else {\n return myself.selectUser();\n }\n }", "onUsuarioSelecionado (callback) {\r\n this.$on('usuarioSelecionado', callback)\r\n }", "switchUser() {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Resolves a resource specified as an attribute in a html asset tag (eg. '' or '') provided by a plugin, and copies said asset into the plugin's asset output folder. Does nothing if the resource is a url.
getResolvedAssetElement(assetElementHtml, tagName, attrName, plugin, pluginName) { const $ = cheerio.load(assetElementHtml); const el = $(`${tagName}[${attrName}]`); el.attr(attrName, (i, assetPath) => { if (!assetPath || utils.isUrl(assetPath)) { return assetPath; } const srcPat...
[ "function asset(url){\n if(url.match(/^(?:https?\\:)\\/\\//)) return url;\n else return 'assets/' + url;\n}", "function setSrc(element,attribute){element.setAttribute(attribute,element.getAttribute('data-'+attribute));element.removeAttribute('data-'+attribute);}", "function assetsTask() { return src('assets/*...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
loopLights() function Start the loop, and every eight seconds repeat the loop.
loopLights() { console.log('[johnny-five] Lights Looping.'); this.buildLoop(); this.loop = setTimeout(() => { this.buildLoop(); }, 8000); }
[ "function turnOnLights() {\n lightsFadeIn(bulb1);\n lightsFadeIn(bulb2);\n lightsFadeIn(bulb3);\n lightsFadeIn(bulb4);\n lightsFadeIn(bulb5);\n lightsFadeIn(bulb6);\n lightsFadeIn(leftSpeaker);\n lightsFadeIn(rightSpeaker);\n lightsFadeIn(balloonsButton);\n lightsFadeIn(table);\n li...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
aux function to emit the correct print type
function printResolver(type) { if (type === 'i') { emit(`invokevirtual java/io/PrintStream/print(I)V \n`, -2); } else if (type === 's') { emit(`invokevirtual java/io/PrintStream/print(Ljava/lang/String;)V \n`, -2); } else if (type === 'a') { emit(`invokevirtual Array/string()Lj...
[ "function generatePrint(node)\n\t{\n\t\t// Get the node containing the value we want to print\n\t\tvar valueNode = node.children[0];\n\n\t\t// Three cases:\n\t\t// 1. Id - determine whether the Id's value is a static or heap value and handle appropriately\n\t\t// 2. String - get the ascii values representing the st...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Highlight rooms on drawing.
function highlightRooms(selectedAssetId, drawingController) { drawingController.resetDrawingHighlights(); var eqId = View.controllers.get('assetDrawingConfigController').eqId; var dataSource = View.dataSources.get('servedRooms_ds'); dataSource.addParameter('levelRestriction', "level1='" + selectedAssetI...
[ "function highlightRooms(connections) {\n var controller = View.controllers.get('abEamTcController');\n for (var i = 0; i < connections.length; i++) {\n var location = connections[i]['location'];\n var blId = location['blId'];\n var flId = location['flId'];\n var rmId = location['r...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
theta_oa calculates radians using opposite and adjacent lengths(applies inverse tan)
function radian_oa(o,a) { console.log(Math.atan(o/a)) }
[ "function theta_oh(o,h) {\n console.log((Math.asin(o/h))*180/Math.PI)\n}", "function tan (angle) { return Math.tan(rad(angle)); }", "function calcAngle(a, b) {\n return Math.atan2(b[1] - a[1], b[0] - a[0]) * 180 / Math.PI;\n}", "calcularAngulo(punto){\n return this.angulo = Math.atan2(punto.y - this...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Construct a factory function expression for the given `R3FactoryMetadata`.
function compileFactoryFunction(meta) { var t = variable('t'); var statements = []; // The type to instantiate via constructor invocation. If there is no delegated factory, meaning // this type is always created by constructor invocation, then this is the type-to-create // parameter provided by the ...
[ "function factory () {\n // Just forwards the call to the resolver by setting itself as context.\n function fn (value) {\n return resolver.call(fn, value);\n }\n\n created += 1;\n fn.id = created;\n\n // The state is attached to the function object so it's available to the\n // state-less functions when r...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Update passive mode window size settings on change
function passiveModeWindowSizeListener() { var passiveModeWindowSize = document.getElementById("passiveModeWindowSize"); passiveModeWindowSize.addEventListener("input", function() { var newVal = passiveModeWindowSize.value; chrome.storage.local.get(function(storage) { var cachedSettings = storage["cac...
[ "function UpdateWindowSize()\n{\n var WindowSize = GetWindowSize();\n\n // Only update the sizes if they are larget than zero\n if(WindowSize.X != 0 && WindowSize.Y != 0)\n {\n // Update the canvas size\n Canvas.width = WindowSize.X;\n Canvas.height = WindowSize.Y;\n\n // Update the Vieport to match...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates the XHR object and sends the request.
create() { const opts = pick( this.opts, "agent", "enablesXDR", "pfx", "key", "passphrase", "cert", "ca", "ciphers", "rejectUnauthorized", "autoUnref" ); opts.xdomain = !!this.opts.xd; opts.xscheme = !!this.opts.xs; const xhr = (this...
[ "init()\n {\n this.request = undefined;\n this.request = new XMLHttpRequest();\n\n this.request.overrideMimeType(this.config.requestType);\n\n for (let handler in this.config.handlers) {\n this.request.addEventListener(handler, this.config.handlers[handler]);\n }\n\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }