Skip to content

Instantly share code, notes, and snippets.

View begriffs's full-sized avatar

Joe Nelson begriffs

View GitHub Profile
@wescarr
wescarr / parseurl.js
Last active December 11, 2015 02:49
Parses a URL and returns an object with the same API as window.location with the addition of a "query" attribute which is a hash of query params. Requires underscore.js
function parseUrl(str) {
var link = document.createElement('a');
link.href = str;
// Parse query string. Strip leading ?, decode, and split
var pairs = /^\??(.*)/.exec(decodeURI(link.search))[1].split('&');
// Split pairs and create object from tuples
var query = _.object(_.invoke(pairs, 'split', '='));
// Other url properties to copy
var props = [
'hash',
@clintel
clintel / gist:1155906
Created August 19, 2011 02:40
Fenced code in bullet lists with GitHub-flavoured MarkDown??

Fenced code blocks inside ordered and unordered lists

  1. This is a numbered list.

  2. I'm going to include a fenced code block as part of this bullet:

    Code
    More Code