anchor
stringlengths
10
14.3k
positive
stringlengths
10
14.9k
Functions to log when we connect/disconnect main observer, for debugging
function observerON() { debug('Turning observer ON'); if (validPointer(mainObserver)) {mainObserver.observe(mainTargetNode, mainConfig);} }
moons: lib: code.org library Draws all the moons that are larger than or equal to 6 pixels in radius. Then, it moves them to the left before checking if it should change one into a small moon. Written by Keegan Brown
moons (lib){ for (var i=0;i<7;i++){ let moon = this.madeMoons[i]; var size = moon.s; lib.moveTo(moon.x, moon.y); lib.penRGB(moon.r, moon.g, moon.b); let movingLeft = true; let behind = false; if (moon.s < 6) { ...
! ctxMenu v1.1.1 | (c) Nikolaj Kappler | !
function d(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}
migration to version 3 (part 2)
function migrateLocalStore(txn, cb) { var localStore = txn.objectStore(LOCAL_STORE); var docStore = txn.objectStore(DOC_STORE); var seqStore = txn.objectStore(BY_SEQ_STORE); var cursor = docStore.openCursor(); cursor.onsuccess = function (event) { var cursor = event.target.result; ...
a function to download the .svg file
function downloadAsSVG(fileName) { // use default name if not provided fileName = fileName || "output.svg"; // create a data url of the file var svgData = project.exportSVG({ asString: true }); var url = "data:image/svg+xml;utf8," + encodeURIComponent(svgData); // create a link to the data, and "cli...
Refresh notifications Subtracts the cycles (1 second a cycle), if 0 hides the notification.
function refreshhNotifications(){ var html = ''; for(var i = 0;i < currentNotifications.length;i++){ var typeClass = ""; var typeText = ""; if(currentNotifications[i].type == "positive"){ typeClass = "positive-notification"; typeText = "dark-text"; }else if(currentNotifications[i].type == "negative"){...
vkBeautify Version 0.99.00.beta Copyright (c) 2012 Vadim Kiryukhin
function vkXML (text, step) { const ar = text.replace(/>\s{0,}</g, "><") .replace(/</g, "~::~<") .replace(/\s*xmlns\:/g, "~::~xmlns:") // .replace(/\s*xmlns\=/g,"~::~xmlns=") .split("~::~"); const len = ar.length; let inComment = false; let deep = 0; let str = ""; const space = (step != null...
TODO: Pass the Bot transcript to this method for adding to the prechat details.
async initializeChat(conversationData, userInfo, botTranscript) { var buttonOverrides = new Array(process.env.BUTTON_ID); var preChatDetails = this.initializePrechatDetails(userInfo, botTranscript); var chasitorInit = this.initializeSalesForceChatObject(preChatDetails, userInfo, conversationData...
=========================================================================== For Z_HUFFMAN_ONLY, do not look for matches. Do not maintain a hash table. (It will be regenerated if this run of deflate switches away from Huffman.)
function deflate_huff(s, flush) { var bflush; /* set if current block must be flushed */ for (;;) { /* Make sure that we have a literal to write. */ if (s.lookahead === 0) { fill_window(s); if (s.lookahead === 0) { if (flush === Z_NO_FLUSH) { return BS_NEED_MORE; ...
Creates the primary movie list
function movieList(query, sortBy, order) { getMovies(query, sortBy, order).then((movies) => { //console.log('Here are all the movies:'); movies.forEach(({title, rating, id, tvdb, imdb_id, fav}) => { // console.log(`id#${id} - ${title} - rating: ${rating}`); let moviePoster = "images...
Returns true if PageElement's width eventually equals the expected width or if it deviates no more than the specified tolerance from the expected width within a specific timeout.
hasWidth(width, opts = { tolerance: 0 }) { return this._node.__eventually(() => this._node.wait.hasWidth(width, { tolerance: opts.tolerance, timeout: opts.timeout })); }
Returns true if the given element is within a currentlycollapsed collapse block.
function isWithinCollapsedBlock(element) { /* If the element is not within a collapse block at all, it obviously can't be within a *currently-collapsed* collapse block. */ let collapseParent = element.closest(".collapse"); if (!collapseParent) return false; /* If the element is within a collapse block a...
Retrive JSON from local storage
function retrieveData(key) { var retrieved = JSON.parse(window.localStorage.getItem(key)); return retrieved; }
Load Add Club Editor
function loadAddClubEditor(mobile) { build = "\ <div id='editorContainer'>\ <div id='editor-fields'>\ <input type='text' id='club-name' placeholder='Name of your Club..' />\ <div id='color-picker-container'>\ <label>Color of your Club</label>\ <span id='blue' class='color-box checked' onclick='c...
Add a second passphrase to an account
function createSecondPassphrase (selectedAccount) { var bip39 = require('bip39') var data = { secondPassphrase: bip39.generateMnemonic() } if (selectedAccount.secondSignature) { return formatAndToastError( gettextCatalog.getString('This account already has a second passphrase: ' + s...
Handle main application initialization. Prepare main interface by requiring all necessary modules needed for the application to run.
function onAppReady(obj) { "use strict"; console.log("init.js: onAppReady"); require(["MainApp", "Router", "Config", "DataService", "handlebars", "templates"], function (MainApp, Router, Config, DataService, handlebars, templates) { window.app = new MainApp(Config, templates, DataSer...
Get the config object.
static get() { if (this._config) { return this._config; } else { return this.build(); } }
fonction qui remet la valeur (tapez votre email, tapez votre mot de passe ...) dans le champ de l'input
function retablir(txt, id_controle) { if(document.getElementById(id_controle).value==''){ document.getElementById(id_controle).value=txt; } }
Load contribute buttons Must refresh more frequently, so it is seperate If uploading gets competitive, refresh may need to be upped
function activeSubmit() { $.ajax( { url: "../ajax/active-submit.php", type: "POST", data: { slug: slug }, cache: false, success: function(html) { $("#contributeA").html(html); $("#contributeB").ht...
criar a bolinha para mudar a foto na tela
function generateBullets (qtd) { for (var i=0; i<qtd; i++){ var bullet = $("<a>").html("&bullet; ").attr("href","#").data("id",i); $(".bullets").append(bullet); } $(".bullets a").eq(position).addClass("active"); }
Enter a parse tree produced by MmParsersoundName.
enterSoundName(ctx) { }
I wanted to implement forEach, but couldn't figure out how to.
function map(words, instruction) { // console.log(words.forEach(instruction)); var result = []; for (var i = 0; i < words.length; i++) { result.push(instruction(words[i])); } console.log(result); }
Everything here to the check letter function is my attempt to generate a new photo every time a new word is generated.
function randomImg() { imgURL = images[Math.floor(Math.random() * images.length)]; console.log(imgURL); }
return true if (i,i+1) crosses (k,k+1)
function isCrossing(i, k){ if ( i == k || i == k + 1 || i == k - 1){ return false; } var path1 = [pointarray[i].LatLng, pointarray[i + 1].LatLng, pointarray[k].LatLng]; var path2 = [pointarray[i].LatLng, pointarray[i + 1].LatLng, pointarray[k + 1].LatLng]; var path3 = [pointarray[k].LatLng, pointarray[k + ...
renders todo info on edit modal
function renderModalEdit(todo) { var form = $('#form-todo-edit'); var id = todo.attr('data-id'), title = todo.attr('data-title'), priority = todo.attr('data-priority'), details = todo.attr('data-details'), created = todo.attr('data-created'), elapsed = parseInt(todo.attr('data-elapsed')), ...
fn(relativePos) Parameters: block (obj) block whose button was clicked relativePos (buttonpos) position of button (14)
onAddButtonClick(fn) { this.onAddButtonClickFn = fn }
This function tries to parse a single expression at a given offset in a string. Useful for parsing mixedlanguage formats that embed JavaScript expressions.
function parseExpressionAt(input, pos, options) { var p = new Parser(options, input, pos); p.nextToken(); return p.parseExpression() }
this is an array to store players info
function setup(){ database = firebase.database(); console.log(database); createCanvas(displayWidth/2, displayHeight/2); game = new Game(); game.start(); }
if the user specifies include_docs=true, then we don't want to block the main cursor while we're fetching the doc
function fetchDocAsynchronously(metadata, row, winningRev) { var key = metadata.id + "::" + winningRev; docIdRevIndex.get(key).onsuccess = function onGetDoc(e) { row.doc = decodeDoc(e.target.result); if (opts.conflicts) { row.doc._conflicts = collectConflicts(metadata); ...
clear old shape then load a new one from Shape.js
function createNewShape() { agentNewShape = true; emptyShapeElements(); shape = CreateShape(); nextShape = nextShapeDisplay(); ghostShape = createGhostShape(); sortShapePos(shape); timeStep = originalTimeStep; }
Get the item prefix e.g. " 1. " for a numbered list, " " for a bulleted list.
function getItemPrefix() { var prefix; if(args.tag === "ol") { prefix = " " + num + ". "; num = num + 1; } else { prefix = " " + bullet + " "; } return prefix; }
endregion region Element Toggle Helpers
function setEnabled(element, condition) { if (condition) element.removeAttribute('disabled'); else element.setAttribute('disabled', ''); }
function when user logs out
function handleLogout(event) { setUser(false); NavbarComponents.pop(); // Remove Admin page in Navbar NavbarComponents.pop(); // Change Log out to Log in in Navbar NavbarComponents.push( <li key="login"> <Link to="/login">Giriş Yap</Link> </li> ); }
Return method is a function and therefore you can use it as you would a function. To invoke a function, simply call it like this: plus1(); plus2(); Function Declarations
function plus1(a,b){ return(a+b); }
Change the key in the lock
function set_key(lock, key, callback) { let str = JSON.stringify({ Action: "SET", Attribute: "KEY", Value: key }) send_command(lock, str) callback(f.hacker.ingverb()) }
! SCOREBOARD ASSETS This is the function that runs to add scoreboard assets
function addScoreboardAssets(){ manifest.push({src:'assets/scoreboard/bg_scoreboard.png', id:'bgScoreboard'}); manifest.push({src:'assets/scoreboard/icon_replay.png', id:'iconReplay'}); manifest.push({src:'assets/scoreboard/icon_save.png', id:'iconSave'}); manifest.push({src:'assets/scoreboard/icon_scoreboard.png',...
functions to activate achievements
function onFireAction(){ }
Fetches all pages of the provided categories, calling the `callback` function for each page loaded.
async fetchPages(categories, callback) { let pages = []; for (const category of categories) { const pagesInCategory = await request.get( `${API_ROOT}/categories/${category}/docs`, this.httpOptions ); for (const json of pagesInCategory) { pages.push(this.fetchPage(json, ...
get the terminal configuration using the id
getTerminalConfiguration(terminalConfigurationId) { return this.dataElement.terminalConfigurations.find(tc => tc.terminalConfigurationId === terminalConfigurationId); }
no vr plugin error message
function no_vr_plugin() { var errorBox = ID("errorBox"); errorBox.innerHTML = ""+ "<center>"+ "<br>"+ "<h1 style='margin-bottom:0;'>NPVR Browser Plugin required!</h1>"+ "<br>"+ "Get the plugin here and install it:<br>"+ "<br>"+ "<a href='https://github.com/CodingCooky/npvr/#npvr' target='_blank'>https:...
Update the water position and draw : object pool water sprites
function updateWater() { // animate water for (var i = 0; i < water.length; i++) { water[i].update(); water[i].draw(); } // remove water that has gone off screen if (water[0] && water[0].x < -platformWidth) { var w = water.splice(0, 1)[0]; w.x = water[water.length-1].x + pla...
SOLUTION SAVING /////////////////////////////////////////// //////////////// html5 storage
function HTML5_SolutionStorage() { }
the first pair where the sum is 0. Return an array that includes both values that sum to zero or undefined if a pair does not exist. sumZero([3,2,1,0,1,2,3]) => [3,3] sumZero([2,0,1,3]) => undefined sumZero([1,2,3]) => undefined
function sumZero(arr){ for(let i = 0; i < arr.lenght; i++){ for(let j = 0; j < arr.lenght; j++){ if(arr[i] + arr[j] === 0){ return [arr[i], arr[j]]; } } } }
CERTIFICATONS ENDS////////////////// / / / / ////////////////////ACHIEVEMENTS STARTS
function insertAchievements(data) { var achievements=""; achievements+='<div class="row achievement" id="'+data.achievementId+'">'; achievements+='<div class="row">'; achievements+='<div class="col-md-6 text-left">'; achievements+='<div style="font-size:18px;color:#008322;"><i class="fa fa-trophy"></i>&n...
Is called when databases are connected and adapter received configuration.
async onReady() { // Init info await this.initInfoStates(); // store all current (acknowledged) state values const allStates = await this.getStatesAsync('*'); for (const id in allStates) { if (allStates[id] && allStates[id].ack) { this.currentStateValu...
Merge two trees together The roots of tree1 and tree2 must be the same revision
function mergeTree(in_tree1, in_tree2) { var queue = [{tree1: in_tree1, tree2: in_tree2}]; var conflicts = false; while (queue.length > 0) { var item = queue.pop(); var tree1 = item.tree1; var tree2 = item.tree2; if (tree1[1].status || tree2[1].status) { tree1[1].status = ...
function to block bad immoral language...lol
function smutEngine() { smut="#@&*%!#@&*%!#@&*%!"; cmp="sex shit fuck piss dick porno cum cunt prick arse feck " +"asshole pedophile man-boy man/boy dong twat "; txt=document.isn.dirt.value; tstx=""; for (var i=0;i<16;i++){ pos=cmp.indexOf(" "); wrd=cmp.substring(0,pos); wrdl=wrd.length cmp=cmp...
Gets the suggestions from the database and adds them to the current state
getSearchSuggestions(term) { console.log(this.state.text); // GET request for movies axios .get('/api/searchgames', { params: { term: term } }) .then( function(response) { console.log(response.data); movieArray = response.data; ...
target, name > boolean
function Has(target, name) { if(!(this instanceof Has)) return new Has(target, name); else Read.call(this, target); Object.defineProperties(this, { "name": { value: name }, "origin": { value: (name in target) } }); // define diff Object.defineProperty(th...
Helper to get a typed SimpleDbStore for the document target object store.
function documentTargetStore(txn){return SimpleDb.getStore(txn,DbTargetDocument.store);}
Do this when collides == true
function collideAction(ball, p) { ball.vy = -ball.vy; if(paddleHit == 1) { ball.y = p.y - p.h; particlePos.y = ball.y + ball.r; multiplier = -1; } else if(paddleHit == 2) { ball.y = p.h + ball.r; particlePos.y = ball.y - ball.r; multiplier = 1; } points++; increaseSpd(); if(collision) { ...
DISPLAY ZOMATO API RESULTS
function displayResults (cuisine) { console.log(cuisine); }
| start_loading:void () | | Ready to start loading.
start_loading(){ this.model.preload(); }
Inser5t list items into DOM
function createList() { [...richestPeople].forEach((person, index ) => { const listItem = document.createElement('li'); listItem.setAttribute('data-index', index); listItem.innerHTML = `<span class="number">${index + 1}</span> <div class="draggable" draggable="true"> <p ...
206 // 207 Unlifts the DevTools store to act like the app's store. // 208 209
function unliftStore(liftedStore, reducer) { // 210 return _extends({}, liftedStore, { // 211 devToolsStore: liftedStore, // 212 dispatch: function dispatch(action) { // 213 li...
removed expired aggregated total from local store
function removeExpiredAggTotals() { var now = new Date().getTime(); var cache_time = 3600000; //1 hour (3600000 ms) for (var i = 0; i < localStorage.length; i++) { var key = localStorage.key(i); var agg_data = JSON.parse(localStorage[key]); //check within cache time if ((now...
Get weather by coordinates
getWeather(){ // Construct the API url to call let url = 'https://api.openweathermap.org/data/2.5/weather?lat=' + this.state.latitude + '&lon=' + this.state.longitude + '&units=metric&appid=ce0cb4b99e8ee814c20a4f76609c8196'; // console.log(url); // Call the API, and set the state of the weather forecast fet...
Autoupdate interval millisec Used from buttons to send commands to pre.di.c
function control_cmd(cmd, update=true) { // Sends the command to pre.di.c through by the server's PHP: // https://www.w3schools.com/js/js_ajax_http.asp var myREQ = new XMLHttpRequest(); myREQ.open("GET", "php/functions.php?command=" + cmd, true); myREQ.send(); // Then update the web page i...
Normalize `position` to add an `indent`.
function normalize(position) { var offsets = ctx.offset; var line = position.line; var result = []; while (++line) { if (!(line in offsets)) { break; } result.push((offsets[line] || 0) + 1); } return { start: position, indent: result }; }
A special extend for ajax options that takes "flat" options (not to be deep extended) Fixes 9887
function ajaxExtend( target, src ) { var key, deep, flatOptions = jQuery.ajaxSettings.flatOptions || {}; for ( key in src ) { if ( src[ key ] !== undefined ) { ( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ]; } } if ( deep ) { jQuery.extend( true, target, deep ); } ret...
Listener for clicks on window, Set the last selected element.
onPageClick_() { this.pageClicks_++; this.lastSelection_ = this.win_.document.activeElement; }
render main window view
function renderMainWindow () { var targetMainPage = process.cwd() + '/html/main.html'; var html = fs.readFileSync(targetMainPage, 'utf8'); $('#window').append(html); }
Represent k1, k2 in a Joint Sparse Form
function getJSF(k1, k2) { var jsf = [ [], [], ]; k1 = k1.clone(); k2 = k2.clone(); var d1 = 0; var d2 = 0; var m8; while (k1.cmpn(-d1) > 0 || k2.cmpn(-d2) > 0) { // First phase var m14 = (k1.andln(3) + d1) & 3; var m24 = (k2.andln(3) + d2) & 3; if (m14 === 3) m14 = -1; ...
Namespace and Property Utilities definitions;
function cloneFn(obj) { // "Static" types. if (isUndefined(obj) || isStaticType(obj)) return obj; var clonedObj = null; // Array. if (typeUtils.isArray(obj)) { clonedObj = []; for (var i = 0; i < obj.length; i++) clonedObj[i] = cloneFn(obj[i]); return clonedObj; } // Objects. clonedObj = new obj.con...
A consistent way of creating unique IDs in angular. The ID is a sequence of alpha numeric characters such as '012ABC'. The reason why we are not using simply a number counter is that the number string gets longer over time, and it can also overflow, where as the the nextId will grow much slower, it is a string, and it ...
function nextUid() { var index = uid.length; var digit; while(index) { index--; digit = uid[index].charCodeAt(0); if (digit == 57 /*'9'*/) { uid[index] = 'A'; return uid.join(''); } if (digit == 90 /*'Z'*/) { uid[index] = '0'; } else { uid[index] = String.fromChar...
called when we know the calendar couldn't be rendered when it was initialized, but we think it's ready now
function lateRender() { setTimeout(function() { // IE7 needs this so dimensions are calculated correctly if (!currentView.start && bodyVisible()) { // !currentView.start makes sure this never happens more than once renderView(); } },0); }
Modal controls and listeners Initialize existing modal
function init_modal(selector) { $(selector).draggable({ addClasses:false }); }
Use the Google API Loader script to load the google.picker script.
function loadPicker() { gapi.load('auth', {'callback': onAuthApiLoad}); gapi.load('picker', {'callback': onPickerApiLoad}); }
calculate 2s complement checksum over a buffer, starting with a byte index
checksum( buf, start, length ) { let sum = 0; for( var i = start; i < start+length; i++ ) { sum = sum + buf[i]; } return ((~sum)+1) & 0xFF; }
Para Reposotory que utilizar MongoDb, passar o nome do database.collection no atributo da entidade
constructor() { super('loja.produtoInformacoes', 'pgMongoDb'); }
Resizes the canvas Code originally found at
function resizeCanvas(e){ var canvas = document.getElementById('mapCanvas'); var ctx = canvas.getContext('2d'); canvas.width = 950; canvas.height= 1200; var isMobile = { Android: function() { return navigator.userAgent.match(/Android/i); }, BlackBerry: function() { r...
get vendor property name that contains uppercase letter. e.g. webkitTransform
function getProperty(prop, host) { var targetHost = host || document.body.style; if (!(prop in targetHost)) { var char1 = prop.charAt(0).toUpperCase(); var charLeft = prop.substr(1); for (var i = 0; i < vendors.length; i++) { var vendorProp = vendors[i] + char1 + charLeft; ...
select items to analyze / graph type
function capitalizeFirstLetter(string) { return string.charAt(0).toUpperCase() + string.slice(1); }
Copyright (c) 2015present, Facebook, Inc. This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree. Provides the empty string for anonymous operations.
function opName(operation) { return operation.name ? operation.name.value : ''; }
hide or show viaurl
function switchForm(to=0) { let viaurl = document.getElementById('new-i-form-viaurl'); let viaform = document.getElementById('new-i-form-page'); if (viaurl && viaform) { viaurl.style.display = to ? 'none' : ''; viaform.style.display = to ? '' : 'none'; } }
Pushes down a context to the given range by clearing all overrides between pushDownFrom and range.commonAncestorContainer, and clearing all overrides inside and along the range's boundary (see walkBoundary()), invoking pushDownOverride on all siblings of the range boundary that are not contained in it. Requires range's...
function pushDownContext(liveRange, pushDownFrom, cacOverride, getOverride, clearOverride, clearOverrideRec, pushDownOverride) { // Because range may be mutated during traversal, we must only // refer to it before traversal. var cac = liveRange.commonAncestorContainer; walkBoundary(liveRange, getOverride, pushD...
Hint: it may be helpful to get the height of your BST
function isBalanced(root) { }
function to write README file
function writeToFile(readMe, data) { const userData = generateMD(data); fs.writeFile(readMe, userData, function(err) { if(err) { throw err } else { console.log("You have successfully created a new README.md file.") } }) }
Goes to specified state.
changeState(state) { if(this.getStates().indexOf(state) != -1){ if(this.prevState[this.prevState.length - 1] != this.state) this.prevState.push(this.state); this.state = state; }else throw new Error("") }
populates the list of selectable pages, binds left and right arrow keys
function setupNav() { setupPageSelector(); setupRecipeSelector(); }
Gets credit cards list
fetchCreditCards(accountId) { let promise = this.remotePaymentAPI.query({accountId: accountId}).$promise; // check if if was OK or not let parsedResultPromise = promise.then((data) => { this.creditCardsPerAccount.set(accountId, data); }); return parsedResultPromise; }
End GC related code A utility function that returns a function that returns a timeout promise of the given value
function weShouldWait(delay) { return function (value) { return WinJS.Promise.timeout(delay). then(function () { return value; }); }; }
adds a Salutation to the recognize list
addSalutation() { return Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__awaiter"])(this, void 0, void 0, function* () { try { yield this.salutationService.addSalutation(this.newSalutation.value); } catch (err) { console.error(err); } ...
Balance the '(parent) left heavy, (child) right heavy' condition
leftRightCase(node) { if (!node.left) { throw new Error("leftRightCase: left child not set"); } node.left = this.rotateLeft(this.nodes[node.left]).id; return this.rotateRight(node); }
function to update existing duration logs in the reporting module.
function completeDurationLogs(jobId) { var ReportLog = mongoose.model('ReportLog'); var updateObj = { 'log.jobStatus': 'F' }; ReportLog.update( { 'type': 'durationLog', 'log.jobId': jobId, }, updateObj,{ multi: true } ,function(err, updatedReportLog){ if(e...
Function that executes on click of second next button
function next_step2(){ addAnimation(document.getElementById("second"), 'bounceOutRight'); setTimeout(function() { document.getElementById("second").style.display="none"; document.getElementById("third").style.opacity=0; document.getElementById("third").style.display="block"; ...
Give beforeSelectionChange handlers a change to influence a selection update.
function filterSelectionChange(doc, sel, options) { var obj = { ranges: sel.ranges, update: function(ranges) { var this$1 = this; this.ranges = []; for (var i = 0; i < ranges.length; i++) { this$1.ranges[i] = new Range(clipPos(doc, ranges[i].anchor), ...
Funcion que se ejecuta al inicio
function init(){ mostrarform(false); listar(); $("#formulario").on("submit",function(e){ guardaryeditar(e); }); }
draw the avaiable colors we can use
function drawPalette() { $('#palette').html(' '); for (let i = 0; i < SQUARE_COLORS_ARRAY.length; i++) { let div = '<div id="color' + i + '"></div>'; $('#palette').append(div); $('#color' + i).css('background', SQUARE_COLORS_ARRAY[i]); } //add the click events $('#palette div').each(function(div) { $(`#c...
var pattern_config = require('./patternlabconfig.json');
function isDirectory(dir){ try { return fs.statSync(dir).isDirectory(); } catch (err){ return false; } }
! moment.js locale configuration
function a(e,a,c,n){var t={m:["eine Minute","einer Minute"],h:["eine Stunde","einer Stunde"],d:["ein Tag","einem Tag"],dd:[e+" Tage",e+" Tagen"],w:["eine Woche","einer Woche"],M:["ein Monat","einem Monat"],MM:[e+" Monate",e+" Monaten"],y:["ein Jahr","einem Jahr"],yy:[e+" Jahre",e+" Jahren"]};return a?t[c][0]:t[c][1]}
Make sure result is not too big for display
function formatResult ( result, PRECISION, MAXDIGITS ) { // Number. if ( !isNaN ( result ) && result.toExponential().length > MAXDIGITS ) { return result.toPrecision( PRECISION ).replace ( /\+/g, ''); } else { return result; } }
Returns true if a to the given pathname/query combination is currently active.
function isActive(_ref, indexOnly, currentLocation, routes, params) { var pathname = _ref.pathname, query = _ref.query; if (currentLocation == null) return false; // TODO: This is a bit ugly. It keeps around support for treating pathnames // without preceding slashes as absolute paths, but possibly also...
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 moment(); } res = moments[0]; for (i = 1; i < moments.length; ++i) { if (moments...
Takes any number of passed in arguments that are numbers, and multiplies them.
function multiplyCommand(arguments, receivedMessage) { if (arguments.length < 2) { receivedMessage.channel.send("Not enough values to multiply. Try !`multiply 2 4 10` or `!multiply 5.2 7`") return } let product = 1 arguments.forEach((value) => { product = product * parseFloat(va...
getTotalLength() equivalent for circle, rect, polyline, polygon and line shapes adapted from
function getDistance(p1, p2) { return Math.sqrt(Math.pow(p2.x - p1.x, 2) + Math.pow(p2.y - p1.y, 2)); }
GeneralHomepage component displays Navbar Displays welcome banner Routes users to /login or /signup
function GeneralHomepage(props) { return ( // <Router> <React.Fragment> <Navbar sticky='top'> <Navbar.Brand> <Link to="/"> <img height={60} src="/static/img/small-new-logo.png"/> </Link> </Navbar.Brand> <Navbar.Collapse className="j...
Absolute path to app dir
async function main() { const account = await nodemailer.createTestAccount(); const transporter = nodemailer.createTransport({ service: 'gmail', auth: { user: 'the.one.brogrammers.inc@gmail.com', pass: `zkkhp65GZT9iB8GJ42Wf` } }); const mailOptions = { ...
returns true if this link can be picked up by linkify rule from plain text
can_be_linkify(dest) { let match = dest.match(/^(https?:|\/\/)/i); if (!match) return false; let proto = match[0]; let len = linkify.testSchemaAt(dest, proto, proto.length); return len && (len === dest.length - proto.length); }
Send GET request to run aiishellfe commands
function configure(option, hostname) { if (confirm('Do you want to "' + option + '" "' + hostname + '" ?')) $.get(AII_URL + '/cgi-bin/dashboard-aii.cgi', { 'action': 'configure', 'hostname': hostname, 'option': option }, fun...