Search is not available for this dataset
query
stringlengths
7
355k
document
stringlengths
9
341k
metadata
dict
negatives
listlengths
0
101
negative_scores
listlengths
0
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
Below this comment, create a function named addNumbers, which accepts two parameters. The function should add the two parameters together and write the result to the element with the id resultadd
function addNumbers(num1, num2) { $('#result-add').text(num1 + num2) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function addNumbers(a, b) {\n\t/* Within the addNumbers() function, we will create a variable that will add the two above arguments together. */\n\tvar sum = a + b;\n\n\t/* Use a function \"return\" to send the \"sum\" variable outside of the function for other elements to use. */\n\treturn sum;\n}", "function a...
[ "0.77218115", "0.761139", "0.75727594", "0.7570341", "0.75699544", "0.75540084", "0.7514997", "0.7481818", "0.74782306", "0.74749494", "0.74749494", "0.7468673", "0.7467695", "0.7465843", "0.74373406", "0.7424583", "0.7419535", "0.73992944", "0.73965997", "0.73928785", "0.738...
0.80425704
0
Below this comment, create a function named multiplyNumbers, which accepts two parameters. The function should multiply the two parameters together and return the result.
function multiplyNumbers(num1, num2) { return num1 * num2 }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function multiplyNumbers (firstNumber, secondNumber) {\n\treturn firstNumber * secondNumber;\n}", "function multiplyTwoNumbers(a, b) {\nreturn a * b\n}", "function multiplyingDemo(firstNumber, secondNumber) {\n var product = firstNumber * secondNumber;\n return product;\n}", "function multiplyTwoNumbs(a,b)...
[ "0.87625736", "0.8323231", "0.8177905", "0.8046964", "0.8020497", "0.8019717", "0.8019717", "0.7984211", "0.7984211", "0.7974034", "0.7952212", "0.7936247", "0.79324836", "0.79324836", "0.79324836", "0.7925046", "0.79035467", "0.7876551", "0.7863656", "0.7816884", "0.7812884"...
0.86278033
1
Below this comment, create a function named clear, which accepts no parameters. The function should clear the contents of the elements with the ids of resultadd and resultmult
function clear() { $('#result-add').text(""); $('#result-mult').text(""); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function clear(){\n firstNumber = \"\";\n secondNumber = \"\";\n result = 0;\n operator = \"\";\n operatorClicked = false;\n $(\"#first-number\").empty();\n $(\"#second-number\").empty();\n $(\"#operator\").empty();\n $(\"#result\").empty();\n }",...
[ "0.75346893", "0.73496157", "0.7225813", "0.7215812", "0.71783274", "0.7126384", "0.7084642", "0.7084585", "0.6995309", "0.6990193", "0.6964122", "0.69453734", "0.69334906", "0.69297093", "0.6915465", "0.6910099", "0.68822855", "0.6826975", "0.6822776", "0.6818518", "0.681492...
0.797155
0
Helper function to correctly set up the prototype chain, for subclasses.
function extendClass(protoProps, staticProps) { var parent = this , child , _proto ; // Short for extendClass({constructor: function(){...}}) -> extendClass(function(){...}) if ( typeof protoProps == 'function' ) { protoProps = { constructor: protoProps }; } else if(Array.isArray(protoProps)) { protoProps = assign.apply(undefined, [{}].concat(protoProps)); } // The constructor function for the new subclass is either defined by you // (the "constructor" property in your `extend` definition), or defaulted // by us to simply call the parent's constructor. if ( !protoProps || !hop.call(protoProps, 'constructor') || !(child = protoProps.constructor) || child === Object ) { child = function() { if ( this.__super__ ) { return this.__super__('constructor', arguments); } else { return parent.apply(this, arguments); } }; } // Add static properties to the constructor function, if supplied. assign(child, parent, staticProps); // Set the prototype chain to inherit from `parent`, without calling // `parent`'s constructor function. var _super = parent.prototype; child.prototype = _proto = objCreate(_super); _proto.constructor = child; // Add prototype properties (instance properties) to the subclass, // if supplied. assign(_proto, protoProps); // parent's prototype child.__super__ = _super; return child; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function ensurePrototypeTraversal(prototype) {\n if (!Object.__proto__) {\n var ancestor = Object.getPrototypeOf(prototype);\n prototype.__proto__ = ancestor;\n if (isBase(ancestor)) {\n ancestor.__proto__ = Object.getPrototypeOf(ancestor);\n }\n }\n }", "function ensurePrototyp...
[ "0.6313063", "0.6313063", "0.6313063", "0.6218673", "0.6218673", "0.62085706", "0.6169029", "0.6086806", "0.60661626", "0.59716296", "0.5958745", "0.5922943", "0.5864225", "0.5810853", "0.5806519", "0.57948834", "0.5777991", "0.5721786", "0.564515", "0.56209916", "0.5598791",...
0.0
-1
This function is intended for debug only!
function funcName(f) { var n = f.displayName || f.name; if(!n) { n = (f+'').match(/function\s+([^\(]*)/); if(n) { n = n[1]; } else n = undefined; } return n; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private internal function m248() {}", "private public function m246() {}", "protected internal function m252() {}", "function devDebug(){\n\n}", "transient private protected internal function m182() {}", "function debug(v){return false;}", "static private protected internal function m118() {}", "stat...
[ "0.68376553", "0.6501064", "0.6235522", "0.61179686", "0.5982679", "0.5963744", "0.59347975", "0.5903419", "0.58887666", "0.5885437", "0.5879306", "0.5795816", "0.57918817", "0.5790841", "0.5762828", "0.5722841", "0.57203895", "0.57117516", "0.5695893", "0.56831133", "0.56206...
0.0
-1
assumming all handler required to make async call in sequence return err
function sequenceHandler(handlers) { const handling = async function handling(event) { let index = 0; while (index < handlers.length) { // eslint-disable-next-line no-await-in-loop const resp = await Promise.resolve(handlers[index](event)); if (resp && resp.statusCode === '401') index = handlers.length; else index++; } }; return handling; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function asyncHandler(cb){\n return async(req, res, next) => {\n try {\n await cb(req, res, next)\n } catch(error){\n // Forward error to the global error handler\n next(error);\n }\n }\n }", "function asyncHandler(cb){\n return async(req, res, next) => {\n try{\n await...
[ "0.7059022", "0.70500934", "0.7037833", "0.7024228", "0.6941244", "0.6930722", "0.6925344", "0.68845373", "0.68727154", "0.6843286", "0.6843286", "0.6835614", "0.6751795", "0.6725149", "0.67213535", "0.67106134", "0.6702262", "0.66944975", "0.66045004", "0.6581339", "0.653469...
0.6148936
31
due to the webpack build insert'use strict' directive for module prior babel transformation nodent which used by fastasync will raise function block scope hoisting syntax error reference to for description
async function displayEvtStatusQuo({accessToken, deviceToken}, data) { const {flHongbao, tjHongbao} = data; const noHongbao = {type: 'noHongbao'}; if (flHongbao) { flHongbao.type = 'flHongbao'; noHongbao.url = flHongbao.url; } if (tjHongbao) { tjHongbao.type = 'tjHongbao'; noHongbao.url = tjHongbao.url; } const eventStatus = [flHongbao, tjHongbao].map(getEventStatus); let pendingEvent = eventStatus.length; [flHongbao, tjHongbao].forEach((hbDateTime, index) => { if (hbDateTime) { const {isEventOngoing, isPostEvent} = eventStatus[index]; if (isEventOngoing) { --pendingEvent; renderHBDraw({accessToken, deviceToken}, hbDateTime); } else if (!isPostEvent) { initCountdown({accessToken, deviceToken}, hbDateTime); } } else --pendingEvent; }); if (pendingEvent) renderHBPlaceholder(); renderHbRuleBtn([flHongbao, tjHongbao, noHongbao]); if (accessToken) { const hbRank = await request.fetchHBRank(accessToken, deviceToken); updateRanking(hbRank); } else updateRanking(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function addStrict(moduleMeta) {\n console.log(\"transform '\" + moduleMeta.name + \"'\");\n moduleMeta.configure({source: \"'use strict;'\\n\" + moduleMeta.source});\n}", "function run() {\n 'use strict';\n}", "function strictly() {\n 'use strict';\n\n}", "function foo() {\n \"use strict\";\n}", ...
[ "0.64158064", "0.5856894", "0.5804921", "0.5788511", "0.5710229", "0.5710229", "0.570638", "0.56965965", "0.5665966", "0.56631815", "0.5658681", "0.565474", "0.56163067", "0.55871135", "0.5546054", "0.5545191", "0.552622", "0.5504311", "0.54164606", "0.5409648", "0.5379085", ...
0.0
-1
Creating a function to build and return a HTML string.
function buildHTMLString(element) { let htmlString = `<div class="restaurant-card" id="card-id-${element.id}"><a href="${element.url}" target= _blank> ${element.name}</a><p>${element.address}</p> <p>Rating: ${element.averageUserRating}</p><p>Average Cost For Two: $ ${element.averageCostPerTwo}</p><a href="${element.menuURL}" target= _blank><button class="menu-button">View Menu</button></a><button id="del-btn-${element.id}">Delete</button><button id="edit-btn-${element.id}">Edit</button></div>`; return htmlString; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function buildHTML(tag, html, attrs) {\n\n var element = document.createElement(tag);\n // if custom html passed in, append it\n if (html) element.innerHTML = html;\n\n // set each individual attribute passed in\n for (attr in attrs) {\n if (att...
[ "0.65401155", "0.64846575", "0.63951284", "0.6355726", "0.634439", "0.62954026", "0.6284767", "0.6277153", "0.62669307", "0.6248323", "0.62193817", "0.62069726", "0.61787236", "0.6177544", "0.61741894", "0.6142228", "0.6142228", "0.6142228", "0.6142228", "0.6142228", "0.61105...
0.58855015
50
Creating a function for searching the restaurants by title
function restaurantSearch(searchTerm) { fetch(jsVar.fetchLink).then((restaurants) => restaurants.json()).then((parsedRestaurants) => { parsedRestaurants.forEach((element) => { if (element.name.toLowerCase().includes(searchTerm.toLowerCase())) { document.querySelector(`#restaurant-container`).innerHTML += buildHTMLString(element); } }); searchFunctions.noResultsFound(); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function searchBook(title) {\n const bookData = getListOfBook();\n const searchResult = [];\n for (let data of bookData) {\n if (data.title.includes(title)) {\n searchResult.unshift(data);\n }\n }\n renderBookList(true, searchResult);\n}", "function search() {\n var searc...
[ "0.7001196", "0.68762887", "0.67931485", "0.66652256", "0.6527432", "0.65255845", "0.6509465", "0.64972496", "0.6487822", "0.64734995", "0.6472562", "0.6467518", "0.64127386", "0.6406536", "0.6340363", "0.6300312", "0.6295129", "0.62785655", "0.62728345", "0.6264796", "0.6260...
0.694777
1
return true if new layout is different from current page layout
function layoutChanged(page) { if (!$layout.length) return false; if (!lastPage || lastPage.fixlayout || lang(lastPage) !== lang(page)) return true; var currentlayout = $layout.attr('data-render-layout') || 'main-layout'; var newlayout = generator.layoutTemplate(page); return (newlayout !== currentlayout); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function toggleConfKeepLayout(){\n\ttoggleConfBool('layout', keepLayout);\n\tredirect(link[posActual]);\n}", "get layoutModified() {\n return this._layoutModified;\n }", "performLayoutUpdate () {\n this.component.layout ();\n this.stale = this.rows.length !== this.component.getRows ().length;\n...
[ "0.63119304", "0.62250066", "0.6035228", "0.6025724", "0.58956254", "0.5884063", "0.56655836", "0.56432134", "0.5613372", "0.5547768", "0.55335164", "0.55305576", "0.55305576", "0.54757786", "0.5461575", "0.54430956", "0.53780544", "0.53751343", "0.531757", "0.53046453", "0.5...
0.82934874
0
this won't work if the href of a fragment is edited
function updateHtml(href) { var fragment = generator.fragment$[href]; if (!fragment) return log('jqueryview cannot find fragment: ' + href); var $html = $('[data-render-html="' + href + '"]'); if (!$html.length) return log('jqueryview cannot update html for fragment: ' + href); generator.emit('before-update-view', $html); $html.replaceWith(generator.renderHtml(fragment)); generator.emit('after-update-view', $html); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function onHashChange() {\n // set location fragmention as uri-decoded text (from href, as hash may be decoded)\n location.fragmention = decodeURIComponent((location.href.match(/#(#|%23)(.+)/) || [0,0,''])[2].replace(/\\+/g, ' '));\n\n\n // conditionally remove stashed element fragmention attribute\...
[ "0.65636873", "0.6541271", "0.648164", "0.6408295", "0.63244", "0.62536347", "0.6221268", "0.6210001", "0.6202181", "0.61882466", "0.6112521", "0.6107851", "0.60569245", "0.60199714", "0.5981198", "0.5963247", "0.59495384", "0.5942643", "0.59400046", "0.5935999", "0.5907381",...
0.63842475
4
Initialize the submenu HTML element.
initMenu() { let menuGroups = this._items.map(menuGroup => { let items = menuGroup.map(menuItem => { let item = HTMLBuilder.li("", "menu-item"); item.html(menuItem.label); if (menuItem.action) { item.data("action", menuItem.action) .click(e => { if (!item.hasClass("disabled")) { this.controller.doAction(menuItem.action); this.closeAll(); } }); let shortcut = this.controller.shortcutCommands[menuItem.action]; if (shortcut) { HTMLBuilder.span("", "hint") .html(convertShortcut(shortcut)) .appendTo(item); } } if (menuItem.submenu) { let submenu = new this.constructor(this, item, menuItem.submenu); item.addClass("has-submenu").mouseenter(e => { if (!item.hasClass("disabled")) { this.openSubmenu(submenu); } }); this._submenus.push(submenu); } item.mouseenter(e => { if (this._activeSubmenu && item !== this._activeSubmenu.parentItem) { this.closeSubmenus(); } }); this.makeItem(item, menuItem); return item; }); return HTMLBuilder.make("ul.menu-group").append(items); }); this._menu = HTMLBuilder.div(`submenu ${this.constructor.menuClass}`, menuGroups); // make sure submenus appear after the main menu this.attach(); this._submenus.forEach(submenu => { submenu.attach(); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "_init() {\n var subs = this.$element.find('li.is-dropdown-submenu-parent');\n this.$element.children('.is-dropdown-submenu-parent').children('.is-dropdown-submenu').addClass('first-sub');\n\n this.$menuItems = this.$element.find('[role=\"menuitem\"]');\n this.$tabs = this.$element.children('[role=\"men...
[ "0.6975112", "0.6917933", "0.6901138", "0.6817762", "0.6762443", "0.67478174", "0.6644594", "0.6644372", "0.65117735", "0.6494994", "0.6296573", "0.62743604", "0.62415844", "0.6232315", "0.62134165", "0.61482924", "0.61411774", "0.6102161", "0.6084086", "0.60815626", "0.60802...
0.7301351
0
Open this submenu, in the case of this submenu being toplevel.
openTopLevel() { throw new NotImplementedError(this); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function openMenu() {\n g_IsMenuOpen = true;\n}", "open() {\n const that = this;\n\n if (that.opened) {\n return;\n }\n\n that._open();\n }", "openSubMenu(element, item) {\n const me = this,\n subMenu = item.menu;\n\n if (subMenu) {\n if (!subMenu.isVi...
[ "0.6710982", "0.65928006", "0.65794134", "0.6576348", "0.63735604", "0.63311595", "0.63244146", "0.6310133", "0.6270878", "0.6226644", "0.61915517", "0.6176953", "0.6128036", "0.6121118", "0.60982436", "0.60707384", "0.6070736", "0.6063347", "0.6063347", "0.6056426", "0.60393...
0.5680061
67
METHODS Add this menu to the page.
attach() { this._menu.appendTo("body"); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function onOpen() { CUSTOM_MENU.add(); }", "addPage() {\n\t\tthrow new Error('You cannot directly add pages in a RichMenu');\n\t}", "addMenuItem(menuItem){\r\n\r\n }", "add(menu) {\n // Make sure we have a menu ID\n menu = React.cloneElement(menu, { id: menu.props.id || menu.props.label });\...
[ "0.74133885", "0.7262759", "0.6769861", "0.67182606", "0.65837014", "0.6540529", "0.6514619", "0.6447271", "0.63913894", "0.63330895", "0.6289641", "0.62523067", "0.623188", "0.622712", "0.6212479", "0.6208633", "0.6181291", "0.6178908", "0.61659455", "0.6157785", "0.61538553...
0.71732485
2
Close the active submenu underneath this submenu.
closeSubmenus() { if (this._activeSubmenu) { this._activeSubmenu.close(); this._activeSubmenu = null; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function closeSubmenu(e) {\n let isClickInside = menu.contains(e.target);\n \n if (!isClickInside && menu.querySelector(\".submenu-active\")) {\n menu.querySelector(\".submenu-active\").classList.remove(\"submenu-active\");\n }\n }", "function closeSubmenu(e) {\r\n const isClickInside = e.tar...
[ "0.7751952", "0.761558", "0.76103", "0.74736863", "0.7163817", "0.7067129", "0.7036395", "0.7036372", "0.6855157", "0.6827137", "0.6723293", "0.66428864", "0.6617966", "0.66058147", "0.64786553", "0.6442533", "0.6405709", "0.63689935", "0.6368808", "0.6319181", "0.6279469", ...
0.84054166
0
Here are declared all functions = Bootstraper =
function qll_main() {//qll_system_settings_delete(); try { opera.postError(''); qll_GMSupport=false;} catch(err) {} try { GM_listValues(); } catch(err) { qll_GMSupport=false; } qll_system_settings_update(); qll_system_settings_load(); qll_styles(); switch(qll_opt['system:language']) { case 'POL': qll_lang=qll_langmt[0]; qll_img=qll_imgmt[0]; break; case 'ENG': qll_lang=qll_langmt[1]; qll_img=qll_imgmt[1]; break; default: qll_lang=qll_langmt[0]; qll_img=qll_imgmt[0]; } qll_module_style(); // chicken auto reloader ^.^ error=document.getElementById('error'); if(error!=null) { var chk=setInterval(function() { $.ajax( { url: "http://www.erepublik.com/en", cache: false, success: function(html) { if(html.match(/<body id="error">/)==null) { clearInterval(chk); window.location.reload(); return; } } }); },1000); return; } url=location.pathname; page=url.replace(/\/[a-z][a-z][\/]?/,""); index=page.indexOf("/"); if(index>0) page=page.substr(0,index); // prevention in running QLL in ridiculous places if(location.pathname.match(/\/[a-z][a-z]\/chat\/open\/.*/) // chat window || location.pathname.match(/.*.js/) // .js files || location.pathname.match(/.*.css/) // .css files || location.hostname.match(/.*wiki\.erepublik\.com.*/) // wiki || location.hostname.match(/.*api\.erepublik\.com.*/) // api || location.hostname.match(/.*ads\.erepublik\.com.*/) // ads || location.hostname.match(/.*tickets\.erepublik\.com.*/) // tickets || location.pathname.match(/\/[a-z][a-z]\/tickets\/report\/.*/) // ticket ) { return; } if(window.parent != window) { // we are inside of frame try{qll_utility_qllformatting_preview();}catch(e){} return; } chk=document.getElementById('remember'); qll_system_menu(); // qll_module_ajax(); if(qll_opt['module:links']) try{qll_module_links_display();}catch(e){} if(qll_opt['utility:search']) try{qll_utility_search();}catch(e){} if(chk==null) { // not main page - logged in try{qll_module_erepmenu();}catch(e){} if(qll_opt['utility:keepalive']) try{qll_utility_keepalive();}catch(e){} try{qll_utility_qllformatting();}catch(e){} if(qll_opt['utility:notepad']) try{qll_utility_notepad();}catch(e){} if(qll_opt['system:checkupdates']) try{qll_system_checkupdates();}catch(e){} if(qll_opt['module:hotchicks:sidebar']) try{qll_module_hotchicks_sidebar();}catch(e){} // if(qll_opt['module:links']) qll_module_links(); //alert(location.pathname); switch(true) { case location.pathname.match(/en\/main\/messages-compose\/[0-9]+$/) !== null: if(qll_opt['utility:message:signature']) try{qll_utility_messages_signature();}catch(e){} break case location.pathname.match(/work$/) !== null: if(qll_opt['module:economic:work']) try{qll_module_economic_work();}catch(e){} break; } switch(page) { case '': if(qll_opt['utility:orders']) try{qll_utility_orders();}catch(e){} break; case 'write-article': case 'edit-article': if(qll_opt['utility:article:cache']) try{qll_utility_article_cache();}catch(e){} break; case 'article': if(qll_opt['utility:article:signature']) try{qll_utility_article_signature();}catch(e){} if(qll_opt['utility:article:quote']) try{qll_utility_article_quote();}catch(e){} break; /* case 'market': if(qll_opt['module:economic:marketplace'] && qll_opt['module:economic'] && qll_opt['module:gameinfo']) qll_module_economic_marketplace(); break;*/ case 'exchange': if(qll_opt['module:economic:monetary']) try{qll_module_economic_monetary();}catch(e){} break; /* case 'company': if(qll_opt['module:economic:company'] && qll_opt['module:economic'] && qll_opt['module:gameinfo']) qll_module_economic_company();*/ default: } } else { // main page - not logged in if(qll_opt['utility:radiochecked']) try{qll_utility_boxchecked();}catch(e){} } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "bootstrap() { }", "function Bootstrapper() {\n\tBootstrapperBase.call(this, Catberry);\n}", "function krnBootstrap() {\n hostLog(\"bootstrap\", \"host\"); // Use hostLog because we ALWAYS want this, even if _Trace is off.\n\n // Initialize our global queues.\n _KernelInterruptQueue = new Que...
[ "0.75630903", "0.7146837", "0.70061165", "0.6960796", "0.6950936", "0.69363064", "0.68807197", "0.6859073", "0.6853958", "0.6784157", "0.67627156", "0.6759388", "0.6759388", "0.67141604", "0.6639376", "0.6639376", "0.6639376", "0.65785366", "0.65192395", "0.6483056", "0.63943...
0.0
-1
= QLL System menu =
function qll_system_menu() { menu = document.createElement("div"); menu.setAttribute('id','QLLSMenu'); menu.setAttribute('name','QLLSMenu'); document.getElementsByTagName("body")[0].appendChild(menu); h = document.createElement("div"); h.setAttribute('id','QLLSMenuHolder_open'); h.setAttribute('class','QLLSMenuHolder'); h.innerHTML= '<div class="QLLSMenuMHeader" id="QLLSMenuMHeader_open">'+qll_lang[5]+'</div><div class="QLLSMenuContainer" id="QLLSMenuContainer_open"><div class="QLLSMenuHeader" id="QLLSMenuHeader_open">'+qll_lang[5]+'</div></div>'; h.setAttribute('onmouseover','document.getElementById("QLLSMenuContainer_open").setAttribute("style","display:block;");'); h.setAttribute('onmouseout','document.getElementById("QLLSMenuContainer_open").setAttribute("style","display:none;");'); menu.appendChild(h); $("#QLLSMenuHeader_open").click(qll_menu); ch = Number(document.getElementById("QLLSMenuContainer_open").offsetHeight)+5; if(window.innerHeight-60 < ch) ch = Number(Number(window.innerHeight)-60); GM_addStyle("#QLLSMenuContainer_open {height:"+ch+"px;}"); $("#QLLSMenuContainer_open").hide(); h = document.createElement("div"); h.setAttribute('id','QLLSMenuHolder_info'); h.setAttribute('class','QLLSMenuHolder'); h.innerHTML= '<div class="QLLSMenuMHeader" id="QLLSMenuMHeader_info">'+qll_lang[82]+'</div><div class="QLLSMenuContainer" id="QLLSMenuContainer_info"><div class="QLLSMenuHeader" id="QLLSMenuHeader_info">'+qll_lang[82]+'</div></div>'; h.setAttribute('onmouseover','document.getElementById("QLLSMenuContainer_info").setAttribute("style","display:block;");'); h.setAttribute('onmouseout','document.getElementById("QLLSMenuContainer_info").setAttribute("style","display:none;");'); menu.appendChild(h); info = document.getElementById('QLLSMenuContainer_info'); info.innerHTML = info.innerHTML + '<a class="QLLSMenuElement" id="QLLSMenuElement_changelog" href="#QLLSMenu">'+qll_lang[18]+'</a> \ <a class="QLLSMenuElement" href="http://www.erepublik.com/en/newspaper/186857/1" target="_blank">'+qll_lang[83]+'</a> \ <a class="QLLSMenuElement" href="http://economy.erepublik.com/en/citizen/donate/1376818" target="_blank">'+qll_lang[84]+'</a>'; $("#QLLSMenuElement_changelog").click(function(){qll_fun_showDisplayBox(qll_lang[18], qll_serverURI + '/changelog', true);}); ch = Number(document.getElementById("QLLSMenuContainer_info").offsetHeight)+5; if(window.innerHeight-60 < ch) ch = Number(Number(window.innerHeight)-60); GM_addStyle("#QLLSMenuContainer_info {height:"+ch+"px;}"); $("#QLLSMenuContainer_info").hide(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function help_menu() {\n console.log('Please use one of the following commands:')\n console.log('Summary: ./pandlss.sh -s <date> <time>')\n console.log('Breakdown: ./pandlss.sh -b <date> <time> <increment>')\n console.log('Breakdown one stock: ./pandlss.sh -b-os <stock> <date> <time> <increment>')\n}",...
[ "0.7107809", "0.6847974", "0.6810089", "0.6709932", "0.66918486", "0.66488194", "0.66373634", "0.6601549", "0.6598697", "0.65552074", "0.65313816", "0.650404", "0.6503349", "0.64995706", "0.64953744", "0.64942867", "0.6468396", "0.6438251", "0.6427622", "0.64274234", "0.64188...
0.65434015
10
= Check for updates function =
function qll_system_checkupdates() { if(!qll_GMSupport) { return; } object = document.createElement("div"); object.setAttribute('class', 'QLLsystembox'); object.setAttribute('id', 'QLLBoxMenuUpdates'); object.innerHTML="<img class='QLLIMGLoading' src='" + qll_loadingImg + "'>"; adv=document.getElementById('eads'); adv.parentNode.insertBefore(object,adv); GM_xmlhttpRequest( { method: 'GET', url: 'http://userscripts.org/scripts/show/58579', onload:function(responseDetails) { var responseText = responseDetails.responseText; version = responseText.match(/<b>Version:<\/b>[^<]*/)[0]; version = version.replace('<b>Version:</b>',''); obj=document.getElementById('QLLBoxMenuUpdates'); if(version>qll_version) { var inner = qll_lang[0] + '<br/>'+ qll_lang[1] +' ' + qll_version + '<br/>' + qll_lang[2] +' ' + version; obj.setAttribute('onclick', "window.open(\'http://userscripts.org/scripts/show/58579\');"); } else { var inner = qll_lang[3]; } obj.innerHTML = inner; } }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function manuallyCheckForUpdate() {\r\n\tcheckForUpdate(true);\r\n} //End manual update check", "check_update(value) { return (this.value != value); }", "shouldUpdate(e){return!0}", "validateBeforeUpdate (id, newData, prevData) { return true }", "enableUpdating(_requestedUpdate) {\n }", "shouldUpdate(_c...
[ "0.77070385", "0.7414871", "0.72115636", "0.7174502", "0.7161608", "0.7151325", "0.70320076", "0.7025666", "0.69321716", "0.69143605", "0.68844557", "0.68600225", "0.6859099", "0.68578655", "0.68578655", "0.6853048", "0.6841909", "0.6815532", "0.67999744", "0.6798333", "0.679...
0.0
-1
= Settings manager options =
function qll_system_settings_import() { sett=$('#QLLMenuSettingsField').attr('value').split(";"); if(sett.length<=1) { qll_fun_showAlertBox('ALARM', qll_lang[40]); return; } var line= new Array(); for(var k in sett) { if(sett[k].length==0) { continue; } line[k]=sett[k].split("="); if(line[k].length!==2) { alert(qll_lang[40]); return; } line[k][0]=qll_fun_unsafe(line[k][0]); line[k][1]=qll_fun_unsafe(line[k][1]); } if(line[0][0]!='QLLVersion' || parseInt(line[0][1])!=GM_getValue("QLLVersion",qll_version*10000000)) { alert(qll_lang[40]); return; } qll_system_settings_delete(); for(k in line) { if(line[k][1].length==0) { continue; } switch(line[k][1]) { case 'true': line[k][1]=true; break; case 'false': line[k][1]=false; break; default: if(isFinite(parseInt(line[k][1]))) line[k][1]=parseInt(line[k][1]); break; } GM_setValue(line[k][0],line[k][1]); } alert(qll_lang[39]); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function SettingManager(options) {\n if (options === void 0) { options = {}; }\n this.serverSettings = options.serverSettings ||\n serverconnection_1.ServerConnection.makeSettings();\n }", "function loadOptions() {\n chrome.storage.sync.get(\"settings\", function(items) {\n ...
[ "0.7236851", "0.69396126", "0.6756615", "0.67441434", "0.6681188", "0.66138124", "0.6567886", "0.65573096", "0.6553386", "0.65444756", "0.6525147", "0.6515256", "0.65010345", "0.64227027", "0.64227027", "0.64227027", "0.64227027", "0.64227027", "0.6416836", "0.64020133", "0.6...
0.0
-1
= multi search box =
function qll_utility_search() { GM_addStyle("body{padding-top:25px;}"); GM_addStyle('#QLLSearch{background:'+qll_opt['css:menu:bg']+'; outline:'+ qll_opt['css:menu:borderc'] +' double 3px; color:'+qll_opt['css:menu:fontc']+'; width:100%;display: block;padding: 0;margin:0px; position:fixed; top:0px; z-index:25000; text-align:center;}'); menu=document.getElementsByTagName('body')[0]; object = document.createElement("div"); object.setAttribute('id','QLLSearch'); object.setAttribute('align','center'); object.innerHTML='<input size="25" class="QLLInput" id="QLLSearchInput" type="text" value="'+qll_lang[66]+'" /><button class="QLLButton" type="button" id="QLLSearchNewspaper">'+qll_lang[62]+'</button><button class="QLLButton" type="button" id="QLLSearchCitizen">'+qll_lang[60]+'</button><button class="QLLButton" type="button" id="QLLSearchCompany">'+qll_lang[61]+'</button><button class="QLLButton" type="button" id="QLLSearchErepublik">'+qll_lang[63]+'</button><button class="QLLButton" type="button" id="QLLSearchErepwiki">'+qll_lang[65]+'</button>'; menu.appendChild(object); $("#QLLSearchInput").focus(function(){$("#QLLSearchInput").select();}); $("#QLLSearchNewspaper").click(function(){qll_fun_showDisplayBox(qll_lang[62], 'http://www.google.com/search?sitesearch=erepublik.com/en/article/&as_q='+$("#QLLSearchInput").attr('value'),true);}); $("#QLLSearchCitizen").click(function(){qll_fun_showDisplayBox(qll_lang[60], 'http://www.google.com/search?sitesearch=erepublik.com/en/citizen/profile/&as_q='+$("#QLLSearchInput").attr('value'), true);}); $("#QLLSearchCompany").click(function(){qll_fun_showDisplayBox(qll_lang[61], 'http://www.google.com/search?sitesearch=erepublik.com/en/company/&as_q='+$("#QLLSearchInput").attr('value'), true);}); $("#QLLSearchErepublik").click(function(){qll_fun_showDisplayBox(qll_lang[63], 'http://www.google.com/search?sitesearch=erepublik.com/en/&as_q='+$("#QLLSearchInput").attr('value'), true);}); $("#QLLSearchErepwiki").click(function(){qll_fun_showDisplayBox(qll_lang[65], 'http://www.google.com/search?sitesearch=wiki.erepublik.com/&as_q='+$("#QLLSearchInput").attr('value'), true);}); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function searchKeywords() {\n if(searchString.toLowerCase().includes('unit')) {\n if(searchString.toLowerCase().includes('1')) {\n searchBox.value = 'Javascript DOM JQuery CSS function html flexbox arrays';\n } if(searchString.toLowerCase().includes('2')) {\n searchBox.value = 'middleware node exp...
[ "0.69228464", "0.67884094", "0.6783339", "0.669975", "0.6686005", "0.6667939", "0.66036344", "0.6544548", "0.6544512", "0.65110296", "0.6495528", "0.64728266", "0.64728266", "0.64600027", "0.6451478", "0.6421094", "0.6412245", "0.6408448", "0.64071834", "0.63898444", "0.63826...
0.0
-1
= Citizen advert blocking =
function qll_utility_blockadvert() { $("#eads").removeAttr('width'); $("#eads").removeAttr('height'); $("#eads").removeAttr('src'); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function adBlockNotDetected() {\n}", "function BLOCKIND() {return true;}", "function block() {\n blocked++;\n }", "function adBlockDetected() {\n //ga(\"send\",{hitType:\"adblock-detected\",eventCategory:\"adblock\",eventAction:\"detected\",eventLabel: \"adblock-detected\"});\n if(localStorage.getIte...
[ "0.72740626", "0.66109", "0.6515572", "0.63428533", "0.6165977", "0.5917189", "0.5910007", "0.59061867", "0.58915204", "0.5819372", "0.57548547", "0.5752981", "0.5704558", "0.56923014", "0.5650035", "0.56122005", "0.55876416", "0.55870813", "0.5574825", "0.55484277", "0.55314...
0.53398967
36
= QLL Text formatting module =
function qll_utility_qllformatting() { if(!qll_opt['utility:qllformatting'] || location.pathname.match(/\/article\//) == null && location.pathname.match(/\/messages\/read\//) == null && location.pathname.length > 3) { return; } if(location.pathname.length == 3) // main { } else if(location.pathname.match(/\/citizen\/profile\//) != null || location.pathname.match(/\/accounts\//) != null || location.pathname.match(/\/inventory/) != null) // profile { } else if(location.pathname.match(/\/article\//) != null) // article { if(qll_opt['utility:qllformatting:article']) { node = document.getElementById('content').getElementsByTagName('p')[1]; qll_utility_qllformatting_raw(node); qll_utility_qllformatting_a(node); qll_utility_qllformatting_img(node); } if(qll_opt['utility:qllformatting:comment']) { node = document.getElementById('comments_div').getElementsByTagName('p'); for(var i = 0; i< node.length; i++) { qll_utility_qllformatting_raw(node[i]); qll_utility_qllformatting_a(node[i]); qll_utility_qllformatting_img(node[i]); } } } else // pm { if(qll_opt['utility:qllformatting:pm']) { node = document.getElementById('content').getElementsByTagName('p')[0]; qll_utility_qllformatting_raw(node); qll_utility_qllformatting_a(node); qll_utility_qllformatting_img(node); } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function formatText(text){\n text = text.replace(/\\r/g, \" \").replace(/\\n/g, \" \");\n text = text.replaceAll(/#w(.*?)#w;/g, \"<span class='text-important'>$1</span>\");\n text = text.replaceAll(/##(.*?)##;/g, \"<span class='text-title'>$1</span>\");\n text = text.replaceAll(/#d(.*?)#d;/g, \"<span c...
[ "0.6431396", "0.6182933", "0.6172128", "0.6172128", "0.61631304", "0.6008989", "0.5980674", "0.59631675", "0.5962245", "0.5959544", "0.59509754", "0.5932357", "0.5904384", "0.58850336", "0.588015", "0.5803011", "0.5771262", "0.5744228", "0.57395566", "0.5722318", "0.57033885"...
0.6100196
5
= Login page radio box checked =
function qll_utility_boxchecked() { $("#remember").attr('checked','checked'); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function hideLogin() {\n\tvar signin = $$('#signin');\n\tsignin.each(function(signin) {\n\t\tvar tags = signin.select('input');\n\t\tvar selected = false;\n\t\ttags.each(function(tag) {if (tag.checked) selected=true});\n\t\tif (selected != true) {toggleLogin(signin.id, 0.0);}\n\t});\t\n}", "function onchecked() ...
[ "0.6465876", "0.6412882", "0.62099004", "0.60516196", "0.601075", "0.592749", "0.59256065", "0.59194016", "0.5893278", "0.58865017", "0.5842532", "0.582517", "0.5813812", "0.5804552", "0.58035344", "0.578946", "0.57890266", "0.5785933", "0.57733613", "0.57556176", "0.5755454"...
0.6014854
4
= Notepad module =
function qll_utility_notepad() { object = document.createElement("div"); object.setAttribute('class', 'QLLNotepad'); inner="<div id='QLLNotepad'>" + qll_lang[21] + "</div>"; inner=inner + "<textarea id='QLLNotepadContent'>" + GM_getValue("QLLMenuNotepad:content",qll_lang[24]) + "</textarea>"; inner=inner + "<div id='QLLNotepadSave'>" + qll_lang[22] + "</div>"; object.innerHTML=inner; adv=document.getElementById('content'); adv.insertBefore(object,adv.childNodes[0]); $('#QLLNotepad').click(function(){qll_utility_notepad_switch();}); $('#QLLNotepadSave').click(function(){qll_utility_notepad_save();}); $('#QLLNotepadContent').hide(); $('#QLLNotepadSave').hide(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function openNotepad() {\n\tvar courseID = getQueryVariable('course_id');\n\topenWin(\"/bin/common/notepad.pl?course_id=\"+courseID);\n}", "function Expt() {\r\n}", "function TextEditor() {}", "function Mod() {\r\n}", "function showAbout(){\n\talert(\"Niven is a browser based text editor.\\n\\nUse and modi...
[ "0.6395507", "0.59570926", "0.5743267", "0.57229406", "0.5665321", "0.5632356", "0.563081", "0.56059414", "0.5572376", "0.5553755", "0.5529779", "0.5503143", "0.5490183", "0.54822886", "0.5475527", "0.5472017", "0.5458511", "0.54418945", "0.54402703", "0.54402703", "0.5438893...
0.65121025
0
= Article cache =
function qll_utility_article_cache() { var object = document.createElement("input"); object.setAttribute('class', 'arrowbutton'); object.setAttribute('type', 'button'); object.setAttribute('id','QLLArticleCacheReload'); object.setAttribute('value', qll_lang[26]); var button=document.getElementsByName('commit'); button=button[button.length-1]; button.parentNode.appendChild(object,button); object = document.createElement("input"); object.setAttribute('class', 'arrowbutton'); object.setAttribute('type', 'button'); object.setAttribute('id','QLLArticleCacheRemove'); object.setAttribute('value', qll_lang[27]); button.parentNode.appendChild(object,button); $("#QLLArticleCacheReload").click(function(){qll_utility_article_cache_reload();}); $("#QLLArticleCacheRemove").click(function(){qll_utility_article_cache_remove();}); $("input[name='commit']").click(function(){qll_utility_article_cache_save();}); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function cacheArticles(articles) {\n articleList = articleList.concat(articles);\n showTenMoreArticles();\n}", "function Cache() {}", "function EntryCache() {}", "function Cache() {\n this.docs = [];\n }", "function cacheToMemory(){\n // need to implement\n}", "get _cache() {\n return cac...
[ "0.7462856", "0.7321859", "0.6930257", "0.68522054", "0.67983466", "0.67194504", "0.67155236", "0.67155236", "0.67155236", "0.66237557", "0.66237557", "0.6590004", "0.6561721", "0.6556369", "0.65069604", "0.6502354", "0.6496045", "0.64868766", "0.6453134", "0.63835233", "0.63...
0.0
-1
= Article signature =
function qll_utility_article_signature() { content=document.getElementById('article_comment'); content.value=content.value+ '\n' + GM_getValue("QLLMenuArticleSignature:content",""); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function Article(title, body) {\n this.title = title;\n this.body = body;\n}", "function createMetadata(article) {\n // Authors. Title. Journal. Year Month;Volume(Issue):Pages. Times cited: n. Percentile rank in Field: n.\n var year = parseInt(article.cover_date.split(\".\")[2]);\n var month = parseIn...
[ "0.591111", "0.5885551", "0.58005184", "0.58005184", "0.57932127", "0.5787186", "0.5784885", "0.5768627", "0.5707028", "0.5680155", "0.5663203", "0.5572938", "0.55285347", "0.54634506", "0.5451425", "0.5442048", "0.5430306", "0.53897995", "0.5381715", "0.5380694", "0.53636414...
0.64325213
0
= Article comments quotes =
function qll_utility_article_quote() { coa = $("#profileholder .smalldotted:first").text(); coh = document.getElementById('profileholder').getElementsByTagName('h1')[0].getElementsByTagName('span')[0]; $(".articlerelated .box:first").append("<div class='rankholder' id='QLLMenuArticleQuoteArticle'><span class='shadow'>Q</span><span class='value'>Q</span></div>"); query = document.getElementById("QLLMenuArticleQuoteArticle"); query.setAttribute('onmouseover',"QLLMenuArticleQuote=new String(window.getSelection());"); // query.setAttribute('onclick',"if(QLLMenuArticleQuote.length>0){document.getElementById('article_comment').value= document.getElementById('article_comment').value + '\\n <a class=\"informer\" target=\"_blank\" href=\"" + coa.getAttribute('href') + "\"> " + coa.innerHTML + "@"+ coh.innerHTML +":\\n' + QLLMenuArticleQuote +' </a> '; document.getElementById('article_comment').focus();}"); query.setAttribute('onclick',"if(QLLMenuArticleQuote.length>0){document.getElementById('article_comment').value= document.getElementById('article_comment').value + '\\n" + coa + "@"+ coh.innerHTML +":\\n\"\"' + QLLMenuArticleQuote +'\"\"\\n'; document.getElementById('article_comment').focus();}"); content=document.getElementById('article_comment'); coh=document.getElementById('comments_div'); cominst=coh.getElementsByTagName('div'); for(com in cominst) { if(cominst[com].getAttribute('class')=='articlecomments') { s=cominst[com].getElementsByTagName('div')[1]; auth = s.getElementsByTagName('a')[1].getAttribute('title'); s = s.getElementsByTagName('span')[0]; s.setAttribute('onmouseover',"QLLMenuArticleQuote=new String(window.getSelection());"); // s.setAttribute('onclick',"if(QLLMenuArticleQuote.length==0){ document.getElementById('article_comment').value= document.getElementById('article_comment').value + '\\n <a target=\"_blank\" href=\"" + s.getAttribute('href') + "\"> @" + s.getAttribute('title') + " </a> : '; document.getElementById('article_comment').focus();}else{document.getElementById('article_comment').value= document.getElementById('article_comment').value + '\\n <a class=\"informer\" target=\"_blank\" href=\"" + s.getAttribute('href') + "\"> @" + s.getAttribute('title') + ":\\n' + QLLMenuArticleQuote +' </a> '; document.getElementById('article_comment').focus();}"); s.setAttribute('onclick',"if(QLLMenuArticleQuote.length==0){ document.getElementById('article_comment').value= document.getElementById('article_comment').value + '\\n@" + auth + " : '; document.getElementById('article_comment').focus();}else{document.getElementById('article_comment').value= document.getElementById('article_comment').value + '\\n@" + auth + ":\\n\"\"' + QLLMenuArticleQuote +'\"\"\\n'; document.getElementById('article_comment').focus();}"); } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function doquote(objID,strAuthor){\r\n\tdocument.inputform.message.value += \"[quote=\"+strAuthor+\"] \"+document.getElementById(objID).innerText+\" [/quote]\\n\";\r\n\twindow.location.hash=\"comment\";\r\n}", "function Comment(){\n this.id;\n this.user_id;\n this.entry_id;\n this.date;\n this.text;\n}", ...
[ "0.62734485", "0.6271485", "0.6270597", "0.6188914", "0.61154795", "0.6011577", "0.5962815", "0.5892786", "0.58524454", "0.5828363", "0.5812693", "0.5796907", "0.5785868", "0.5768783", "0.5766025", "0.5751945", "0.5751822", "0.57265", "0.5725106", "0.5685492", "0.56563824", ...
0.60413194
5
= Erepublik menu modifications =
function qll_module_erepmenu() { var menu= new Array(); var ul = new Array(); menu[0]=document.getElementById('menu'); for(i=1;i<=6;i++) menu[i]=document.getElementById('menu'+i); // menu[1].innerHTML=menu[1].innerHTML + '<ul></ul>'; menu[2].innerHTML=menu[2].innerHTML + '<ul></ul>'; menu[3].innerHTML=menu[3].innerHTML + '<ul></ul>'; menu[6].innerHTML=menu[6].innerHTML + '<ul></ul>'; for(i=1;i<=6;i++) ul[i]=menu[i].getElementsByTagName("ul")[0]; if(qll_opt['module:erepmenu:design']) { //object.setAttribute('class','new_feature_small'); // menu[2].getElementsByTagName("a")[0].href = "http://economy.erepublik.com/en/time-management"; /*aux = ul[2].removeChild(ul[2].getElementsByTagName("li")[6]); // adverts ul[6].appendChild(aux); */ object = document.createElement("li"); object.innerHTML='<a href="http://economy.erepublik.com/en/work">' + "Work" + '</a>'; ul[2].appendChild(object); object = document.createElement("li"); object.innerHTML='<a href="http://economy.erepublik.com/en/train">' + "Training grounds" + '</a>'; ul[2].appendChild(object); object = document.createElement("li"); object.innerHTML='<a href="http://www.erepublik.com/en/my-places/newspaper">' + "Newspaper" + '</a>'; ul[2].appendChild(object); object = document.createElement("li"); object.innerHTML='<a href="http://www.erepublik.com/en/economy/inventory">' + "Inventory" + '</a>'; ul[2].appendChild(object); object = document.createElement("li"); object.innerHTML='<a href="http://www.erepublik.com/en/my-places/organizations">' + "Organizations" + '</a>'; ul[2].appendChild(object); object = document.createElement("li"); object.innerHTML='<a href="http://economy.erepublik.com/en/company/create">' + qll_lang[97] + '</a>'; ul[2].appendChild(object); object = document.createElement("li"); object.innerHTML='<a href="http://www.erepublik.com/en/military/campaigns">' + qll_lang[69] + '</a>'; ul[3].appendChild(object); //ul[4].insertBefore(object,ul[4].getElementsByTagName("li")[3]) object = document.createElement("li"); object.innerHTML='<a href="http://www.erepublik.com/en/loyalty/program">' + "Loyalty program" + '</a>'; ul[6].appendChild(object); object = document.createElement("li"); object.innerHTML='<a href="http://www.erepublik.com/en/gold-bonus/1">' + "Gold bonus" + '</a>'; ul[6].appendChild(object); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function menuOptions() {}", "function menuhrres() {\r\n\r\n}", "_overriddenMenuHandler() { }", "function simulat_menu_infos() {\n display_menu_infos();\n}", "function zoto_set_menu_box_edit(){\n\tthis.$uber({label_text:_('edit'), open_event:'onclick'});\n//\tthis.zoto_menu_box({label_text:_('edit'), ope...
[ "0.7617758", "0.72968394", "0.70223653", "0.695241", "0.693029", "0.68904614", "0.6844699", "0.6794213", "0.6769936", "0.67649275", "0.67300034", "0.6721052", "0.6720158", "0.67093915", "0.67083114", "0.670166", "0.66980916", "0.66859573", "0.66540426", "0.66423494", "0.66396...
0.6867202
6
= Hot chick sidebar display =
function qll_module_hotchicks_sidebar() { if(!qll_GMSupport) { return; } object = document.createElement("div"); object.setAttribute('class', 'QLLBoxModHotChicks'); object.setAttribute('id', 'QLLBoxModHotChicks'); object.innerHTML="<img class='QLLIMGLoading' src='" + qll_loadingImg + "'>"; adv=document.getElementById('eads'); adv.parentNode.insertBefore(object,adv); GM_xmlhttpRequest( { method: 'GET', url: qll_serverURI + '/modules/hotchicks/request.php', onload:function(responseDetails) { var responseText = responseDetails.responseText; uri=responseText.substring(responseText.lastIndexOf("http")); obj=document.getElementById('QLLBoxModHotChicks'); obj.innerHTML = "<img alt='" + uri + "' src='" + uri + "' border='0'>"; $("#QLLBoxModHotChicks").click(function(){qll_fun_showDisplayBox(qll_lang[19], "<a href='" + uri + "' target='_blank'><img alt='" + uri + "' src='" + uri + "' border='0'></a>");}); } }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function sidebar() {\n\tif (!hasClass(document.getElementById('main'), 'nosidebar')) {\n\t\tvar c = document.getElementById('content').getElementsByTagName('div')[0];\n\t\tif (!hasClass(c, 'contextual')) {\n\t\t\t$(document.getElementById('content')).insert({top: '<div class=\"contextual\"></div>'});\n\t\t\tc = do...
[ "0.7105575", "0.7068786", "0.6945905", "0.6921002", "0.6905447", "0.6782105", "0.67227286", "0.67168313", "0.6708289", "0.6692463", "0.6682901", "0.6673738", "0.66431123", "0.66412497", "0.6615999", "0.6614985", "0.65898234", "0.65710866", "0.6540344", "0.6538894", "0.6538760...
0.6411076
35
= Economic module =
function qll_module_economic_monetary() { if(!qll_opt['module:economic']) { return; } selector=document.getElementById('populateSelectors'); object = document.createElement("button"); object.setAttribute('style', 'display:block; width:150px; float:left;'); object.setAttribute('class', 'QLLButton'); object.setAttribute('id','QLLEconomicMonetarySwap'); object.innerHTML="<img src='/images/parts/icon_show-off.gif' />&nbsp;&nbsp;"+qll_lang[76]; selector.appendChild(object); $("#QLLEconomicMonetarySwap").click(function() { sel=document.getElementById('accounts_selector'); hash=sel.href; hash=hash.substr(hash.indexOf('#')+1); hash=hash.split(';'); b=hash[0].split('='); s=hash[1].split('='); window.location.replace("#buy_currencies="+s[1]+";sell_currencies="+b[1]+";page=1"); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function Fundamentals() {\n\n }", "function Module(){}", "function Module(){}", "function Module() {\r\n}", "function NbpChartModule() {\n }", "function Module() {}", "function Module() {}", "function Module() {}", "function Module() {}", "function Module() {}", "function Module() {}", "f...
[ "0.6021262", "0.5946292", "0.5946292", "0.59409434", "0.5753946", "0.57302874", "0.57302874", "0.57302874", "0.57302874", "0.57302874", "0.57302874", "0.5551726", "0.5540839", "0.5458252", "0.54341125", "0.54263765", "0.54182214", "0.5408599", "0.5368403", "0.5343326", "0.533...
0.51013553
56
= Ajax module =
function qll_module_ajax() { addJS('http://www.erepublik.com/js/jquery-1.3.2.min.js','head'); addJS('http://www.erepublik.com/js/jquery.history.plugin.js','head'); addJS('http://www.erepublik.com/js/exchange/filters.js','head'); addJS('http://www.erepublik.com/js/exchange/historyList.js','head'); addJS('http://www.erepublik.com/js/exchange/currency.js','head'); addJS('http://www.erepublik.com/js/exchange/listOffers.js','head'); addJS('http://economy.erepublik.com/js/uncompressed.jquery.dd.js','head'); addJS('http://economy.erepublik.com/js/jquery.tools.min.js','head'); addJS('http://economy.erepublik.com/js/ui.core.js','head'); addJS('http://economy.erepublik.com/js/ui.slider.js','head'); addJS('http://economy.erepublik.com/js/jquery.blockUI.js','head'); addJS('http://economy.erepublik.com/js/Market/marketplace.js','head'); addJS('http://economy.erepublik.com/js/numberChecks.js','head'); addCSS('http://www.erepublik.com/css/cmp/marketplace.css','head'); //$("#content a").each(function(){ $("a").each(function(){ if($(this).attr("href") == "#") return; $(this).click(function(event){ event.preventDefault() qll_module_ajax_perform($(this).attr("href")) }); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function IAjaxHttpHook() { }", "useAjax( ajax ) {\n this._ajax = ajax;\n }", "useAjax( ajax ) {\n this._ajax = ajax;\n }", "function ajax2() {\n\n }", "function __ajax(url, data){\nvar ajax= $.ajax({\n \"method\":\"POST\",\n \"url\":url,\n \"data\":data\n })\n return ajax\n}", "onAf...
[ "0.7480327", "0.7357762", "0.7357762", "0.7267907", "0.71338457", "0.7061603", "0.6998731", "0.6932271", "0.6786179", "0.6723073", "0.6680333", "0.66595286", "0.66427165", "0.6626547", "0.66239345", "0.6595372", "0.6591448", "0.65905964", "0.65836656", "0.6564656", "0.6546727...
0.67597854
9
= Miscelanous Functions =
function qll_fun_sandbox(content) { sandbox=document.getElementById('QLLsandbox'); if(sandbox==undefined) { sandbox = document.createElement("div"); sandbox.setAttribute('id','QLLsandbox'); document.getElementsByTagName("body")[0].appendChild(sandbox); $('#QLLsandbox').hide(); } instance = document.createElement("div"); instance.innerHTML=content; sandbox.appendChild(instance); return instance; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function mostraNotas(){}", "private internal function m248() {}", "transient protected internal function m189() {}", "private public function m246() {}", "function normal() {}", "function miFuncion (){}", "protected internal function m252() {}", "transient private internal function m185() {}", "fun...
[ "0.6639741", "0.66123", "0.6528409", "0.6512705", "0.6498729", "0.6457005", "0.64558333", "0.6384901", "0.63762605", "0.6354705", "0.6354705", "0.6354705", "0.63216007", "0.6314738", "0.6271534", "0.6268273", "0.6267033", "0.6267033", "0.6267033", "0.6204062", "0.61926436", ...
0.0
-1
Returns a random integer between min (inclusive) and max (inclusive) Using Math.round() will give you a nonuniform distribution! I did not originally write this, it is from this Stackoverflow post: URL:
function getRandomInt(min, max) { return Math.floor(Math.random() * (max - min + 1)) + min; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function randint(min, max) {\n let rand = min - 0.5 + Math.random() * (max - min + 1);\n return Math.round(rand);\n}", "function randomInteger(min, max) {\n let rand = min - 0.5 + Math.random() * (max - min + 1)\n rand = Math.round(rand);\n return rand;\n}", "function randomInteger(min, max) {\n\t ...
[ "0.87170804", "0.86760473", "0.8647942", "0.8609952", "0.8580101", "0.8565627", "0.849435", "0.84693307", "0.8436083", "0.8430691", "0.8429009", "0.8426568", "0.84103304", "0.84102637", "0.840209", "0.8384952", "0.8355008", "0.8350709", "0.8341065", "0.8328648", "0.83197147",...
0.0
-1
This function gets the row / col index for given droppableID
function find_table_position(droppableID) { // Figure out the row / col // URL: https://stackoverflow.com/questions/96428/how-do-i-split-a-string-breaking-at-a-particular-character var test = String(droppableID).split('_'); var row = String(test[0]).split('row'); row = row[1]; var col = String(test[1]).split('col'); col = col[1]; var arry = []; // Save the row / col in an array, so that we can return both at once. arry.push(row); arry.push(col); // Return the row / col in an array. return arry; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getPositionIndex(e){\n\t\t\n\t\tvar totCells = cells.length,\n\t\t\ttotRows = Math.ceil(totCells / args.columns),\n\t\t\tcol = args.columns-1,\n\t\t\trow = totRows-1,\n\t\t\theightMult = (args.cellHeight + (2 * args.rowPadding)),\n\t\t\twidthMult = (args.cellWidth + (2 * args.columnPadding));\n\t\t\n\t\t/...
[ "0.6464066", "0.6453165", "0.63811576", "0.6318323", "0.6226967", "0.6105529", "0.60800177", "0.60456836", "0.6007988", "0.5978512", "0.5971972", "0.595708", "0.5955449", "0.5954452", "0.58874637", "0.5864064", "0.5844629", "0.58310777", "0.5829451", "0.58056474", "0.5803191"...
0.7785699
0
This function, given a piece ID will return which letter it represents. parameters: an ID of a tile returns: the letter that tile represents. On error, returns "1".
function find_letter(given_id) { // Go through the 7 pieces, for(var i = 0; i < 7; i++) { // If we found the piece we're looking for, awesome! if(game_tiles[i].id == given_id) { // Just return its letter! return game_tiles[i].letter; } } // Or try looking in the completed word array for(var i = 0; i < complete_words.length; i++) { for(var x = 0; x < complete_words[i].length; x++) { if(given_id == complete_words[i][x].id) { return complete_words[i][x].letter; } } } // If we get here, we weren't given a nice draggable ID like "piece1", so return -1 return -1; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getPieceName(pieceCode) {\n switch (parseInt(pieceCode)) {\n case 1:\n return \"pawn\";\n case 2:\n return \"knight\";\n case 3:\n return \"bishop\";\n case 4:\n return \"rook\";\n cas...
[ "0.6445566", "0.631108", "0.6202048", "0.61871296", "0.6179145", "0.6116845", "0.6102789", "0.60724854", "0.6071657", "0.60710955", "0.60508704", "0.6009523", "0.5948256", "0.5930796", "0.5917462", "0.58823216", "0.58622813", "0.58337224", "0.582979", "0.5813873", "0.5795102"...
0.81183976
0
This function generates a random tile for the load_scrabble_pieces() function and for swapping for a new tile. It returns the new letter that was generated.
function get_random_tile() { // Need take into account that there are 100 tiles total, not just 26 options. // Going to create an array of all the possible letters then - 100 to start. var all_letters = []; var total_letters = 0; for (var i = 0; i < 26; i++) { var current_letter = pieces[i].letter; // Get current letter, "A" to start var remaining = pieces[i].remaining; // Remaining letters, "9" for A at the start. total_letters += remaining; // Keep track of ALL the letters for the random call. for (var x = 0; x < remaining; x++) { all_letters.push(current_letter); // Add "remaining" number of the current letter to the array. } } // Now all_letters should have 100 letters at the start (less while playing the game) // Pick a random number and return that letter. var random_num = getRandomInt(0, total_letters - 1); // Off by one error if we don't subtract. 0 to 100 is bad. Want 0 to 99. var letter = all_letters[random_num]; // Save the letter. // Find the letter to decrement. for (var i = 0; i < 26; i++) { if (pieces[i].letter == letter) { pieces[i].remaining--; // Decrement letter remaining for this letter. return letter; // Return the letter's index. } } // Error if we get here. return -1; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "characterShuffle() {\n\t\tthis.loadedPieces.forEach((e, key) => {\n\t\t\tthis.character[`${key}`] = e.object;\n\t\t});\n\n\t\tHelper.shuffleCharacter(this.game, this.character);\n\t}", "function scramble(){\n\tvar i,j,nameImage=0;\n\tvar tiles=new Array();\n\tfor(i=0;i<=numTiles;i++) tiles[i]=i;\n\ttiles[numTile...
[ "0.69493926", "0.68173194", "0.6799961", "0.6624085", "0.6608978", "0.6590431", "0.65651155", "0.65441746", "0.6535757", "0.6525382", "0.6482125", "0.6455097", "0.6451292", "0.64218223", "0.6412266", "0.6411063", "0.63242096", "0.6317848", "0.6313469", "0.6310228", "0.6274061...
0.73350275
0
This function will update the "Letters Remaining" table. The table has 3 rows of 9 cells, but the very last cell (row 3, cell 9) is empty and should remain empty. URL for info on this function:
function update_remaining_table() { var x = 0; var first = true; // Go through every cell in the table and update it. $('#letters_remain tr').each(function() { // DO NOT go over the limit of the array! Currently there is 27 elements in the // array. So we should stop at 27, since we are going 0 to 26. // Make sure to return false for this to work (THANK YOU STACKOVERFLOW) // URL for that amazing tip: https://stackoverflow.com/questions/1784780/how-to-break-out-of-jquery-each-loop if (x > 25) { // hack to make Blank show "2". // Quit before bad things happen. return true; } $(this).find('td').each(function() { // Skip the first row, we don't want to mess with it. if (first == true) { first = false; return false; } // DO NOT go over the limit of the array! Currently there is 27 elements in the // array. So we should stop at 27, since we are going 0 to 26. if (x > 25) { // Quit before bad things happen. return false; } // Easier to use variables for this stuff. var letter = pieces[x].letter; var remaining = pieces[x].remaining; // Using "$(this)" access each cell. $(this).html(letter + ": " + remaining); x++; // Keep looping return true; }); return true; }); return true; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function updateTable() {\n var rowCount = 5;\n if(pageId == 'page-screen')\n rowCount = 8;\n\n // Build the new table contents\n var html = '';\n for(var i = getGuessesCount() - 1; i >= Math.max(0, getGuessesCount() - row...
[ "0.6281706", "0.601515", "0.5962762", "0.5871492", "0.5821169", "0.5790783", "0.5748978", "0.5665217", "0.5648849", "0.55729765", "0.5548345", "0.5529779", "0.5472754", "0.54659355", "0.5460105", "0.54563975", "0.5455365", "0.5440394", "0.5434315", "0.5427203", "0.5423976", ...
0.79960924
0
This function is an easy way to reset the pieces array / objects.
function load_pieces_array() { pieces = [ {"letter":"A", "value": 1, "amount": 9, "remaining": 9}, {"letter":"B", "value": 3, "amount": 2, "remaining": 2}, {"letter":"C", "value": 3, "amount": 2, "remaining": 2}, {"letter":"D", "value": 2, "amount": 4, "remaining": 4}, {"letter":"E", "value": 1, "amount": 12, "remaining": 12}, {"letter":"F", "value": 4, "amount": 2, "remaining": 2}, {"letter":"G", "value": 2, "amount": 3, "remaining": 3}, {"letter":"H", "value": 4, "amount": 2, "remaining": 2}, {"letter":"I", "value": 1, "amount": 9, "remaining": 9}, {"letter":"J", "value": 8, "amount": 1, "remaining": 1}, {"letter":"K", "value": 5, "amount": 1, "remaining": 1}, {"letter":"L", "value": 1, "amount": 4, "remaining": 4}, {"letter":"M", "value": 3, "amount": 2, "remaining": 2}, {"letter":"N", "value": 1, "amount": 6, "remaining": 6}, {"letter":"O", "value": 1, "amount": 8, "remaining": 8}, {"letter":"P", "value": 3, "amount": 2, "remaining": 2}, {"letter":"Q", "value": 10, "amount": 1, "remaining": 1}, {"letter":"R", "value": 1, "amount": 6, "remaining": 6}, {"letter":"S", "value": 1, "amount": 4, "remaining": 4}, {"letter":"T", "value": 1, "amount": 6, "remaining": 6}, {"letter":"U", "value": 1, "amount": 4, "remaining": 4}, {"letter":"V", "value": 4, "amount": 2, "remaining": 2}, {"letter":"W", "value": 4, "amount": 2, "remaining": 2}, {"letter":"X", "value": 8, "amount": 1, "remaining": 1}, {"letter":"Y", "value": 4, "amount": 2, "remaining": 2}, {"letter":"Z", "value": 10, "amount": 1, "remaining": 1}, {"letter":"_", "value": 0, "amount": 0, "remaining": 0} // Temporary set to 0 until I implement this. ]; // Normally 2 should be in the array. }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "reset() {\n\t\tfor (let i = 0; i < this.tiles.length; i++) {\n\t\t\tthis.tiles[i].unsetPiece();\n\t\t}\n\t\tfor (let i = 0; i < this.whitePieces.length; i++) {\n\t\t\tthis.whitePieces[i].unsetTile();\n\t\t\tthis.whitePieces[i].animation = null;\n\t\t\tthis.blackPieces[i].unsetTile();\n\t\t\tthis.blackPieces[i].ani...
[ "0.7658752", "0.76202255", "0.73145896", "0.7215553", "0.7098666", "0.70202386", "0.70109636", "0.6971597", "0.6953982", "0.6937595", "0.69083756", "0.6888775", "0.68325686", "0.6800275", "0.67999375", "0.6798311", "0.67948186", "0.67726445", "0.6764131", "0.6685815", "0.6682...
0.0
-1
Go through the Table with the Scrabble board and fill in special spaces. This Stackoverflow post was handy: URL:
function fill_in_table() { var row = 0; var col = 0; // CURRENTLY USING BACKGROUND IMAGES FOR THE SPECIAL SPACES. $('#scrabble_board tr').each(function() { col = 0; /** * Note, here "$(this)" refers to the given cell we are looking at currently. * This code goes through ALL cells in order, so that we can apply some properties to certain cells. */ $(this).find('td').each(function() { // Add a unique id consisting of row#col# to the cell, where "row#" is the row number // and "col#" is the column number. Ex: row0col0 is the top left most cell in the table. // Helpful link: https://stackoverflow.com/questions/2176986/jquery-add-id-instead-of-class $(this).attr('id', 'row' + row + '_' + 'col' + col); col++; }); row++; }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function llenarTablero() {\n\tfillBoard();\n}", "function displayChessboard() {\n var rows = [];\n for (var i = 0; i < 5; i++) {\n var row = [];\n for (var j = 0; j < 5; j++) {\n if ((j + i) % 2 == 0) row.push(new TextCell('##'));\n else row.push(new TextCell(' '));\n ...
[ "0.6160182", "0.6122663", "0.60799897", "0.6065048", "0.5908557", "0.5891682", "0.5823882", "0.5823199", "0.580899", "0.58000576", "0.5780455", "0.5768882", "0.5755294", "0.57485616", "0.5745775", "0.57105374", "0.57097495", "0.5706609", "0.57012886", "0.56989646", "0.5667393...
0.74104625
0
NOTE: Never send unencrypted user credentials in production!
function postRequest() { // var formData = new FormData(document.getElementById('myForm')); // 'https://jsonplaceholder.typicode.com/todos' // JSON.stringify({name:name,msg:msg}) // `name=${name}&message=${msg}` let name = document.getElementById('name').value; let msg = document.getElementById('msg').value; axios({ method: 'post', url: 'https://jsonplaceholder.typicode.com/posts', data: `name=${name}&message=${msg}` }).then(logResult).catch(logError); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "_parseAuthInfo(){\n if(this.authInfo){\n const authCode = this.authInfo.split(/\\s+/)[1]\n const authDecode = new Buffer(authCode, 'base64').toString()\n const creds = authDecode.split(':')\n this.login = creds[0]\n this.password = creds[1]\n this.user = User.find_by_login(this.log...
[ "0.6504549", "0.6473724", "0.6411177", "0.61328", "0.60653245", "0.60166097", "0.6012215", "0.59828675", "0.5980733", "0.5957961", "0.5953004", "0.59459543", "0.59459543", "0.5934666", "0.59340453", "0.5867887", "0.5867657", "0.5866522", "0.5852946", "0.58469975", "0.58348894...
0.0
-1
Track last data element clicked for shift click
function deselect(e) { $('.pop').slideFadeToggle(function() { e.removeClass('selected'); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "_lastButtonClickHandler() {\n const that = this;\n\n that.last();\n }", "function click(d, _, unshift) {\n d3.event.stopPropagation();\n\n if(d3.event.shiftKey && !unshift) {\n //If you shift-click, it'll toggle fold all the children, instead of itself\n d3.event....
[ "0.6382816", "0.5936566", "0.5936566", "0.5936566", "0.5936566", "0.5741679", "0.56731623", "0.5636553", "0.5625179", "0.56077456", "0.55954796", "0.5590035", "0.55803204", "0.5547504", "0.5543896", "0.5472042", "0.54440814", "0.5410817", "0.54104626", "0.5357239", "0.5327217...
0.0
-1
Deploys a network app using the admin connection
function upgradeApp(){ // 3. Create a Business Network Definition object from directory var bnaDef = {} BusinessNetworkDefinition.fromDirectory(bnaDirectory).then(function(definition){ bnaDef = definition; console.log("Successfully created the definition!!! ",bnaDef.getName()) // 4.Install the new version of the BNA return adminConnection.install(bnaDef); }).then(()=>{ // 5. start the network // If you do not have the app installed, you will get an error console.log("Install successful") return adminConnection.start(appName, version, { networkAdmins: [ {userName : 'admin', enrollmentSecret:'adminpw'} ] } ) }).then(()=>{ console.log('Network up and runing!!! ', 'Network name: ', bnaDef.getName(),' ', 'Network version: ', bnaDef.getVersion()); //6. connect network admin card adminConnection.connect(cardNameForNetworkAdmin).then(()=>{ // 7. Ping the network adminConnection.ping(appName).then(function(response){ console.log("Ping Response:"); console.log(response); }); }) // 8. Disconnect adminConnection.disconnect(); }).catch(function(error){ console.log(error); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function create(appName, callback) {\n commons.post(format('/%s/apps/', deis.version), {\n id: appName\n }, callback);\n }", "async function deployiOSDApp(noDebug, forProd, wipeStorage, localMDNS) {\n var runHelper = new RunHelper()\n var ionicHelper = new IonicHelper()\n\n // Make sure mand...
[ "0.6045106", "0.5855501", "0.568801", "0.56382346", "0.5465194", "0.54348034", "0.5375702", "0.53549707", "0.5347991", "0.53236043", "0.5288324", "0.52631855", "0.52187955", "0.519844", "0.5172483", "0.51483744", "0.513677", "0.51349205", "0.512596", "0.5113219", "0.51042336"...
0.60331744
1
accepts a number. Return true/false depending if number can be trucanted from both left and right hand side directions
function isTrunk(num){ //return false, if the number passed is non-prime if (primes[+num] ==0){ return false; } //return false if we hit a non-prime by removing numbers //from the left var removeLeft = num.toString(); while (removeLeft.length>0){ // console.log("removeleft:%s",removeLeft); if (primes[+removeLeft] ==0){ return false; } removeLeft = removeLeft.slice(1); } //return false if we hit a non-prime by removing numbers //from the right var removeRight = num.toString(); while (removeRight.length>0){ // console.log("removeRight:%s",removeRight); if (primes[+removeRight] ==0){ return false; } removeRight = removeRight.slice(0,removeRight.length-1); } return true; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function esPotencia2(numero) {\n if (typeof numero != 'number') {\n throw TypeError('El argumento debe ser un número.');\n }\n\n return numero && (numero & (numero - 1)) === 0;\n}", "function checkNumber(a, b) {\n if (a == 8 || b == 8) {\n console.log(true);\n } else if (a + b == 8) ...
[ "0.62930053", "0.6185014", "0.6154536", "0.6000826", "0.5988791", "0.598493", "0.5982636", "0.5921438", "0.5869946", "0.58697784", "0.5849518", "0.5792611", "0.5775912", "0.57641983", "0.57595485", "0.57483196", "0.57293725", "0.5695945", "0.5668529", "0.5667061", "0.56634915...
0.0
-1
HELPER FUNCTIONS FOR CHECKING FOR GENERATING PRIMES return array with all prime numbers less than a limit [0,1,2,3,0,5,0,7,0,0,0,11...limit]
function sieve(limit){ // console.log("starting sieve"); var arr = []; //initialize an array for (var i =0; i < limit; i++){ arr.push(i); } arr[1]=0; //check all 2*n, 3*n, 4*n,etc... and make their entries 0 //whatever remains must be a prime for (var j=2; j < limit; j++){ if (arr[j]!=0){ for (var k=2; k < limit/j; k++){ arr[k*j] = 0; } } } return arr; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function primes(limit) {\n let list = [];\n let nonPrimes = [];\n\n //build range\n for (let idx = 2; idx <= limit; idx++) list.push(idx);\n\n // mark nonPrimes\n list.forEach(number => {\n if (!nonPrimes.includes(number)) {\n for (let testNum = number * 2; testNum <= limit; testNum += number) {\n ...
[ "0.8066804", "0.78435403", "0.750811", "0.7365144", "0.7283588", "0.7076695", "0.7043132", "0.7038277", "0.7012754", "0.69983685", "0.6969858", "0.6945218", "0.69313216", "0.69144374", "0.68968797", "0.68853337", "0.68460906", "0.68367714", "0.6828308", "0.6819231", "0.680962...
0.7606336
2
resets even class to all dt's without hidden class
function setStripes() { var currentEven = $('.even'); if (currentEven) { currentEven.removeClass('even'); } $('#apis > dt:not(.hidden)').forEach(function(element, index) { if (index % 2 === 1) { $(element).addClass('even'); } }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function clearAll() {\n for (var i = 0; i < tds.length; i++) {\n tds[i].className = '';\n }\n }", "function clickRight() {\n var sept = document.getElementsByClassName('september'); \n for(var i = 0; i < sept.length; i++){\n sept[i].classList.add(\"d-none\");\n }\n ...
[ "0.6643962", "0.57419723", "0.5740775", "0.57109827", "0.5701641", "0.5670024", "0.55317307", "0.5518069", "0.55007416", "0.5476566", "0.54550266", "0.54270494", "0.5416296", "0.54116243", "0.53957784", "0.53781676", "0.53037506", "0.5302284", "0.53000146", "0.5289943", "0.52...
0.55572283
6
hides all certified dt and closes dd if opened
function hideCertified() { $('dt.certified').forEach(function(element) { element = $(element); element.addClass('hidden'); // hide description if opened var model = element._model; if (model.visible) { model.visible = false; // XXX this will need to be changed if any animation will be // implemented to hide model.hide(); } }); setStripes(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function mydate() {\n\t//alert(\"\");\n\tdocument.getElementById(\"dt\").hidden = false;\n\tdocument.getElementById(\"DOB\").hidden = true;\n}", "function unhide_dates(){\r\n\t$(\"#hidden_row\").css(\"display\",\"inline\");\r\n}", "function hideDate(id){\n document.getElementById(id).style.display =\"none\"...
[ "0.67143506", "0.6281024", "0.61245894", "0.61185396", "0.5967705", "0.58774936", "0.5781316", "0.5752279", "0.57493913", "0.5716294", "0.56873137", "0.56736743", "0.56594384", "0.5642195", "0.56330305", "0.5612947", "0.5612326", "0.5598936", "0.5596466", "0.55714846", "0.556...
0.6534959
1
show all certified dt
function showCertified() { $('dt.certified').removeClass('hidden'); setStripes(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function viewAllDepts() {\n connection.query(\"SELECT d.name AS Department FROM department d ORDER BY d.name;\", function (err, res) {\n if (err) throw err;\n let tableResults = [];\n for (var i = 0; i < res.length; i++) {\n var deptObj = [res[i].Department];\n tableResults.push(deptObj);\n ...
[ "0.608084", "0.59012055", "0.5722991", "0.5713949", "0.56503654", "0.5640247", "0.5575808", "0.5571545", "0.55162346", "0.5503084", "0.5481278", "0.54632676", "0.54398346", "0.54068756", "0.5396296", "0.5376146", "0.5364056", "0.5333311", "0.5326717", "0.5278247", "0.5264913"...
0.5436921
13
show hide certified regarding the setting
function renderCertified() { if (settings.get('certifiedVisible')) { showCertified(); } else { hideCertified(); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function hideDevOpts(hide = true) {\n if (hide) {\n $('#showcaymans')[0].style.display = 'none';\n $('#loggingEnabled')[0].style.display = 'none';\n $('#viewcache')[0].style.display = 'none';\n opt_showcaymans = false;\n GM_setValue(\"opt_showcaymans\",...
[ "0.6927425", "0.6925881", "0.6666956", "0.66298", "0.66105646", "0.6588622", "0.6551528", "0.6545508", "0.6483497", "0.64807105", "0.64746046", "0.64739096", "0.64353746", "0.64170873", "0.64170873", "0.6405065", "0.63640314", "0.6358734", "0.6350933", "0.6347156", "0.6339249...
0.6330753
21
end of init function mapReady function that fires when the first or base layer has been successfully added to the map. Very useful in many situations. called above by this line: dojo.connect(map, "onLoad", mapReady)
function mapReady(map){ //Sets the globe button on the extent nav tool to reset extent to the initial extent. dijit.byId("extentSelector").set("initExtent", map.extent); //Create scale bar programmatically because there are some event listeners that can't be set until the map is created. //Just uses a simple div with id "latLngScaleBar" to contain it var latLngBar = new wim.LatLngScale({map: map}, 'latLngScaleBar'); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "afterMapLoaded(map) {\r\n this.initQueryParamListener();\r\n this.initFeatureClickEvent();\r\n this.initLayerAnchorClickEvent();\r\n }", "function ready(error, us1, data1) {\n us = us1;\n one = data1;\n drawMap(null, one);\n}", "function initialize(){\r\n //<-w...
[ "0.72007793", "0.69397837", "0.6793498", "0.6711798", "0.67069906", "0.6685676", "0.66706115", "0.6648385", "0.6640614", "0.66198504", "0.6521417", "0.649485", "0.649349", "0.64130837", "0.64113635", "0.63870126", "0.6380731", "0.63685036", "0.6327631", "0.628617", "0.628531"...
0.7122066
1
function to show feedback form when a user click to submit feedback on a site
function feedback(complexID) { dojo.byId("formDiv").innerHTML = '<div id="feedbackInfo">Submit comments here for site ID: <label id="feedbackID">1234</label></div><form><label for="emailInput">email: </label><br><input type="email" required name="email" id="emailInput" class="feedbackInput"/><br><label for="commentsInput">comments: </label><br><textarea id="commentsInput" rows="5" cols="25" required></textarea><br><div id="feedbackButtons"><button type="button" onclick="showFeedbackResult()" id="submitButton">Submit</button><button type="button" onclick="cancelFeedback()" title="Cancel" id="cancelButton">Cancel</button></div></form>'; dojo.byId("feedbackID").innerHTML = complexID; //dojo.style(dojo.byId("submittedInfo"),"visibility","hidden"); //dojo.style(dojo.byId("formDiv"),"visibility","visible"); dojo.style(dojo.byId("feedbackForm"),"visibility","visible"); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function feedback_form_open(){\n document.getElementById('form-feedback-problem').style.display = \"block\";\n \n}", "function ShowFeedback() {\n // Show the comment in the feedback feed\n let article = document.getElementById(\"user-feedback\");\n article.classList.add(\"show\");\n\n // Change...
[ "0.7643869", "0.7587085", "0.73846817", "0.7383526", "0.735089", "0.735089", "0.7327286", "0.7281764", "0.71290183", "0.7111905", "0.71079904", "0.7090412", "0.7075135", "0.70717365", "0.70472664", "0.6868846", "0.686746", "0.6862839", "0.6830329", "0.68250203", "0.67985755",...
0.62809247
57
USGS Logo click handler function
function showUSGSLinks(evt){ //check to see if there is already an existing linksDiv so that it is not build additional linksDiv. Unlikely to occur since the usgsLinks div is being destroyed on mouseleave. if (!dojo.byId('usgsLinks')){ //create linksDiv var linksDiv = dojo.doc.createElement("div"); linksDiv.id = 'usgsLinks'; //LINKS BOX HEADER TITLE HERE linksDiv.innerHTML = '<div class="usgsLinksHeader"><b>USGS Links</b></div>'; //USGS LINKS GO HERE linksDiv.innerHTML += '<p>'; linksDiv.innerHTML += '<a style="color:white" target="_blank" href="http://www.usgs.gov/">USGS Home</a><br />'; linksDiv.innerHTML += '<a style="color:white" target="_blank" href="http://www.usgs.gov/ask/">Contact USGS</a><br />'; linksDiv.innerHTML += '<a style="color:white" target="_blank" href="http://search.usgs.gov/">Search USGS</a><br />'; linksDiv.innerHTML += '<a style="color:white" target="_blank" href="http://www.usgs.gov/laws/accessibility.html">Accessibility</a><br />'; linksDiv.innerHTML += '<a style="color:white" target="_blank" href="http://www.usgs.gov/foia/">FOIA</a><br />'; linksDiv.innerHTML += '<a style="color:white" target="_blank" href="http://www.usgs.gov/laws/privacy.html">Privacy</a><br />'; linksDiv.innerHTML += '<a style="color:white" target="_blank" href="http://www.usgs.gov/laws/policies_notices.html">Policies and Notices</a></p>'; //place the new div at the click point minus 5px so the mouse cursor is within the div linksDiv.style.top = evt.clientY-5 + 'px'; linksDiv.style.left = evt.clientX-5 + 'px'; //add the div to the document dojo.byId('map').appendChild(linksDiv); //on mouse leave, call the removeLinks function dojo.connect(dojo.byId("usgsLinks"), "onmouseleave", removeLinks); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function logoClick(){\r\n\t\tcallAjax(createSlideShow, \"slideshow\", \"get\"); //slideshow\r\n\t\tdocument.getElementById(\"slideshow\").style.display = \"block\";\r\n\t\tdocument.getElementById(\"alloptions\").style.display = \"none\";\r\n\t\tdocument.getElementById(\"headermid\").style.display = \"none\";\r\n\t...
[ "0.7047855", "0.64871645", "0.64079124", "0.631334", "0.629696", "0.62641424", "0.6222847", "0.6216063", "0.61945385", "0.6163782", "0.60537195", "0.6052129", "0.59730464", "0.59389526", "0.59354675", "0.59280235", "0.5918165", "0.59111345", "0.5838603", "0.5828612", "0.58119...
0.0
-1
remove (destroy) the usgs Links div (called on mouseleave event)
function removeLinks(){ dojo.destroy('usgsLinks'); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function removeMega(elem){\n\t$(elem).removeClass(\"hovering\");\n\tdata.page = 0;\n\tupdate();\n}", "function addThumbnails(images,links,text){\r\n for(var x=0; x<images.length;x++){\r\n var nail = document.createElement('div');\r\n var image = document.createElement('img');\r\n var link...
[ "0.6678005", "0.64242864", "0.6367724", "0.6253172", "0.6163924", "0.6151484", "0.61369896", "0.60813254", "0.60661745", "0.6063021", "0.6060965", "0.60381854", "0.6002633", "0.5983508", "0.5982574", "0.59759516", "0.59759516", "0.59759516", "0.59759516", "0.59702", "0.596945...
0.7380312
0
because javascript can't handle 64bit int bitwise opperations...
function decomposeBigInt(n) { const result = []; (function recur(bit) { if (n > bit) { n = recur(bit * 2) } if (n >= bit) { result.push(bit); return n - bit; } return n; })(1); return result; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function get64binary(int) {\n if (int>=0)\n return int\n .toString(2)\n .padStart(36, \"0\");\n // else\n return (-int-1)\n .toString(2)\n .replace(/[01]/g, function(d){return +!+d;}) // hehe: inverts each char\n .padStart(36, \"1\");\n}", "get is64Bit() {\n return true;\n ...
[ "0.681089", "0.6704781", "0.666521", "0.6598113", "0.6598113", "0.6598113", "0.65154624", "0.64823574", "0.64435786", "0.63510907", "0.63483924", "0.63459283", "0.63459283", "0.6312622", "0.63112754", "0.6274197", "0.6267864", "0.6257336", "0.6248223", "0.6235451", "0.6230044...
0.0
-1
Helpers for interfacing realtime database
function writeCompanyData(query, callback) { var companyRef = db.ref('companies/' + query.company); companyRef.set({ employees: query.employees, industry: query.industry, location: query.location, imgUrl: query.imgUrl, description: query.description }); callback(NULL, "Added company to database!"); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function DB (options) {}", "function notesDB() { }", "function CreateDatabaseQuery() {}", "function Database(){}", "static database_query(json, fcn) {\n if (window.Settings.enableLog)\n WebUtils.log(\"Web.database_query({0})\".format(json));\n Database.query(json, fcn);\n }", ...
[ "0.6814865", "0.66586024", "0.6615573", "0.6520268", "0.6445476", "0.6437964", "0.6419784", "0.6410213", "0.6378224", "0.62852097", "0.6231181", "0.6165056", "0.6165056", "0.6129086", "0.61262757", "0.6079702", "0.60610706", "0.6042549", "0.60393554", "0.6027563", "0.6022031"...
0.0
-1
Basic turtle graphics implementation: For more info on Javascript OOP: The turtle's coordinate system uses pixels for distance and degrees for rotations 0 degrees is straight right (east); positive degrees are clockwise Turtle constructor takes optional x, y starting coordinates (default is center of sketch)
function Turtle(x, y) { // assign default values to x and y if they were not passed if (typeof x === "undefined") { x = width * 0.5; } if (typeof y === "undefined") { y = height * 0.5; } this.x = x; this.y = y; this.bearingRadians = 0; this.isPenDown = true; this._stateStack = []; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function Turtle() {\n // Construct new turtle.\n // Optional argument is passed to Init()\n // Define public properties\n this.log = '';\n this.logging = false;\n \n // Initialize (define and initialize remaining public properties\n if ( arguments.length >= 1 ) {\n this.Init(arguments[0]);\n }\n else ...
[ "0.63799214", "0.6354133", "0.6305667", "0.62904775", "0.6257948", "0.6161578", "0.6117585", "0.6081102", "0.6075312", "0.603642", "0.59862715", "0.5982152", "0.59687954", "0.5965246", "0.59165823", "0.5901254", "0.585511", "0.58210444", "0.581", "0.58017135", "0.5794279", ...
0.7448076
0
This is done to register the method called with moment() without creating circular dependencies.
function setHookCallback (callback) { hookCallback = callback; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "constructor(moment) {\n this.moment = moment;\n }", "moment(date) {\n return moment(date);\n }", "viewDateMoment () {\n const m = moment(this.props.viewDate)\n return function () {\n return m.clone()\n }\n }", "function Sb(a,b){return function(c,d){var e,f;\n//invert the arguments,...
[ "0.6808176", "0.61082673", "0.59246933", "0.5748391", "0.5748391", "0.5748391", "0.5748391", "0.5748391", "0.5748391", "0.5748391", "0.5748391", "0.5748391", "0.5748391", "0.5748391", "0.5748391", "0.5748391", "0.5740086", "0.5740086", "0.5740086", "0.5735562", "0.5735562", ...
0.0
-1
compare two arrays, return the number of differences
function compareArrays(array1, array2, dontConvert) { var len = Math.min(array1.length, array2.length), lengthDiff = Math.abs(array1.length - array2.length), diffs = 0, i; for (i = 0; i < len; i++) { if ((dontConvert && array1[i] !== array2[i]) || (!dontConvert && toInt(array1[i]) !== toInt(array2[i]))) { diffs++; } } return diffs + lengthDiff; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function compareArrays(array1, array2) {\n var len = Math.min(array1.length, array2.length),\n lengthDiff = Math.abs(array1.length - array2.length),\n diffs = 0,\n i;\n for (i = 0; i < len; i++) {\n if (~~array1[i] !== ~~array2[i]) {\n diffs+...
[ "0.82804155", "0.82804155", "0.82804155", "0.82804155", "0.82804155", "0.82804155", "0.82804155", "0.82804155", "0.82804155", "0.82804155", "0.82804155", "0.79988205", "0.7986667", "0.7953736", "0.7924851", "0.77121043", "0.7560073", "0.7548933", "0.75345767", "0.75057775", "...
0.0
-1
format date using native date object
function formatMoment(m, format) { if (!m.isValid()) { return m.localeData().invalidDate(); } format = expandFormat(format, m.localeData()); formatFunctions[format] = formatFunctions[format] || makeFormatFunction(format); return formatFunctions[format](m); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "formatDate(date) {\n\t\treturn date.toString()\n\t\t.replace(/(\\d{4})(\\d{2})(\\d{2})/, (string, year, month, day) => `${year}-${month}-${day}`);\n\t}", "static formatDate(date) {\n return new Date(date).toLocaleDateString();\n }", "formatTheDate(date, format) {\n const [ year, month, day ] = (date.toI...
[ "0.75320816", "0.7421278", "0.7386446", "0.7386206", "0.73497903", "0.7336332", "0.73048234", "0.7300858", "0.7292591", "0.7292591", "0.7292591", "0.7221218", "0.7213261", "0.7210653", "0.7188191", "0.71826464", "0.71783525", "0.71683335", "0.71673006", "0.71582985", "0.71363...
0.0
-1
pick the locale from the array try ['enau', 'engb'] as 'enau', 'engb', 'en', as in move through the list trying each substring from most specific to least, but move to the next array item if it's a more specific variant than the current root
function chooseLocale(names) { var i = 0, j, next, locale, split; while (i < names.length) { split = normalizeLocale(names[i]).split('-'); j = split.length; next = normalizeLocale(names[i + 1]); next = next ? next.split('-') : null; while (j > 0) { locale = loadLocale(split.slice(0, j).join('-')); if (locale) { return locale; } if (next && next.length >= j && compareArrays(split, next, true) >= j - 1) { //the next array item is better than a shallower substring of this one break; } j--; } i++; } return globalLocale; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function chooseLocale(names) {\n var i = 0, j, next, locale, split;\n \n while (i < names.length) {\n split = normalizeLocale(names[i]).split('-');\n j = split.length;\n next = normalizeLocale(names[i + 1]);\n next = next ? next.split('-') : nu...
[ "0.7081012", "0.7076643", "0.7076643", "0.7076643", "0.7076643", "0.7076643", "0.7076643", "0.7076643", "0.7076643", "0.7076643", "0.7076643", "0.7076643", "0.7076643", "0.7076643", "0.7076643", "0.7076643", "0.7076643", "0.7076643", "0.7076643", "0.7076643", "0.7076643", "...
0.0
-1
This function will load locale and then set the global locale. If no arguments are passed in, it will simply return the current global locale key.
function getSetGlobalLocale (key, values) { var data; if (key) { if (isUndefined(values)) { data = getLocale(key); } else { data = defineLocale(key, values); } if (data) { // moment.duration._locale = moment._locale = data; globalLocale = data; } else { if ((typeof console !== 'undefined') && console.warn) { //warn user if arguments are passed but the locale could not be set console.warn('Locale ' + key + ' not found. Did you forget to load it?'); } } } return globalLocale._abbr; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getSetGlobalLocale(key,values){var data;if(key){if(isUndefined(values)){data = getLocale(key);}else {data = defineLocale(key,values);}if(data){ // moment.duration._locale = moment._locale = data;\nglobalLocale = data;}else {if(typeof console !== 'undefined' && console.warn){ //warn user if arguments are p...
[ "0.7327511", "0.72994685", "0.72960633", "0.7250679", "0.7250679", "0.7250679", "0.7250679", "0.7250679", "0.7250679", "0.7242776", "0.7242776", "0.7231589", "0.72192186", "0.7215549", "0.72115666", "0.72115666", "0.72115666", "0.72115666", "0.72076297", "0.7207319", "0.72072...
0.0
-1
Pick the first defined of two or three arguments.
function defaults(a, b, c) { if (a != null) { return a; } if (b != null) { return b; } return c; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function pick() {\n\tvar args = arguments,\n\t\ti,\n\t\targ,\n\t\tlength = args.length;\n\tfor (i = 0; i < length; i++) {\n\t\targ = args[i];\n\t\tif (typeof arg !== 'undefined' && arg !== null) {\n\t\t\treturn arg;\n\t\t}\n\t}\n}", "function pick() {\n\t\tvar args = arguments,\n\t\t\ti,\n\t\t\targ,\n\t\t\tlengt...
[ "0.7627128", "0.755574", "0.7451226", "0.7446005", "0.6877117", "0.6670455", "0.6649569", "0.6639284", "0.6579108", "0.64876544", "0.64770585", "0.6404518", "0.629943", "0.62962943", "0.62828404", "0.61646676", "0.6150696", "0.5959921", "0.5959005", "0.59343785", "0.5931304",...
0.0
-1
convert an array to a date. the array should mirror the parameters below note: all values past the year are optional and will default to the lowest possible value. [year, month, day , hour, minute, second, millisecond]
function configFromArray (config) { var i, date, input = [], currentDate, expectedWeekday, yearToUse; if (config._d) { return; } currentDate = currentDateArray(config); //compute day of the year from weeks and weekdays if (config._w && config._a[DATE] == null && config._a[MONTH] == null) { dayOfYearFromWeekInfo(config); } //if the day of the year is set, figure out what it is if (config._dayOfYear != null) { yearToUse = defaults(config._a[YEAR], currentDate[YEAR]); if (config._dayOfYear > daysInYear(yearToUse) || config._dayOfYear === 0) { getParsingFlags(config)._overflowDayOfYear = true; } date = createUTCDate(yearToUse, 0, config._dayOfYear); config._a[MONTH] = date.getUTCMonth(); config._a[DATE] = date.getUTCDate(); } // Default to current date. // * if no year, month, day of month are given, default to today // * if day of month is given, default month and year // * if month is given, default only year // * if year is given, don't default anything for (i = 0; i < 3 && config._a[i] == null; ++i) { config._a[i] = input[i] = currentDate[i]; } // Zero out whatever was not defaulted, including time for (; i < 7; i++) { config._a[i] = input[i] = (config._a[i] == null) ? (i === 2 ? 1 : 0) : config._a[i]; } // Check for 24:00:00.000 if (config._a[HOUR] === 24 && config._a[MINUTE] === 0 && config._a[SECOND] === 0 && config._a[MILLISECOND] === 0) { config._nextDay = true; config._a[HOUR] = 0; } config._d = (config._useUTC ? createUTCDate : createDate).apply(null, input); expectedWeekday = config._useUTC ? config._d.getUTCDay() : config._d.getDay(); // Apply timezone offset from input. The actual utcOffset can be changed // with parseZone. if (config._tzm != null) { config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm); } if (config._nextDay) { config._a[HOUR] = 24; } // check for mismatching day of week if (config._w && typeof config._w.d !== 'undefined' && config._w.d !== expectedWeekday) { getParsingFlags(config).weekdayMismatch = true; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function dateFromArray(input) {\n return new Date(input[0], input[1] || 0, input[2] || 1, input[3] || 0, input[4] || 0, input[5] || 0, input[6] || 0);\n }", "function dateFromArray(input) {\n return new Date(input[0], input[1] || 0, input[2] || 1, input[3] || 0, input[4] || 0, input[5] || 0, inp...
[ "0.70562154", "0.70562154", "0.69697267", "0.6848421", "0.6635893", "0.6460555", "0.61294675", "0.6126646", "0.6066878", "0.60141927", "0.60141927", "0.60141927", "0.60141927", "0.60141927", "0.5960733", "0.5960733", "0.5960733", "0.5900434", "0.5883834", "0.58756566", "0.586...
0.0
-1
date from iso format
function configFromISO(config) { var i, l, string = config._i, match = extendedIsoRegex.exec(string) || basicIsoRegex.exec(string), allowTime, dateFormat, timeFormat, tzFormat; if (match) { getParsingFlags(config).iso = true; for (i = 0, l = isoDates.length; i < l; i++) { if (isoDates[i][1].exec(match[1])) { dateFormat = isoDates[i][0]; allowTime = isoDates[i][2] !== false; break; } } if (dateFormat == null) { config._isValid = false; return; } if (match[3]) { for (i = 0, l = isoTimes.length; i < l; i++) { if (isoTimes[i][1].exec(match[3])) { // match[2] should be 'T' or space timeFormat = (match[2] || ' ') + isoTimes[i][0]; break; } } if (timeFormat == null) { config._isValid = false; return; } } if (!allowTime && timeFormat != null) { config._isValid = false; return; } if (match[4]) { if (tzRegex.exec(match[4])) { tzFormat = 'Z'; } else { config._isValid = false; return; } } config._f = dateFormat + (timeFormat || '') + (tzFormat || ''); configFromStringAndFormat(config); } else { config._isValid = false; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function isoDate(date)\n{\n\treturn date.getFullYear() + \"-\" + (date.getMonth() + 1) + \"-\" + date.getDate()\n}", "function dateFromISO8601(isostr) {\n var parts = isostr.match(/\\d+/g);\n var date = new Date(parts[0], parts[1] - 1, parts[2], parts[3], parts[4], parts[5]);\n var mm = date...
[ "0.7161587", "0.7084152", "0.69561076", "0.68181574", "0.66757625", "0.66372114", "0.6559707", "0.6525335", "0.6466161", "0.6465599", "0.644205", "0.64171946", "0.6406543", "0.6406543", "0.6406543", "0.6406543", "0.63656497", "0.63241196", "0.6322188", "0.62742394", "0.626350...
0.0
-1
date and time from ref 2822 format
function configFromRFC2822(config) { var match = rfc2822.exec(preprocessRFC2822(config._i)); if (match) { var parsedArray = extractFromRFC2822Strings(match[4], match[3], match[2], match[5], match[6], match[7]); if (!checkWeekday(match[1], parsedArray, config)) { return; } config._a = parsedArray; config._tzm = calculateOffset(match[8], match[9], match[10]); config._d = createUTCDate.apply(null, config._a); config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm); getParsingFlags(config).rfc2822 = true; } else { config._isValid = false; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function createDrupalDateFromPieces(date, hour, minute, marker) {\n //Build time\n var time = hour + ':' + minute + ' ' + marker;\n //Build full date\n var dateTime = moment(date + ' ' + time, 'YYYY-MM-DD hh:mm A');\n //Return date in 24-hour format\n return moment(dateTime);\n }",...
[ "0.653082", "0.63895303", "0.6154629", "0.6096161", "0.60804975", "0.605977", "0.60540193", "0.605324", "0.605324", "0.605324", "0.605324", "0.6040541", "0.6028883", "0.6021129", "0.6021129", "0.6021129", "0.6021129", "0.6021129", "0.6021129", "0.6021129", "0.6021129", "0.6...
0.0
-1
date from iso format or fallback
function configFromString(config) { var matched = aspNetJsonRegex.exec(config._i); if (matched !== null) { config._d = new Date(+matched[1]); return; } configFromISO(config); if (config._isValid === false) { delete config._isValid; } else { return; } configFromRFC2822(config); if (config._isValid === false) { delete config._isValid; } else { return; } // Final attempt, use Input Fallback hooks.createFromInputFallback(config); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function isoToDate(s) {\n if (s instanceof Date) { return s; }\n if (typeof s === 'string') { return new Date(s); }\n}", "function isoStringToDate(match){var date=new Date(0);var tzHour=0;var tzMin=0;// match[8] means that the string contains \"Z\" (UTC) or a timezone like \"+01:00\" or \"+0100\"\nvar dateSett...
[ "0.6913624", "0.6697844", "0.6643611", "0.6552669", "0.6552669", "0.6519266", "0.6491801", "0.64860713", "0.64487875", "0.6430311", "0.6430311", "0.6409434", "0.6409434", "0.6405906", "0.64035094", "0.64035094", "0.64035094", "0.64035094", "0.64035094", "0.64035094", "0.64035...
0.0
-1
date from string and format string
function configFromStringAndFormat(config) { // TODO: Move this to another part of the creation flow to prevent circular deps if (config._f === hooks.ISO_8601) { configFromISO(config); return; } if (config._f === hooks.RFC_2822) { configFromRFC2822(config); return; } config._a = []; getParsingFlags(config).empty = true; // This array is used to make a Date, either with `new Date` or `Date.UTC` var string = '' + config._i, i, parsedInput, tokens, token, skipped, stringLength = string.length, totalParsedInputLength = 0; tokens = expandFormat(config._f, config._locale).match(formattingTokens) || []; for (i = 0; i < tokens.length; i++) { token = tokens[i]; parsedInput = (string.match(getParseRegexForToken(token, config)) || [])[0]; // console.log('token', token, 'parsedInput', parsedInput, // 'regex', getParseRegexForToken(token, config)); if (parsedInput) { skipped = string.substr(0, string.indexOf(parsedInput)); if (skipped.length > 0) { getParsingFlags(config).unusedInput.push(skipped); } string = string.slice(string.indexOf(parsedInput) + parsedInput.length); totalParsedInputLength += parsedInput.length; } // don't parse if it's not a known token if (formatTokenFunctions[token]) { if (parsedInput) { getParsingFlags(config).empty = false; } else { getParsingFlags(config).unusedTokens.push(token); } addTimeToArrayFromToken(token, parsedInput, config); } else if (config._strict && !parsedInput) { getParsingFlags(config).unusedTokens.push(token); } } // add remaining unparsed input length to the string getParsingFlags(config).charsLeftOver = stringLength - totalParsedInputLength; if (string.length > 0) { getParsingFlags(config).unusedInput.push(string); } // clear _12h flag if hour is <= 12 if (config._a[HOUR] <= 12 && getParsingFlags(config).bigHour === true && config._a[HOUR] > 0) { getParsingFlags(config).bigHour = undefined; } getParsingFlags(config).parsedDateParts = config._a.slice(0); getParsingFlags(config).meridiem = config._meridiem; // handle meridiem config._a[HOUR] = meridiemFixWrap(config._locale, config._a[HOUR], config._meridiem); configFromArray(config); checkOverflow(config); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function makeDateFromStringAndFormat(string, format) {\n var datePartArray = [0, 0, 1, 0, 0, 0, 0],\n config = {\n tzh : 0, // timezone hour offset\n tzm : 0 // timezone minute offset\n },\n tokens = format.match(formattingTokens),\n ...
[ "0.7544057", "0.7378126", "0.71777546", "0.71777546", "0.71777546", "0.71777546", "0.71671367", "0.7163808", "0.7163808", "0.7163808", "0.7163808", "0.7163808", "0.71498096", "0.71486294", "0.71486294", "0.71486294", "0.70893186", "0.7086403", "0.70293576", "0.70293576", "0.7...
0.0
-1
date from string and array of format strings
function configFromStringAndArray(config) { var tempConfig, bestMoment, scoreToBeat, i, currentScore; if (config._f.length === 0) { getParsingFlags(config).invalidFormat = true; config._d = new Date(NaN); return; } for (i = 0; i < config._f.length; i++) { currentScore = 0; tempConfig = copyConfig({}, config); if (config._useUTC != null) { tempConfig._useUTC = config._useUTC; } tempConfig._f = config._f[i]; configFromStringAndFormat(tempConfig); if (!isValid(tempConfig)) { continue; } // if there is any input that was not parsed add a penalty for that format currentScore += getParsingFlags(tempConfig).charsLeftOver; //or tokens currentScore += getParsingFlags(tempConfig).unusedTokens.length * 10; getParsingFlags(tempConfig).score = currentScore; if (scoreToBeat == null || currentScore < scoreToBeat) { scoreToBeat = currentScore; bestMoment = tempConfig; } } extend(config, bestMoment || tempConfig); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function makeDateFromStringAndArray(string, formats) {\n var output,\n inputParts = string.match(parseMultipleFormatChunker) || [],\n formattedInputParts,\n scoreToBeat = 99,\n i,\n currentDate,\n currentScore;\n for (i = 0; i < format...
[ "0.6992324", "0.6912437", "0.6811143", "0.67375225", "0.67375225", "0.67375225", "0.67375225", "0.67375225", "0.67109895", "0.67109895", "0.67109895", "0.66975677", "0.65970886", "0.65863997", "0.65863997", "0.65736145", "0.65736145", "0.65736145", "0.65736145", "0.65736145", ...
0.0
-1
Pick a moment m from moments so that m[fn](other) is true for all other. This relies on the function fn to be transitive. moments should either be an array of moment objects or an array, whose first element is an array of moment objects.
function pickBy(fn, moments) { var res, i; if (moments.length === 1 && isArray(moments[0])) { moments = moments[0]; } if (!moments.length) { return createLocal(); } res = moments[0]; for (i = 1; i < moments.length; ++i) { if (!moments[i].isValid() || moments[i][fn](res)) { res = moments[i]; } } return res; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function pickBy(fn, moments) {\n var res, i;\n if (moments.length === 1 && isArray(moments[0])) {\n moments = moments[0];\n }\n if (!moments.length) {\n return moment();\n }\n res = moments[0];\n for (i = 1; i < moments.length; ++i) {\n ...
[ "0.76116085", "0.76116085", "0.76116085", "0.76116085", "0.76116085", "0.76116085", "0.76116085", "0.76116085", "0.76116085", "0.76116085", "0.76116085", "0.76116085", "0.76116085", "0.76116085", "0.76116085", "0.76116085", "0.76116085", "0.76116085", "0.76116085", "0.76116085"...
0.0
-1
TODO: Use [].sort instead?
function min () { var args = [].slice.call(arguments, 0); return pickBy('isBefore', args); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "sort() {\n\t}", "sort() {\n\t}", "function Sort() {}", "sort(){\n\n }", "function sortItems(arr) {\r\n return arr.sort();\r\n}", "function sort(theArray){\n\n}", "function arrangeElements( array ) {\r\n\tarray = array.sort();\r\n\treturn array;\r\n}", "function alfa (arr){\n\tfor (var i = 0; i<...
[ "0.76896363", "0.76896363", "0.7431174", "0.7381352", "0.7223031", "0.7044736", "0.7002338", "0.697896", "0.69405884", "0.68795085", "0.6870758", "0.6870758", "0.68334246", "0.68275315", "0.6821634", "0.67999935", "0.6789589", "0.67690444", "0.6720508", "0.67083323", "0.67058...
0.0
-1
Return a moment from input, that is local/utc/zone equivalent to model.
function cloneWithOffset(input, model) { var res, diff; if (model._isUTC) { res = model.clone(); diff = (isMoment(input) || isDate(input) ? input.valueOf() : createLocal(input).valueOf()) - res.valueOf(); // Use low-level api, because this fn is low-level api. res._d.setTime(res._d.valueOf() + diff); hooks.updateOffset(res, false); return res; } else { return createLocal(input).local(); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function makeAs(input, model) {\n\t return model._isUTC ? moment(input).zone(model._offset || 0) :\n\t moment(input).local();\n\t }", "function makeAs(input, model) {\n return model._isUTC ? moment(input).zone(model._offset || 0) :\n moment(input).local();\n }", "funct...
[ "0.8500792", "0.84180975", "0.84180975", "0.84180975", "0.84180975", "0.84180975", "0.84180975", "0.84180975", "0.84180975", "0.84180975", "0.84180975", "0.84180975", "0.84180975", "0.84180975", "0.84180975", "0.84180975", "0.84180975", "0.84180975", "0.7952661", "0.79354805", ...
0.0
-1
MOMENTS keepLocalTime = true means only change the timezone, without affecting the local hour. So 5:31:26 +0300 [utcOffset(2, true)]> 5:31:26 +0200 It is possible that 5:31:26 doesn't exist with offset +0200, so we adjust the time as needed, to be valid. Keeping the time actually adds/subtracts (one hour) from the actual represented time. That is why we call updateOffset a second time. In case it wants us to change the offset again _changeInProgress == true case, then we have to adjust, because there is no such time in the given timezone.
function getSetOffset (input, keepLocalTime, keepMinutes) { var offset = this._offset || 0, localAdjust; if (!this.isValid()) { return input != null ? this : NaN; } if (input != null) { if (typeof input === 'string') { input = offsetFromString(matchShortOffset, input); if (input === null) { return this; } } else if (Math.abs(input) < 16 && !keepMinutes) { input = input * 60; } if (!this._isUTC && keepLocalTime) { localAdjust = getDateOffset(this); } this._offset = input; this._isUTC = true; if (localAdjust != null) { this.add(localAdjust, 'm'); } if (offset !== input) { if (!keepLocalTime || this._changeInProgress) { addSubtract(this, createDuration(input - offset, 'm'), 1, false); } else if (!this._changeInProgress) { this._changeInProgress = true; hooks.updateOffset(this, true); this._changeInProgress = null; } } return this; } else { return this._isUTC ? offset : getDateOffset(this); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getSetOffset(input,keepLocalTime){var offset=this._offset||0,localAdjust;if(!this.isValid()){return input!=null?this:NaN;}if(input!=null){if(typeof input==='string'){input=offsetFromString(matchShortOffset,input);}else if(Math.abs(input)<16){input=input*60;}if(!this._isUTC&&keepLocalTime){localAdjust=getD...
[ "0.6656456", "0.6656456", "0.6616619", "0.6616619", "0.6616619", "0.6616619", "0.6616619", "0.6616619", "0.6616619", "0.6616619", "0.6616619", "0.6616619", "0.6616619", "0.6616619", "0.6616619", "0.6616619", "0.6616619", "0.6616619", "0.6616619", "0.6616619", "0.6616619", "...
0.0
-1
TODO: remove 'name' arg after deprecation is removed
function createAdder(direction, name) { return function (val, period) { var dur, tmp; //invert the arguments, but complain about it if (period !== null && !isNaN(+period)) { deprecateSimple(name, 'moment().' + name + '(period, number) is deprecated. Please use moment().' + name + '(number, period). ' + 'See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info.'); tmp = val; val = period; period = tmp; } val = typeof val === 'string' ? +val : val; dur = createDuration(val, period); addSubtract(this, dur, direction); return this; }; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "setName(name) { }", "constructor(name) {\n super(name);\n this.name = name;\n }", "constructor(name) {\n this.name = name;\n }", "constructor(name) {\n this.name = name;\n }", "constructor(name) {\n this.name = name;\n }", "constructor(name) {\n this.name = name;\n }", "construct...
[ "0.67782986", "0.6759405", "0.67381084", "0.67381084", "0.67381084", "0.67381084", "0.6733258", "0.6733258", "0.67120683", "0.66484624", "0.6612438", "0.6540716", "0.65202653", "0.65195", "0.6489472", "0.6465985", "0.6462259", "0.6415414", "0.6381141", "0.6297654", "0.6276111...
0.0
-1
Return a human readable representation of a moment that can also be evaluated to get a new moment which is the same
function inspect () { if (!this.isValid()) { return 'moment.invalid(/* ' + this._i + ' */)'; } var func = 'moment'; var zone = ''; if (!this.isLocal()) { func = this.utcOffset() === 0 ? 'moment.utc' : 'moment.parseZone'; zone = 'Z'; } var prefix = '[' + func + '("]'; var year = (0 <= this.year() && this.year() <= 9999) ? 'YYYY' : 'YYYYYY'; var datetime = '-MM-DD[T]HH:mm:ss.SSS'; var suffix = zone + '[")]'; return this.format(prefix + year + datetime + suffix); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function inspect(){if(!this.isValid()){return'moment.invalid(/* '+this._i+' */)';}var func='moment';var zone='';if(!this.isLocal()){func=this.utcOffset()===0?'moment.utc':'moment.parseZone';zone='Z';}var prefix='['+func+'(\"]';var year=0<=this.year()&&this.year()<=9999?'YYYY':'YYYYYY';var datetime='-MM-DD[T]HH:mm:...
[ "0.7135807", "0.7135807", "0.71200997", "0.70935315", "0.70811427", "0.70811427", "0.70811427", "0.70811427", "0.70571965", "0.70571965", "0.70571965", "0.70571965", "0.70571965", "0.70571965", "0.70571965", "0.70571965", "0.70571965", "0.70571965", "0.70571965", "0.70571965", ...
0.0
-1
If passed a locale key, it will set the locale for this instance. Otherwise, it will return the locale configuration variables for this instance.
function locale (key) { var newLocaleData; if (key === undefined) { return this._locale._abbr; } else { newLocaleData = getLocale(key); if (newLocaleData != null) { this._locale = newLocaleData; } return this; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function locale(key){var newLocaleData;if(key===undefined){return this._locale._abbr;}else{newLocaleData=getLocale(key);if(newLocaleData!=null){this._locale=newLocaleData;}return this;}}", "function locale(key){var newLocaleData;if(key===undefined){return this._locale._abbr;}else{newLocaleData=getLocale(key);if(...
[ "0.7286929", "0.7286929", "0.723348", "0.7206655", "0.7206655", "0.7091514", "0.7091514", "0.7091514", "0.7091514", "0.7091514", "0.7091514", "0.7091514", "0.7091514", "0.7091514", "0.7091514", "0.7091514", "0.7091514", "0.7091514", "0.7091514", "0.7091514", "0.7091514", "0...
0.0
-1
actual modulo handles negative numbers (for dates before 1970):
function mod$1(dividend, divisor) { return (dividend % divisor + divisor) % divisor; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function mod (x, y) {return x < 0? y - (-x % y) : x % y;}", "function testRemainder_17() {\n assertEquals(-0, -0 % Number.MAX_VALUE);\n}", "function moduloWithNegativeZeroDividend(a, b, c)\n{\n var temp = a * b;\n return temp % c;\n}", "function modulo(dividend, divisor)\n{\n var epsilon = divisor ...
[ "0.70104235", "0.69869745", "0.6744497", "0.6722426", "0.6722426", "0.6722426", "0.6700196", "0.66672075", "0.6644362", "0.66419977", "0.6620504", "0.6617394", "0.6583436", "0.65654695", "0.65529805", "0.65529805", "0.65529805", "0.6544862", "0.65278447", "0.64930606", "0.648...
0.0
-1
() (5) (fmt, 5) (fmt) (true) (true, 5) (true, fmt, 5) (true, fmt)
function listWeekdaysImpl (localeSorted, format, index, field) { if (typeof localeSorted === 'boolean') { if (isNumber(format)) { index = format; format = undefined; } format = format || ''; } else { format = localeSorted; index = format; localeSorted = false; if (isNumber(format)) { index = format; format = undefined; } format = format || ''; } var locale = getLocale(), shift = localeSorted ? locale._week.dow : 0; if (index != null) { return get$1(format, (index + shift) % 7, field, 'day'); } var i; var out = []; for (i = 0; i < 7; i++) { out[i] = get$1(format, (i + shift) % 7, field, 'day'); } return out; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function foo5(a /* : number */, a2 /* : number */) /* : string => boolean => Foo */ {\n return s => b => ({\n moom: b,\n soup: s,\n nmb: a + a2 + 1\n })\n}", "function P$4(t){return t?[l$b(t[0]),l$b(t[1]),l$b(t[2]),l$b(t[3]),l$b(t[4]),l$b(t[5])]:[l$b(),l$b(),l$b(),l$b(),l$b(),l$b()]}", "funct...
[ "0.54520625", "0.54125756", "0.54015124", "0.5300545", "0.52498543", "0.51416755", "0.5129984", "0.5089496", "0.49964607", "0.49952304", "0.4973966", "0.4964228", "0.49168083", "0.4914914", "0.4910557", "0.49089327", "0.49089327", "0.49089327", "0.49089327", "0.49089327", "0....
0.0
-1
supports only 2.0style add(1, 's') or add(duration)
function add$1 (input, value) { return addSubtract$1(this, input, value, 1); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function Duration(time) {\n var d = document.createElement('span');\n d.classList.add('duration');\n d.innerText = time;\n return d;\n}", "function duration_add_subtract__add (input, value) {\n\t return duration_add_subtract__addSubtract(this, input, value, 1);\n\t }", "function duration_add_subt...
[ "0.64308345", "0.6108279", "0.6108279", "0.6108279", "0.6108279", "0.6108279", "0.6108279", "0.6108279", "0.6108279", "0.6108279", "0.6108279", "0.6108279", "0.6108279", "0.608478", "0.60591125", "0.60149765", "0.60149765", "0.6010823", "0.5894448", "0.5894448", "0.5894448", ...
0.0
-1
supports only 2.0style subtract(1, 's') or subtract(duration)
function subtract$1 (input, value) { return addSubtract$1(this, input, value, -1); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function duration_add_subtract__subtract (input, value) {\n\t return duration_add_subtract__addSubtract(this, input, value, -1);\n\t }", "function duration_add_subtract__subtract (input, value) {\n\t return duration_add_subtract__addSubtract(this, input, value, -1);\n\t }", "function durati...
[ "0.7400228", "0.7400228", "0.7400228", "0.7400228", "0.7400228", "0.7400228", "0.7400228", "0.7400228", "0.7400228", "0.7400228", "0.7400228", "0.7400228", "0.73801476", "0.7363223", "0.7363223", "0.72737086", "0.72737086", "0.72737086", "0.72737086", "0.72737086", "0.7273708...
0.0
-1
helper function for moment.fn.from, moment.fn.fromNow, and moment.duration.fn.humanize
function substituteTimeAgo(string, number, withoutSuffix, isFuture, locale) { return locale.relativeTime(number || 1, !!withoutSuffix, string, isFuture); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function $a(a,b){var c;\n// moment.duration._locale = moment._locale = data;\nreturn a&&(c=p(b)?bb(a):_a(a,b),c&&(vf=c)),vf._abbr}", "function $a(a,b){var c;\n// moment.duration._locale = moment._locale = data;\nreturn a&&(c=p(b)?bb(a):_a(a,b),c&&(vf=c)),vf._abbr}", "function $a(a,b){var c;\n// moment.duration...
[ "0.6559775", "0.6559775", "0.6559775", "0.6559775", "0.64748263", "0.6382462", "0.6327351", "0.6327351", "0.6327351", "0.6327351", "0.6327351", "0.6327351", "0.6327351", "0.6327351", "0.6327351", "0.6212573", "0.61233556", "0.61233556", "0.60977244", "0.60977244", "0.60977244...
0.0
-1
This function allows you to set the rounding function for relative time strings
function getSetRelativeTimeRounding (roundingFunction) { if (roundingFunction === undefined) { return round; } if (typeof(roundingFunction) === 'function') { round = roundingFunction; return true; } return false; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function duration_humanize__getSetRelativeTimeRounding (roundingFunction) {\n if (roundingFunction === undefined) {\n return round;\n }\n if (typeof(roundingFunction) === 'function') {\n round = roundingFunction;\n return true;\n }\n ...
[ "0.72622484", "0.72409254", "0.72409254", "0.72409254", "0.72409254", "0.72409254", "0.72409254", "0.72409254", "0.70998174", "0.70998174", "0.70998174", "0.70998174", "0.70998174", "0.70998174", "0.70998174", "0.70998174", "0.70998174", "0.70998174", "0.70998174", "0.70998174"...
0.0
-1
This function allows you to set a threshold for relative time strings
function getSetRelativeTimeThreshold (threshold, limit) { if (thresholds[threshold] === undefined) { return false; } if (limit === undefined) { return thresholds[threshold]; } thresholds[threshold] = limit; if (threshold === 's') { thresholds.ss = limit - 1; } return true; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getSetRelativeTimeThreshold (threshold, limit) {\n if (thresholds[threshold] === undefined) {\n return false;\n }\n if (limit === undefined) {\n return thresholds[threshold];\n }\n thresholds[threshold] = limit;\n if (threshol...
[ "0.69783336", "0.69343334", "0.69072294", "0.69072294", "0.69072294", "0.69072294", "0.69072294", "0.69072294", "0.6901369", "0.6901369", "0.6901369", "0.6901369", "0.6901369", "0.6901369", "0.6895151", "0.68865347", "0.6871718", "0.6841288", "0.6824244", "0.6824244", "0.6824...
0.0
-1
The Buffer constructor returns instances of `Uint8Array` that have their prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of `Uint8Array`, so the returned instances will have all the node `Buffer` methods and the `Uint8Array` methods. Square bracket notation works as expected it returns a single octet. The `Uint8Array` prototype remains unmodified.
function Buffer (arg, encodingOrOffset, length) { // Common case. if (typeof arg === 'number') { if (typeof encodingOrOffset === 'string') { throw new TypeError( 'The "string" argument must be of type string. Received type number' ) } return allocUnsafe(arg) } return from(arg, encodingOrOffset, length) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function BufferToArrayBuffer () {\n return (new Buffer(this)).buffer\n}", "function BufferToArrayBuffer () {\n return (new Buffer(this)).buffer\n}", "function BufferToArrayBuffer () {\n return (new Buffer(this)).buffer\n}", "function BufferToArrayBuffer () {\n return (new Buffer(this)).buffer\n}", "toB...
[ "0.7353032", "0.7353032", "0.7353032", "0.7353032", "0.6973215", "0.6893831", "0.6893831", "0.6847244", "0.6847244", "0.6847244", "0.6847244", "0.6847244", "0.6847244", "0.6847244", "0.6837017", "0.6837017", "0.6837017", "0.6837017", "0.6837017", "0.6837017", "0.6837017", "...
0.0
-1
Finds either the first index of `val` in `buffer` at offset >= `byteOffset`, OR the last index of `val` in `buffer` at offset <= `byteOffset`. Arguments: buffer a Buffer to search val a string, Buffer, or number byteOffset an index into `buffer`; will be clamped to an int32 encoding an optional encoding, relevant is val is a string dir true for indexOf, false for lastIndexOf
function bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) { // Empty buffer means no match if (buffer.length === 0) return -1 // Normalize byteOffset if (typeof byteOffset === 'string') { encoding = byteOffset byteOffset = 0 } else if (byteOffset > 0x7fffffff) { byteOffset = 0x7fffffff } else if (byteOffset < -0x80000000) { byteOffset = -0x80000000 } byteOffset = +byteOffset // Coerce to Number. if (numberIsNaN(byteOffset)) { // byteOffset: it it's undefined, null, NaN, "foo", etc, search whole buffer byteOffset = dir ? 0 : (buffer.length - 1) } // Normalize byteOffset: negative offsets start from the end of the buffer if (byteOffset < 0) byteOffset = buffer.length + byteOffset if (byteOffset >= buffer.length) { if (dir) return -1 else byteOffset = buffer.length - 1 } else if (byteOffset < 0) { if (dir) byteOffset = 0 else return -1 } // Normalize val if (typeof val === 'string') { val = Buffer.from(val, encoding) } // Finally, search either indexOf (if dir is true) or lastIndexOf if (Buffer.isBuffer(val)) { // Special case: looking for empty string/buffer always fails if (val.length === 0) { return -1 } return arrayIndexOf(buffer, val, byteOffset, encoding, dir) } else if (typeof val === 'number') { val = val & 0xFF // Search for a byte value [0-255] if (typeof Uint8Array.prototype.indexOf === 'function') { if (dir) { return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset) } else { return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset) } } return arrayIndexOf(buffer, [val], byteOffset, encoding, dir) } throw new TypeError('val must be string, number or Buffer') }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function bidirectionalIndexOf(buffer,val,byteOffset,encoding,dir){// Empty buffer means no match\n if(buffer.length===0)return -1;// Normalize byteOffset\n if(typeof byteOffset==='string'){encoding=byteOffset;byteOffset=0;}else if(byteOffset>0x7fffffff){byteOffset=0x7fffffff;}else if(byteOffset<-0x80000000){byte...
[ "0.8282926", "0.8255244", "0.8255244", "0.8253898", "0.8253898", "0.8253898", "0.8253898", "0.8253898", "0.8253898", "0.8253898", "0.8253898", "0.82487696", "0.82464457", "0.8244766", "0.8244766", "0.82286805", "0.82205904", "0.82192326", "0.82192326", "0.82192326", "0.821923...
0.0
-1
Need to make sure that buffer isn't trying to write out of bounds.
function checkOffset (offset, ext, length) { if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint') if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length') }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function writeBuffer(buffer, pos, src) {\n src.copy(buffer, pos)\n return src.length\n}", "function writeBuffer(buffer, pos, src) {\n src.copy(buffer, pos)\n return src.length\n}", "ensure(n) {\n let minsize = this.pos + n;\n if (minsize > this.capacity) {\n let cap = this.capacity * 2;\n w...
[ "0.66712785", "0.66712785", "0.6632945", "0.65210676", "0.63827264", "0.62754023", "0.62562263", "0.62335545", "0.62335545", "0.61056054", "0.6035937", "0.6017502", "0.59810936", "0.5959609", "0.5951102", "0.5951102", "0.5951102", "0.5951102", "0.5951102", "0.5951102", "0.595...
0.0
-1
ArrayBuffer or Uint8Array objects from other contexts (i.e. iframes) do not pass the `instanceof` check but they should be treated as of that type. See:
function isInstance (obj, type) { return obj instanceof type || (obj != null && obj.constructor != null && obj.constructor.name != null && obj.constructor.name === type.name) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function isArrayBuffer (o) { return o instanceof ArrayBuffer }", "function isArrayBuffer (o) { return o instanceof ArrayBuffer }", "function isArrayBuffer(value) {\n return typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer;\n}", "function isArrayBuffer(value) {\n return typeof ArrayBuf...
[ "0.6930499", "0.6930499", "0.66416276", "0.66416276", "0.66416276", "0.66416276", "0.66416276", "0.66416276", "0.66416276", "0.66416276", "0.66416276", "0.66416276", "0.66416276", "0.66416276", "0.66416276", "0.66147846", "0.6572228", "0.6572228", "0.65621686", "0.6551051", "...
0.0
-1
These standalone emit functions are used to optimize calling of event handlers for fast cases because emit() itself often has a variable number of arguments and can be deoptimized because of that. These functions always have the same number of arguments and thus do not get deoptimized, so the code inside them can execute faster.
function emitNone(handler, isFn, self) { if (isFn) handler.call(self); else { var len = handler.length; var listeners = arrayClone(handler, len); for (var i = 0; i < len; ++i) listeners[i].call(self); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "emit(...args) {\n this._event_dispatcher.$emit(...args);\n }", "function emitAsync(args){\n\t\tsetTimeout(function(){\n\t\t\temit.apply(evented, args);\n\t\t}, 0);\n\t}", "function emitEvent(fn) {\n if (typeof fn != 'function') return\n\n var args = [].slice.call(arguments, 1)\n return fn.apply(null, ar...
[ "0.6524171", "0.6403223", "0.634626", "0.6194433", "0.6063215", "0.604239", "0.5946616", "0.5925932", "0.5901471", "0.58936495", "0.5877004", "0.5867342", "0.5861124", "0.58575964", "0.5846938", "0.5846938", "0.58239335", "0.58167434", "0.5793601", "0.5793601", "0.5792203", ...
0.0
-1
About 1.5x faster than the twoarg version of Arraysplice().
function spliceOne(list, index) { for (var i = index, k = i + 1, n = list.length; k < n; i += 1, k += 1) list[i] = list[k]; list.pop(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "static fastSplice(arr, startIdx, removeCount) {\n let i, length = arr.length;\n if (startIdx >= length || removeCount === 0) {\n return;\n }\n removeCount = (startIdx + removeCount > length ? length - startIdx : removeCount);\n let len = length - removeCount;\n ...
[ "0.7395812", "0.71519256", "0.7065192", "0.7012039", "0.6878061", "0.6753091", "0.67074555", "0.66961807", "0.66882205", "0.6687342", "0.6681239", "0.6679162", "0.6678183", "0.66775954", "0.66335577", "0.6621636", "0.65752155", "0.6558999", "0.6531689", "0.65295357", "0.64876...
0.0
-1
v8 likes predictible objects
function Item(fun, array) { this.fun = fun; this.array = array; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function compareLike(a,b){\n var al = a.idLikesProp.length;\n var bl = b.idLikesProp.length;\n if(al > bl) return -1;\n if(bl > al) return 1;\n return 0;\n}", "function lookAround() {\n var objectDescription = \"\"\n tj.see().then(function(objects) {\n objects.forEach(function(each) {\n ...
[ "0.527866", "0.52612406", "0.51951283", "0.518796", "0.51302594", "0.5044646", "0.48934332", "0.4857401", "0.484017", "0.48302925", "0.482028", "0.4812441", "0.4808473", "0.47852293", "0.47828078", "0.47574478", "0.47493434", "0.4739314", "0.47239366", "0.4703992", "0.4703992...
0.0
-1
Currently only WebKitbased Web Inspectors, Firefox >= v31, and the Firebug extension (any Firefox version) are known to support "%c" CSS customizations. TODO: add a `localStorage` variable to explicitly enable/disable colors
function useColors() { // NB: In an Electron preload script, document will be defined but not fully // initialized. Since we know we're in Chrome, we'll just detect this case // explicitly if (typeof window !== 'undefined' && window.process && window.process.type === 'renderer') { return true; } // is webkit? http://stackoverflow.com/a/16459606/376773 // document is undefined in react-native: https://github.com/facebook/react-native/pull/1632 return (typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance) || // is firebug? http://stackoverflow.com/a/398120/376773 (typeof window !== 'undefined' && window.console && (window.console.firebug || (window.console.exception && window.console.table))) || // is firefox >= v31? // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31) || // double check webkit in userAgent just in case we are in a worker (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function useColors(){ // is webkit? http://stackoverflow.com/a/16459606/376773\nreturn 'WebkitAppearance' in document.documentElement.style || // is firebug? http://stackoverflow.com/a/398120/376773\nwindow.console && (console.firebug || console.exception && console.table) || // is firefox >= v31?\n// https://de...
[ "0.67635036", "0.6297456", "0.6297456", "0.6297456", "0.6252116", "0.6252116", "0.6252116", "0.6252116", "0.6252116", "0.6252116", "0.6252116", "0.6252116", "0.6252116", "0.6252116", "0.6252116", "0.6252116", "0.6252116", "0.6252116", "0.6252116", "0.6252116", "0.6252116", ...
0.0
-1
Colorize log arguments if enabled.
function formatArgs(args) { var useColors = this.useColors; args[0] = (useColors ? '%c' : '') + this.namespace + (useColors ? ' %c' : ' ') + args[0] + (useColors ? '%c ' : ' ') + '+' + _$browser_913.humanize(this.diff); if (!useColors) return; var c = 'color: ' + this.color; args.splice(1, 0, c, 'color: inherit') // the final "%c" is somewhat tricky, because there could be other // arguments passed either before or after the %c, so we need to // figure out the correct index to insert the CSS into var index = 0; var lastC = 0; args[0].replace(/%[a-zA-Z%]/g, function(match) { if ('%%' === match) return; index++; if ('%c' === match) { // we only are interested in the *last* %c // (the user may have provided their own) lastC = index; } }); args.splice(lastC, 0, c); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "log(...args) {\n console.log(this.getColorOn() + args.join(\" \"));\n }", "function writelnColor(){\n\t\tfor(var i=0; i<arguments.length; i=i+2)\n\t\t\tgrunt.log.write(arguments[i][arguments[i+1]]);\n\t\tgrunt.log.writeln('');\n\t}", "debug(...args) {\n console.debug(this.getColorOn() + args.join(...
[ "0.6760166", "0.6711751", "0.65307504", "0.65290976", "0.65290976", "0.65290976", "0.6475225", "0.64737195", "0.64728016", "0.6462169", "0.645757", "0.6455942", "0.6453729", "0.64420164", "0.64335275", "0.64298606", "0.642863", "0.6418752", "0.6418752", "0.6418752", "0.641875...
0.0
-1
Invokes `console.log()` when available. Noop when `console.log` is not a "function".
function log() { // this hackery is required for IE8/9, where // the `console.log` function doesn't have 'apply' return 'object' === typeof console && console.log && Function.prototype.apply.call(console.log, console, arguments); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function log() {\n if (window.console) console.log.apply(console,arguments);\n}", "function consoleLog() {\n if (typeof(console) == 'object' && typeof(console[\"log\"]) != \"undefined\") {\n console.log.apply(console, arguments);\n }\n}", "function L() {\n if (window.console && console.log) {\n ...
[ "0.7739394", "0.7717552", "0.77075", "0.76093554", "0.7566829", "0.7566829", "0.7531627", "0.7490471", "0.7414659", "0.7336425", "0.73305815", "0.7329548", "0.7324058", "0.73122233", "0.73095244", "0.73095244", "0.73095244", "0.73095244", "0.73095244", "0.73051697", "0.730516...
0.0
-1
base64 is 4/3 + up to two characters of the original data
function byteLength (b64) { var lens = getLens(b64) var validLen = lens[0] var placeHoldersLen = lens[1] return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "getBase64() {\n var s = this.getDump();\n\n var ch =\n \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\";\n var c1, c2, c3, e1, e2, e3, e4;\n var l = s.length;\n var i = 0;\n var r = \"\";\n\n do {\n c1 = s.charCodeAt(i);\n e1 = c1 >> 2;\n c2 = s.charCod...
[ "0.77057606", "0.7324507", "0.72870255", "0.7230772", "0.7183817", "0.71231633", "0.7105772", "0.7089243", "0.7062078", "0.6977857", "0.6975599", "0.6933752", "0.6899215", "0.6899215", "0.6893997", "0.6879304", "0.68740326", "0.68740326", "0.68538475", "0.68362004", "0.681601...
0.0
-1
FUNCTIONS // Dummy constructor.
function Ctor() { // Empty... }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "constructor (){}", "constructur() {}", "constructor( ) {}", "constructor(){}", "constructor(){}", "constructor(){}", "constructor(){}", "constructor(){}", "constructor(){}", "constructor(){}", "function _construct()\n\t\t{;\n\t\t}", "function Constructor() {}", "function Constructor() {}", ...
[ "0.85090643", "0.84665614", "0.845112", "0.8285781", "0.8285781", "0.8285781", "0.8285781", "0.8285781", "0.8285781", "0.8285781", "0.8145793", "0.8120852", "0.8120852", "0.8120852", "0.81043327", "0.81043327", "0.81043327", "0.81043327", "0.81043327", "0.81043327", "0.810433...
0.793029
52
eslintdisableline maxlen FUNCTIONS // Dummy constructor.
function Dummy() {}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "constructor( ) {}", "function Constructor() {}", "function Constructor() {}", "function Constructor() {}", "constructur() {}", "constructor() {}", "constructor() {}", "constructor() {}", "constructor() {}", "constructor() {}", "constructor() {}", "constructor() {}", "constructor() {}", "c...
[ "0.73958194", "0.73035824", "0.73035824", "0.73035824", "0.7241961", "0.72391737", "0.72391737", "0.72391737", "0.72391737", "0.72391737", "0.72391737", "0.72391737", "0.72391737", "0.72391737", "0.72391737", "0.72391737", "0.72391737", "0.72391737", "0.72391737", "0.72391737",...
0.0
-1
From FvD 13.37, CSS Color Module Level 3
function hsl2rgb(h, m1, m2) { return (h < 60 ? m1 + (m2 - m1) * h / 60 : h < 180 ? m2 : h < 240 ? m1 + (m2 - m1) * (240 - h) / 60 : m1) * 255; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function Colour(){\n\n /* Returns an object representing the RGBA components of this Colour. The red,\n * green, and blue components are converted to integers in the range [0,255].\n * The alpha is a value in the range [0,1].\n */\n this.getIntegerRGB = function(){\n\n // get the RGB components of this ...
[ "0.7089194", "0.7050894", "0.70180076", "0.6918326", "0.69088155", "0.6865348", "0.6787769", "0.6779162", "0.67433536", "0.6725297", "0.6723463", "0.6701248", "0.66937774", "0.66653216", "0.6639698", "0.66359454", "0.66359454", "0.66359454", "0.66295534", "0.66295534", "0.662...
0.0
-1
p0 = [ux0, uy0, w0] p1 = [ux1, uy1, w1]
function zoom(p0, p1) { var ux0 = p0[0], uy0 = p0[1], w0 = p0[2], ux1 = p1[0], uy1 = p1[1], w1 = p1[2], dx = ux1 - ux0, dy = uy1 - uy0, d2 = dx * dx + dy * dy, i, S; // Special case for u0 ≅ u1. if (d2 < epsilon2) { S = Math.log(w1 / w0) / rho; i = function(t) { return [ ux0 + t * dx, uy0 + t * dy, w0 * Math.exp(rho * t * S) ]; }; } // General case. else { var d1 = Math.sqrt(d2), b0 = (w1 * w1 - w0 * w0 + rho4 * d2) / (2 * w0 * rho2 * d1), b1 = (w1 * w1 - w0 * w0 - rho4 * d2) / (2 * w1 * rho2 * d1), r0 = Math.log(Math.sqrt(b0 * b0 + 1) - b0), r1 = Math.log(Math.sqrt(b1 * b1 + 1) - b1); S = (r1 - r0) / rho; i = function(t) { var s = t * S, coshr0 = cosh(r0), u = w0 / (rho2 * d1) * (coshr0 * tanh(rho * s + r0) - sinh(r0)); return [ ux0 + u * dx, uy0 + u * dy, w0 * coshr0 / cosh(rho * s + r0) ]; }; } i.duration = S * 1000; return i; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function pu(a,b){this.$h=[];this.vo=a;this.ym=b||null;this.Af=this.re=!1;this.Jc=void 0;this.jl=this.wq=this.Pi=!1;this.oi=0;this.L=null;this.Si=0}", "function mul( p0, p1 ) {\n return {x: p0.x * p1.x, y: p0.y * p1.y};\n}", "function ip(v0, v1){\r\n return v0.x*v1.x+v0.y*v1.y+v0.z*v1.z;\r\n}", "Pistol() {...
[ "0.60834116", "0.5920651", "0.5779755", "0.5689053", "0.56599534", "0.5659321", "0.5597352", "0.55253756", "0.55253756", "0.55253756", "0.55253756", "0.5474401", "0.54669297", "0.5466692", "0.54463005", "0.5383259", "0.53486145", "0.5294024", "0.5282052", "0.52651596", "0.523...
0.0
-1
Computes the decimal coefficient and exponent of the specified number x with significant digits p, where x is positive and p is in [1, 21] or undefined. For example, formatDecimal(1.23) returns ["123", 0].
function formatDecimal(x, p) { if ((i = (x = p ? x.toExponential(p - 1) : x.toExponential()).indexOf("e")) < 0) return null; // NaN, ±Infinity var i, coefficient = x.slice(0, i); // The string returned by toExponential either has the form \d\.\d+e[-+]\d+ // (e.g., 1.2e+3) or the form \de[-+]\d+ (e.g., 1e+3). return [ coefficient.length > 1 ? coefficient[0] + coefficient.slice(2) : coefficient, +x.slice(i + 1) ]; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function formatDecimal(x, p) {\n if ((i = (x = p ? x.toExponential(p - 1) : x.toExponential()).indexOf(\"e\")) < 0) return null; // NaN, ±Infinity\n var i, coefficient = x.slice(0, i);\n\n // The string returned by toExponential either has the form \\d\\.\\d+e[-+]\\d+\n // (e.g., 1.2e+3) or the...
[ "0.8267669", "0.8267669", "0.82674587", "0.82674587", "0.82674587", "0.82674587", "0.82674587", "0.82674587", "0.82674587", "0.8245311", "0.823352", "0.823352", "0.823352", "0.821987", "0.821662", "0.821662", "0.821662", "0.81836796", "0.80449224", "0.80319804", "0.80319804",...
0.82380456
14
Trims insignificant zeros, e.g., replaces 1.2000k with 1.2k.
function formatTrim(s) { out: for (var n = s.length, i = 1, i0 = -1, i1; i < n; ++i) { switch (s[i]) { case ".": i0 = i1 = i; break; case "0": if (i0 === 0) i0 = i; i1 = i; break; default: if (i0 > 0) { if (!+s[i]) break out; i0 = 0; } break; } } return i0 > 0 ? s.slice(0, i0) + s.slice(i1 + 1) : s; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function stripZero(num){\n return parseFloat(a.toFixed(4));\n}", "function removeZeros(value) {\n if (value.indexOf('.') !== -1) {\n while (value[value.length - 1] === '0') {\n value = value.substring(0, value.length - 1);\n }\n if (value[value.length - 1] === '.') {\n value = value.substr...
[ "0.68889534", "0.6851092", "0.65857196", "0.6565163", "0.64634806", "0.63949716", "0.6363541", "0.6351559", "0.63513404", "0.6247222", "0.62280047", "0.62115145", "0.619423", "0.61817855", "0.6175368", "0.6175368", "0.6171408", "0.6171158", "0.6164902", "0.6164902", "0.616490...
0.6158505
23
deinterpolate(a, b)(x) takes a domain value x in [a,b] and returns the corresponding parameter t in [0,1]. reinterpolate(a, b)(t) takes a parameter t in [0,1] and returns the corresponding domain value x in [a,b].
function continuous(deinterpolate, reinterpolate) { var domain = unit, range$$1 = unit, interpolate$$1 = d3Interpolate.interpolate, clamp = false, piecewise, output, input; function rescale() { piecewise = Math.min(domain.length, range$$1.length) > 2 ? polymap : bimap; output = input = null; return scale; } function scale(x) { return (output || (output = piecewise(domain, range$$1, clamp ? deinterpolateClamp(deinterpolate) : deinterpolate, interpolate$$1)))(+x); } scale.invert = function(y) { return (input || (input = piecewise(range$$1, domain, deinterpolateLinear, clamp ? reinterpolateClamp(reinterpolate) : reinterpolate)))(+y); }; scale.domain = function(_) { return arguments.length ? (domain = map$1.call(_, number), rescale()) : domain.slice(); }; scale.range = function(_) { return arguments.length ? (range$$1 = slice.call(_), rescale()) : range$$1.slice(); }; scale.rangeRound = function(_) { return range$$1 = slice.call(_), interpolate$$1 = d3Interpolate.interpolateRound, rescale(); }; scale.clamp = function(_) { return arguments.length ? (clamp = !!_, rescale()) : clamp; }; scale.interpolate = function(_) { return arguments.length ? (interpolate$$1 = _, rescale()) : interpolate$$1; }; return rescale(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function _interpolate(a, b, t) {\n\t return ((1 - t) * a) + (t * b);\n\t }", "function _interpolate(a, b, t) {\n return ((1 - t) * a) + (t * b);\n }", "function _interpolate(a, b, t) {\n return ((1 - t) * a) + (t * b);\n }", "function continuous(deinterpolate,reinterpolate){var ...
[ "0.67090166", "0.6664758", "0.6664758", "0.63704807", "0.63488925", "0.6339267", "0.6263025", "0.62424994", "0.62424994", "0.6228663", "0.6228663", "0.6228663", "0.6228663", "0.6223167", "0.6223167", "0.6223167", "0.62195826", "0.6211459", "0.6211459", "0.6211459", "0.6211459...
0.6310586
9
Should skip false boolean attributes.
function shouldSkip(name, value) { var attrType = __properties_929[name]; return value == null || (attrType === __types_929.BOOLEAN && !value) || (attrType === __types_929.OVERLOADED_BOOLEAN && value === false); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function shouldSkip(name, value) {\n\tvar attrType = properties[name];\n\treturn value == null ||\n\t(attrType === types.BOOLEAN && !value) ||\n\t(attrType === types.OVERLOADED_BOOLEAN && value === false);\n}", "function skip_attr(a) {\n return a==='supported' || a==='concrete' || a==='parents';\n}", "funct...
[ "0.72779316", "0.6685473", "0.6618591", "0.6332508", "0.6295732", "0.6279915", "0.6261553", "0.6180319", "0.61388403", "0.6120033", "0.6093414", "0.60127616", "0.60116357", "0.599246", "0.59682345", "0.59682345", "0.5965536", "0.59626603", "0.59621686", "0.59621686", "0.59621...
0.70946777
1