Latest Posts

Happy 2016

December 31, 2015 9:00 am Published by 2 Comments

The number 2016 is 11111100000 in binary. Years whose binary representations are just 1s followed by 0s have been rare for a thousand years, but we’re going to get more and more in the next few decades:

2016 11111100000
2032 11111110000
2040 11111111000
2044 11111111100
2046 11111111110
2047 11111111111
2048 100000000000

And then no more until the 31st century. So enjoy them while they last!

Records that The Force Awakens has set

December 22, 2015 7:41 pm Published by 1 Comment

Star Wars: The Force Awakens had a pretty big opening weekend. It broke the records for domestic opening weekend ($247.9M, over Jurassic World‘s 208.8M) and worldwide ($529M, also breaking Jurassic World‘s 524.9M). But that’s not all.

  • Largest Thursday “preview” day
  • Largest Friday, largest opening day, largest single day
  • (Not the largest Saturday, it was 3rd, behind the first Avengers movie and Jurassic World
  • Largest Sunday
  • Largest Monday (in this case breaking Spiderman 2‘s 11-year-old record)
  • Highest per-theater average (this record is probably the craziest — it broke Jurassic World‘s previous record by 22%)
  • Fastest movie to $100M (in fact, the very first movie to break 100M in one day, so this record will never be broken, only tied) and the fastest to $250M
  • Largest domestic and global IMAX weekends
  • Biggest December opening weekend (by a factor of 3! $248M, compared to the previous record was the first Hobbit at 85M)

There are more, too, but they’re all implied by the above ones (largest PG-13 opening weekend! Largest holiday weekend!).

And for the record, my review:

The National Anthem retold simply

May 14, 2015 9:39 am Published by Leave your thoughts

Our Sign With Stars On It

It’s morning now.
That thing we saw last evening — can you see it?
It was on the other side of that wall.
We could see its colors even though there was a fight happening.
In fact, the fighting gave off light that let us see it all night!
So, is it still there?

(Inspired by XKCD’s Up-goer Five and repeated singing of The Starspangled Banner to my infant daughter.)

A week’s worth of paternity leave

April 6, 2015 9:05 am Published by Leave your thoughts

Stats from a week’s worth of paternity leave with a 3.5 month old:

  • Naps: 22 (average 4.4 per day, median length: 46 mins)
  • Bottles: 20 (average 4 per day, median volume: 3.25 oz)
  • Diapers: 32 (average 6.4 per day)
  • Smiles: 1040 (approximate)

JavaScript Flickr carousel

December 19, 2014 9:03 am Published by Leave your thoughts

My wife and I made something a couple of weeks ago, and her name is Simone. Our families and some friends want to see lots of pictures, but most people don’t want us to flood their Facebook feeds with baby photos (nor do we want to). So we’ve been uploading them to Flickr mostly, but I wanted a slightly simpler page where people could just see a carousel slideshow of photos of our daughter. There was no good immediately-integrated-with-Flickr JavaScript carousel I could find, but I was pretty easily able to integrate it with Fotorama.

Here is the final product (and beautiful pictures of my girl). Here are the easy steps to do it yourself:

  1. Sign up for a Flickr API key. If this is a non-commercial site, it’s free and instant.
  2. Grab the download or copy the hotlink markup from the setup page in the Fotorama docs
  3. Add this markup to your page:
    <div class="carousel" data-auto="false"></div>

    There’s a lot of configuration options you can add besides that. Here’s the full list.

  4. And now the final step, the JavaScript that populates the carousel:
      <script type="text/javascript">
        $(function() {
          var AddPhotosToCarousel = function(data) {
          var imgs = [];
          $.each(data.photoset.photo, function(index, photo) {
            imgs.push({img: photo['url_m'],
                       thumb: photo['url_sq'],
                       caption: photo['title']});
            });
            $('.carousel').fotorama({ data: imgs });
          };
          $.getJSON('https://api.flickr.com/services/rest/?method=flickr.photosets.getPhotos&api_key=XXXXXXXXXX&photoset_id=YYYYYYYYYY&format=json&extras=url_sq,url_m&jsoncallback=?', AddPhotosToCarousel);
        });
      </script>
    

You must put your API key and your photoset’s id into that big URL you pass to $.getJSON(). If you want the photos to show up in reverse order (as I did), change imgs.push() to imgs.unshift(). You can display things other than photosets (search results and such), but you’ll need to dig into the Flickr API docs to build those queries yourself.