Skip to content

Instantly share code, notes, and snippets.

View Prestaul's full-sized avatar

Matt Dunlap Prestaul

  • Uber
  • Denver, CO
View GitHub Profile
@Prestaul
Prestaul / worker-pool.js
Created September 10, 2018 17:13
A utility for creating a pool of web workers for batch processing outside of UI thread
// Used by both PooledWorker and WorkerPool
function deferred() {
let resolve, reject;
const promise = new Promise((res, rej) => {
resolve = res;
reject = rej;
});
return {
promise,
@Prestaul
Prestaul / tz-map-from-xml.js
Created August 5, 2016 14:00
This is a script that parses the windowsZones.xml mapping of Windows time zones to Olsen (IANA) time zones
// This is the windowsZones xml mapping to olsen time zones. It could be loaded in other ways
// but for now I just pasted it in here.
// http://unicode.org/repos/cldr/trunk/common/supplemental/windowsZones.xml
var xml = '<supplementalData><version number="$Revision$"/><windowsZones><mapTimezones otherVersion="7e00100" typeVersion="2016d"><!-- (UTC-12:00) International Date Line West --><mapZone other="Dateline Standard Time" territory="001" type="Etc/GMT+12"/><mapZone other="Dateline Standard Time" territory="ZZ" type="Etc/GMT+12"/><!-- (UTC-11:00) Coordinated Universal Time-11 --><mapZone other="UTC-11" territory="001" type="Etc/GMT+11"/><mapZone other="UTC-11" territory="AS" type="Pacific/Pago_Pago"/><mapZone other="UTC-11" territory="NU" type="Pacific/Niue"/><mapZone other="UTC-11" territory="UM" type="Pacific/Midway"/><mapZone other="UTC-11" territory="ZZ" type="Etc/GMT+11"/><!-- (UTC-10:00) Hawaii --><mapZone other="Hawaiian Standard Time" territory="001" type="Pacific/Honolulu"/><mapZone other="H