I hereby claim:
- I am patrickjs on github.
- I am patrickjs (https://keybase.io/patrickjs) on keybase.
- I have a public key ASBn2MGzPQqMCt802JVdIQZ4jMYLE-gPnJ4uBCai7-XQxgo
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
| class LRU extends Map { | |
| m = 10; | |
| get(k) { | |
| let i = super.get(k); | |
| if (i) { | |
| super.delete(k); | |
| super.set(k, i); | |
| } | |
| return i; | |
| } |
| let matches = null; | |
| export function matchesSelector(element: Element, selector: string): boolean { | |
| if (!matches) { | |
| const elProto = Element.prototype as any; | |
| matches = elProto.matches || elProto.matchesSelector || elProto.mozMatchesSelector || | |
| elProto.msMatchesSelector || elProto.oMatchesSelector || elProto.webkitMatchesSelector; | |
| } | |
| return matches.call(element, selector); | |
| } |
| <?php | |
| /* | |
| Identify existing meetings/meeting IDs on Zoom.us call app | |
| License: Public domain. Use for pranking only. Any other use prohibited. | |
| https://gist.github.com/nekromoff/48ec26cbaecc31fccb202d1efa7d0657 | |
| */ | |
| $ch = curl_init(); |
| export const h=(t,p,...c)=>({t,p,c,k:p&&p.key}) | |
| export const render=(e,d,t=d.t||(d.t={}),p,r,c)=> | |
| // arrays | |
| e.pop?e.map((e,p)=>render(e,d,t.o&&t.o[p])): | |
| // components | |
| e.t.call?(e.i=render((render.c=e).t({children:e.c,...e.p},e.s=t.s||{},t=> | |
| render(Object.assign(e.s,t)&&e,d,e)),t.i||d,t&&t.i||{}),e):( | |
| // create notes | |
| e.d=t.d||(e.t?document.createElement(e.t):new Text(e.p)), | |
| // diff props |
| const { createServer } = require('http'); | |
| createServer((req, res) => { | |
| res.writeHead(200, { | |
| Connection: 'Transfer-Encoding', | |
| 'Content-Type': 'text/html; charset=utf-8', | |
| 'Transfer-Encoding': 'chunked' | |
| }); | |
| res.write(` |
I recently had several days of extremely frustrating experiences with service workers. Here are a few things I've since learned which would have made my life much easier but which isn't particularly obvious from most of the blog posts and videos I've seen.
I'll add to this list over time – suggested additions welcome in the comments or via twitter.com/rich_harris.
Chrome 51 has some pretty wild behaviour related to console.log in service workers. Canary doesn't, and it has a load of really good service worker related stuff in devtools.
| /* eslint-disable no-param-reassign */ | |
| const path = require('path'); | |
| const fse = require('fs-extra'); | |
| class LoadablePlugin { | |
| constructor({ filename = 'loadable-stats.json', writeToFileEmit = false } = {}) { | |
| this.opts = { filename, writeToFileEmit }; | |
| } | |
| apply(compiler) { |
| function logger(strings,...values) { | |
| var str = ""; | |
| for (let i = 0; i < strings.length; i++) { | |
| if (i > 0) { | |
| if (values[i-1] && typeof values[i-1] == "object") { | |
| if (values[i-1] instanceof Error) { | |
| if (values[i-1].stack) { | |
| str += values[i-1].stack; | |
| continue; | |
| } |
| AWS region code | AWS region name | Number of AZs | AZ names |
|---|---|---|---|
| us-east-1 | Virginia | 4 | us-east-1a, us-east-1b, us-east-1c, us-east-1e |
| us-west-1 | N. California | 2 | us-west-1a, us-west-1b |
| us-west-2 | Oregon | 3 | us-west-2a, us-west-2b, us-west-2c |
| eu-west-1 | Ireland | 3 | eu-west-1a, eu-west-1b, eu-west-1c |
| eu-central-1 | Frankfurt | 2 | eu-central-1a, eu-central-1b |
| ap-southeast-1 | Singapore | 2 | ap-southeast-1a, ap-southeast-1b |
| ap-southeast-2 | Sydney | 2 | ap-southeast-2a, ap-southeast-2b, ap-southeast-2c |
| ap-northeast-1 | Tokyo | 2 | ap-northeast-1a, ap-nort |