query
stringlengths
9
34k
document
stringlengths
8
5.39M
negatives
listlengths
19
20
metadata
dict
For flexibility and efficiency, the basic paths and lines are already loaded into the dom. We just need to actually add paths, etc so they are not invisible, which is what this function does. This way, we dont have to do special setup in range vs single mode, just dont draw the other handle when in single mode and just...
_buildHandles() { if(this._handleDefinitions && this._startHandle && this._endHandle) { if(this.isRange) { this._startHandle.select('.handleDropShadow') .attr("d", this._handleDefinitions.up.shadowD); this._startHandle.select('.handleBody') .attr("d", this._han...
[ "function OnSceneGUI() {\n var waypoints = path.editor_waypoints.Where(function(obj) obj != null).ToArray();\n\n if(waypoints.length > 0) {\n drawDisc(waypoints[:1], Color(0, 1, 0, 0.3));\n }\n\n if(waypoints.length > 1) {\n drawDisc(waypoints[-1:], Color(1, 0, 0, 0.3));\n }\n\n if(waypo...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Adds mouse moved event listener, Changes cameraTarget based on user rotation
function setupMouseMove(){ canvas.addEventListener('mousemove', function(e){ document.body.style.backgroundImage = "url('')"; var currentXMovement = e.movementX; currentRotateY += currentXMovement + prevX; prevX = currentXMovement; yaw = currentRotateY * rotateSpeed; var currentYMove...
[ "function onMouseMove(event)\n{\n if (dragging)\n {\n var pos = getRelative(event);\n var deltaX = mouseDragStartX - pos.x;\n var deltaY = mouseDragStartY - pos.y;\n if (!isNaN(deltaX) && !isNaN(deltaY)) // check if mouse is inside div element\n {\n camRotationY += deltaX;\n camRotationX...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Retrieves the site design task, if the task has finished running null will be returned
getSiteDesignTask(id) { return __awaiter(this, void 0, void 0, function* () { const task = yield this.clone(SiteDesigns, `GetSiteDesignTask`) .execute({ "taskId": id }); return hOP(task, "ID") ? task : null; }); }
[ "getSiteDesignTask(id) {\n return __awaiter(this, void 0, void 0, function* () {\n const task = yield this.clone(SiteDesignsCloneFactory, \"GetSiteDesignTask\")\n .execute({ \"taskId\": id });\n return hOP(task, \"ID\") ? task : null;\n });\n }", "addSiteDesig...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
The execution count of the cell.
get executionCount() { return this.modelDB.getValue('executionCount'); }
[ "get executionCount() {\n return this.modelDB.has('executionCount')\n ? this.modelDB.getValue('executionCount')\n : null;\n }", "get executionCount() {\n return this._executionCount;\n }", "getExecutionCountDecision() {\r\n let cellDecs = decisions_1.filterDecisi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
prevents enter from creating a new line, creates new entry instead
function checkEnterKey(e) { if (e.key == "Enter") { e.preventDefault(); // stop new line if (this.value && !this.nextElementSibling) { // something is in the textarea, and we're in the last textarea addNewEntry(); this.nextElementSibling.focus(); } } }
[ "function preventNewLine(event) {\n if (event.keyCode == 13) {\n event.preventDefault();\n }\n}", "insertNewline(event) {\n if (! event.shiftKey) {\n // Do not trigger the \"submit on enter\" action if the user presses\n // SHIFT+ENTER, because that should just insert a n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
A "truthy" value is a value that translates to true when evaluated in a Boolean context. All values are truthy unless they're defined as falsy. All falsy values are as follows: false null undefined 0 NaN "" Create a function that takes an argument of any data type and returns 1 if it's truthy and 0 if it's falsy.
function isTruthy(input) { return input ? 0 : 1; }
[ "function isTruthy(input){\n return 0;\n }", "function isTruthy(input){\n return input == 1;\n}", "function isTruthy(input) {\n if (input){\n return 1;\n } else {\n return 0;\n }\n}", "function isTruthy(input) {\n\n}", "function isTruthy(input) {\n\n }", "fun...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
to not mutate the representation of our children from the last iteration we clone them we copy the cycle functions for each element, as JSON parse/stringify does not work for functions
function copyChildren(oldChildren) { var newChildren = JSON.parse(JSON.stringify(oldChildren)); newChildren.forEach(function (child, index) { var oldChild = oldChildren[index]; if (oldChild.props && oldChild.props.cycle) { child.cycle = oldChild.props.cycle; } if (_typeof(oldChildren[index]) ...
[ "function copyChildren(oldChildren = []) {\n let newChildren = JSON.parse(JSON.stringify(oldChildren));\n newChildren.forEach((child, index) => {\n let oldChild = oldChildren[index];\n if (oldChild.props && oldChild.props.cycle) {\n child.cycle = oldChild.props.cycle;\n }\n\n if (typeof oldChildr...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Bind HTTP error mapper.
bindHttpErrorMapper() { this.app.singleton('http.error.mapper', _HttpErrorMapper.default); }
[ "bindHttpErrorMapper() {\n\t\tthis.app.singleton('http.error.mapper', HttpErrorMapper);\n\t}", "function mapError(err) {\n console.error(err);\n return err.isDomain\n ? { status: (ERROR_MAP[err.code] || BAD_REQUEST),\n\tcode: err.code,\n\tmessage: err.msg\n }\n : { status: SERVER_ERROR,\n\tcode: 'INT...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Strips the license header. Basically only the first multiline comment up to to the closing
function stripHeader(contents, fileName) { var ls = contents.split(/\r?\n/); while (ls[0]) { if (ls[0].match(/^\s*\/\*/) || ls[0].match(/^\s*\*/)) { ls.shift(); } else if (ls[0].match(/^\s*\*\//)) { ls.shift(); break; } else { ...
[ "function stripLicenses(contents, fileName) {\n contents = contents.replace(new RegExp(\"\\r\\n\",\"gm\"), \"\\n\");\n var ls = contents.split(/[\\r\\n]/);\n if(ls[0].match(/\\s*\\*$/)){\n ls[0] = ls[0].replace(/\\s*\\/\\s*\\*$/,'');\n var first_line = ls[0];\n ls.shift();\n }\n\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
update and filter particle systems
updateParticles(delta) { this.particles.forEach(particle => particle.updateAndDraw(this.engine, delta)); // delete unused particles this.particles = this.particles.filter(particle => particle.inProgress); }
[ "function update(){\n\tvar particles = system.getParticles();\n\tif(particles.length == 0){\n\t \treturn;\n\t}\n\telse{\n\t \tfor(var p in particles){\n\t \t\tif( particles[p].life_time == params.life_time ) // only randomize new particles\n\t \t\t{\n\t \t\t\tvar velocity = new THREE.Vector3();\n\t\t \t\tvelocity.s...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Weave lists together in all possible ways. This algorithm works by removing the head from one list, recursing, and then doing the same thing with the other list.
function weaveLists ({ first = [], second = [], results = [], prefix = []}) { count++ /* One list is empty. Add remainder to [a cloned] prefix and store result. */ if (first.length === 0 || second.length === 0) { let result = _.clone(prefix) result = result.concat(first) result = result.concat(second...
[ "function weaveLists(first, second, results, prefix) {\n // One list is empty. Add remainder to [a cloned] prefix and store result\n if (first.size() === 0 || second.size() === 0) {\n let result = prefix.clone()\n result.addAll(first);\n result.addAll(second);\n results.add(r...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function: clearBoard Clears all the layers so that the board can be redrawn.
function clearBoard() { bgTileLayer.removeChildren(); pieceLayer.removeChildren(); fgTileLayer.removeChildren(); }
[ "function clearBoard() {\n initBoard();\n refresh();\n}", "function clearBoard() {\n // Resets the states of all the buttons\n for (const b of buttons) {\n b.selected = false;\n b.special = false;\n }\n\n // Resets the note counts\n for (const note of notes) {\n note[2] = 0;\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
The "overlap" visualization shows a model (a gray block) and overlapping families (green or purple blocks) at the overlap positions, with text columns for %identity, %coverage, and match Evalue. Hovering a model shows a tooltip (a DotPlot) of the individual alignment. The text columns can be used to resort the data.
function Overlap(options) { this.data = options.data; this.target = options.target; this.DIMENSIONS = { margin: { top: 10, right: 10, bottom: 10, left: 10, }, axis: { height: 30, margin_bottom: 20, }, overlap: { height: 10, margin_bottom: 4, ...
[ "renderOverlap(data) {\n this.oData = data;\n this.renderedChart.drawOverlap(this.oData, this.data);\n }", "function TypeOverlapChart(designType, details, ukey, size) {\n var settings = new ImageSettings(3 * size, 10 * size, 62 * size, 62 * size, 5 * size);\n // overlaps to other design typ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
configure private git repository
function repo () { opts.git = true opts.meta.repo = 'init' opts.files.gitignore = true }
[ "async init () {\n await GitRepo.init(this.dir);\n }", "function initWithRemoteGitRepository(urlString, ref) {\n \n // get repository name from url\n const urlObject = url.parse(urlString);\n var repo = path.basename(urlObject.pathname, \".git\");\n \n // git clone <url>\n var resul...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Ecma International makes this code available under the terms and conditions set forth on (the "Use Terms"). Any redistribution of this code must retain the above copyright and this notice and otherwise comply with the Use Terms. / es5id: 15.2.3.54285 description: > Object.create one property in 'Properties' is a Date o...
function testcase() { var dateObj = new Date(); var data = "data"; dateObj.set = function (value) { data = value; }; var newObj = Object.create({}, { prop: dateObj }); var hasProperty = newObj.hasOwnProperty("prop"); newObj.prop ...
[ "create(property) {\n\t\tthrow new Error(\"Not yet implemented\");\n\t}", "function testcase() {\n\n var proto = {};\n Object.defineProperty(proto, \"prop\", {\n get: function () {\n return {};\n },\n enumerable: true\n });\n\n var Constr...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This function will return a String containing the whole call history list. If there are no entries in call history, it will return null. Call history entries will be separated by "carriage return new line": \r\n Call history fields will be separated by "tabs": \t The order of fields and their meaning: type: int 0=Outgo...
function listcallhistory() { if (typeof (webphone_api.plhandler) !== 'undefined' && webphone_api.plhandler !== null) return webphone_api.plhandler.ListCallhistory(); }
[ "function getTizenCallHistory() {\r\n\tvar filter =\r\n\t\tnew tizen.AttributeFilter(\"callType\", \"EXACTLY\", \"tizen.tel\"),\r\n\t\tsortMode = new tizen.SortMode(\"startTime\", \"ASC\");\r\n\r\n\ttry {\r\n\t\ttizen.call.history.find(onCallHistoryFindSuccess, onCallHistoryFindError, filter, sortMode);\r\n\t} catc...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates a Productview Tag Also creates a Pageview Tag by setting pc="Y" Passing an "N" as the fourth parameter disables PageView Tag Generation Format of Page ID is "PRODUCT: ()" productID: required. Product ID to set on this Productview tag productName: required. Product Name to set on this Productview tag categoryID:...
function cmCreateProductviewTag(productID, productName, categoryID,createPageView) { var cm = new _cm("tid", "5", "vn2", "e3.1"); if (productName == null) { productName = ""; } // if available, override the referrer with the frameset referrer if (parent.cm_ref != null) { cm.rf = myNormalizeURL(parent.cm_ref,...
[ "function cmCreateProductviewTag(productID, productName, categoryID) {\r\n\tvar cm = new _cm(\"tid\", \"5\", \"vn2\", \"e4.0\");\r\n\r\n\tif (productName == null) {\r\n\t\tproductName = \"\";\r\n\t}\r\n\r\n\t// if available, override the referrer with the frameset referrer\r\n\tif (parent.cm_ref != null) {\r\n\t\tc...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Executes a jzen context
static _runContext( threadContext ) { // While we are not at the end of the code const jsenCode = threadContext.code; const jsenCodeLen = jsenCode.length; while( threadContext.pc < jsenCodeLen ) { // Get next statement const codeStatement = jsenCode[threadContext.pc]; switch ( typeof( ...
[ "function executeInContext(code) {\n let fun = new Function(code);\n fun.call(window);\n }", "runInContext( source, __context ) {\n\n let preface = code.preface;\n\n if ( typeof __context === \"object\" ) {\n\n Object.keys( __context ).forEach( name => {\n\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
get all unique values of a certain property (prop) in all objects in array (arr)
function getUniqueValues(arr, prop) { var values = [], o, p, v; for (var obj in arr) { // default to assuming prop is not an array o = arr[obj]; p = prop; // if prop is an array, scope o[p] to be equivalent to the dot syntax of each element in the array // e.g. o[p] == obj.prop[0].prop[1] ... ...
[ "distinct(prop) {\r\n const data = __classPrivateFieldGet(this, _data);\r\n const itemIds = [...data.keys()];\r\n const values = [];\r\n let count = 0;\r\n for (let i = 0, len = itemIds.length; i < len; i++) {\r\n const id = itemIds[i];\r\n const item = data....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This function replaces the generic footer text with date added to new one
function footer_text(){ // Display the footer text with current year var text_element = document.getElementById(AllIdNames.footer_text_id); var current_year = new Date().getFullYear(); text_element.innerHTML = '&copy;' + ' Voltex Designs ' + current_year; }
[ "function footerDate() {\n\tvar today = new Date;\n\tvar months = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'];\n\tDate.prototype.getMonthName = function() {\n\t\treturn months[this.getMonth()];\n\t};\n\tvar day = today.getDate();\n\tvar ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get the default target selector when determining a host
function getDefaultTarget() { return _defaultHostSelector; }
[ "function getDefaultTarget() {\n return _defaultHostSelector;\n}", "function setDefaultTarget(selector) {\n _defaultHostSelector = selector;\n}", "function setDefaultTarget(selector) {\n _defaultHostSelector = selector;\n}", "function setDefaultTarget(selector) {\r\n _defaultHostSelector = selector;...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Selects the nth critter in the list. Selects no critter if n = 0.
function selectCritter(n) { $('#critterlist>li.critter').removeClass('selected'); if (n > 0) { $('#critterlist>li.critter:nth-of-type(' + (n + 1) + ')').addClass('selected'); } $('#critterlist>li.selected .battlelist').slideDown('fast'); $('#critterlist>li:not(.selected) .battlelist').slideUp('fast'); $(...
[ "function takeNth(coll, nth) {\n if (arguments.length === 1) {\n nth = coll;\n return function(xform) {\n return new TakeNth(nth, xform);\n };\n }\n return seq(coll, takeNth(nth));\n}", "function select(k, n, list) {\n if (k <= 0 || n <= 0) {\n return [];\n }\n let oddsWeWantNth = k / n;\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates an instance of dependency manager service.
function DependencyManagerService(cacheStoreManagerService, dataService) { this.cacheStoreManagerService = cacheStoreManagerService; this.dataService = dataService; }
[ "function DependencyManager() {\n this._libraries = {};\n}", "function createManager() {\n return new PrivateManager();\n}", "function createManager() {\r\n return new PrivateManager();\r\n}", "constructor() {\n if (ServiceManager._instance) {\n return ServiceManager._instance;\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Interact with yahooFinance symbolArray array of stock symbols to get info on ytd bool of year to date or full year
function getHistoricalData(symbolArray, ytd){ let month = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"]; let a = new Date(); let b; if (ytd){ b = new Date("january 1 "+a.getFullYear()); } else { b = new Date(month[a.getMonth(...
[ "function getYAxisPricesPrices(stockPricesArray)\n{\n var historicalClosingPricesArray = new Array();\n\n stockPricesArray.forEach(element => {\n historicalClosingPricesArray.push(element.close);\n });\n\n return historicalClosingPricesArray;\n}", "function getYahooStockEvents(stockSymbol, call...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Applies filter ('excel' mode).
excelFilter() { const that = this, context = that.context; if (Array.isArray(context.dataSource)) { that.customExcelFilter(); return; } const tree = that.tree, filterObject = that.filterObject; filterObject.clear(); that....
[ "excelFilter() {\n const that = this,\n context = that.context;\n\n if (Array.isArray(context.dataSource)) {\n that.customExcelFilter();\n return;\n }\n\n const tree = that.tree,\n filterObject = that.filterObject;\n\n filterObject.clear...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Runs a while loop to add new total value for Frame and appends it to totals Calls calculateBoundIndex
updateTotal(score) { let { totals, subFrames, subMappings, total, carryOverFrameScore, totalIndex } = this.state; let k = totalIndex; let boundIndex = this.calculateBoundIndex(subMappings, totalIndex); while (subFrames[boundIndex] >= 0 && totals.length < this.MAX...
[ "calcPendingFrames() {\n const firstFrame = 1;\n const secondFrame = 2;\n let backFrame = 1;\n let carriedForwardTotal;\n\n if (this.frameCount === firstFrame) return;\n if (this.frameCount > secondFrame) backFrame = 2;\n\n for (\n let frameNo = this.frameCount - backFrame;\n frameNo ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Invokes the PageSpeed Insights API. The response will contain JavaScript that invokes our callback with the PageSpeed results. type is a string of either "mobile" or "desktop", indicating strategy
function runPagespeed(strategy, url) { var apiKey = "AIzaSyAHehZ3CRwWG3cpCGF3WRTLdWxD0XXDdaI"; //identified as localhost var psiURL = 'https://www.googleapis.com/pagespeedonline/v1/runPagespeed?'; var s = document.createElement('script'); s.type = 'text/javascript'; s.async = true; ...
[ "function runPagespeed(url, strategy) {\n var s = document.createElement('script');\n s.type = 'text/javascript';\n s.async = true;\n var query = [\n 'url=http://' + url,\n 'callback=runPagespeedCallbacks',\n 'key=' + API_KEY,\n 'strategy=' + strategy,\n 'screenshot=true'\n ].join('&');\n s.src...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
returns whether the string given is strictly numeric or decimal
function isdecimal(num) { return (/^\d+(\.\d+)?$/.test(num + "")); }
[ "function is_numeric(str) {\n return /^-?\\d*\\.{0,1}\\d+$/.test(str);\n}", "function isNum(s){\n // based on utility function isNum from xml2json plugin (http://www.fyneworks.com/ - diego@fyneworks.com)\n // few bugs corrected from original function :\n // - syntax error : regexp.test(str...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
takes in user selected category of posts, gathers the data for that category, and renders the page
function selectCategory (category) { postsObj = {} // goes to correct category firebase database endpoint refPath = category dbRef = database.ref(refPath) // reads data from endpoint collection, sets it on the posts object dbRef.on('value', function (snapshot) { snapshot.forEach(function...
[ "function handleCategoryChange() {\n var newPostCategory = $(this).val();\n getPosts(newPostCategory);\n }", "function handleCategoryChange() {\n var newPostCategory = $(this).val();\n getPosts(newPostCategory);\n }", "function handleCategoryChange() {\n var newPostCategory = $(this).va...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Retrieve rentals for the city sorted based rent rate low to high
function rental(req, res) { var city = req.body.from; var rent = req.body.rent; var rent2 = parseFloat(rent) - 5000; rent2 = rent2.toString(); //console.log(start); var options = { city: city, category: 'hhh', offset: 5, maxAsk : rent, minAsk : rent2 }; cli...
[ "function getRentals() {\n RealEstateService.getRentals()\n .then(function (rentals) {\n vm.rentals = rentals;\n });\n }", "function price1(rentals)\n{\n for (var i = 0; i < rentals.length; i++) // Browze the table rentals\n {\n var time = getDays(rentals[i].pic...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
show the new number with animation
function showNum(posX, posY,value){ $("#num_"+posX+posY).css({ backgroundColor:getBGColor(value), color:getColor(value), }).text(value).animate({ // position:'absolute', width:"100px", height:"100px", opacity:1.0, top:20*(posX+1)+100*posX, left:20*(posY+1)+100*pos...
[ "function changeDigit(name,nextDigit,duration){\n\n $(name).find('.digit').first().text(nextDigit);\n \n if (!$(name).find(':animated').size()){\n \n $(name).find('.pusher').animate({height:200},{\n \n duration: duration || 250,\n complete: function (){\n \n $...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns a date formatter that provides the weeknumbering year for the input date.
function weekNumberingYearGetter(size) { var trim = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; return function (date, locale) { var thisThurs = getThursdayThisWeek(date); var weekNumberingYear = thisThurs.getFullYear(); return padNumber(weekN...
[ "function weekFormat() {\n\n var format = function(d) {\n return formatWeekYear(d) + 'w' + formatWeek(d);\n }\n \n format.parse = function parse(dateString) {\n var matchedDate = dateString.match(/^(\\d{4})w(\\d{2})$/);\n return matchedDate ? getDateFromWeek(matchedDate[1], matchedDate[2]): null;\n };...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Checks if attribute is supported by a browser
function attributeSupported(attribute) { return (attribute in document.createElement("input")); }
[ "function attributeSupported(element, attribute) {\n return (attribute in document.createElement(element));\n}", "function isSupported()\r\n{\r\n\treturn (isIE || isMoz);\r\n}", "function supportsInputAttribute (attr) {\n var input = document.createElement('input');\n return attr in input;\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
des fonction de carousel function next background
function nextBg (e) { //je récupere tout les bg let lstBgCarousel = document.querySelectorAll('.carousel__bg'); let majFait = false; //je parcours ma liste lstBgCarousel.forEach( function (item, index) { //si je ne retrouve pas la classe carousel__bg--hidden, je lui ajoute et je ...
[ "next() {\n this.slides[this.index].classList.remove(\"active\");\n //opérateur ternaire\n (this.index == this.slides.length-1) ? this.index = 0 : this.index++;\n\n this.slides[this.index].classList.add(\"active\");\n }", "function nextCarousel(){\n self.allPhotos = self.allPh...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Task cursor Sets the cursor to the first task, if any exists.
function setCursorToFirstTask(shouldScroll) { const tasks = getTasks(); if (tasks.length > 0) { setCursor(tasks[0], shouldScroll); } }
[ "function setCursorToFirstTask(isAgenda, shouldScroll) {\n var tasks = getTasks();\n if (tasks.length > 0) {\n setCursor(isAgenda, tasks[0], shouldScroll);\n }\n }", "function cursorFirst() {\n disabledWithLazyLoading('Cursoring first task', () => {\n setCursorToFirstTask('scroll');\n })...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Prompt 1 Return an array of fund objects in alphabetical order.
function sortFundsAlphabetically(obj) { return Object.values(obj).sort(function(a, b) { let A = a.name.toLowerCase(); let B = b.name.toLowerCase(); return (A < B) ? -1 : (A > B) ? 1 : 0; }); }
[ "function sortAlphabetically() {\n // 1. Get list of Books & sort, save the sorted books array inside the library.\n myLibrary.books = myLibrary.sortAlphabetically();\n // 2. Display the result on the page. \n displayResult(myLibrary);\n }", "function sortRestau...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
HISTORICAL METHODS / add a bubble to the historical
function addToHistorical(bubble) { if (!(bubble.name in HistoricalMap)) HistoricalMap[bubble.name] = new Array(); for (var i = 0; i < HistoricalMap[bubble.name].length; ++i) if (HistoricalMap[bubble.name][i].year == bubble.year) return; HistoricalMap[bubble.name].push(jQuery.e...
[ "function addPreviousYearToHistory() {\n var j;\n var found = false;\n var years = {};\n for (var i = 0; i < bubbles.length; ++i) {\n if (bubbles[i].isClicked && bubbles[i].yearClick <= year.current) {\n if (dataEntries[guiAxes.X][bubbles[i].name] != null || dataEntries[guiAxes.X][b...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Method to get API from file. Reads file from resource folder.
function getAPI() { return new Promise(function (resolve, reject) { try { fs.readFile(FILE_DIR.concat(API_FILE), "UTF8", function (err, data) { if (err) { logger.errorLog("readFile", err); reject(false); } let api = JSON.parse(data); if (api.length === 0 |...
[ "loadAPIFile(name) {\n if (Parser.LOG_LEVEL > 3)\n console.info(\"Parsing API file\" + name);\n var fileName = path.join(Parser.BASE_DIR, name);\n var content = fs.readFileSync(fileName, \"UTF-8\");\n var result = JSON.parse(content);\n return result;\n }", "functi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Resolves its promise when an iframe is loaded.
function waitReady(iframe) { if (iframe.contentDocument && iframe.contentDocument.readyState === 'complete') { return Promise.resolve(iframe); } else { const loadPromise = new Promise((resolve) => { iframe.addEventListener('load', () => { resolve(iframe); ...
[ "function pollReady() {\n if (!iframe.contentWindow.document.getElementById('progress')) {\n setTimeout(pollReady, 100);\n } else {\n resolve(iframe);\n }\n }", "function i...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Given a filename and options, build a Babel config object with the appropriate plugins.
function buildBabelConfig(filename, options, plugins = []) { const babelRC = getBabelRC(options); const extraConfig = { babelrc: typeof options.enableBabelRCLookup === 'boolean' ? options.enableBabelRCLookup : true, code: false, cwd: options.projectRoot, filename, highlightCode: true }; let ...
[ "function buildBabelConfig(filename, options) {let plugins = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];\n const babelRC = getBabelRC(options.projectRoot);\n\n const extraConfig = {\n babelrc:\n typeof options.enableBabelRCLookup === 'boolean' ?\n options.enableBabelRCLookup :...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
scopeExists(validators.Subscription, 'default') > true scopeExists(validators.Subscription, 'update') > false
function scopeExists(validator, scope) { return Object.keys(validator.scopes).find(key => key === scope) !== undefined }
[ "function checkSubscriptions() {\n let existingSubscriber = false;\n pubsub\n .getSubscriptions()\n .then(results => {\n const subscriptions = results[0];\n\n subscriptions.forEach(resultSubscription => {\n\n// If subscri...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Ends the click operation
_endClick() { const that = this; //Click Handler that._resizeHandler(); if (that.disabled || that.readonly) { return; } if (that._isInactiveOn('click')) { return; } if (that.clickMode !== 'release' && that.clickMode !== 'pressAn...
[ "function C012_AfterClass_DormExit_Click() {\t\n\n\t// Regular interactions\n\tClickInteraction(C012_AfterClass_DormExit_CurrentStage);\n\n}", "function clickExit(){\n\tconsole.log(\"Clicking exit\")\n\n\t//find exit button\n\t//fire click\n\tdocument.getElementsByClassName(\"close\")[0].click()\n\n\t//spin for a...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
returns an array of the correct player order based on spell priority
function orderPlayers(players) { let playerOrder = []; let playerSet = []; let priority = ['Dispel magic', 'Counter-spell', 'Counter spell', 'Magic mirror', 'Summon goblin', 'Summon ogre', 'Summon troll', 'Summon giant', 'Summon elemental', 'Raise dead', 'Haste', 'Time stop', 'Protection from evil', 'Resist heat', ...
[ "function readOrderOfallCharactersFromPriority() {\r\n sortOrderFromPriority(allCharacters);\r\n readWhatCharacterIsInPlay();\r\n}", "function determineAttackOrder() {\r\n\tvar playersWithTrump = [];\r\n\tvar trumpSuit = this.deck.getTrump().getSuit();\r\n\r\n\tfor (var i = 0; i < this.players.length; i++) ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
SOAP SERVICES: getXmlConfFile PARAMETERS: ID(System) Description: Returns XML specification of Lab.
function getXmlConfFileSuccessFunction(soapResponse, soapParams){ var return_value = soapResponse.toJSON().Body.getXmlConfFileResponse.return; xmlContent = return_value.xmlConfFile; if (typeof xmlContent != "undefined"){ //xmlDoc = $.parseXML(xmlContent.substring(3)); xmlDoc = $.parseXML(xmlContent); $xml = $(...
[ "function readConfigFile(xml) {\n var appId = null;\n var nodeIp = null;\n\n var parser = new DOMParser();\n var configFile = parser.parseFromString(xml.responseText,\"text/xml\");\n var configValues = configFile.getElementsByTagName('app')[0].childNodes;\n\n for (var i = 0...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
return target panel or `true` (means global panel)
function getPanelByPoint(controller, e, localCursorPoint) { var panels = controller._panels; if (!panels) { return true; // Global panel } var panel; var transform = controller._transform; each(panels, function (pn) { pn.isTargetByCursor(e, localCursorPoint, transform) &&...
[ "hasPanel() {\n return !!this.panel;\n }", "hasPanel() {\n return !!this._panelTemplateRef;\n }", "function isOpenedPanel(){\r\n return current_panel__id !== \"\";\r\n}", "function getPanelByPoint(controller, e, localCursorPoint) {\n var panels = controller._panels;\n if (...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Remove the given animator from the list of animators managed by this module.
function removeAnimator(animator) { animatorList.splice(animatorList.indexOf(animator), 1); }
[ "function removeAnimation(id) {\n if (animated_objects.indexOf(id) > -1)\n animated_objects.splice(animated_objects.indexOf(id), 1);\n}", "removeAllAnimations() {\n _.each(this._animations, (anim, name) => this.removeAnimationWithName(name));\n return this;\n }", "function removeAnima...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get a string for a default item in a certain mech's slot
async function GetDefaultString(receivedMessage, place) { // String to be filled for the final one depending on the item's type var arg1Str = ''; var arg2Str = ''; var arg3Str = ''; var statStr = ''; // Stats var mechEnergy = await GetMechEnergy(receivedMessage); var mechWeight = await GetMechWeight(...
[ "function findItemSlot(slot) {\n\t\tswitch (slot) {\n\t\t\tcase 1:\n\t\t\t\treturn \"Head\";\n\t\t\tcase 2:\n\t\t\t\treturn \"Neck\";\n\t\t\tcase 3:\n\t\t\t\treturn \"Shoulder\";\n\t\t\tcase 4:\n\t\t\t\treturn \"Body\";\n\t\t\tcase 5:\n\t\t\t\treturn \"Chest\";\n\t\t\tcase 6:\n\t\t\t\treturn \"Waist\";\n\t\t\tcase ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Debugging helpers. ////////////////////////////////////////////////////////////////////////////// ;; camMarkTiles(label | array of labels) ;; ;; Mark area on the map by label(s), but only if debug mode is enabled. ;; Otherwise, remember what to mark in case it is going to be. ;;
function camMarkTiles(label) { if (camIsString(label)) { __camMarkedTiles[label] = true; } else { for (var i = 0, l = label.length; i < l; ++i) { __camMarkedTiles[label[i]] = true; } } // apply instantly __camUpdateMarkedTiles(); }
[ "function camUnmarkTiles(label)\n{\n\tif (camIsString(label))\n\t{\n\t\tdelete __camMarkedTiles[label];\n\t}\n\telse\n\t{\n\t\tfor (var i = 0, l = label.length; i < l; ++i)\n\t\t{\n\t\t\tdelete __camMarkedTiles[label[i]];\n\t\t}\n\t}\n\t// apply instantly\n\t__camUpdateMarkedTiles();\n}", "function drawAnnotation...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Helper function to get the layout snippet theme.liquid and add our snippet to it
async function getAssetThemeLiquid(id, axios) { // Implementing https://shopify.dev/api/admin-rest/2021-07/resources/asset#[get]/admin/api/2021-07/themes/{theme_id}/assets.json const { data } = await axios.get( `/themes/${id}/assets.json?asset[key]=layout/theme.liquid` ); if (!data.asset.value) { return...
[ "function getSnippet(version, https) {\n https = https || false;\n var url = getURL(version),\n snippet = tag.replace('{url}', url);\n \n if (https) {\n snippet = snippet.replace(/(href|src)=\"/, '$&https:');\n }\n \n return snippet;\n }", "function embedL...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Handler to load Calendar Sidebar.
function loadCalendarSidebar() { var html = HtmlService.createHtmlOutputFromFile('calendarSidebar').setTitle('U3A Tools') SpreadsheetApp.getUi().showSidebar(html) }
[ "function loadSidebarEvents() {\n // Set parameters for data collection\n var timeSpan = 'month';\n var today = new Date(Date.now());\n var minDate = new Date(today.getFullYear(), today.getMonth(), today.getDate());\n var maxDate;\n switch (timeSpan) {\n case 'day':\n maxDate = n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Takes the superBlock and tokenizer for the line and return a block of this parser's type
parse(superBlock, tokenizer) { throw new Error("parse function not implemented!"); }
[ "parseBlock() {\n\t\tvar program = this.delimited('{', '}', null, this.parseExpression.bind(this));\n\t\treturn {\n\t\t\ttype: 'block',\n\t\t\texpressions: program\n\t\t};\n\t}", "block() {\n const startToken = this.curr;\n\n let declarations = this.declarations();\n let compound = this.compound_statemen...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Fetches the list of installed extension IDs.
function getInstalledExtensionIds() { let installed = new Array(); for (let extension of vscode.extensions.all) { if (extension.packageJSON.isBuiltin) continue; installed.push(extension.id); } return installed; }
[ "getAll() {\n const extensions = this.manifest.getExtensions();\n return Object.keys(extensions).map((extId) => extensions[extId]);\n }", "function getExtensionsList(){\n\ttry{\n\t\tvar em = Components.classes[\"@mozilla.org/extensions/manager;1\"].getService(Components.interfaces.nsIExtensionMan...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Runs a directive, which changes the assembler state.
function handleDirective(state, directive) { directive(state); }
[ "async compileDo () {\n this.pushScope('compile do')\n await this.pause()\n this.assert({ [TOKEN_TYPE.KEYWORD]: KEYWORDS.DO })\n await this.compileSubroutineCall()\n this.assert({ [TOKEN_TYPE.SYMBOL]: ';' })\n this.vmWriter.writePop(SEGMENTS.TEMP, 0)\n this.popScope()\n }", "function interpr...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
10) When the Widget gains focus, this handler method animates its alpha to give it the appearance of fading in.
onFocus() { this.refs.widget.animate( { a: 1 }, 0.25 ); }
[ "handleFocus() {\n this.showDelayed();\n }", "onFocusOut() {\n this.updateFocused(false);\n }", "onFocusOut() {\n this.updateFocused(false);\n }", "handleFocus() {\n // Re-init colors in case the value changed externally since the UI was last visible.\n this.initColorValues();\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Randomises the tile positions
function randomiseTiles(){ randomiseArray(tiles); var i; for(i = 0; i < tiles.length; i++){ tiles[i].x = -border + Math.random() * (maskRect.width - scale); tiles[i].y = ROWS * scale + Math.random() * (trayDepth - scale); div.appendChild(tiles[i].div); tiles[i].update(); } }
[ "function randomiseTiles(){\n\t\tvar ax, ay, bx, by;\n\t\twhile(complete() > 3){\n\t\t\tax = bx = (Math.random() * COLS) >> 0;\n\t\t\tay = by = (Math.random() * ROWS) >> 0;\n\t\t\tif(tiles[ay][ax]) continue;\n\t\t\t\n\t\t\tif(Math.random() < 0.5){\n\t\t\t\tbx += Math.random() < 0.5 ? 1 : -1;\n\t\t\t} else {\n\t\t\t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Checks if items overflow and shows/hides scroll buttons.
_checkOverflow() { const that = this, overflow = that.overflow; if (overflow === 'hidden') { return; } const overflowing = Math.round(that.$.mainContainer.scrollHeight) > Math.round(that.$.mainContainer.offsetHeight), showNear = Math.round(that.$.mai...
[ "_checkOverflow() {\n const that = this,\n overflow = that.overflow;\n\n if (overflow === 'hidden') {\n return;\n }\n\n const overflowing = Math.round(that.$.mainContainer.scrollHeight) > Math.round(that.$.mainContainer.offsetHeight),\n showNear = Math.ro...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Set Alpha of RGB on hover background.
set HoverAlpha(value) { this._hoverAlpha = value; }
[ "function setAlpha(rule, alpha) {\n var r = getCSSRule(rule)\n var color = r.style[\"color\"]\n if(color.startsWith(\"rgb(\")){\n color = color.replace(\"rgb(\", \"rgba(\")\n color = color.replace(\")\", \",\" + alpha + \")\")\n r.style[\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
additional configuration, along with its parent's configurations viewableObjects: maximum number of objects that will be drawn at once
function scrollableObjectList(configuration) { this.configuration = this.mergeConfigWithDefault(configuration); if(this.configuration.displayScrollBar) { configuration.cellWidth -= 4; } objectList.call(this, configuration); if(this.configuration.displayScrollBar) { ...
[ "generateView() {\n let config = this.config,\n bufferMultiplier = config.bufferMultiplier,\n nodeHeight = config.divHeight,\n lastNodeIndex = this.lastNodeIndex,\n dataArray = config.dataArray;\n\n if (lastNodeIndex < dataArray.length) {\n let visibleNodesNumber = Math.ceil(window.in...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns true if the id of the source node is part of the authors
function isFromSource(authorId, authors) { for (let i = 0; i < authors.length; i++) { if (authorId === authors[i]) return true; } return false; }
[ "function hasAuthor (citation, author) { return citation.authors.includes (author); }", "function ownByEditor(articleAuthor, req){\n\tif (articleAuthor._id.toString() != req.user._id.toString()){\n\t\treturn false;\n\t} else\n\t{\n\t\treturn true;\n\t} \n}", "function isAuthor (author, articles) {\n return _...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Applies theme updates from the parent hub site collection.
syncHubSiteTheme() { return this.clone(Web_1, `syncHubSiteTheme`).postCore(); }
[ "context_update() {\n const children = this.querySelectorAll(\"[pfelement]\");\n let theme = this.cssVariable(\"theme\");\n\n // Manually adding `pfe-theme` overrides the css variable\n if (this.hasAttribute(\"pfe-theme\")) {\n theme = this.getAttribute(\"pfe-theme\");\n // Update the css vari...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Madlib Write a madlib function, which is given a name and a subject. It will return(not print) a new string: (name)'s favorite subject in school is (subject).
function madLib (name, subject) { return `${name}'s favorite subject in school is ${subject}.` }
[ "function madlib(name,subject) {\n return name + \"'s favorite subject in school is \" + subject\n}", "function madlib(name, subject) {\n return name + \"'s favorite subject in school is \" + subject + \".\";\n}", "function madlib(name, subject) {\n return `${name}'s favorite subject in school is ${sub...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Validates potential date input and returns an Array of Date Objects.
_getValidDates(dateOrDates) { let result = []; function validate(date) { if (date instanceof Date) { return date; } else if (JQX.Utilities.DateTime && date instanceof JQX.Utilities.DateTime) { return date.toDate(); } ...
[ "_getValidDates(dateOrDates) {\n let result = [];\n\n function validate(date) {\n if (date instanceof Date) {\n return date;\n }\n else if (Smart.Utilities.DateTime && date instanceof Smart.Utilities.DateTime) {\n return date.toDate();\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
pull the team names and abbrs from the team preseason stats page
function parseTeamStatsForAbbrs(intext) { var ptr1, ptr2, ptr3, ptr4, name, abbr; ptr1 = intext.indexOf("class=\"whiter\"", 0); while (ptr1 >= 0) { ptr2 = intext.indexOf("myteamno=", ptr1); if (ptr2 < 0) { break; } ptr3 = intext.indexOf("\">", ptr2); ptr4 = intext.indexOf("</a>", ptr3); ...
[ "function parseTeamStatsForAbbrs(intext) {\n\tvar ptr1, ptr2, ptr3, ptr4, name, abbr, idnum;\n\n\tptr1 = intext.indexOf(\"<th>ANYA</th>\", 0);\n\twhile (ptr1 >= 0) {\n\t\tptr2 = intext.indexOf(\"myteamno=\", ptr1);\n\t\tif (ptr2 < 0) {\n\t\t\tbreak;\n\t\t}\n\n\t\tptr3 = intext.indexOf(\"\\\">\", ptr2);\n\t\tidnum =...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Validates the project has the minimum Functions SDK version that works on all OS's See this bug for more info:
validateFuncSdkVersion(csprojPath, csprojContents) { return __awaiter(this, void 0, void 0, function* () { if (!constants_1.isWindows) { // No need to validate on Windows - it should work with previous versions try { const minVersion = '1.0.8'; ...
[ "function checkVersion ()\n{\n return true;\n\n /***************************\n var ver = new String(InstallTrigger.getVersion(\"jslib\"));\n\n // strip off build info \n ver = ver.substring(0, ver.lastIndexOf(\".\"));\n\n return (G_VER >= ver);\n ***************************/\n}", "async function alertIfUns...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This function gets allocations for the state variables of the contracts; this is distinct from getStorageAllocations, which gets allocations for storage structs. While mostly state variables are kept in storage, constant ones are not. And immutable ones, once those are introduced, will be kept in code! (But those don't...
function getStateAllocations(contracts, referenceDeclarations, userDefinedTypes, storageAllocations, existingAllocations = {}) { let allocations = existingAllocations; for (const contractInfo of contracts) { let { contractNode: contract, immutableReferences, compiler, compilationId } = contractInfo; ...
[ "function getStorageAllocations(referenceDeclarations, contracts, existingAllocations = {}) {\n let allocations = existingAllocations;\n for (const node of Object.values(referenceDeclarations)) {\n if (node.nodeType === \"StructDefinition\") {\n try {\n allocations = allocateS...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Refresh the display with the card associated with the active nav
function refreshDisplay() { $('body > .container .nav').children().each(function(i, obj) { obj = $(obj); if (obj.hasClass('active')) { experienceCards[i].removeClass('hide'); } }); }
[ "_refreshCardContent() {\n const that = this;\n\n that._updateVisibleCards(that._start.view, that._start.data, true);\n }", "function updateCurrentCardNav() {\n currentCardNav.innerText = `${currentCardID + 1} / ${cardData.length}`;\n}", "function refresh(){\n chosenCards = [];\n cards...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Messages: addAgentMessage function adding Agent specific messages Dialogflow or GUI
async function addAgentMessage(text) { agent.add(text); await addMessage(text, 0); return; }
[ "function addBotMessage(message) {\n addMessage(true, message);\n}", "emitAgentMessageToAdmin(payload) {\n const { message } = payload;\n this.emitToAdmin({ message }, AGENT_MESSAGE);\n }", "function appendMessage(message, sender) {\n if (sender == 'agent') {\n console.log(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
=============================================================================================== display the note on the corkboard, with the current note object as a parameter. this function is called in two cases: 1. the user created a new task following a mouse click on button. 2. loading a note from local storage
function displayNote(noteDataObj) { var notes_c = document.getElementById("notes-container"); // the notes container var note_div = document.createElement("div"); // create a new div element, of a single note notes_c.appendChild(note_div); // apply note div on the notes container note_div.className =...
[ "function dispCreateNote() {\n getTaskContent();\n displayTaskInput();\n}", "function showNewNote() {\n\n showContent(\"newNote\");\n}", "function showNotes() {\n let notes = localStorage.getItem(\"notes\");\n if (notes == null) {\n notesObj = [];\n }\n else {\n notesObj = J...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
STEP 2 Write a function called squareNumber() that accepts one argument (a number), square that number, and return the result. It should also log a string like "The result of squaring the number 3 is 9."
function squareNumber(num) { var result = num * num; console.log("The result of squaring the number " + num + " is " + result); return result; }
[ "function squareNumber(number){\n console.log('The result of squaring the number ' + number + ' is ' + (number * number) + '.');\n return number * number;\n}", "function squareNumber(num){\n\tvar result = num * num\n\t\n\tconsole.log(\"The result of squaring the number \" + num + \" is \" + result + \".\")\n\n\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Evaluates, or attempts to evaluate, a ShorthandPropertyAssignment, before applying it on the given parent
function evaluateShorthandPropertyAssignment({ environment, node }, parent) { const identifier = node.name.text; const match = getFromLexicalEnvironment(node, environment, identifier); if (match == null) { throw new UndefinedIdentifierError({ node: node.name }); } parent[identifier] = match....
[ "function evaluatePropertyAssignment({ environment, node, evaluate, statementTraversalStack }, parent) {\n const initializer = evaluate.expression(node.initializer, environment, statementTraversalStack);\n // Compute the property name\n const propertyNameResult = evaluate.nodeWithValue(node.name, environme...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
getImportAs produces a symbol that can be used to import the given symbol. The import might be different than the symbol if the symbol is exported from a library with a summary; in which case we want to import the symbol from the ngfactory reexport instead of directly to avoid introducing a direct dependency on an othe...
getImportAs(staticSymbol, useSummaries = true) { if (staticSymbol.members.length) { const baseSymbol = this.getStaticSymbol(staticSymbol.filePath, staticSymbol.name); const baseImportAs = this.getImportAs(baseSymbol, useSummaries); return baseImportAs ? this.g...
[ "getImportAs(staticSymbol, useSummaries = true) {\n if (staticSymbol.members.length) {\n const baseSymbol = this.getStaticSymbol(staticSymbol.filePath, staticSymbol.name);\n const baseImportAs = this.getImportAs(baseSymbol, useSummaries);\n return baseImportAs ?\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Check if there is a new contentID, if so update currentContentID and call callbacks
async function updateContentID() { // const start = performance.now(); try { const newContentID = await getContentIDImpl(); // console.log('updateContentID triggered', newContentID, currentContentID); if (!currentContentID || (newContentID.domain != currentContentID.domain || newContentID.userName != cu...
[ "function getContentID() {\n if (!currentContentID) updateContentID(); // Ensure contentID is populated, even if late.\n return currentContentID;\n}", "_postponedUpdateContent() {\n //this.__updateContentPlanned = true;\n this._updateContent();\n }", "async function getContentIDAsync() {\n if (!...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Listener for address links on the page.
detectAnchor(): void { [...document.querySelectorAll('a')].map(node => { let href = Dom.attr(node, 'href'); if (href) { href = href.toString(); } if (href && href.indexOf(':')) { const hrefPref = href.split(':')[0]; if (['callto', 'tel', 'mailto'].includes(hrefPref)) { Event.bi...
[ "function anchorListeners() {\n const allAnchors = Array.from(document.querySelectorAll('a'));\n const anchors = allAnchors.filter(a => (a.classList.contains('currentPage') === false));\n function cachePage(e) {\n loadPage(e.target.href);\n }\n anchors.forEach(a => a.addEventListener('mouseover'...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Format a date with zeros for months and days below 10.
function formatDateWithZeros(year, month, day, separator) { if (month < 10) month = "0"+month; if (day < 10) day = "0"+day; return year+separator+month+separator+day; }
[ "function paddedDate(date){\n if (date >= 10){\n return date.toString();\n }\n else{\n return \"0\" + date.toString();\n }\n }", "addZeroToDate(date) {\n if(date < 10) {\n return \"0\" + date;\n }\n \n return date;\n }", "function formatDate(d...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Check if a window is a popup
function isWindowPopup(win) { return ((win.opener) ? true : false); }
[ "function isPopupAsWindowOpen()\n{\n\tif (popupAsWindow != null)\n\t{\n\t\tif (popupAsWindow.closed)\n\t\t{\n\t\t\tpopupAsWindow = null;\n\t\t}\n\t\telse\n\t\t{\n\t\t\treturn true;\n\t\t}\n\t}\n\t\n\treturn false;\n}", "function checkForPopUp()\n{\n\tif (WindowID)\n\t{\n\t\tif (!WindowID.closed) \n\t\t{\n\t\t\tWi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
trigger a UI update, this gets the UI to pull from the brick spawner
updateUI(){ this.GUI.updateUI(); }
[ "function updateUI() {\r\n\tupdateStats();\r\n}", "uiUpdate() {\n // pass\n }", "updateUI(){\n // we should\n MainGameScene.updateUI();\n }", "#updater(){\r\n this.update(this.render());\r\n this.componentDidUpdate();\r\n }", "function updateWidget()\n {\n //t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This function clears the previous quote and runs printQuote, which posts the new quote
function initializeQuote() { clearQuote() printQuote() }
[ "function updateQuote() {\n printQuote();\n}", "function printQuote () {\n message = \"\"\n getRandomQuote();\n buildMessage();\n printMessage();\n colorChange();\n}", "function printQuote () {\n\tvar index = getRandomQuote();\n\tnewQuote = quotes[index].quote;\n\tnewSource = quotes[index].source;\n\tnewC...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This function overwrites the values of the previous lesion (selectedLesion1) with the answers of 'selectedLesion'.
function shiftAnswersBackForLesion(selectedLesion) { // first clear the lesion that will be overwritten resetAnswersForLesion(selectedLesion-1); // shift completed value back meCompletedLesions[selectedLesion-1] = meCompletedLesions[selectedLesion]; meScorePerLesion[selectedLesion-1] = meScorePerL...
[ "function updatePreviouslySelectedInterests() {\n\tpreviousSelection = $('#select-interest').dropdown('get value'); \n\tpreviousSelection = previousSelection[previousSelection.length - 1] == null ? [] : previousSelection[previousSelection.length - 1];\n}", "function answer_selected(selected_ANSWER) {\n\tconsole.l...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Removes current row from attribute table
function removeCurrentAttribute(attribute){ var index =$scope.selectedCreative.attributeGrid.attributes.indexOf(attribute); $scope.selectedCreative.attributeGrid.attributes.splice(index,1); }
[ "function removeCurrentAttribute(attribute){\n\t\t var index =$scope.attributeGrid.attributes.indexOf(attribute); \n\t\t $scope.attributeGrid.attributes.splice(index,1);\n\t }", "removeLineFromTable(){\n // Delete second row\n table.deleteRow(this.rowSelected);\n }", "function de...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
returns an array of coordinates for laying out objectCount objects as a grid with an equal number of lines and columns
function gridCoordinates(objectCount, cellSize) { var gridSide = Math.sqrt(objectCount); var coords = []; for (var i = 0; i < objectCount; i++) { coords.push({ x:i%gridSide * cellSize, y:Math.floor(i/gridSide) * cellSize }); } return coords; }
[ "function createGridPoints(size) {\n window.gridPointsArr = [];\n var cord = { x: 0, y: 0 };\n var center = 0;\n cord.x = GRID_LINE_W;\n cord.y = GRID_LINE_W;\n for (var y = 0; y < size.y; y++) {\n for (var x = 0; x < size.x; x++) {\n window.gridPointsArr.push(new MainObj({ x: co...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
ACCESSING DATA /////////// Set the sale dates for 'Banana Bunches' from store2 to a variable, then return that variable
function accessesingData1() { let bananaSaleDates = []; for (var i = 0; i < store2['sale dates']['Banana Bunches'].length; i++) { bananaSaleDates.push(store2['sale dates']['Banana Bunches'][i]); } return bananaSaleDates; }
[ "function accessesingData1(store2) {\n var dates = store2['sale dates']['Banana Bunches'];\n return dates;\n}", "function accessesingData1() {\n let saleDates = store2['sale dates']['Banana Bunches']\n return saleDates\n}", "function updatingData2(store2) {\n var dates = store2['sale dates']['Caramel Twist...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Renders a position based upon the fen passed to it.
function renderPositionFen(fen){ if(!(chess in window)){ chess.clear(); $('[data-piece]').remove(); chess.load(fen); }else{ chess = new Chess(); } for(var i=0, r=0; i < 64; i++){ if(i % 8 == 0) {r++;} id_c = columns.charAt(i%8); id_r = (r-9)*-1; if( chess.get(id_c+id_r) ) ...
[ "function startPosRender (posID) { }", "function renderFenBoard(fenBoard) {\n //Clears current game\n game.clear();\n //Loads the fen position\n game.load(fenBoard);\n //Renders the game\n board.position(game.fen());\n}", "function renderFilm () {\n\tsetActiveClass();\n\n\tfilm_elt.style.left ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
sort by isbn, unmoderated, timestamp
function sortComments (a, b) { if (a.isbn < b.isbn) return -1; else if (a.isbn > b.isbn) return 1; else { if (a.ok === false && b.ok === true) return -1; else if (a.ok === true && b.ok === false) return 1; else return (b.timestamp - a.timestamp); } }
[ "function sortComments (a, b) {\n\t\tif (a.isbn < b.isbn)\n\t\t\treturn -1;\n\t\telse if (a.isbn > b.isbn)\n\t\t\treturn 1;\n\t\telse {\n\t\t\tif (a.ok === false && b.ok === true) return -1;\n\t\t\telse if (a.ok === true && b.ok === false) return 1;\n\t\t\telse\n\t\t\t\treturn (a.timestamp - b.timestamp);\n\t\t}\n\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Client object decoration function Modifies the client object that will be stored in the registry The client object contains already a number of properties, which vary depending on the server configuration. Some properties can never be modified, or an error will be thrown. They are: id sid admin clientType See the autho...
function decorateClientObj(clientObj, info) { if (info.headers) clientObj.userAgent = info.headers['user-agent']; }
[ "function decorateClientObj(clientObject, info) {\n var amtData;\n if (info.handshake.headers) {\n clientObject.userAgent = info.handshake.headers['user-agent'];\n }\n if (!clientObject.connectTime) clientObject.connectTime = Date.now();\n\n if (info.query) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Called when a server or channel is switched
onSwitch() {}
[ "handleICEConnectionStateChange() {\n if (this.peerConnection.iceConnectionState == 'disconnected') {\n console.log('Client disconnected!');\n this.sendAnnounceChannelMessage();\n }\n }", "function channelStateChange(event, channel) {\n console.log(util.format('Channel %s is now: %s', channel....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
getNext monitors for 4 different checkpoints 1. It wont call next page if allready fetching data of previous page 2. Wont next page when pull to refresh is done 3. Will stop pagination if next page payload is not present
getNext(){ if ( this.loadingNext || this.refreshing || !this.fetchServices.hasNextPage ) return; this.beforeNext(); this.fetchServices .fetch() .then((res) => { this.onNext(res); }) .catch((error) => { this.onNe...
[ "fetchNext() {\n ++this.currentPage;\n this.selectPayoutHistory();\n }", "function get_different_f_page() {\n var select_object_data_url = \"/api/tracking/select?object_name=_Alert_Finds&column_data=_id,rule_name,object_name,column_name,found_value\"\n select_object_data_url += \"&limit=\" ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
$(sId).attr.('href', 'http:// 192.168.0.3:8080/home/branches/?Id='+sId); var id_value =
function generate_link() { var id_value; var sId = $("Ecom478").val(); // var sId2 = $("Ecom479").val() //if(!sId1) //sId.setAttribute.('href', 'http://localhost:8080/home/branches/?Id='+sId); document.getElementById("Ecom478").href = "http://localhost:8080/home/branches/?Id="+sId; }
[ "function updateCompareURL(){\n var url = 'compare.html?';\n for(var i=0;i<compareNumber;i++){\n url += ('id' + (i+1) + '=');\n url += (compareIDs[i] + '&');\n }\n for(var i=compareNumber;i<5;i++){\n url += ('id' + (i+1) + '=&');\n }\n //alert(url);\n $('#button-compare').a...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This method adds the SWF to the DOM and prepares the initialization of the channel
function addSwf(domain){ // the differentiating query argument is needed in Flash9 to avoid a caching issue where LocalConnection would throw an error. var url = config.swf + "?host=" + config.isHost; var id = "easyXDM_swf_" + Math.floor(Math.random() * 10000); // prepare t...
[ "function addSwf(domain){\n // the differentiating query argument is needed in Flash9 to avoid a caching issue where LocalConnection would throw an error.\n var url = config.swf + \"?host=\" + config.isHost;\n var id = \"easyXDM_swf_\" + Math.floor(Math.random() * 10000);\n\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This is much like graphqlRequest except we don't skip access control checks!
function authedGraphqlRequest({ keystone, query, variables }) { return keystone.executeGraphQL({ query, variables }); }
[ "async function performGraphQLRequest(query, endPoint, bearerToken) {\n var opt = {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n },\n body: query\n }\n if (bearerToken && bearerToken != \"\")\n opt.headers.Authorization = bearerToken;\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Custom tracking for Graphic Lightbox components
function trackGraphicLightboxClick(source) { var s = s_gi(s_account); var txt = 'GraphicLightbox_' + source; s.trackExternalLinks = false; s.linkTrackVars = 'prop6,eVar6'; s.tl(this, 'o', txt); }
[ "lightBox(obj) {\n this.lightBox = document.getElementById(\"lightBox\");\n this.lightBox.style.display = \"flex\";\n\n document.querySelector(\"body\").classList.add(\"body-overflow\");\n //add event listener to lightbox X to hide lightbox\n document\n .getElementsByClassName(\"x\")[0]\n ....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Updates the shared Data context with new area information for collections, tags and content groups.
function updateAreaContext(id) { if (typeof(id) === 'number') { // Set collections for area collections. var collections = CollectionsByArea.query({areaId: id}); collections.$promise.then(function (data) { if (data !== undefined) { if (data.length > 0) ...
[ "function setContext(id) {\n\n if (typeof(id) === 'number') {\n\n // Initialize global categories.\n var categories = CategoryList.query();\n categories.$promise.then(function (data) {\n Data.categories = data;\n Data.currentCategoryIndex = data[0].id;\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Create a shallow copy of an object, and then copy all fields from 'update'object into the copied object (changing/overwriting fields if needed)
function copyAndUpdateObj(copiedObject, update) { return Object.assign({}, copiedObject, update); }
[ "static shallowCopy(objectToCopy) {\n return Object.assign({}, objectToCopy);\n }", "__createCopy(oldObj) {\n return JSON.parse(JSON.stringify(oldObj));\n }", "function testDeepCloning() {\n let profile = {\n id: {\n name: 'joe', ssn: 123\n },\n address: {\n mail: {town: 'Orang...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
uninstall a plugin, using "data" in arguments for "release" and "uninstall" plugin's methods
uninstall(plugin, ...data) { let directory = ""; let key = -1; let pluginName = ""; // check plugin return Promise.resolve().then(() => { return (0, checkOrchestrator_1.default)("uninstall/plugin", plugin).then(() => { key = this.getPluginsNames().find...
[ "exitUninstallPlugin(ctx) {\n\t}", "function uninstall(data, reason) {}", "function uninstall(data, reason) {\n}", "function uninstall() {}", "visitUninstallPlugin(ctx) {\n\t return this.visitChildren(ctx);\n\t}", "enterUninstallPlugin(ctx) {\n\t}", "uninstall() {\n if (this._installer == null) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Subscription select dropdown handler to update the subscription type of the form Changes the subscriptionType and showRestHookForm in this.state
handleSubscribeTypeSelect(subscriptionType) { console.log("Subscription Type: " + subscriptionType); this.setState({ subscriptionType: subscriptionType, showRestHookForm: subscriptionType === this.subscriptionType.RESTHOOK ? true : false }); }
[ "function updateSelectedSubscription()\n{\n let panel = E(\"tabs\").selectedPanel;\n if (!panel)\n return;\n\n let list = panel.getElementsByTagName(\"richlistbox\")[0];\n if (!list)\n return;\n\n let data = Templater.getDataForNode(list.selectedItem);\n FilterView.subscription = (data ? data.subscripti...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Create a new staking pool. The sender will be the operator of this pool. Note that an operator must be payable.
createStakingPool(operatorShare, addOperatorAsMaker) { const self = this; assert_1.assert.isNumberOrBigNumber('operatorShare', operatorShare); assert_1.assert.isBoolean('addOperatorAsMaker', addOperatorAsMaker); const functionSignature = 'createStakingPool(uint32,bool)'; return {...
[ "createTransaction(receiver,amount,blockChain,transactionPool)\n {\n this.balance=this.calculateBalance(blockChain );\n if(amount > this.balance)\n {\n console.log(`amount ${amount} is exceed the current balance ${this.balance}`);\n return;\n }\n\n let tra...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Funciones Funcion que cambia la foto en la siguiente posicion
function pasarFoto() { // se incrementa el indice (posicionActual) // ...y se muestra la imagen que toca. }
[ "function pasarFoto() { \r\n switch(posicionActual){\r\n case 0:\r\n posicionActual++;\r\n renderizarImagen(); \r\n break;\r\n case 1:\r\n posicionActual++;\r\n renderizarImagen(); ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Methods adding a +, , , /, or . to 'formula'
function newOperation(symbol){ if(isLastCharInteger(formula)){ formula += symbol } else { formula = removeLastChar(formula) + symbol //remove last symbol, and add the new one at the end if it is a math operation(or dot/comma) } }
[ "function calculateFormula(row, columnName, formula) {\n //split the formula by a space....\n let columns = formula.split(' ');\n let column1 = columns[0];\n let operator = columns[1];\n let column2 = columns[2];\n let operators = {\n '+': function(a, b) { return...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Given a number of digits a number has (including the sign), this returns the fontsize we should use to make it fit in an r = 20 circle
function numDigitsToFontSize(numDigits) { if(numDigits == 1) { return 30; } if(numDigits == 2) { return 25; } if(numDigits == 3) { return 20; } if(numDigits == 4) { return 15; } if(numDigits == 5) { return 13; } }
[ "function fontSize(d){\n var radius = d.radius;\n if(radius < 21) return 8;\n else if(radius < 31 && radius > 21) return 9;\n else if(radius < 52 && radius > 31) return 12;\n else return 20;\n }", "function getFontSiz...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
function to assign different colors to each part of the polyline in : polyline totExcitement: Values correpondent to each segment of polyline
function setMultplePolylineColor(polyline, totExcitement){ for(i=0; i<polyline.length; i++){ ////set colour vaue in previous polyline/// var colour = getColour(totExcitement[i]); //alert('This is the new color='+colour); polyline[i].setOptions({strokeColor: colour}); } }
[ "function getPolylineStyle(distance, duration) {\n var speed = distance / duration;\n var polyline_color = undefined;\n if (speed > 22.35/* unit: m/s */) {\n polyline_color = \"#197C11\"; // Green\n } else if (speed > 11.18) {\n polyline_color = \"#F0D744\"; // Yellow\n } else {\n poly...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
pass: label returns: number
function labelToInt(label) { var n = 0; var i; for(i = 0; i < label.length; ++i) { n *= charset.length; n += charset.indexOf(label[i]); } return n; }
[ "function NumberLabel() { }", "function int2label(num) {\r\n return \"UTO\" + num.toString();\r\n}", "static getLabel(number) {\n return SDG_LABELS[Number(number) - 1]\n }", "function getNumLabel(variable) {\n if (variable != null) {\n if (variable.length == 1000) {\n return \"1000+\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }