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
// https://www.reddit.com/r/PostgreSQL/comments/6gw866/best_practice_for_id_system_that_is_obscure_for/diu8cr1/ | |
// https://planetcalc.com/3311/ | |
const [a, b, modulo, radix] = [204021643231n, 975874032671n, 1000000000000n, 36]; | |
const encode = (plainId) => ((BigInt(plainId) * a) % modulo).toString(radix); | |
const decode = (encodedId) => (BigInt(parseInt(encodedId, radix)) * b) % modulo; | |
for (let i = 1; i <= 20; i++) { | |
console.log(`${i} | ${encode(i)} | ${decode(encode(i))}`); |
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 isoComps = { | |
'session-menu-root': SessionMenu, | |
}; | |
const isoData = window.isoData || {}; | |
Object.keys(isoData).forEach(id => { | |
const props = isoData[id]; | |
const el = document.getElementById(id); | |
const Comp = isoComps[id]; | |
if (props && el && Comp) { | |
render(<Comp {...props} />, el); |
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
// /app/config.js | |
class Config { | |
constructor() { | |
this.data = {}; | |
} | |
setData(data) { | |
this.data = {...this.data, ...data}; |
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
require 'json' | |
require 'rest_client' | |
ACCOUNT_SID = "XXX" | |
AUTH_TOKEN = "YYY" | |
API_BASE = "https://#{ACCOUNT_SID}:#{AUTH_TOKEN}@api.twilio.com" | |
TEST_DATE = "2012-10-27" | |
def fetch_call_sids_from_uri(uri, sids=[]) | |
# fetch and parse data |