Skip to content

Instantly share code, notes, and snippets.

💭
merging your prs

Tom MacWright tmcw

View GitHub Profile
@tmcw
tmcw / README.md
Created Mar 5, 2019
Image version navigator
View README.md

If you version images like person-1.jpg person-2.jpg, this will let you swap an img element for a Timg component, and clicking on the image cycles through previous versions.

View data.json
[{"ingredients":["Creme de Cacao","Vodka"],"name":"'57 Chevy with a White License Plate"},{"ingredients":["Dark rum","Light rum","Vodka","Orange juice"],"name":"155 Belmont"},{"ingredients":["Absolut Citron","Orange Curacao","Strawberry liqueur","Orange juice"],"name":"9 1/2 Weeks"},{"ingredients":["Vodka","Peach schnapps","Orange juice","Cranberry juice"],"name":"A Gilligan's Island"},{"ingredients":["Amaretto","Lemon","Ice","Maraschino cherry"],"name":"A True Amaretto Sour"},{"ingredients":["White Creme de Menthe","Southern Comfort","Vodka","Hot chocolate"],"name":"A.D.M. (After Dinner Mint)"},{"ingredients":["Gin","Grand Marnier","Lemon Juice","Grenadine"],"name":"A1"},{"ingredients":["Gin","Sweet Vermouth","Orange Juice","Angostura Bitters"],"name":"Abbey Martini"},{"ingredients":["Absolut Citron","Sweet and sour","Sprite","Soda water","Lemon"],"name":"Absolut Summertime"},{"ingredients":["Vodka","Cranberry Juice","Champagne"],"name":"Absolutely Fabulous"},{"ingredients":["Absolut Citron","Orange juice","
View adjusted.csv
name economy (mpg) cylinders displacement (cc) power (hp) weight (lb) 0-60 mph (s) year
AMC Ambassador Brougham 13 8 360 175 3821 11 73
AMC Ambassador DPL 15 8 390 190 3850 8.5 70
AMC Ambassador SST 17 8 304 150 3672 11.5 72
AMC Concord DL 6 20.2 6 232 90 3265 18.2 79
AMC Concord DL 18.1 6 258 120 3410 15.1 78
AMC Concord DL 23 4 151 3035 20.5 82
AMC Concord 19.4 6 232 90 3210 17.2 78
AMC Concord 24.3 4 151 90 3003 20.1 80
AMC Gremlin 18 6 232 100 2789 15 73
View adjusted.csv
name economy (mpg) cylinders displacement (cc) power (hp) weight (lb) 0-60 mph (s) year
AMC Ambassador Brougham 13 8 360 175 3821 11 73
AMC Ambassador DPL 15 8 390 190 3850 8.5 70
AMC Ambassador SST 17 8 304 150 3672 11.5 72
AMC Concord DL 6 20.2 6 232 90 3265 18.2 79
AMC Concord DL 18.1 6 258 120 3410 15.1 78
AMC Concord DL 23 4 151 3035 20.5 82
AMC Concord 19.4 6 232 90 3210 17.2 78
AMC Concord 24.3 4 151 90 3003 20.1 80
AMC Gremlin 18 6 232 100 2789 15 73
View es-module-note.md

Adding an ES Module entry point to your node module is potentially a breaking change

If you've published a bunch of node modules to npm like I have, this note is for you.

tl;dr: If you're adding an ES Module entry point to your node module ("module" in package.json), and you previously exported a single thing from the CommonJS entry point (module.exports = …), you need to mark the change as a major version bump in semver, or you'll get a lot of angry webpack users.

Okay, so, recently I've been doing some minor maintainance to my little constellation of node modules, and one of the things I was doing was adding a "module" entry point to package.json, and using microbundle to expose an ES Module alongside CommonJS and UMD bundles. This leads to a bunch of fun benefits linked in the aforementioned blog post.

My gut was that this addition to the modules constituted a minor bump to their versions - I try to follow [semver](https://semver.org/

View nouns.txt
aardvark
abacus
abbey
abdomen
ability
abolishment
abroad
abuse
accelerant
accelerator
View triangle.txt
59
73 41
52 40 09
26 53 06 34
10 51 87 86 81
61 95 66 57 25 68
90 81 80 38 92 67 73
30 28 51 76 81 18 75 44
84 14 95 87 62 81 17 78 58
21 46 71 58 02 79 62 39 31 09
View big_exp.txt
519432,525806
632382,518061
78864,613712
466580,530130
780495,510032
525895,525320
15991,714883
960290,502358
760018,511029
166800,575487
View index.js
import * as Library from "@observablehq/stdlib";
View words.txt
"A","ABILITY","ABLE","ABOUT","ABOVE","ABSENCE","ABSOLUTELY","ACADEMIC","ACCEPT","ACCESS","ACCIDENT","ACCOMPANY","ACCORDING","ACCOUNT","ACHIEVE","ACHIEVEMENT","ACID","ACQUIRE","ACROSS","ACT","ACTION","ACTIVE","ACTIVITY","ACTUAL","ACTUALLY","ADD","ADDITION","ADDITIONAL","ADDRESS","ADMINISTRATION","ADMIT","ADOPT","ADULT","ADVANCE","ADVANTAGE","ADVICE","ADVISE","AFFAIR","AFFECT","AFFORD","AFRAID","AFTER","AFTERNOON","AFTERWARDS","AGAIN","AGAINST","AGE","AGENCY","AGENT","AGO","AGREE","AGREEMENT","AHEAD","AID","AIM","AIR","AIRCRAFT","ALL","ALLOW","ALMOST","ALONE","ALONG","ALREADY","ALRIGHT","ALSO","ALTERNATIVE","ALTHOUGH","ALWAYS","AMONG","AMONGST","AMOUNT","AN","ANALYSIS","ANCIENT","AND","ANIMAL","ANNOUNCE","ANNUAL","ANOTHER","ANSWER","ANY","ANYBODY","ANYONE","ANYTHING","ANYWAY","APART","APPARENT","APPARENTLY","APPEAL","APPEAR","APPEARANCE","APPLICATION","APPLY","APPOINT","APPOINTMENT","APPROACH","APPROPRIATE","APPROVE","AREA","ARGUE","ARGUMENT","ARISE","ARM","ARMY","AROUND","ARRANGE","ARRANGEMENT","ARRIVE","ART",
You can’t perform that action at this time.