fuzzy notepad

Atom feed [blog] blog

[blog] Converting a Git repo from tabs to spaces

This post is about the thing in the title.

I used to work for Yelp. For historical reasons — probably “the initial developers preferred it” — their mostly-Python codebase had always been indented with tabs. That’s in stark contrast to the vast majority of the Python ecosystem, which generally uses the standard library’s style guide recommendation of four spaces. The presence of tabs caused occasional minor headaches and grumbles among the Python developers, who now numbered in the dozens and were generally used to spaces.

At the end of 2013, I bestowed Yelp with a Christmas gift: I converted their entire primary codebase from tabs to four spaces. On the off chance anyone else ever wants to do the same, here’s how I did it. Probably. I mean, it’s been two and a half years, but I wrote most of this at the time, so it should be correct.

Please note: I do not care what you think about tabs versus spaces. That’s for a different post! I no longer work for Yelp, anyway — so as compelling as your argument may be, I can no longer undo what I have done.

[blog] Extracting music from the PICO-8

Update 2016-07-27: PICO-8 0.1.8 supports music export — export "foo%d.wav" while the music tab is selected in the editor!

Our PICO-8 game, Under Construction, contains some music that Mel composed.

The PICO-8 can only play music that you compose with the PICO-8, and it doesn’t have a music export. This posed a slight problem.

I solved that problem, and learned some things about audio along the way. None of this will be news to anyone who’s worked with sound before, but if you know as little about it as I do, you might find it as interesting as I did.

[blog] Perlin noise

I used Perlin noise for the fog effect and title screen in Under Construction. I tweeted about my efforts to speed it up, and several people replied either confused about how Perlin noise works or not clear on what it actually is.

I admit I only (somewhat) understand Perlin noise in the first place because I’ve implemented it before, for flax, and that took several days of poring over half a dozen clumsy explanations that were more interested in showing off tech demos than actually explaining what was going on. The few helpful resources I found were often wrong, and left me with no real intuitive grasp of how and why it works.

Here’s the post I wish I could’ve read in the first place.

[blog] Under Construction, our PICO-8 game

Mel and I made a game!

We’d wanted to a small game together for a while. Last month’s post about embedding Lua reminded me of the existence of the PICO-8, a “fantasy console” with 8-bit-ish limitations and built-in editing tools. Both of us have a bad habit of letting ambitions spiral way out of control, so “built-in limitations” sounded pretty good to me. I bought the console ($15, or free with the $20 Voxatron alpha) on a whim and started tinkering with it.

The result: Under Construction!

pico-8 cartridge

You can play in your very own web browser, assuming you have a keyboard. Also, that image is the actual cartridge, which you can save and play directly if you happen to have PICO-8. It’s also in the PICO-8 BBS.

(A couple people using Chrome on OS X have reported a very early crash, which seems to be a bug outside of my control. Safari works, and merely restarting Chrome has fixed it for at least one person.)

I don’t have too much to say about the game itself; hopefully, it speaks for itself. If not, there’s a little more on its Floraverse post.

I do have some things to say about making it. Also I am really, really tired, so apologies if this is even more meandering than usual.

[blog] Learning to draw, learning to learn

On January 1, 2015, I started learning to draw.

I’d made a couple brief attempts before, but nothing very serious. I’d eyeballed some official PokĂ©mon artwork on two occasions, and that was pretty much it. I’d been dating an artist for seven years and had been surrounded by artist friends for nearly half my life, but I’d never taken a real crack at it myself.

On some level, I didn’t believe I could. It seemed so far outside the range of things I was already any good at. I’m into programming and math and computers and puzzles; aesthetics are way on the opposite end of a spectrum that only exists inside my head. Is it possible to bridge that huge, imaginary gap? Is it even allowed? (Spoilers: totally.)

In the ensuing sixteen months, a lot of people have — repeatedly — expressed surprise at how fast I’ve improved. I’ve then — repeatedly — expressed surprise at this surprise, because I don’t feel like I’m doing anything particularly special. I don’t have any yardstick for measuring artistic improvement speed; the artists I’ve known have always been drawing for years by the time I first met them. Plenty of people start drawing in childhood; not so many start at 27.

On the other hand, I do have 15 years’ experience of being alright at a thing. I suspect, in that time, I’ve picked up a different kind of skill that’s undervalued, invaluable, and conspicuously lacking from any curriculum: how to learn!

I don’t claim to be great at art, or even necessarily great at learning, but here are some things I’ve noticed myself doing. I hope that writing this down will, at the very least, help me turn it into a more deliberate and efficient process — rather than the bumbling accident it’s been so far.

[blog] Embedding Lua vs Python

Nova Dasterin asks, with money:

How about usage of Lua for game development? Love2d etc. Also http://lexaloffle.com/pico-8.php which I recently heard about.

clarification: thoughts on Lua as a ‘good choice’, also Lua vs Python for that subject (gamedev)

There are a couple ways I can interpret this, so I’ll go with: all of them.

(edit: you may be interested in a subsequent post about the game I actually made for the PICO-8!)

[blog] The case for base twelve

Decimal sucks.

Ten is such an awkward number. Its only divisors are two and five. Two is nice, but five? Who cares about five? What about three and four?

I have a simple solution to all of these non-problems and more, which is: we should switch to base twelve.

[blog] Elegance

Programmers sometimes like to compliment code as elegant, yet I can’t recall ever seeing a satisfying explanation of what “elegant code” is. Perhaps it’s telling that I see “elegant” used much less often by more experienced programmers, who opt for more concrete commentary.

Surely elegance is a quality to strive for, but how are we to strive for something we can’t define? “I know it when we see it” isn’t good enough.

I think about this from time to time. Here’s what I’ve come up with.

[blog] Apple did not invent emoji

I love emoji. I love Unicode in general. I love seeing plain text become more expressive and more universal.

But, Internet, I’ve noticed a worrying trend. Both popular media and a lot of tech circles tend to assume that “emoji” de facto means Apple’s particular font.

I have some objections.

[blog] My first computer

This month — March, okay, today is March 36th — Vladimir Costescu is sponsoring an exciting post about:

How about this: write about your very first computer (e.g. when you were a kid or whatever) and some notable things you did with it / enjoyed about it. If you’ve ever built your own computer from parts, feel free to talk about that too.

[blog] I made a Doom level

Yes, dear readers, I have a confession to make. Despite spending 29,000 words explaining why and how you should make a Doom level, I’ve yet to actually publish one myself.

I’ve been… orbiting? the ZDoom community for over a decade, but only really contributed in the form of minor wiki edits and occasional advice. I started a good few maps when I was a teenager, but I tended to get bogged down in making some complicated contraption work, and then get bored with the whole idea and lose interest.

More recently I’ve actually made a few maps that got as far as having an exit (!), but I never really finished them, and I haven’t published them anywhere.

So when the Doom Upstart Mapping Project 2 was announced, with the goal of just getting something done with the short time limit of a week, I figured I should give it a shot. And I did. I spent six straight days doing virtually nothing but working on this Doom map.

Results: pretty good! I’m pretty happy with it, and a few people have played it and enjoyed it. I put a lot of thought into it — or tried, anyway — and have a lot to say about it, so this is my developer commentary.

I’ve described the course through the map as I go, and I’ve tried to include some context for people whose knowledge of Doom is only “you shoot monsters”, so I hope it’s at least a little accessible. It’s really long, though. Again. Sorry. Not actually sorry.

[blog] Maybe we could tone down the JavaScript

I’m having a really weird browser issue, where scripts on some pages just won’t run until about 20 seconds have passed.

Whatever you’re about to suggest, yes, I’ve thought of it, and no, it’s not the problem. I mention this not in the hope that someone will help me debug it, but because it’s made me acutely aware of a few… quirks… of frontend Web development.

(No, really, do not try to diagnose this problem from one sentence, I have heard and tried almost everything you could imagine.)

[blog] The NSA is trying to create a virtual clone of me

update 2016-03-19: I believe the account described below is run by a real human being, but for the sake of their privacy I’m not going to tell you why. I’m leaving this post up, though, because it’s an interesting story and also this was a hecka creepy thing to do.

@softfennec and @orezpraw brought to my attention the following tweet, which I have to reconstruct from memory for reasons that will be clear in a moment:

I like to think I’m okay at math, but then I stumble into Math SE and it’s Latin to me. http://math.stackexchange.com/q/1665383/58532

What a hilarious joke! I liked it so much that it turns out I’d already made it myself:

i like to think i’m ok at math but then i stumble into math.SE and it is basically lorem ipsum to me http://math.stackexchange.com/q/1665383/58532

— @eevee, Feb 21 at 10:49am

[blog] VD

This month — which I will pretend is still February, because time zones or something — Vladimir Costescu has sponsored a post on:

OK, how about this: write a post on what you think about (the concept of) Valentine’s Day. Bonus points if you write a brief commentary on this video and work it into the post somehow.

I… I’m afraid I don’t know how to work death metal performed by vampires into a post about anything else.

But Valentine’s Day, I think I can do.

[blog] I made cheesecake

If you were not aware, I have a Patreon tier that’s essentially: I will work on whatever you want for a day, then write about it. I made the tier assuming that people would force me to do programming, e.g. actually work on veekun for once. So far it’s been about half that, and half “hey try this thing you haven’t really done before”.

Last month, @amazingant asked me to cook something, so I decided to try making pretzels, and half-seriously ended the post suggesting that he should have me make cheesecake next.

Well, guess what I had to do this month.

[blog] Twitter’s missing manual

I mentioned recently, buried in a post about UI changes, that Twitter’s latest earnings report included this bombshell:

We are going to fix the broken windows and confusing parts, like the .@name syntax and @reply rules, that we know inhibit usage and drive people away

There’s an interesting problem here. UI is hard. You can’t just slap a button on the screen for every feature that could conceivably be used at any given time. Some features are only of interest to so-called “power users”, so they’re left subtle, spread by word-of-mouth. Some features you try to make invisible and heuristic. Some features are added just to solve one influential user’s problem. Some features are, ah, accidental.

A sufficiently mature, popular, and interesting product thus tends to accumulate a small pile of hidden features, sometimes not documented or even officially acknowledged. I’d say this is actually a good thing! Using something for a while should absolutely reward you with a new trick every so often — that below-the-surface knowledge makes you feel involved with the thing you’re using and makes it feel deeper overall.

The hard part is striking a balance. On one end of the spectrum you have tools like Notepad, where the only easter egg is that pressing F5 inserts the current time. On the other end you have tools like vim, which consist exclusively of easter eggs.

One of Twitter’s problems is that it’s tilted a little too far towards the vim end of the scale. It looks like a dead-simple service, but those humble 140 characters have been crammed full of features over the years, and the ways they interact aren’t always obvious. There are rules, and the rules generally make sense once you know them, but it’s also really easy to overlook them.

Here, then, is a list of all the non-obvious things about Twitter that I know. Consider it both a reference for people who aren’t up to their eyeballs in Twitter, and an example of how these hidden features can pile up. I’m also throwing in a couple notes on etiquette, because I think that’s strongly informed by the shape of the platform.