21 March 2018

Space Creatures

Since January, I have been at Recurse Center. I like to refer to it as a self-directed coding retreat. I’m really loving it. As is seen on this blog, I really enjoy jumping into side projects and building fun things. This space is great for it as it gives me a wonderful environment to work in, and also the added benefit of being around interesting people who are also working on interesting things. It feels part academic, part co-working space, part art studio, and part social experiment.

I can talk more on RC, but I figured today I would share the project I built when I applied. There were many prompts to choose from, and I chose one that asked to implement your own version of Space Invaders. I called it Space Creatures!

After going through the initial application and sharing it, I worked on it for an extra day, because I was having fun piecing it together. I built it from scratch, using no libraries (as the prompt requested limiting usage of other libraries). My favorite parts were the sounds and explosion animations. In trying to get the right easing on my animations, To point out one random part, I had fun resorting to high school math and plotting ideas on the built-in Grapher tool on my Mac:

 _fade_out_exp(frac) {
  // frac - float - 0 to 1
  // exponential fade-out: y = (2 - 2^(1 - 6x)) / 2
  return (2 - Math.pow(2, 1 - 6 * frac)) / 2;
}

Space creatures easing function graph

This was the first project on which I used Prettier. I also went on a fun tangent reading about Symbols and realizing that my initial intuition on how I wanted to use them as enums isn’t exactly what they’re really meant for.

Space Creatures links:

Space Creatures game

I recently wanted to save a Quicktime screen recording .mov file as .mp4.

There are a number of tools online, but why load any of those when you can just run ffmpeg from your terminal! You can download their installer or on a Mac, just run brew install ffmpeg.

To convert it and also compress the result, you can run:

ffmpeg -i my-video.mov -vcodec h264 -acodec mp2 my-video.mp4

This went from a 24MB Quicktime Movie file to a 3.7MB MP4!

Various of examples of how errors and rejects bubble up (or not) with JavaScript Promises. read full post…

21 December 2017

An abacus in a pile of toys

I recently chanced across an abacus and finally learned how they work. It turns out it’s a really cool tool and I think it’s useful for all math students to learn! read full post…
Net Neutrality is under attack by the current administration. This post is what I sent. Please take a moment to let the FCC know you care about protecting Title II classification! read full post…

Peter Coles

Peter Coles

is a software engineer who lives in NYC, works at Ringly, and blogs here.
More about Peter »

github · soundcloud · @lethys · rss

It’s time to get big money out of politics. Join the kick-started campaign to put government back in the hands of the people. Pledge mayday.us now