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
class ImmutableMap<T> { | |
// This is immutable, can't be changed in place | |
private innerMap: Map<string,T>; | |
public constructor(nativeMap = new Map<string,T>()) { | |
this.innerMap = nativeMap; | |
} | |
public keys() : string[] { |
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
/** | |
* Strips the time part away from a date so that it's a pure date (no time). | |
*/ | |
function toPureDate(d: Date) : Date { | |
return new Date(d.getFullYear(), d.getMonth(), d.getDate(), 0, 0, 0, 0); | |
} | |
function hoursAgo(h: number) : Date { | |
const now: Date = new Date(); | |
now.setTime(now.getTime() - h * 60 * 60 * 1000); |
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
// Simulating Bitcoin's Proof-of-Work mining algorithm | |
// The challenge: choose a nonce that, when appended to "hello", | |
// yields an MD5 hash with at least 4 leading zeroes | |
for (let i = 0; i < 1000000; i++) { | |
out = md5("hello" + i); | |
if (out.startsWith("0000")) { | |
console.log(i, out) | |
} | |
} |
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
Andover-Harvard Theological Library | |
Arnold Arboretum Horticultural Library | |
Arthur and Elizabeth Schlesinger Library on the History of Women in America | |
Baker Library | |
Baker Library Special Collections | |
Birkhoff Mathematical Library | |
Botany Libraries | |
Cabot Science Library | |
Chemistry and Chemical Biology Library | |
Countway Library of Medicine |
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
Fogg Museum | |
Busch-Reisinger Museum | |
Arthur M. Sackler Museum | |
Carpenter Center | |
Peabody Museum | |
Graduate School of Design | |
Harvard Semitic Museum | |
Arnold Arboretum | |
Collection of Historical Scientific Instruments | |
Harvard Museum of Natural History |
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
/\b[\w\d._%+-]+@[\w\d.-]+\.[\w]{2,}\b/g |