query
stringlengths
9
34k
document
stringlengths
8
5.39M
negatives
listlengths
19
20
metadata
dict
Hide all of the views before displaying another view
_hideAll() { this.views.directorySelection.hide(); this.views.training.hide(); this.views.messages.hide(); this.views.directorySelection.css('visibility', 'hidden'); this.views.training.css('visibility', 'hidden'); this.views.messages.css('visibility', 'hidden'); }
[ "function hideAllGameViews() {\n hideBlock(\"sideStatus\");\n hideBlock(boardView.wrapper.id);\n}", "function hideAll(){\n my.contactsView.hideView();\n my.contactForm.hideView();\n }", "function hideSpecificView(view) {\n $(view).css('display', 'none');\n }", "hideView() {\n\t\tthis....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
checking with timeOut 500ms if load data table is done.
function waitUntilTableDataLoad(){ setTimeout(function(){ if($('#jg-overlay').css("display") == "none"){ textColorQty(); mobile_qty_outofstock_color(); mobile_adjust_tooltip(); mobile_pricingChange(); mob...
[ "function wait() {\r\n\t\t\tif (typeof window.tableLoad === 'undefined') {\r\n\t\t\t\tsetTimeout(wait, 10);\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\tresolve();\r\n\t\t\t}\r\n\t\t}", "function wait() {\r\n\t\t\t\tif (typeof window.tableLoad === 'undefined') {\r\n\t\t\t\t\tsetTimeout(wait, 10);\r\n\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sets a CSS style property, but only if property exists on `el`
function safeSetStyle(el, property, value) { if (property in el.style) { el.style[property] = value; } else { // tslint:disable-next-line:no-console console.warn(new Error(`Trying to set non-existing style ` + `${property} = ${value} on a <${el.tagName.toLowerCase()}>.`))...
[ "function safeSetStyle(el, property, value) {\n if (property in el.style) {\n el.style[property] = value;\n }\n else {\n // tslint:disable-next-line:no-console\n console.warn(new Error(\"Trying to set non-existing style \" +\n (property + \" = \" + value + \" on a <\" + el.t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Updates the inner dimension depending on child controls.
updateInnerHeightDependingOnChilds(){}
[ "updateInnerWidthDependingOnChilds(){}", "updateSubPanelWidth()\n {\n if (this.leftPanel != null) {\n this.leftPanel.resize(this.x, this.y, this.position, this.height);\n }\n\n if (this.rightPanel != null) {\n this.rightPanel.resize(this.x + this.position, this.y, thi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
X. Load modal jade template (stub)
function loadJade( itcb ) { YUI.dcJadeRepository.loadNodeFromTemplate( 'chooselabdata_modal', 'FormEditorMojit', {}, node, itcb ); }
[ "function loadJade( itcb ) {\n Y.doccirrus.jsonrpc.api.jade.renderFile( { path: JADE_TEMPLATE } )\n .then( onTemplateLoaded )\n .fail( itcb );\n\n function onTemplateLoaded( response ) {\n var template = ( response && response.da...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates a new message using the data sent in from the client.
function createMsg(data) { return db.Message .create(data) .then(msg => { msg = msg.toObject(); return db.User .findById(msg.from) .select('_id name avatar') .exec() .then(user => { msg.from =...
[ "function createNewMessage() {\n var message = {};\n message.webId = Util.getUniqueId();\n message.dateUpdate = Util.getISOCurrentTime();\n message.dateSent = \"\";\n message.value = \"\";\n message.type = 0;\n message.entityType = \"\";\n message.entityId = n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Builds a book object from data attributes of a bookCard element in the DOM
function parseBookElm(bookElm) { var book = { id: Number(bookElm.getAttribute('data-id')), title: bookElm.getAttribute('data-title'), author: bookElm.getAttribute('data-author'), subject: bookElm.getAttribute('data-subject'), vendorURL: bookElm.getAttribute('data-vendor...
[ "function buildCard(bookObject) {\n var card = $(\"<div>\").addClass(\"card col-md-4\");\n var cardBody = $(\"<div>\")\n .addClass(\"card-body card-title font-weight-bold\")\n .text(bookObject.volumeInfo.title);\n console.log(bookObject.volumeInfo.title);\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
the column selector control change event
columnSelectChange(e) { // get the index from the ID let id = e.target.id; let idx = parseInt( id.slice(id.indexOf('column-selector-') + 'column-selector-'.length) ); this.hideAllColumnsExcept(idx); }
[ "_onColumnChange(e) {\n this.selected = e.detail.value;\n this._updateCols(parseInt(e.detail.value));\n }", "_onColumnChange(e){this.selected=e.detail.value;this._updateCols(parseInt(e.detail.value))}", "_selectedChanged() {\n this._updateCols();\n }", "function onChangeColumns() {\n // ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
End ClickTab Function Start AjaxLoad Function
function AjaxLoad($tabid) { // Filename Extension $ext = $(e).find('.button-holder').find("div[data-tabid='"+ $tabid +"']").attr('data-ext'); if ( $ext === undefined ) { $ext='php'; } // New content file $filepath = 'content/tabion/'+$tabid+'.'+$ext; // L...
[ "function init_ajax_tabs(e) {\n var context = $(e.target);\n\n context.find('[data-toggle=\"tabajax\"]').tabajax();\n }", "function setTabLoadComplete()\n{\n var w = getActionKeyWindow();\n w.tabLoading = false;\n}", "function ajax_Load() {\n //$(\".consoleLogOutput\").append('<div class=\"conso...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Takehiro Tominaga 2000xxxx increases the subblock gain and adjusts scalefactors
function inc_subblock_gain(gfc, cod_info, xrpow) { var sfb; var scalefac = cod_info.scalefac; /* subbloc_gain can't do anything in the long block region */ for (sfb = 0; sfb < cod_info.sfb_lmax; sfb++) { if (scalefac[sfb] >= 16) return true; } ...
[ "function inc_subblock_gain(gfc,cod_info,xrpow){var sfb;var scalefac=cod_info.scalefac;/* subbloc_gain can't do anything in the long block region */for(sfb=0;sfb<cod_info.sfb_lmax;sfb++){if(scalefac[sfb]>=16)return true;}for(var window=0;window<3;window++){var s1=0;var s2=0;for(sfb=cod_info.sfb_lmax+window;sfb<cod_...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get Quandl Dataset code of a symbol
function getDatasetCode(symbolParts) { switch (symbolParts.symbol) { // User input BTC or ETH case 'BTC': case 'ETH': return `${symbolParts.symbol}USD`; // Yahoo! autocomplete BTC/USD symbol case 'BTCUSD=X': case 'BTC=X': return 'BTCUSD'; default: return symbolParts.symbo...
[ "function tinf_decode_symbol(d,t){while(d.bitcount<24){d.tag|=d.source[d.sourceIndex++]<<d.bitcount;d.bitcount+=8;}var sum=0,cur=0,len=0;var tag=d.tag;/* get more bits while code value is above sum */do{cur=2*cur+(tag&1);tag>>>=1;++len;sum+=t.table[len];cur-=t.table[len];}while(cur>=0);d.tag=tag;d.bitcount-=len;ret...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Rolespecific get: All roles assigned to the given user id
async getRolesByUserId(userId) { const getSql = { select: "SELECT ar.id, ar.role_name ", from: "FROM g3tools.auth_user_role a", join: "JOIN g3tools.auth_user au ON a.user_id = au.id " + "JOIN g3tools.auth_role ar ON a.role_id = ar.id ", where: `WHERE a.user_id = ${user...
[ "function getUserRoles(id){\n\t\treturn RoleMapping.find({where:{principalId:id}})\n\t\t.then(function(roleMappings){\n\t\t\tvar roleIds=_.uniq(roleMappings.map(function(roleMapping){\n\t\t\t\treturn roleMapping.roleId;\n\t\t\t}));\n\t\t\tvar conditions=roleIds.map(function(roleId){\n\t\t\t\treturn {id:roleId};\n\t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
=================================================================== from functions/io/StdErr.java =================================================================== Needed early: Builtin Needed late: IO ArcObject PORT TODO: This should be able to set stderr. But don't change it!
function StdErr() { }
[ "_errorOutput(){\n\n process.exitCode = 1;\n const message = super._errorOutput();\n\n if (this.value().status === this.option('parsingErrorStatusCode')){\n this.stderr().write(`${message}\\n`);\n }\n else{\n this.stderr().write(message);\n }\n }", "get stderr() {\n return this._st...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
3.Write a program to print all even or odd numbers in given range using recursion.
function printOdd(start,end){ if(start>end){ return } else{ if(start%2!==0){ console.log(start) } return printOdd(start+1,end) } }
[ "function displayOddEven(rangeStart, rangeEnd) {\n for(var i=rangeStart; i<=rangeEnd; i++){\n if(i%2==0)\n console.log(i + \" is even\\n\");\n else\n console.log(i + \" is odd\\n\");\n } \n}", "function showNumbers(limit){\n\n console.log(0, \"Even\");\n for (let i=1; i<=lim...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns a promise that resolves with a generated service worker (the file contents), based off of the options provided.
function generateServiceWorker(options) { console.assert(!!options, '`project` & `buildRoot` options are required'); console.assert(!!options.project, '`project` option is required'); console.assert(!!options.buildRoot, '`buildRoot` option is required'); options = Object.assign({}, options); let pro...
[ "function addServiceWorker(options) {\n return generateServiceWorker(options).then((fileContents) => {\n return new Promise((resolve, reject) => {\n let serviceWorkerPath = path.join(options.buildRoot, options.serviceWorkerPath || 'service-worker.js');\n fs_1.writeFile(serviceWorkerP...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
builds a json url for a map layer
function buildLayerUrl(id){ var jsonurl = ""; switch (id){ case "montypemapbtn": jsonurl = baseurl + "sites/geo/type/" + buildParamString(id,delimurl,true,1) + "/geojson?uri=true"; return jsonurl; case "monperiodmapbtn": jsonurl = baseurl + "sites/geo/period/" + buildParamString(id,delimurl,true,1) + "/g...
[ "function addQueryLayerToMap(jsonurl, layername, values){\n\t//colours = addLyrCols(values);\n\tvar fSource = new ol.source.Vector({\n\t\turl: jsonurl,\n\t\tformat: new ol.format.GeoJSON({\n\t\t\tdefaultDataProjection: 'EPSG:27700'\n\t\t})\n\t});\n\t\n\tvar fLayer = new ol.layer.Vector({\n\t\ttitle: layername,\n\t\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
generate matrix coordinates[start(x,y), end(x,y)] from span data (for current week)
span2coords(spans) { if (!this.cur_week) { return; } // exit if not initialized var self = this; var coords = []; self.cur_week.forEach(function(m, x) { let key = m.format('YYYY-MM-DD'); if (spans[key]) { spans[key].forEach(function(span, si) { let ys = self.parseSpan(span); // [starti, ...
[ "span2matrix(data) {\n\t\t\tif (!this.cur_week) { return; } // exit if not initialized\n\t\t\tvar self = this;\n\t\t\tvar mat = self.create2DMatrix(self.x_dim, self.y_dim, false);\n\t\t\t\n\t\t\tself.cur_week.forEach(function(m, mi) {\n\t\t\t\tlet key = m.format('YYYY-MM-DD');\n\t\t\t\tif (data[key]) {\n\t\t\t\t\td...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Parse the given contents and return either an AST or a parse error as a Warning. It needs the filename and the location offset to produce correct warnings.
function parseJs(contents, file, locationOffset, warningCode, sourceType) { if (!warningCode) { warningCode = 'parse-error'; } let program; try { // If sourceType is not provided, we will try script first and if that // fails, we will try module, since failure is probably that it...
[ "function parseJs(contents, file, locationOffset, warningCode, sourceType) {\n if (!warningCode) {\n warningCode = 'parse-error';\n }\n let parsedFile;\n const parseOptions = Object.assign({ sourceFilename: file }, baseParseOptions);\n try {\n // If sourceType is not provided, we will t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
str: a custom projection string, e.g.: "albersusa +PR"
function parseCustomProjection(str) { var parts = str.trim().split(/ +/); var params = []; var names = parts.filter(function(part) { if (/^\+/.test(part)) { params.push(part.substr(1)); // strip '+' return false; } return true; }); var name = names[0]; var opts ...
[ "function expandProjDefn(str, dataset) {\n var mproj = require$1('mproj');\n var proj4, params, bbox, isConic2SP, isCentered, decimals;\n if (str in mproj.internal.pj_list === false) {\n // not a bare projection code -- assume valid projection string in other format\n return str;\n }\n isCo...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
When a new entitiy is found, and it's a boss type we need to do: 1. Add row to the database 2. Add entry in this.boss 3. Sum data for this.boss
handleEntitiesList() { let entities = this.database.entitiesRaw .filter(e => this.isBossEntity(e)) .filter(e => this.isNewEntity(e)) ; const now = moment(new Date()); for (let c = 0; c < entities.length; c++) { /* check if id is already set */ ...
[ "function addBoss(){\n if(qtdBoss.length === 0){\n if(getRandom(5000) > 4990){\n let bossEnemie = new Boss();\n qtdBoss.push(bossEnemie);\n bossEnemie.enemyDraw(); \n } \n } \n }", "addBoss(boss) {\n this.level.changeMarker(boss, this.endCellPosn.x, t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Lightning Exercise Taco Truck Write a function to represent a taco truck's ordering system. The function should accept two parameters: typeOfShell and topping. (Both will be strings.) Inside the function, use string interpolation to build a sentence that announces the taco is ready. Use the information the customer pas...
function tacoOrder(typeOfShell, topping){ var madeTaco = `One ${typeOfShell} taco with ${topping}` return madeTaco }
[ "function tacoTruck(typeOfShell, topping){\n var tacoOrder = `Your ${typeOfShell} taco with ${topping} is ready!`\n return tacoOrder\n}", "function run (exercise){\n return \"Today's exercise: running\"\n}", "function makeTrain() {\n\tconsole.log(\"Make me a Train\");\n\n\t// ---- put function here ---...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Initializes a new instance of the CommonDialogsComponent class.
function CommonDialogsComponent(dialogService) { this.dialogService = dialogService; }
[ "function initDialogs(self){\n\t\tvar container = $('#dialogContainerElement');\n\n\t\tvar defaultDialogConf = { show: false, backdrop: false };\n\t\tself.dialogs = {};\n\n\t\tself.dialogs.openDialog = container.find(\".openMenu\").modal(defaultDialogConf);\n\t\tself.dialogs.renameDialog = container.find(\".renameD...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
function to pad out a Hex value with leading zeros to l bits total length, preserving the '0x' at the start
function padHex(A, l) { if (l % 8 !== 0) throw new Error('cannot convert bits into a whole number of bytes'); return ensure0x(strip0x(A).padStart(l / 4, '0')); }
[ "function pad(hex) {\n return (hex.length === 1 ? \"0\" + hex : hex);\n}", "function padLeft(str, bits){\n\t\t\t\tbits = bits || config.bits\n\t\t\t\tvar missing = str.length % bits;\n\t\t\t\treturn (missing ? new Array(bits - missing + 1).join('0') : '') + str;\n\t\t\t}", "function padLeft(str, bits) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Return the list of variables first declared in this scope.
declaredVariables() { var v; return ((function() { var i, len, ref, results; ref = this.variables; results = []; for (i = 0, len = ref.length; i < len; i++) { v = ref[i]; if (v.type === 'var') { results.push(v.name); } } return results; })....
[ "declaredVariables() {\n var v;\n return ((function() {\n var i, len, ref, results;\n ref = this.variables;\n results = [];\n for (i = 0, len = ref.length; i < len; i++) {\n v = ref[i];\n if (v.type === 'var') {\n results.push(v.name);\n }\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function to make the mastery graph bar chart animate
function animateMasteryGraph() { // TODO 360 is a magic number var x = d3.scale.linear() .range([0, 360]) .domain([0, 10]); d3.selectAll("#masteryGraphSection svg .bar rect") .attr("width", 0) .transition() .duration(500) .delay(function(d, i) { return i * 10; }) .attr("width", function(d) { return d.s...
[ "function barAnimation() {\n document.getElementById(\"landing-content\").style.animation = \"slideOutLeft linear 200ms forwards\"\n\n var fillBars = document.getElementsByClassName(\"fill-bar\")\n\n for (var i = 0; i < fillBars.length; i++) {\n fillBars[i].style.animation = \"barsFillIn ease-in 600ms...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Update the sizes of the diff content columns. This will figure out the minimum and maximum widths of the columns and set them in a stylesheet, ensuring that lines will constrain to those sizes (forcewrapping if necessary) without overflowing or causing the other column to shrink too small.
_updateColumnSizes() { if (this.$el.hasClass('diff-error')) { return; } let $parent = this._$parent; if (!$parent.is(':visible')) { /* * We're still in diff loading mode, and the parent is hidden. We * can get the width we need from the...
[ "_precalculateContentWidths() {\n let cellPadding = 0;\n\n if (!this.$el.hasClass('diff-error') && this._$revisionRow.length > 0) {\n const containerExtents = this.$el.getExtents('p', 'lr');\n\n /* Calculate the widths and state of the diff columns. */\n let $cells = $...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Create the documentation base component style object
function DocumentationBaseComponentStyle() { this.initByNamespace("documentation"); }
[ "function PartogramBaseComponentStyle() {\n\tthis.initByNamespace(\"parto-base-wf\");\n}", "function create() {\n\t return new ReactFreeStyle();\n\t}", "get style(){ return this.__baseStyle; }", "function _createBaseStyles() {\n _baseVisualization = $(\"<style />\", {\n id: \"alice-base-v...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Modify the JSON tests file specified by `testFilePath`, adding test cases to its `tests` property.
function updateTestFile( testFilePath ){ var testsJson = JSON.parse(fs.readFileSync( testFilePath )); addTests( testsJson, function writeNewFile( newTestJson ){ fs.writeFile( testFilePath, JSON.stringify( newTestJson, undefined, 2 ) ); }); }
[ "async reload(filePath, overwrite=true) {\n\n let fs = require(\"fs-extra\");\n\n /** @type {Object[]} */\n let json = await fs.readJSON(filePath);\n\n if (overwrite) this.qa._tests = [];\n\n for (let testInfo of json) {\n /** @type {Test} */\n let test = Object.assign(new Test(), testInfo)...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get settings from Cookie, or set them with default value
function settingsFromCookie() { var settings = {}; _setSettingOrDefault(settings, 'color_outliers', '#C30000'); _setSettingOrDefault(settings, 'color_true_positive', '#008800'); _setSettingOrDefault(settings, 'color_false_positive', '#FF0000'); _setSettingOrDefault(settings, 'color_false_negative', ...
[ "function ApplyCookie() {\n ApplyCookieSettings(CookieSettings);\n}", "function overwriteDefaultWithCookieSettings() {\n console.log(\"Overwrite Default Values\");\n\n textSizeSlider.overwriteDefault();\n linepacingSlider.overwriteDefault();\n textStyleDropdown.overw...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
When the viewport resizes we want to check if the measured constraints have changed and, if so, reposition the element within those new constraints relative to where it was before the resize.
scalePositionWithinConstraints() { if (!this.visualElement.current) return; const { drag, dragConstraints } = this.getProps(); const { projection } = this.visualElement; if (!indexLegacy.isRefObject(dragConstraints) || !projection || !this.constraints) return; ...
[ "scalePositionWithinConstraints() {\n var _a;\n if (!this.visualElement.current)\n return;\n const { drag, dragConstraints } = this.getProps();\n const { projection } = this.visualElement;\n if (!is_ref_object_isRefObject(dragConstraints) || !projection || !this.constra...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Array: SecondtoLast: Return the secondtolast element of an array. Given [42, true, 4, "Liam", 7], return "Liam". If array is too short, return null.
function secondToLast(arr) { if (arr.length < 2) { return null; } else { return arr[arr.length - 2]; } }
[ "function secondToLast(arr){\n if(arr.length >1){\n return arr[arr.length-2];\n }else {\n return null;\n }\n}", "function secondToLast(arr) {\r\n\tif (arr.length<=1) {\r\n\t\treturn null;\r\n\t}\r\n\treturn arr[arr.length-2];\r\n}", "function secondToLast(arr) {\n if (arr.length >= 2) {\n ret...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Construct with the jquery wrapper of the div Debounce prevents successive on_slide events from firing more frequently than the given number of milliseconds
constructor(jdiv, on_slide=function(first,last){}, debounce_ms=100) { const self = this this.jdiv = jdiv this.on_slide = on_slide this.debounce_ms = debounce_ms // Debounce state this.last_event = performance.now() this.deferred = null this.last_range = ...
[ "function revealBySlideDown(elem, time) {\n timers.push(window.setTimeout(function() {\n $(elem).slideDown(500);\n }, time));\n}", "function slideDownNotification(startAfter, autoClose, duration){ \n setTimeout(function(){\n $('div#info_message').animate({\n top: 0\n })...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Adds or removes multiple dimensions.
_addRemoveMultipleDimensions(oldvalue, value, changeValueDimensions) { const that = this; if (value < 1 || value > 32) { that.dimensions = 1; if (that.dimensions === oldvalue) { return; } } let difference = that.dimensions - oldvalue...
[ "putDimensions(incomingDimensionSet) {\n if (this.dimensions.length === 0) {\n this.dimensions.push(incomingDimensionSet);\n return;\n }\n for (let i = 0; i < this.dimensions.length; i++) {\n const existingDimensionSet = this.dimensions[i];\n // check...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
RequestAnimationFrameLoop class used for updating objects on a framebyframe. Synchronizes the `update` method invocations to the refresh rate of the screen. Manages the `requestAnimationFrame`loop by normalizing the passed in timestamp when switching tabs.
function RequestAnimationFrameLoop() { var _this = this; // References to objects to be updated on next frame. this._updates = []; this._looper = function(time) { _this.loop(time); }; this._time = 0; this._stoppedAt = 0; this._sleep = 0; // Indicates whether the engine sho...
[ "function RequestAnimationFrameLoop(){var _this=this;// References to objects to be updated on next frame.\nthis._updates=[];this._looper=function(time){_this.loop(time);};this._time=0;this._stoppedAt=0;this._sleep=0;// Indicates whether the engine should be restarted when the tab/ window is\n// being focused again...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
funcion que regresa algo
function nombreFuncion(parametro){ return "regresan algo" }
[ "function pregAnterior(){\n\tvar nvaPreg = pregActiva -1;\n\tif (nvaPreg < 0){nvaPreg =0 }\n\tif(pregActiva ==3 & txtRespuestas[3][1]=='NO'){nvaPreg= pregActiva - 2}\t\n\tmuestraPreg(nvaPreg)\n}", "function RegistrarDatos(){\n //validacion de datos\n \n //capturando valores\n var nom=txtNom.value;\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
function that periodically checks to see if the typed keyword has changed
function checkForChanges() { // retrieve the keyword object var keyword = document.getElementById("keyword").value; // check to see if the keyword is empty if(keyword == "") { // hide the suggestions hideSuggestions(); // reset the keywords userKeyword=""; httpRequestKeyword=""; } // set the timer for a new check setTi...
[ "function autoCheckTyping() {\n checkIsTyping();\n setTimeout(autoCheckTyping, 3000);\n}", "checkTyping() {\n const self = this;\n\n const typingTimer = (new Date()).getTime();\n const duration = typingTimer - self.lastTypingTime;\n if (self.didReachTypingTimeout(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Navigate to the last image/content. Fired when the user clicks the navigate to last control or presses the END key.
function lastItem() { stopSlideshow(); changeItem(anchors.length-1); }
[ "onEndKeyDown() {\n this.target.navigateLast();\n }", "function navigateNext(){\n _displayImage( _listCache()[_currentIndexCache+1] || _listCache()[0] );\n }", "function jumpToLast() {\n\t\t\tif (options.sliderType === 'vertical') {\n\t\t\t\t$sliderWindow.animate({\n\t\t\t\t\tmarginT...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
CHOOSE AVATAR Triggers click event for file input opens file selector
function chooseAvatar(){ $("#choose_avatar").trigger('click'); }
[ "function selectFilePrompt() {\n s.avatarInput.click();\n }", "function uploadAvatar(){\n\t$('#avatarPhoto').click();\n}", "function fileChoose(e) {\n\t\n\tdocument.getElementById(\"uploadFile\").click();\n}", "function openUploadFile() {\n $('#profile-file').click();\n }", "function handlePic...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
< Adds datemustbeequalorlessthancurrentdate Custom Validation Attribute to Unobtrusive Validation Handler
function Adddatemustbeequalorlessthancurrentdate() { $.validator.unobtrusive.adapters.addBool("datemustbeequalorlessthancurrentdate"); $.validator.addMethod("datemustbeequalorlessthancurrentdate", function (value, element, param) { if (value) { var TestValue = moment(value, "DD-MM-YYYY"); ...
[ "function Adddatemustbeovertenyearsago() {\n\n $.validator.unobtrusive.adapters.addBool(\"datemustbeovertenyearsago\");\n\n $.validator.addMethod(\"datemustbeovertenyearsago\", function (value, element, param) {\n if (value) {\n var TestValue = moment(value, \"DD-MM-YYYY\");\n var...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
this class provides functionality to make ids from strings, i.e. this class maps filled sentence templates to integer ids and vice versa
function StringIds() { this.count = 0; this.products = []; /** * add another string to the id database * * @returns this */ this.AddString = function(s) { this.products.push(new StringProduct([[s]])); this.count += 1; return this; }; /** * add a Cartesian concatenation of sets of strings to ...
[ "function makeId(text) {\n // Example string: // '⚡⚡⚡ Unicode icons are cool--but they definitely don't belong in a URL fragment.'\n return text.replace(/[^\\w\\s-]/gi, '') // ' Unicode icons are cool--but they definitely dont belong in a URL fragment'\n .replace(/\\s+/g, '-') ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Attempts to add file and line number info to the given log arguments.
function formatLogArguments(args) { args = Array.prototype.slice.call(args) var stackInfo = getStackInfo(1) if (stackInfo) { // get file path relative to project root var calleeStr = '(' + stackInfo.relativePath + ':' + stackInfo.line + ')' if (typeof (args[0]) === 'string') { ...
[ "function formatLogArguments(args) {\n args = Array.prototype.slice.call(args);\n var stackInfo = getStackInfo(1);\n if (stackInfo) {\n // get file path relative to project root\n var calleeStr = stackInfo.relativePath + ':' + stackInfo.line;\n if (typeof args[0] === 'string') {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Rebuild the stupid shit
rebuild() { this.built = false; this.build(); }
[ "Rebuild()\n {\n // TODO: Rebuild buffers\n }", "_rebuild() {\n\t\tthis.cards = this.graveyard;\n\t\tthis.graveyard = [];\n\t\tthis.suffle(2);\n\t}", "_rebuild() {\n if (!this.dirty) {\n return;\n }\n this._applyExceptionRules();\n this.com...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Change left sidenav view
changeLeftSidenavView(view) { this._chatService.onLeftSidenavViewChanged.next(view); }
[ "function toggleLeftSidenavView(id) {\n vm.leftSidenavView = id;\n }", "function toggleLeftSidenavView(id)\n {\n vm.leftSidenavView = id;\n }", "function toggleLeftMenu() {\n $mdSidenav('left').toggle();\n }", "function sidenavOpen () {\n sidenavBar.style.transform ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This functions includes the code for device enrollment with server
function enroll() { $("#next").click(function() { var serverEndpoint = $("#server_endpoint").val(); // server endpoint = 10.100.4.109:8280 var urlEnroll = serverEndpoint + "/api/device-mgt/v1.0/device/agent/1.0.0/enroll"; var urlToken = serverEndpoint + "/token";...
[ "function enrollDevice(event){\n if (!event || !enrollRequest) {\n return;\n }\n \n var apdu = event.payload.apdu;\n log(\"enrollDevice: APDU returned from device \" + apdu);\n var words = CryptoJS.enc.Hex.parse(apdu);\n log(\"enrollDevice: words = \" + words);\n var base64Apdu = CryptoJS.enc.Base64.stri...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
eventServiceElements and tourismServiceElement curently obtain their data from arrays in the files eventServices and tourismSerices respectively, both found in the resources folder. The receied data is passed to the ServiceButton element (file in "components" folder)
render(){ const eventServiceElements = eventServicesData.map(eventService => <ServiceButton key={eventService.id} label={eventService.label} />) const tourismServiceEvents = tourismServiceData.map(tourismService => <ServiceButton key={tourismService.id} label={tourismService.label}/>) return( <div class...
[ "loadFeatureServices(){\n\t\tlet featureServiceHtml = `<div class=\"row space-top\">\n\t\t<!-- BEGIN SERVICES-->\n\t\t<div class=\"c8 text-center\">\n\t\t<h1 class=\"maintitle text-center\">\n\t\t<span>More Services</span>\n\t\t</h1>`;\n\t\tthis.featureServices.forEach(featureService =>{\n\t\t\tfeatureServiceHtml +...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
FUNCTION: stripCfoutputIfNested DESCRIPTION: Given a string, removes all tags if already within a larger . The second argument is given, searchs outward from that node. Otherwise searches outward from the selected node / insertion point. ARGUMENTS: theStr the string to remove cfoutput tags from optionalNode (optional) ...
function stripCfoutputIfNested(theStr, optionalNode, force) { theStr = String(theStr); if (theStr && theStr.search(/<cfoutput>/i)!=-1) { //if contains <cfoutput> if (force || isWithinCfoutput(optionalNode)) { theStr = theStr.replace(/<cfoutput[^>]*>/gi,""); //remove open tags theStr = theStr.repl...
[ "function dwscripts_canStripCfOutputTags(charRange, checkForBind)\n{\n var isNested = false;\n var startOffset = 0;\n var endOffset = 0;\n var dom = dw.getDocumentDOM();\n\n // If we were not given a charRange, then get the current selection\n if (charRange)\n {\n startOffset = charRange.startoffset;\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
apskiritimo plotas pi r^2
function apskritimoPlotas(spindulys) { console.log('Apskritimo plotas'); return Math.PI * (spindulys ** 2); }
[ "function spindulioReiksme () {\n// let ivedimoLaukas = document.querySelector('div input');\n let r = document.querySelector('div input').value;\n let plotas= Math.PI*r*r\n\n// console.log(plotas);\ndocument.querySelector(\".apskritimo-plotas\").innerHTML = plotas;\n}", "function twoPiRad(r){\n if(r < 0){ r...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Load car models into Dual Listbox and contains a clearArray function
function loadCarModels() { this.cars = new Array(); var k = 0; for (var i = 0; i < measurements.length; i++) { // Add car model to cars array if it is not contained there yet if ($.inArray(measurements[i].sensors.manufacturer + ' ' + measurements[i].sensors.model, this.cars) < 0) { this.cars[k] = measurements...
[ "function changeModels() {\n var leasingCars = {};\n leasingCars['--select--'] = ['--select--'];\n leasingCars['BMW'] = ['--select--', 'X5', 'X6', '750'];\n leasingCars['Audi'] = ['--select--', 'A4', 'A6', 'A8'];\n leasingCars['Ford'] = ['--select--', 'Mondeo', 'Fiesta', 'Transit'];\n\n\n var carList = docu...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
A DFA state represents a set of possible ATN configurations. As Aho, Sethi, Ullman p. 117 says "The DFA uses its state to keep track of all possible states the ATN can be in after reading each input symbol. That is to say, after reading input a1a2..an, the DFA is in a state that represents the subset T of the states of...
function DFAState(stateNumber, configs) { if (stateNumber === null) { stateNumber = -1; } if (configs === null) { configs = new ATNConfigSet(); } this.stateNumber = stateNumber; this.configs = configs; // {@code edges[symbol]} points to target of symbol. Shift up by 1 so (-1) // {@link Token//EOF} maps to {...
[ "function DFAState(stateNumber, configs) {\n if (stateNumber === null) {\n stateNumber = -1;\n }\n\n if (configs === null) {\n configs = new ATNConfigSet();\n }\n\n this.stateNumber = stateNumber;\n this.configs = configs; // {@code edges[symbol]} points to target of symbol. Shift up by 1 so (-1)\n // ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Reads a blob as text
function readBlobAsText(blob) { return readBlobAs(blob, "string"); }
[ "function readBlobAsText(blob) {\n return readBlobAs(blob, \"string\");\n}", "function readBlobAsString(blob) {\n return new Promise(function (resolve, reject) {\n let\n reader = new FileReader();\n \n reader.addEventListener(\"loadend\", function () {\n resolve(re...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
edge condition include exproto_ext_daemon.js
function touchenexEdgeCond(){ return touchenexInfo.exEdgeInfo.isUse && TOUCHENEX_UTIL.isEdge(); }
[ "function RequireEngine(msg)\r\n{\r\n if(!IsInEngine()){\r\n\r\n alert(\"This method only works inside a Leviathan application, msg: \" + msg);\r\n }\r\n}", "function OnEdgeDetect(evt) {\n //alert(\"Status: \" + evt.status + \" Reason: \" + evt.reason);\n\n}", "static isRequestFromEdge(req) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Checks if the passed route applies to the current location.
function routeAppliesToCurrentLocation(route) { const r = new page.Route(route); return r.match(page.current, {}); }
[ "checkRoute(route, currentRoute) {\n\t\tconst re = new RegExp(`^${route}$`)\n\t\tif (re.test(currentRoute)) {\n this.matched = true\n\t\t\tconst matchedRoute = this.routes[route]\n\t\t\tlet params = {}\n\t\t\tfor (let param in matchedRoute.params) {\n\t\t\t\tparams[matchedRoute.params[param]] = currentRoute.ma...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Remove a tab's thumbnail and modal flag from storage
function removeTab(windowId, tabId) { let thumb_key = genThumbDataKey(windowId, tabId); let flag_key = genModalFlagKey(tabId); chrome.storage.local.remove([thumb_key, flag_key]); }
[ "function removeTabInfoFromStorage() {\n getTabId(id => {\n if (id === null) return;\n chrome.storage.local.get('tabs', items => {\n if (id in items.tabs) {\n delete items.tabs[id];\n chrome.storage.local.set({tabs: items.tabs});\n }\n });\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Decorates the vertex with aPosition, aNormal, and aColor attributes, but only if these functions are provided in the options.
function transformVertex(vertex, u, v, options) { var aPosition = isDefined(options.aPosition) ? options.aPosition : void 0; var aNormal = isDefined(options.aNormal) ? options.aNormal : void 0; var aColor = isDefined(options.aColor) ? options.aColor : void 0; var aCoords = isDefined(options.aCoords) ? o...
[ "static setAttribFloat(){\n\t\tif(arguments.length < 3){ console.error(\"Need to send at least 2 parameters to use setAttribFloat\"); return false; }\n\t\tif(arguments[1] < 0) return false;\n\n\t\tswitch(arguments.length){\n\t\t\tcase 2: arguments[0].vertexAttrib1f(arguments[1], arguments[2]); return true;\n\t\t\tc...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets or sets whether to display the vertical line.
get verticalLineVisibility() { return this.i.pm; }
[ "get wrapVertical() {\n return this._wrapVertical;\n }", "get verticalLineStroke() {\r\n return brushToString(this.i.pc);\r\n }", "function IsVertical(){\n\t\tif (skel.breakpoint('small').active)\n\t\t\t{ return true }\n\t\telse\n\t\t\t{ return false }\n\t}", "setVerticalOrientatio...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Finalize this query and remove all matching Model instances
async remove() { // Call internally stored DB API to remove all models matching self query await this._db.remove(this._Model, this); }
[ "clear() {\n var models = this._models;\n this._models = [];\n\n for (var i = 0; i < models.length; i++) {\n var model = models[i];\n model.unloadRecord();\n }\n\n this._metadata = null;\n }", "clear() {\n var models = this._models;\n this._models = [];\n\n for (...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
this will allow the page to wait 5 seconds before going to the next question by calling goToNextQuestion
function waitBeforeGoingNextAutomatically() { setTimeout(goToNextQuestion, 1000 * 5); }
[ "function displayNextQuestion() {\n setTimeout(nextQuestion, 5000);\n }", "function delayNextQuestion() {\n setTimeout(nextQuestion, 3000);\n }", "function waitBeforeNextQuestion() {\n setTimeout(function nextQuestion() {\n \n questionIndex++;\n if (questionIndex === 4) {\n subm...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets the current community domain we are on
function _getCurrentCommunityContext() { const { page } = store.getState() || {}; const { community, __is_sandbox } = page || {}; const { subdomain } = community || {}; return { __community: subdomain, __is_sandbox }; }
[ "function _getDomain() {\n\t return getDomain();\n\t}", "function getCurrentDomain ()\n\t{\n\t\tvar newCurrentDomain = appAPI.db.get(\"searchDomain\");\n\n\t\tif(newCurrentDomain==null || newCurrentDomain>searchDomains.length)\n\t\t{\n\t\t\tnewCurrentDomain=1; // default to SMU\n\t\t\taddDebug(2, \"getCurrentD...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
merge sort implementation data: an array of Objects on_field: the field to sort on in Objects order: 0 ascending, 1 descending
function g_msort(array, on_field, order) { if(array.length < 2) return array; var middle = Math.ceil(array.length/2); return g_merge(g_msort(array.slice(0, middle), on_field, order), g_msort(array.slice(middle), on_field, order), on_field, order); }
[ "function g_merge(left, right, on_field, order)\r\n{\r\n var result = [];\r\n var val, val_r, obj, obj_r;\r\n\r\n\r\n while((left.length > 0) && (right.length > 0))\r\n {\r\n obj = left[0];\r\n obj_r = right[0];\r\n\r\n val = obj.computed[on_field] === undefined ?\r\n obj[on_field] : obj.compute...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Fire event with all details in rule
fireEventWithRule() { var ruleDetails = { "ruleLabel" : this.ruleLabel, "ruleName" : this.ruleName, "ruleDescription" : this.ruleDescription, "ruleActive" : this.ruleActive, "sharedObjectApiName" : this.sharedObjectApiName, "sharedObject" ...
[ "fireEventWithRule() {\n const evt = new CustomEvent('ruledetail', { detail : this.rule });\n this.dispatchEvent(evt);\n }", "function makeListenerForRule(rule) {\n console.log(\"makeListenerForRule\", rule);\n var eventListener = function(evt) {\n /**/console.log(\"event...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
get specific items on the page. This function will return the element that is identified by the parameter. It's used on storylist pages, such as the main page, or the recently added page.
function storylist_getitem(id){ obj = stories.snapshotItem(cursorpointer); switch(id){ //the currently selected element case "self": return obj; //The cursor place case "cursor": return obj.childNodes[0]; //the story link case "link": ...
[ "function getTheListItem(num1,num2) {\n let listItem = document.querySelector(\"#myPage ul:nth-child(\"+num1+\")\");\n return listItem.querySelector(\"ul li:nth-child(\"+num2+\")\");\n}", "function getItemId() {\n const urlParams = ( new URL( window.location.href ) ).searchParams;\n return urlParams.get( ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
When the progress panel is open, cancel stops bootstrapping... unless we are showing an error, in which case the action is "Reconfigure".
function onProgressCancelOrReconfigure(aWizard) { let progressContent = document.getElementById("progressContent"); if (!progressContent || !progressContent.hasAttribute("isShowingReconfigure")) { stopTorBootstrap(); } if (aWizard) { aWizard.rewind(); } else { restoreButtonLabel("ca...
[ "cancelBake() {\n this.chefWorker.terminate();\n this.registerChefWorker();\n this.setBakingStatus(false);\n this.manager.controls.showStaleIndicator();\n }", "function cancel()\n {\n dirtyController.setDirty(false);\n hideWorkflowEditor();\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function: removeRow This function handles when a user clicks to remove a row. It removes the tr element from the table element. If the resulting table is empty then it hides the container, otherwise it updates the row numbers
function removeRow(data){ var parent = data.parentElement.parentElement; var child = data.parentElement; parent.removeChild(child); if(isDisplayTableEmpty()){ $tableContainer.hide(); } else{ setNumbers(); } }
[ "function removeTableRow(row){\n row.remove()\n}", "function removeRow(){\n\t\tjQuery(\"#maintable_\" + window.RemoveRow_UUID).remove();\n\t}", "function removeRow() {\n\tif (numRows > 1) {\n\t\t$(\"#termUnits tr:last\").remove();\n\t\tnumRows--;\n\t\tprocessGPA();\n\t}\n}", "function tr_remove(row, tableid)...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Please note that onDrop method will always be called regardless if dropped file was accepted or rejected. The onDropAccepted method will be called if all dropped files were accepted and the onDropRejected method will be called if any of the dropped files was rejected.
function onDrop(acceptedFiles, rejectedFiles) { // do stuff with files... }
[ "_onDrop(e) {\n e.stopPropagation();\n e.preventDefault();\n\n const dt = e.originalEvent.dataTransfer;\n const files = dt && dt.files;\n\n if (files) {\n const callback = this.model.get('callback');\n\n for (let file of Array.from(files)) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Try to mute all video and audio elements on the page
function mutePage() { var videos = document.querySelectorAll("video"), audios = document.querySelectorAll("audio"); [].forEach.call(videos, function(video) { muteMe(video); }); [].forEach.call(audios, function(audio) { if ((audio != sound.GameOverEntropie) && (audio != sound.GameOverContinue)) mute...
[ "function mutePage() {\n document.querySelectorAll('video, audio').forEach((elem) => muteMe(elem))\n}", "function mutePage() {\r\n document.querySelectorAll(\"video, audio\").forEach(elem => muteMe(elem));\r\n}", "function mutePage() {\n document.querySelectorAll(\"video\").forEach( video => mute...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Add a series to the database
addSeries(series_title) { return new Promise((resolve, reject) => { series_id = undefined; db.transaction(tx => { tx.executeSql( Series.Query.INSERT_SERIES_QUERY, [series_title], (_, { insertId }) => series_id = ...
[ "addWordSeries(word_id, series_id) {\n return new Promise((resolve, reject) => {\n db.transaction(tx => {\n tx.executeSql(\n WordSeries.Query.INSERT_WORDSERIES_QUERY,\n [word_id, series_id],\n (null)\n )\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
log something takes a message and a session
function log(message, sessionid){ var timestamp = new Date().getTime(); var logEntry = "serverTime:" + timestamp + " log:" + message + "\n"; // var logEntry = message; // console.log("log: " + logEntry); // logEntry += "\n"; var session = getSessionById(sessionid); ...
[ "function log(session) {\n console.log(\n \"Start: \" + session.start + \" & \" +\n \"Room: \" + rooms[session.room].name + \" & \" +\n \"Type: \" + session.type + \" & \" +\n \"Track: \" + session.track + \" & \" +\n \"Title: \" + session.title\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
request data from CEP received with argument
function requestDataFrom ( cep, fn ) { var dataURL = mountRequestPath( cep ); agent .get( dataURL ) .end( requestDataFromHandler( fn ) ); return data; }
[ "function requestData() {\n req.get('http://'+adapter.config.hostname+'/sc2_val.xml',\n {'auth':\n {\n\t\t 'user':adapter.config.user,\n\t\t 'pass':adapter.config.password,\n\t\t 'sendImmediately': false\n }\n },function(error,response,data) {\n\t\t if(!error && response.statusCode == 200...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns a time stamp from the microseconds, nanoseconds, picoseconds, femtoseconds, attoseconds, zeptoseconds and yoctoseconds.
getFractionsOfSecondStamp() { const that = this; return that._microsecond.toString() + that._nanosecond + that._picosecond + that._femtosecond + that._attosecond + that._zeptosecond + that._yoctosecond; }
[ "function constructTimestamp(millis, fraction, numberPlaces, decimalPlaces) {\n var fractionStr = sprintf('%0' + decimalPlaces + 'i', fraction);\n var millisStr = sprintf('%0' + numberPlaces + 'i', millis);\n\n return millisStr + '.' + fractionStr;\n}", "function secsToNtpTimestamp (ts, buf = Buffer.a...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
stop default action of an event
function stopDefaultAction(ev) { if (!ev) ev = window.event; (ev.stopPropagation) ? ev.stopPropagation() : ev.cancelBubble = true; (ev.preventDefault) ? ev.preventDefault() : ev.returnValue = false; return false; }
[ "function tii_stopDefaultAction (event)\n{\n\tevent.returnValue = false;\n\tif (typeof event.preventDefault != 'undefined')\n\t{\n\t\tevent.preventDefault ();\n\t}\n}", "function stop_default(ev) {\n ev.preventDefault();\n ev.stopPropagation();\n }", "function stopDefaultAction(ev) {\n\tif(!ev)...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
setupsnitch() Initialises snitch's position, velocity, and health
function setupsnitch() { snitchX = width/5; snitchY = height/2; snitchVX = -snitchMaxSpeed; snitchVY = snitchMaxSpeed; snitchHealth = snitchMaxHealth; }
[ "function movesnitch() {\n //noise time values\n tx = tx + .005;\n ty = ty + .015;\n nx = noise(tx);\n ny = noise(ty);\n //map noise to correspond to snitch XY velocity\n snitchVX = map(nx,0,1,-snitchMaxSpeed,snitchMaxSpeed);\n snitchVY = map(ny,0,1,-snitchMaxSpeed,snitchMaxSpeed);\n\n // Upd...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get the usage prompt as a string
getUsage() { const args = this._args.map(arg => humanReadableArgName(arg)); const usage = `[options]${this.commands.length ? ' [command]' : ''}${this._args.length ? ` ${args.join(' ')}` : ''}`; return this._usage || usage; }
[ "function usage() {\n return util.format([\n 'Usage: %s',\n '',\n 'Tap on the command line to calculate BPM',\n '',\n 'Options',\n ' --help | -h: Print this help message and exit',\n ' --version | -v: Print the version number and exit',\n ''\n ].join('\\n'), path.basename(process.argv...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
animation for first parent transition (child slides to left and becomes parent, new child appears)
function animChildToParent(){ //place child inside parent container parent = child; //create new child inside child container child = new Person("defaultChild"); //hide child column, replace with parent column $("#child-col").hide(); $("#parent-col").show(); //fade out offset col whil...
[ "function switchToParent(){\n\n //check if this is the first transition\n if(parent !== undefined){\n animReplaceParent();\n } else {\n //for the first transition\n animChildToParent();\n }\n\n //set parent events\n parent.allowableEvents = parentEvents.slice();\n}", "functi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Check if the user is already in the list.
function isUserInList(id) { return $("#" + id).length > 0; }
[ "function user_is_in_list(user) {\n return users.indexOf(parseInt(user))>=0;\n}", "function checkUnique(name){\n\tif(userList.indexOf(name) == -1){\n\t\treturn true;\n\t}\n\treturn false;\n}", "function isUser(userList, username){\r\n return username in userList\r\n}", "function isUser(userList, usernam...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns the linear interpolation of the range according to the cardinality
function interpolateRange(rangeMin, rangeMax, cardinality) { // always return a signal since it's better to compute the sequence in Vega later var f = function f() { var rMax = signalOrStringValue(rangeMax); var rMin = signalOrStringValue(rangeMin); var step = "(".concat(rMax, " - ").concat(rM...
[ "function interpolateRange(rangeMin, rangeMax, cardinality) {\n var ranges = [];\n var step = (rangeMax - rangeMin) / (cardinality - 1);\n for (var i = 0; i < cardinality; i++) {\n ranges.push(rangeMin + i * step);\n }\n return ranges;\n }", "function interpolateRange(rangeMin, ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates a Country and adds Religion and TopicAttribute across all years Country Topic Attributes: Dict Attribute Definitions: Dict
constructor(country_code, country_name){ this.country_code = country_code; this.country_name = country_name; this.topic_attributes = {} this.religion = {} }
[ "constructor(country_data, religion_data) {\n // Main Structures that hold Country and Religion data\n this.countries = {};\n this.religions = {};\n this.religionBuckets = [\"Christian\", \"Muslim\", \"New Age\", \"Hindu\", \"Buddhist\", \"Other\"]\n this.topics = [];\n this.attributes = [];\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This is a function for teamsUsernameProjectsProjectKeyGet
teamsUsernameProjectsProjectKeyGet(incomingOptions, cb) { const Bitbucket = require('./dist'); let defaultClient = Bitbucket.ApiClient.instance; // Configure API key authorization: api_key let api_key = defaultClient.authentications['api_key']; api_key.apiKey = incomingOptions.apiKey; // Uncomme...
[ "function getProjectKeyValue() {\n return \"projectId=\" + getProjectID();\n}", "workspacesWorkspaceProjectsProjectKeyGet(incomingOptions, cb) {\n const Bitbucket = require('./dist');\n let defaultClient = Bitbucket.ApiClient.instance;\n // Configure API key authorization: api_key\n let api_key = d...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
function to increase score by 10 and upodate score
function addTenScore(){ score+=10; updateScore(); }
[ "function updateScore(){\n score += 10;\n}", "updateScore() {\n this.currentScore = this.currentScore + 600;\n }", "function _incrScore() {\n _setScore(_getScore() + 1);\n $('#score').html(_getScore());\n }", "incrementScore() {\n let scoreValue = this.getCurrentScore();\n this.setCu...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
convert a ellipse JavaScript object to an HTML string
function buildEllipseHTML (ellipse) { // TODO: Your code goes here. // HINT: draw an ellipse exactly like you would a rectangle, except add to // the style "border-radius: 50%" return ` <div class="text-center mt-5"> <div style=" height: ${ellipse.height}px; ...
[ "function drawEllipseSingle(pen,center,width,height,className,elementID)\r\n {\r\n \t //Check arguments for null values\r\n\t if(!pen || !center || !width || !height)\r\n\t\t return false;\r\n \r\n var ellipseDiv=getContainer().appendChild(document.createElement(\"div\"));\r\n\t\t\r\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
When dropback is selected (key), save the associated value
function dropback_value(ele) { var selected = ele.value; dropback_select = typeDropback[selected] }
[ "saved () {\n this._item.value = this.get()\n this.emit('change')\n }", "function saveSelectedDropdownItem() {\r\n\r\n // Get the actual value\r\n var selectedSubject = $('#subjectList option:selected').text();\r\n\r\n // Update hidden field\r\n $('#subject').val(selectedSubject...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Used to restore the BBO graph (low level data) to its original value before manipulation
resetBBOPGraph() { this.setBBOPGraph(this.bbopGraphBackup); }
[ "restoreOriginalState() {\n\n\t\tconst originalValueOffset = this.valueSize * 3;\n\t\tthis.binding.setValue( this.buffer, originalValueOffset );\n\n\t}", "restoreOriginalState() {\n\t\t\tconst originalValueOffset = this.valueSize * 3;\n\t\t\tthis.binding.setValue(this.buffer, originalValueOffset);\n\t\t}", "res...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
notify if device is not connected
function conn_success(device_connected){ if(! device_connected){ $('#music_files').children('div').remove(); navigator.notification.beep(1); navigator.notification.alert('Please wait for device connection...', function(){ return false; }, 'Device not connected!', 'Ok'); ...
[ "function checkMqttStatus() {\n if (client.connected == true) {\n UIkit.notification(\"Connection Status: OK\", {status: 'success'});\n } else {\n UIkit.notification(\"Connection Status: Device unavailable\", {status: 'danger'});\n }\n}", "function notifyDeviceOfFailure() {\n pubsub.publish(\"device\", ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Initialize binary writer with an initial byte length
function _BinaryWriter(byteLength) { this._arrayBuffer = new ArrayBuffer(byteLength); this._dataView = new DataView(this._arrayBuffer); this._byteOffset = 0; }
[ "function _BinaryWriter(byteLength){this._arrayBuffer=new ArrayBuffer(byteLength);this._dataView=new DataView(this._arrayBuffer);this._byteOffset=0;}", "function _BinaryWriter(byteLength) {\n this._arrayBuffer = new ArrayBuffer(byteLength);\n this._dataView = new DataView(this._arrayBuffer);\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Converts the given permissions to a string. Using this method will guarantee the permissions are in an order accepted by the service.
toString() { const permissions = []; if (this.read) { permissions.push("r"); } if (this.create) { permissions.push("c"); } if (this.write) { permissions.push("w"); } if (this.delete) { permissions.push("d"); ...
[ "function permissionsToString(permissions) {\n return '[' + permissions.join(' ') + ']';\n}", "toString() {\n const permissions = [];\n if (this.read) {\n permissions.push(\"r\");\n }\n if (this.add) {\n permissions.push(\"a\");\n }\n if (this.cre...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns any array containing the default middleware installed by `configureStore()`. Useful if you want to configure your store with a custom `middleware` array but still keep the default set.
function getDefaultMiddleware(options) { if (options === void 0) { options = {}; } var _options = options, _options$thunk = _options.thunk, thunk = _options$thunk === void 0 ? true : _options$thunk, _options$immutableChe = _options.immutableCheck, immutableCheck = _options$immutableCh...
[ "function getDefaultMiddleware() {\n var middlewareArray = [thunk];\n\n {\n\n middlewareArray.push(createSerializableStateInvariantMiddleware());\n }\n\n return middlewareArray;\n}", "function getDefaultMiddleware(options) {\n if (options === void 0) {\n options = {};\n }\n\n var _options = options,\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Modify skip link to match mobile buttons.
function _changeSkipLink( buttons ) { // Start with an empty array. var menuToggleList = _getAllMenusArray(); // Exit out if there are no menu items to update. if ( ! $( menuToggleList ).length > 0 ) { return; } $.each( menuToggleList, function ( key, value ) { var newValue = value.replace( '.', ...
[ "function changeSkipLink( buttons ) {\n var startLink = 'genesis-nav',\n endLink = 'mobile-genesis-nav';\n\n if ( isDisplayNone( buttons ) ) {\n startLink = 'mobile-genesis-nav';\n endLink = 'genesis-nav';\n }\n\n $( '.gene...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Finds the closest element either right or down from the element with the specified text.
function findClosestElement(elements, text, direction) { text = text.toLowerCase(); let matchingElement = elements.find(element => element.text.toLowerCase().startsWith(text)); if (matchingElement === undefined) return undefined; let closestElement = { text: undefined, x: Number.MAX_VALUE, y: Nu...
[ "function findClosestElement(elements, text, direction) {\n text = text.toLowerCase();\n let matchingElement = elements.find(element => element.text.trim().toLowerCase().startsWith(text));\n if (matchingElement === undefined)\n return undefined;\n let closestElement = { text: undefined, x: Number...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
animate submit button on form
function animateSubmitBtn() { $('.submit-text').text('Sending'); $('.spinner').removeClass('display-none'); $('#popup-submit').addClass('disabled'); }
[ "function animateBtn() {\r\n submitBtn.classList.add(\"active-submit-button\");\r\n\r\n setTimeout(() => {\r\n submitBtn.classList.remove(\"active-submit-button\");\r\n }, 100);\r\n}", "function registerFormSubmitAnimation()\n{\n $.each($('form'), function () {\n $(this).on('submit', function () {...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Output: [1, 3, 2, 4, 5, 6, 7] In the above code, we use a queue to traverse the binary tree level by level. We start with the root node and traverse the levels alternately from left to right and right to left. At each level, we store the nodes in an array, reversing the order of nodes if we're traversing the level from...
function zigZagTraversal(root) { let result = []; if (!root) return result; let q = [root]; let leftToRight = true; while (q.length > 0) { let size = q.length; let ans = Array(size); // Level Process for (let i = 0; i < size; i++) { let frontNode = q.shift(); // ...
[ "function traverseZigzag (root) {\n let result = []\n if(!root)return result\n let queue =[root]\n let leftToRight = true\n\n while(queue.length>0){\n let levelSize = queue.length\n let currentLevel = []\n for(let i=0; i<levelSize; i++){\n let curentNode = queue.shift()\n\n if(leftToRight){\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
endregion saveUpsertOne region saveUpsertMany Save multiple new or existing entities. If saving pessimistically, delay adding to collection until server acknowledges success. If saving optimistically; add immediately.
saveUpsertMany(collection, action) { if (this.isOptimistic(action)) { const entities = this.guard.mustBeEntities(action); // ensure the entity has a PK const mergeStrategy = this.extractMergeStrategy(action); collection = this.entityChangeTracker.trackUpsertMany(entities, col...
[ "trackUpsertOne(entity, collection, mergeStrategy) {\n return entity == null\n ? collection\n : this.trackUpsertMany([entity], collection, mergeStrategy);\n }", "trackUpsertMany(entities, collection, mergeStrategy) {\n if (mergeStrategy === MergeStrategy.IgnoreChanges ||\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
updates price and total
function update_price() { var row = $(this).parents('.item-row'); var cost = row.find('.rate').val(); var qty = row.find('.qty').val(); //console.log(row,cost,qty) // console.log(row.find('.price')) row.find('.price').val(Nu...
[ "function updatePrice() {\n\n //assigning various calculated prices to variables\n const baseprice = basePrice();\n const colorprice = colorPrice();\n const quantity = getQuantity();\n const bulkprice = getBulkPrice();\n const totalprice = (((basepr...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Validate that the event file is proper format Parameters: eventFile The exported contents of the event file to validate.
function validate(eventFile) { let isValid = true; if (StringUtils.isEmpty(eventFile.event)) { Log.error("Event file has no defined event type."); isValid = false; } if (typeof eventFile.run !== "function") { Log.error("Event file has no defined run function."); isValid = false; } return isVal...
[ "function mustBeAValidEvent(evt) {\n\n try {\n mustHaveStringAttributes(evt, [\n 'deploymentId',\n 'sourceId',\n 'sourceSequenceId',\n 'recordedAt',\n 'projectName',\n 'dashboardName',\n 'workbookName',\n 'kind'\n ]);\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
reset the timer back to 25 minutes
function resetTimerPomodoro() { resetElement = document.getElementById('timer').innerText = "25:00"; minutes = 25; seconds = 00; }
[ "function reset() {\n seconds = 15;\n }", "function resetTimer() {\n values.timer = 20;\n }", "function reset_minutes()\r\n{\r\n\tminutes=0;\r\n}", "function resetTimer() {\n timer = 15;\n startTimer();\n}", "function resetTimer() {\n stopCountdown();\n timerMinutes = initialTime...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
LINE METHOD / To search in the DB if the line already exist. If not, create a new entry
insertFindOrCreateLine(body, zone){ return new Promise(function (resolve, reject) { models.Line.findOrCreate({ where: { lineName: body.legs[0].line }, defaults: { fromStation: body.from, toSta...
[ "function addIfNotFound(current) {\n //find one by headline\n Headline.findOne({\n 'headline': obj[current][0]\n }, function (err, res) {\n if(err) {\n console.log(err);\n }\n //if no match\n if (res === null) {\n //new entry obj\n var hea...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This function takes in the start and end time of when the permits should be filed It also takes in the limit and offset in the data set that you wish to get back
async function getPermits(start,end,offset,limit){ return new Promise((resolve,reject ) => { console.log('sending request to get permits ', start, end,offset,limit) const options = { host: 'data.cityofnewyork.us', path: '/resource/83x8-shf7.json?$limit=' + limit + '&$offset=' + offset ...
[ "function drawSpeedLimits(start, end) {\n var placeIdQuery = '';\n for (var i = start; i < end; i++) {\n placeIdQuery += '&placeId=' + placeIdArray[i];\n }\n\n $.get('https://roads.googleapis.com/v1/speedLimits',\n 'key=' + apiKey + placeIdQuery,\n fu...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
| randInt:integer returns random integer | | min:number minimum value | max:number maximum value | ease:function easing function to apply to the random value | | Get a random integer between two values, | with the option of easing bias.
static randInt(min, max, ease) { if(max === undefined) { max = min; min = 0; } let random = Math.random(); if(ease) { random = ease(Math.random(), 0, 1, 1); } return Math.floor(Math.random() * (max - min + 1)) + min; }
[ "static randInt(min, max, ease) {\n if (max === undefined) {\n max = min;\n min = 0;\n }\n let random = Math.random();\n if (ease) {\n random = ease(Math.random(), 0, 1, 1);\n }\n return Math.floor(Math.random() * (max - min + 1)) + min;\n }", "static rand(min, max, ease) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
EnumerablesortBy(iterator[, context]) > Array Provides a customsorted view of the elements based on the criteria computed, for each element, by the iterator.
function sortBy(iterator, context) { return this.map(function(value, index) { return { value: value, criteria: iterator.call(context, value, index) }; }).sort(function(left, right) { var a = left.criteria, b = right.criteria; return a < b ? -1 : a > b ? 1 : 0; }).pluc...
[ "function sortBy(arr, callback, context){\n\t callback = makeIterator(callback, context);\n\n\t return sort(arr, function(a, b) {\n\t a = callback(a);\n\t b = callback(b);\n\t return (a < b) ? -1 : ((a > b) ? 1 : 0);\n\t });\n\t }", "function sortBy(arr, ca...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
update the color buffers
function updatecolor(){ for(var i = 1; i < 16; i++){ if(i%3==0) continue; colorsmal[i] = colorsmal[i] + 0.03*Math.sin(2*Math.PI*((framecount)/ 120.0)); } gl.bindBuffer(gl.ARRAY_BUFFER, smalcortop); gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(colorsmal), gl.DYNAMIC_DRAW); smalco...
[ "set colorBuffer(value) {}", "function update () {\n\n loadSurfaceColor();\n\n }", "apply_colors() {\r\n\tvar i, j;\r\n\t//loop through the vertices and modify the color buffer\r\n\tfor (i = 0; i < this.size; i++) {\r\n\t\tfor (j = 0; j < this.size; j++) {\r\n\t\t\tvar v = [3];\r\n\t\t\t// console.log...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Two Stack Queue: Enqueue Create class method enqueue(val) to add a value to the queue. Move all values from stack one to stack two. Add val to stack one. Move all values back to stack one from stack two. Consider writing a populateRandom() method that calls enqueue(val) to quickly populate your queue.
enqueue(val) { this.stack2 = this.stack1; this.stack1 = []; this.stack1.push(val); for (let i = 0; i < this.stack2.length; i++) { this.stack1.push(this.stack2[i]); } this.stack2 = []; return this; }
[ "function Queue_TwoStacks() {\n this._stackIn = new Stack();\n this._stackOut = new Stack();\n}", "function twoStackQueue() {\n this.inbox = new Stack();\n this.outbox = new Stack();\n}", "function QueueTwoStacks() {\n this.inStack = [];\n this.outStack = [];\n}", "function QueueWithTwoStacks(){\n\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets tweets about the artist of the current track that is playing
function getTweets(artist){ console.log("getting tweets!"); // $scope.showTwitterFeed = true; $http.get('/tweets/' + artist) .success(function(data){ $scope.tweets = data; }) }
[ "function getTweets(artist, callback) {\n // Do get request to get tweets\n var twitter_id = TWITTER_USER_IDS[artist.toLowerCase()];\n if (!twitter_id) {\n var doesNotExist = {\n error: \"Could not find tweets for this artist\"\n }\n callback(null, doesNotExist);\n return;\n }\n\n var params =...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }