Skip to content

Instantly share code, notes, and snippets.

View lukechapman's full-sized avatar

Luke Chapman lukechapman

View GitHub Profile

Keybase proof

I hereby claim:

  • I am lukechapman on github.
  • I am lukechapman (https://keybase.io/lukechapman) on keybase.
  • I have a public key ASDPSCT_sSU8DuDd1vP2ye5_PiupGDTDP8YjZ0pWqYXDjAo

To claim this, I am signing this object:

@lukechapman
lukechapman / gist:3719546
Created September 14, 2012 02:55
[PHP] urlize a url
// urlize
// updated as per suggestion by Xeoncross (https://gist.github.com/Xeoncross)
function urlize($url){
if (strpos($url,'//') === false) $url = 'http://'.$url;
return $url;
}
// e.g
$my_url = 'www.google.com';
@lukechapman
lukechapman / gist:2583936
Created May 3, 2012 07:12
[JS] Turn a string in to a pretty permalink-like string.
function permify(str){
return str.replace(/[^a-zA-Z 0-9]+/g,'').replace(/\s+/g, '-').toLowerCase();
// e.g permify("This is an awesome place! (Really awesome!)");
// returns "this-is-an-awesome-place-really-awesome"
}