Skip to content

Instantly share code, notes, and snippets.

💭
merging your prs

Tom MacWright tmcw

💭
merging your prs
Block or report user

Report or block tmcw

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@tmcw
tmcw / README.md
Last active Jul 11, 2019
Mediocre vim code intelligence with ctags
View README.md

Though I love vim, it has one pretty big flaw: it doesn't know JavaScript. There are systems that know JavaScript pretty well, like all of Visual Studio Code’s code intelligence features. I've tried all of them: languageserver, tern, typescript server… and they've all broken my heart. And then I went back to the opposite extreme: no autocomplete, no fancy stuff, not even the supertab plugin. Now I've settled in the middle, and am loving mediocre vim. The combination is:

ctags

Ctags is a beautifully ugly system, with extreme performance and simplicity. Just enough intelligence to pluck out the exports and declarations in your files to make jump to definition work mostly. It's basically a set of regular expressions that tries to find keywords and then puts them in a file that your editor can use as an index.

brew install ctags-exuberant
@tmcw
tmcw / bad-in-the-middle.md
Last active Jul 9, 2019
It's bad in the middle
View bad-in-the-middle.md

It's bad in the middle

Trigger warning: this post talks about money. Skip it if you don’t want to read about money. For real: compensation, money – the whole thing stresses me out. I wrote it because I strongly suspect something’s going on, and that this suspicion has been confirmed a few times, and I think it’s worthwhile to sketch it all out. I take care not to name any numbers here: though you can make very little money in startups and many people manage to, a lot of people also make a lot of money, and the absurdity of the amounts never wears off, ever, and the jealousy will eat you. Note also that I’m not an accountant or a lawyer and this post has nothing to do with my current or previous employers.

Diagnosis:

  • Early stage startups give you equity for cheap, freedom
  • Public tech companies give you cash, liquid equity, stability
  • Middle stage startups are chaotic, less equity and at a worse price, and not as much cash as late-stage startups
View decentralize.sh
#!/bin/zsh
ipfs daemon &
PID1=$!
echo "Jekyll building…"
bundle exec jekyll build
cd _site
make-relative https://macwright.org/
View decentralize.sh
#!/bin/zsh
ipfs daemon &
PID1=$!
echo "Jekyll building…"
bundle exec jekyll build
cd _site
make-relative https://macwright.org/
View decentralize.sh
#!/bin/zsh
ipfs daemon &
PID1=$!
echo "Jekyll building…"
bundle exec jekyll build
cd _site
make-relative https://macwright.org/
@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/

You can’t perform that action at this time.