HHVM commits for the week ending 2015-12-04

I’ve decided to start summarising some of the commits made to HHVM each week. I won’t post all of them (you can view those on github if you want), just the ones I either find interesting or think would be of interest to others.

I’m not part of the HHVM team, nor do I work for Facebook. These are just the ramblings of a community member that likes to follow all the exciting new things being added (which does lead to some interesting commits ?)
Continue reading

Request wrappers for Hack

One of the most frustrating parts of using Hack is accessing user-provided data through the request based $_GET and $_POST super-globals. The problem being two-fold:

  • In partial mode, these aren’t typed. This means Hack assumes you know what you’re doing with the values, which can be bad.
  • In strict mode, the super globals aren’t available and result in undefined variable errors in the type checker.

That’s where my new package comes in.
Continue reading

Dragoon’s Markov Chain

Dragoon is a simple Markov-chain based post generator for App.net. At a high level, it loads recent posts by the current user from App.net until there’s at least 201 posts loaded, or no more to load. It then builds up a chain and generates a string from it that’s no more than 247 characters if ‘Include #Dragoon in the posts?’ is selected or 256 characters otherwise.

Depending on how the process was instigated, it is then either displayed to the user or directly posted to App.net. Then hilarity happens.

There are two main parts to the post generation: creating the markov chain and creating the actual post. I’m going to provide code and details on most of those parts. The glue code is left as an exercise for the reader.
Continue reading