Calculate downloads floor

I wanted to calculate the ratio of active theme installs versus theme downloads, but the calculation often seemed very unfair, for example when a theme has been downloaded 999 times, the “active_installs” number would reflect that as 900  on the WordPress API because it lists theme and plugin count in very round numbers ( 10s, 100s, 1000s, etc. ). More

A simple one-liner to convert all JavaScript to CoffeeScript

A simple one-liner to convert all JavaScript in a folder to CoffeeScript

First, make sure you have installed “js2coffee” ( and is real cool for single files too ):

npm install js2coffee

And then just paste this:

for f in *.js; do js2coffee -it $f > ${f%%.*}.coffee; rm $f; done;

`-it` options modifies the spaces to tabs, remove it if you prefer spaces.


Snippet: Get the correct page in WordPress

Here is another really quick snippet.
If you have a page where you’re using Query Posts you’re going to have trouble with Pagination.
Wordpress for some reason likes to use page and paged randomly.

If you assign your page as the “front page”, you’re going to have to get_query_var(‘page’), and if you’re going to assign it elsewhere, it’s going to be paged. This is all fine and dandy, at least when you’re in control, but as soon as someone else starts using your theme, you need something more trustworthy, and that’s what this is.

Sublime Susy

Sublime Susy 0.1

I just uploaded my initial commit to Github with snippets for the Compass Susy Grid system.
This is version 0.00001, which means I have no idea if I’ve made spelling errors or forgot something, but we’ll fix them over time, right ?

I hope that in the future we can add in some auto-completion for Susy variables, etc, but for now, I hope that you’re going to like my Susy Snippets

CoffeeScript Blows. Minds.

Was looking for a simple way to write an alternative of PHP’s in_array() function in JavaScript, and since I’m using actually writing CoffeeScript, decided to look there as well. And sure enough. Mind Blown.


        for val,key in values
            if val in selected_values
                return "MIND BLOWN."

Turns into

var key, val, _i, _len,
  __indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };

for (key = _i = 0, _len = values.length; _i < _len; key = ++_i) {
  val = values[key];
  if (, val) >= 0) {
    return "MIND BLOWN.";




Filter an HTML Select Dropdown in Regex

I have had a repeated need for this.

Baiscally what it does it turns:

Awesome Number
Top Number


Awesome Number is 99
Top Number is 100

Sometimes useful, decided to save & share :nerd:

$2 is $1

Danish ZIP Codes (PHP Array)

Just in case someone needs this some day.

Usage: [0] => Region Title, [1] => Min ZIP Number, [2] => Max ZIP Number

$denmark = array(
array('København', 1000, 1799),
array('Frederiksberg', 1800, 2999),
array('Nordsjælland', 3000, 3699),
array('Bornholm', 3700, 3799),
array('Færøerne', 3800, 3899),
array('Grønland', 3900, 3999),
array('Øvrige Sjælland', 4000, 4999),
array('Fyn', 5000, 5999),
array('Sønderjylland', 6000, 6999),
array('Vestjylland', 7000, 7999),
array('Østjylland og Midtjylland', 8000, 8999),
array('Nordjylland', 9000, 9999)