Skip to content

Instantly share code, notes, and snippets.

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],
// stolen from discord client
const ls = window.localStorage;
try {
delete window.localStorage;
} catch(o) {}
function localStorageTest() {
const test = 'test';
try {
ls.setItem(test, test);
#!/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 ...`
*/
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',
@devsnek
devsnek / sneksort.js
Created February 28, 2017 04:37
slowest sort algorithm ever made
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);
@devsnek
devsnek / typer.js
Created March 26, 2017 09:30
a better typer.js
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;
// 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()];
/*
const x = new LinkedList();
x.add('meme');
x.add('dream');
x.lastValue; // 'dream'
*/
class LinkedItem {
constructor(value, next) {
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];
[
{
"emoji": "angry",
"shortcuts": [
">:(",
">:-(",
">=(",
">=-("
]
},