Skip to content

Instantly share code, notes, and snippets.

Jamie Learmonth jamiel

Block or report user

Report or block jamiel

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:ea47e4d977cb57e20ddce06f1a7cd5f8
Verifying my Blockstack ID is secured with the address 17Qd1UmHZpdmNPhwFenAPTSJqTXWBookFJ https://explorer.blockstack.org/address/17Qd1UmHZpdmNPhwFenAPTSJqTXWBookFJ
@jamiel
jamiel / gist:3915888
Created Oct 19, 2012
Simple alias for searching Symfony2 projects faster
View gist:3915888
# Add to your ~/.bashrc
# Usage: sgrep <mysearch> .
# Use from the root of your Symfony2 project
alias sgrep="grep -r --exclude-dir=vendor --exclude-dir=app/cache --exclude-dir=app/logs"
@jamiel
jamiel / gist:3134380
Created Jul 18, 2012
Yet another javascript gotcha
View gist:3134380
Auto-filling Array Keys
=======================
var foo = new Array();
foo[500] = 'bar';
console.log(foo.length); // 501
// And it gets worse:
@jamiel
jamiel / gist:3096567
Created Jul 12, 2012
Bash - Testing re-assigning of arrays
View gist:3096567
#!/bin/bash
#
# Test script to test bashes handling of re-assigned arrays
FOO[0]='foo';
FOO[1]='bar';
BAR=$FOO
echo "Loop main array"
@jamiel
jamiel / gist:1950093
Created Mar 1, 2012
Why does count(false) == 1 in PHP?
View gist:1950093
Why does count(false) == 1 in PHP?
----------------------------------
If you have ever been caught out by doing if (count($var)) and wondered why this
passes when a previous assignment failed and set this to false, the reason is
actually quite simple. count() was designed to be used with arrays, and so values
are always cast to an array internally before checking the number of elements. If
you cast a boolean to an array it will be come an array with one element set to the
value of the boolean. See:
@jamiel
jamiel / gist:1950031
Created Mar 1, 2012
New background image not loading after jQuery fadeOut / fadeIn
View gist:1950031
fadeIn rendering bug (background image)
---------------------------------------
I was experiencing an issue in Chrome and Internet Explorer where intermittently the
background image would fail to load after a a fadeIn. Narrowed this down to a rendering
issue rather than a logic error and was able to fix it by resetting the background image
after the fade like so:
$('#wrapper').css('background', $('#wrapper').css('background'));
@jamiel
jamiel / gist:1711933
Created Jan 31, 2012
PHP 5.3 namespaces have taken away the biggest advantage of autoloading
View gist:1711933
PHP 5.3 namespaces have taken away the biggest advantage of autoloading
-----------------------------------------------------------------------
When autoloading was introduced into PHP, the PHP world rejoiced as we no
longer needed to require every class we wanted to use in our current file
at the top of our code. With the introduction of namespaces this advantage
has been completely reversed, where unless you are writing all your code in
a single namespace (unlikely) you will end up needing to "use" every class
you want to include.
You can’t perform that action at this time.