Skip to content

Instantly share code, notes, and snippets.

@etale
etale / fontFamily.js
Last active January 25, 2018 06:28
reset font-family for outlook.office.com
[...document.styleSheets]
.map(a => {
try {
return a.rules;
} catch (e) {
return;
}
})
.filter(a => a)
.reduce((a, b) => [...a, ...b], [])
@etale
etale / Number.prototype.js
Last active March 2, 2018 04:25
an extension for Number
(({ ownKeys, defineProperty }, { prototype }) => ownKeys(Math).forEach(property => defineProperty( prototype, property, (value => typeof value === 'function' ? value.length < 2 ? { get() { return value(this) } } : { value(a) { return value(this, a) } } : { value })(Math[property]) ) ))(Reflect, Number)
@etale
etale / numIterator.js
Last active March 16, 2017 03:50
an iterator for Number
Reflect.set(Number.prototype, Symbol.iterator, function* () { let i = 0; while (i < this) yield i++ })
@etale
etale / equation.md
Last active April 9, 2017 21:14
equation in plain GFM

(t + H) ψ = 0

f = mM / 4πr2

f = qQ / 4πr2

let toUint8Array = (a, p = 0x100, isBig = true) => (
a.isZero ? new Uint8Array :
(([q, r]) => (
new Uint8Array(
isBig
? [...toUint8Array(q, p, isBig), r]
: [r, ...toUint8Array(q, p, isBig)]
)
))
(a.divmod(p))

exp[(1.5 log 10) M + J.ord + (4.8 log 10) + πi/4] = exp[3.454 M − 9.076 + πi/4]

@etale
etale / id.js
Created March 31, 2016 07:43
generate 32 bytes id
var id = () => Array.from(crypto.getRandomValues(new Uint8Array(32))).map(a => (a + 0x100).toString(0x10).slice(1)).join('')

𝐀𝐁𝐂𝐃𝐄𝐅𝐆𝐇𝐈𝐉𝐊𝐋𝐌𝐍𝐎𝐏𝐐𝐑𝐒𝐓𝐔𝐕𝐖𝐗𝐘𝐙𝐚𝐛𝐜𝐝𝐞𝐟𝐠𝐡𝐢𝐣𝐤𝐥𝐦𝐧𝐨𝐩𝐪𝐫𝐬𝐭𝐮𝐯𝐰𝐱𝐲𝐳

𝐴𝐵𝐶𝐷𝐸𝐹𝐺𝐻𝐼𝐽𝐾𝐿𝑀𝑁𝑂𝑃𝑄𝑅𝑆𝑇𝑈𝑉𝑊𝑋𝑌𝑍𝑎𝑏𝑐𝑑𝑒𝑓𝑔𝑕𝑖𝑗𝑘𝑙𝑚𝑛𝑜𝑝𝑞𝑟𝑠𝑡𝑢𝑣𝑤𝑥𝑦𝑧

𝑨𝑩𝑪𝑫𝑬𝑭𝑮𝑯𝑰𝑱𝑲𝑳𝑴𝑵𝑶𝑷𝑸𝑹𝑺𝑻𝑼𝑽𝑾𝑿𝒀𝒁𝒂𝒃𝒄𝒅𝒆𝒇𝒈𝒉𝒊𝒋𝒌𝒍𝒎𝒏𝒐𝒑𝒒𝒓𝒔𝒕𝒖𝒗𝒘𝒙𝒚𝒛

𝒜𝒝𝒞𝒟𝒠𝒡𝒢𝒣𝒤𝒥𝒦𝒧𝒨𝒩𝒪𝒫𝒬𝒭𝒮𝒯𝒰𝒱𝒲𝒳𝒴𝒵𝒶𝒷𝒸𝒹𝒺𝒻𝒼𝒽𝒾𝒿𝓀𝓁𝓂𝓃𝓄𝓅𝓆𝓇𝓈𝓉𝓊𝓋𝓌𝓍𝓎𝓏

𝓐𝓑𝓒𝓓𝓔𝓕𝓖𝓗𝓘𝓙𝓚𝓛𝓜𝓝𝓞𝓟𝓠𝓡𝓢𝓣𝓤𝓥𝓦𝓧𝓨𝓩𝓪𝓫𝓬𝓭𝓮𝓯𝓰𝓱𝓲𝓳𝓴𝓵𝓶𝓷𝓸𝓹𝓺𝓻𝓼𝓽𝓾𝓿𝔀𝔁𝔂𝔃

@etale
etale / Fraktur.md
Last active March 4, 2016 03:03
fraktur chars

𝔄𝔞 𝔅𝔟 ℭ𝔠 𝔇𝔡 𝔈𝔢 𝔉𝔣 𝔊𝔤 ℌ𝔥 ℑ𝔦 𝔍𝔧

@etale
etale / promisify.js
Last active February 19, 2016 00:56
Oneliner Promisify
var promisify = (a) => (...b) => new Promise((c, d) => a(...b, (e, f) => e ? d(e) : c(f)))