This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function range(start, end) { | |
return Array(end - start + 1).fill().map((_, idx) => start + idx) | |
} | |
const IIN = [ | |
{ | |
ISSUING_NETWORK: "American Express", | |
IIN_RANGES: [34, 37], | |
ACTIVE: true, | |
LENGTH: [15], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// stolen from discord client | |
const ls = window.localStorage; | |
try { | |
delete window.localStorage; | |
} catch(o) {} | |
function localStorageTest() { | |
const test = 'test'; | |
try { | |
ls.setItem(test, test); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env node | |
'use strict'; | |
/** | |
* Usage: | |
* `require('./cloudflare_email_scrape')('d1bcb491b6a4a2ffb9bea2a5')` | |
* `curl -s https://gus.host | ./cloudflare_email_scrape.js` | |
* `./cloudflare_email_scrape d1bcb491b6a4a2ffb9bea2a5 ...` | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
exports.Endpoints = { | |
APPLICATIONS: '/applications', | |
APPLICATION_ICON: (n, t) => `/applications/${n}/icons/${t}.jpg`, | |
APPLICATION_RPC: (n) => `/oauth2/applications/${n}/rpc`, | |
AUTHORIZE_IP: '/auth/authorize-ip', | |
AVATAR: (n, t, e = t.startsWith('a_') ? 'gif' : 'webp') => `/users/${n}/avatars/${t}.${e}`, | |
BILLING: '/users/@me/billing', | |
BILLING_HISTORY: '/users/@me/billing/payments', | |
BILLING_PAYMENT_SOURCE: '/users/@me/billing/payment-source', | |
BILLING_PREMIUM_SUBSCRIPTION: '/users/@me/billing/premium-subscription', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const unsorted = [2, 3, 4, 5, 1, 7, 10, 20]; | |
function snekSort(arr) { | |
const out = []; | |
for (let i in arr) { | |
const current = arr[i]; | |
const next = arr[parseInt(i) + 1]; | |
if (i == arr.length - 1) out.splice(1, 0, arr[0]); // out.unshift(arr[0]); | |
else if (current < next) out.push(next); | |
else out.unshift(next); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function eek(element) { | |
const span = document.createElement('SPAN'); | |
element.appendChild(span); | |
return span; | |
} | |
class Typer { | |
constructor(element, words = [], options = {}) { | |
this.element = eek(element); | |
this.words = words; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// console.log(solveRPN('5 3 6 * + 5 3 / - 7 +')); // becomes `28.333333333333332` | |
function solveRPN(input) { | |
const stack = []; | |
const items = input.trim().split(' '); | |
for (const item of items) { | |
if (!isNaN(item) && isFinite(item)) { | |
stack.push(parseFloat(item)); | |
} else { | |
const [a, b] = [stack.pop(), stack.pop()]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
const x = new LinkedList(); | |
x.add('meme'); | |
x.add('dream'); | |
x.lastValue; // 'dream' | |
*/ | |
class LinkedItem { | |
constructor(value, next) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function tofrac(x0) { | |
let x = x0; | |
let a = Math.floor(x); | |
let [h, k, h1, k1] = [a, 1, 1, 0]; | |
while (x - a > Number.EPSILON * k * k) { | |
x = 1 / (x - a); | |
a = Math.floor(x); | |
let [h2, k2] = [h1, k1]; | |
[h1, k1] = [h, k]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{ | |
"emoji": "angry", | |
"shortcuts": [ | |
">:(", | |
">:-(", | |
">=(", | |
">=-(" | |
] | |
}, |