software engineering

Intercepting XMLHttpRequest requests

By Adam K Dean on

Let's kick off the continuation of my code blogging with a very helpful little snippet. I'm just removing this from a codebase so it can sit here for eternity instead.

(function(open) { = function(method, url, async, user, pass) {
        // do some magic, method, url, async, user, pass);

This will intercept the request before it happens, and once you've done whatever changes you need to do, be it logging or tagging, you can continue it.

New website is now live

By Adam K Dean on

Finally, the new website is now live. There are still some features to complete, such as searching, commenting, responsiveness, blog archive and more, but we're close enough to go live.

Since the fateful event of August 2014 when my darling girlfriend turned off all the power before a holiday and somehow destroyed the previous server and therein the old website, this site had been kept running barely by Ghost.

Well, that's a thing of the past now. Ghost is...well, a ghost. A codebase arises.

I'll be actively adding features and finishing off the edges over the next few months.

Oh, and as a bonus, backlinks from my old website now work too.

Disable iptables

By Adam K Dean on

Rather than disabling iptables in Ubuntu 14.04, you can allow everything.

iptables -F
iptables -P INPUT ACCEPT

It's bad, but it works.

Version ranges for node package dependencies

By Adam K Dean on

I've lifted this from, but here at least I'll find it again.

version Must match version exactly
>version Must be greater than version
>=version etc
~version "Approximately equivalent to version"
^version "Compatible with version"
1.2.x 1.2.0, 1.2.1, etc., but not 1.3.0
http://... See 'URLs as Dependencies' below
* Matches any version
"" (just an empty string) Same as *
version1 - version2 Same as >=version1 <=version2.
range1 || range2 Passes if either range1 or range2 are satisfied.
git... See 'Git URLs as Dependencies' below
user/repo See 'GitHub URLs' below
tag A specific version tagged and published as tag path/path/path See Local Paths below

For example, these are all valid:

{ "dependencies" :
    { "foo" : "1.0.0 - 2.9999.9999"
    , "bar" : ">=1.0.2 <2.1.2"
    , "baz" : ">1.0.2 <=2.3.4"
    , "boo" : "2.0.1"
    , "qux" : "<1.0.0 || >=2.3.1 <2.4.5 || >=2.5.2 <3.0.0"
    , "asd" : ""
    , "til" : "~1.2"
    , "elf" : "~1.2.3"
    , "two" : "2.x"
    , "thr" : "3.3.x"
    , "lat" : "latest"
    , "dyl" : "file:../dyl"

Git urls can be of the form:


Read more:

How to replace master branch in git, entirely, from another branch?

By Adam K Dean on

If you want to completely replace a branch by merging over another, the follow trick will help you, as it has helped me:

git checkout yourbranch  
git merge -s ours master  
git checkout master  
git merge yourbranch