datashaman

dev tag

Testing multi-connection models

When testing in Laravel with models that have custom connections set, you need a way to force the connection to one of your choosing for the duration of the test.

Cumulative Filter Object

I've created a cumulative object in coffeescript, useful for creating filters.

It's closest to a Reader / Environment monad.

Every time you call it with arguments, it merges them into a running context, which it uses to create the next filter which is returned. You can create graphs of filters, deriving from a common point.

10 line accordian script for jQuery (or less)

Anyone who's used jQuery, knows that you can write less and do more with JavaScript.

Recently I wanted to use an accordian script to present a large amount of content on one page.

After looking at the options available, I decided that I could write something better. And smaller.

Get URL Parameters in Javascript

I needed a Javascript function which would give me access to the URL querystring, much like PHP's $_GET associative array. Unfortunately most of the solutions I found were either wrong, incomplete or badly written. IMHO. :)

So, being a programmer, I decided to knock up my own version of the script.