anchor stringlengths 10 14.3k | positive stringlengths 10 14.9k |
|---|---|
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"){... | Refresh notifications Subtracts the cycles (1 second a cycle), if 0 hides the notification. |
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... | vkBeautify Version 0.99.00.beta Copyright (c) 2012 Vadim Kiryukhin |
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... | TODO: Pass the Bot transcript to this method for adding to the prechat details. |
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;
... | =========================================================================== 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 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... | Creates the primary movie list |
hasWidth(width, opts = { tolerance: 0 }) {
return this._node.__eventually(() => this._node.wait.hasWidth(width, { tolerance: opts.tolerance, timeout: opts.timeout }));
} | 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. |
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... | Returns true if the given element is within a currentlycollapsed collapse block. |
function retrieveData(key) {
var retrieved = JSON.parse(window.localStorage.getItem(key));
return retrieved;
} | Retrive JSON from local storage |
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... | Load Add Club Editor |
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... | Add a second passphrase to an account |
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... | Handle main application initialization. Prepare main interface by requiring all necessary modules needed for the application to run. |
static get() {
if (this._config) {
return this._config;
} else {
return this.build();
}
} | Get the config object. |
function retablir(txt, id_controle) {
if(document.getElementById(id_controle).value==''){
document.getElementById(id_controle).value=txt;
}
} | fonction qui remet la valeur (tapez votre email, tapez votre mot de passe ...) dans le champ de l'input |
function activeSubmit()
{
$.ajax(
{
url: "../ajax/active-submit.php",
type: "POST",
data: { slug: slug },
cache: false,
success: function(html)
{
$("#contributeA").html(html);
$("#contributeB").ht... | Load contribute buttons Must refresh more frequently, so it is seperate If uploading gets competitive, refresh may need to be upped |
function generateBullets (qtd) {
for (var i=0; i<qtd; i++){
var bullet = $("<a>").html("• ").attr("href","#").data("id",i);
$(".bullets").append(bullet);
}
$(".bullets a").eq(position).addClass("active");
} | criar a bolinha para mudar a foto na tela |
enterSoundName(ctx) {
} | Enter a parse tree produced by MmParsersoundName. |
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);
} | I wanted to implement forEach, but couldn't figure out how to. |
function randomImg() {
imgURL = images[Math.floor(Math.random() * images.length)];
console.log(imgURL);
} | Everything here to the check letter function is my attempt to generate a new photo every time a new word is generated. |
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 + ... | return true if (i,i+1) crosses (k,k+1) |
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')),
... | renders todo info on edit modal |
onAddButtonClick(fn) { this.onAddButtonClickFn = fn } | fn(relativePos) Parameters: block (obj) block whose button was clicked relativePos (buttonpos) position of button (14) |
function parseExpressionAt(input, pos, options) {
var p = new Parser(options, input, pos);
p.nextToken();
return p.parseExpression()
} | 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 setup(){
database = firebase.database();
console.log(database);
createCanvas(displayWidth/2, displayHeight/2);
game = new Game();
game.start();
} | this is an array to store players info |
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);
... | if the user specifies include_docs=true, then we don't want to block the main cursor while we're fetching the doc |
function createNewShape() {
agentNewShape = true;
emptyShapeElements();
shape = CreateShape();
nextShape = nextShapeDisplay();
ghostShape = createGhostShape();
sortShapePos(shape);
timeStep = originalTimeStep;
} | clear old shape then load a new one from Shape.js |
function getItemPrefix() {
var prefix;
if(args.tag === "ol") {
prefix = " " + num + ". ";
num = num + 1;
} else {
prefix = " " + bullet + " ";
}
return prefix;
} | Get the item prefix e.g. " 1. " for a numbered list, " " for a bulleted list. |
function setEnabled(element, condition) {
if (condition) element.removeAttribute('disabled');
else element.setAttribute('disabled', '');
} | endregion region Element Toggle Helpers |
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>
);
} | function when user logs out |
function plus1(a,b){
return(a+b);
} | 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 set_key(lock, key, callback) {
let str = JSON.stringify({
Action: "SET",
Attribute: "KEY",
Value: key
})
send_command(lock, str)
callback(f.hacker.ingverb())
} | Change the key in the lock |
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',... | ! SCOREBOARD ASSETS This is the function that runs to add scoreboard assets |
function onFireAction(){
} | functions to activate achievements |
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, ... | Fetches all pages of the provided categories, calling the `callback` function for each page loaded. |
getTerminalConfiguration(terminalConfigurationId)
{
return this.dataElement.terminalConfigurations.find(tc => tc.terminalConfigurationId === terminalConfigurationId);
} | get the terminal configuration using the id |
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:... | no vr plugin error message |
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... | Update the water position and draw : object pool water sprites |
function HTML5_SolutionStorage() {
} | SOLUTION SAVING /////////////////////////////////////////// //////////////// html5 storage |
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]];
}
}
}
} | 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 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... | CERTIFICATONS ENDS////////////////// / / / / ////////////////////ACHIEVEMENTS STARTS |
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... | Is called when databases are connected and adapter received configuration. |
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 =
... | Merge two trees together The roots of tree1 and tree2 must be the same revision |
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... | function to block bad immoral language...lol |
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;
... | Gets the suggestions from the database and adds them to the current state |
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... | target, name > boolean |
function documentTargetStore(txn){return SimpleDb.getStore(txn,DbTargetDocument.store);} | Helper to get a typed SimpleDbStore for the document target object store. |
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) {
... | Do this when collides == true |
function displayResults (cuisine) {
console.log(cuisine);
} | DISPLAY ZOMATO API RESULTS |
start_loading(){
this.model.preload();
} | | start_loading:void () | | Ready to start loading. |
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 ... | Inser5t list items into DOM |
function unliftStore(liftedStore, reducer) { // 210
return _extends({}, liftedStore, { // 211
devToolsStore: liftedStore, // 212
dispatch: function dispatch(action) { // 213
li... | 206 // 207 Unlifts the DevTools store to act like the app's store. // 208 209 |
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... | removed expired aggregated total from local store |
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... | Get weather by coordinates |
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... | Autoupdate interval millisec Used from buttons to send commands to pre.di.c |
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
};
} | Normalize `position` to add an `indent`. |
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... | A special extend for ajax options that takes "flat" options (not to be deep extended) Fixes 9887 |
onPageClick_() {
this.pageClicks_++;
this.lastSelection_ = this.win_.document.activeElement;
} | Listener for clicks on window, Set the last selected element. |
function renderMainWindow () {
var targetMainPage = process.cwd() + '/html/main.html';
var html = fs.readFileSync(targetMainPage, 'utf8');
$('#window').append(html);
} | render main window view |
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;
... | Represent k1, k2 in a Joint Sparse Form |
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... | Namespace and Property Utilities definitions; |
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... | 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 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);
} | called when we know the calendar couldn't be rendered when it was initialized, but we think it's ready now |
function init_modal(selector) {
$(selector).draggable({
addClasses:false
});
} | Modal controls and listeners Initialize existing modal |
function loadPicker() {
gapi.load('auth', {'callback': onAuthApiLoad});
gapi.load('picker', {'callback': onPickerApiLoad});
} | Use the Google API Loader script to load the google.picker script. |
checksum( buf, start, length ) {
let sum = 0;
for( var i = start; i < start+length; i++ ) {
sum = sum + buf[i];
}
return ((~sum)+1) & 0xFF;
} | calculate 2s complement checksum over a buffer, starting with a byte index |
constructor() {
super('loja.produtoInformacoes', 'pgMongoDb');
} | Para Reposotory que utilizar MongoDb, passar o nome do database.collection no atributo da entidade |
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... | Resizes the canvas Code originally found at |
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;
... | get vendor property name that contains uppercase letter. e.g. webkitTransform |
function capitalizeFirstLetter(string) {
return string.charAt(0).toUpperCase() + string.slice(1);
} | select items to analyze / graph type |
function opName(operation) {
return operation.name ? operation.name.value : '';
} | 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 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';
}
} | hide or show viaurl |
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... | 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 isBalanced(root) {
} | Hint: it may be helpful to get the height of your BST |
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.")
}
})
} | function to write README file |
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("")
} | Goes to specified state. |
function setupNav() {
setupPageSelector();
setupRecipeSelector();
} | populates the list of selectable pages, binds left and right arrow keys |
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;
} | Gets credit cards list |
function weShouldWait(delay) {
return function (value) {
return WinJS.Promise.timeout(delay).
then(function () {
return value;
});
};
} | End GC related code A utility function that returns a function that returns a timeout promise of the given value |
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);
}
... | adds a Salutation to the recognize list |
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);
} | Balance the '(parent) left heavy, (child) right heavy' condition |
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 to update existing duration logs in the reporting module. |
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";
... | Function that executes on click of second next button |
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),
... | Give beforeSelectionChange handlers a change to influence a selection update. |
function init(){
mostrarform(false);
listar();
$("#formulario").on("submit",function(e){
guardaryeditar(e);
});
} | Funcion que se ejecuta al inicio |
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... | draw the avaiable colors we can use |
function isDirectory(dir){
try {
return fs.statSync(dir).isDirectory();
}
catch (err){
return false;
}
} | var pattern_config = require('./patternlabconfig.json'); |
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]} | ! moment.js locale configuration |
function formatResult ( result, PRECISION, MAXDIGITS ) {
// Number.
if ( !isNaN ( result ) && result.toExponential().length > MAXDIGITS ) {
return result.toPrecision( PRECISION ).replace ( /\+/g, '');
} else {
return result;
}
} | Make sure result is not too big for display |
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... | Returns true if a to the given pathname/query combination is currently active. |
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... | 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 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... | Takes any number of passed in arguments that are numbers, and multiplies them. |
function getDistance(p1, p2) {
return Math.sqrt(Math.pow(p2.x - p1.x, 2) + Math.pow(p2.y - p1.y, 2));
} | getTotalLength() equivalent for circle, rect, polyline, polygon and line shapes adapted from |
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... | GeneralHomepage component displays Navbar Displays welcome banner Routes users to /login or /signup |
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 = {
... | Absolute path to app dir |
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);
} | returns true if this link can be picked up by linkify rule from plain text |
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... | Send GET request to run aiishellfe commands |
function TaskQueue$2() {
this.promise = new PouchPromise$1(function (fulfill) {fulfill(); });
} | Simple task queue to sequentialize actions. Assumes callbacks will eventually fire (once). |
function callLanguages(){
if (localStorage.getItem("language"))
localStorage.getItem("language") == 2 ? language_file = 'json/pt.json' : language_file = 'json/en.json'
else
language_file = 'json/en.json'
$.getJSON(language_file, function(json){
localStorage.setItem("json", JSO... | =============================== LANGUAGES FILES CLIENT ========== ================================ |
function printString(myString) {
console.log(myString[0]);
if (myString.length > 1) {
let mySubString = myString.substring(1, myString.length);
printString(mySubString);
} else {
// complete once there are no remaining letters to shift to the left
return true;
}
} | recurses, calling itself once for each letter in the string |
function getText(typedarray) {
//PDFJS should be able to read this typedarray content
var pdf = PDFJS.getDocument(typedarray);
return pdf.then(function(pdf) {
// get all pages text
var maxPages = pdf.pdfInfo.numPages;
var countPromises ... | getText() function definition. This is the pdf reader function. |
_downloadModule() {
// If URL is not provided, throw error.
if(!this.evt.options.url) {
return BbPromise.reject(new SError('Github URL is required. (eg. serverless module install <github-url>)', SError.errorCodes.UNKNOWN));
}
let _this = this,
spinner = SCli.spinner(),
... | Downloads the module from github |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.