Skip to content

Instantly share code, notes, and snippets.

View StevenBlack's full-sized avatar
🇨🇦

Steven Black StevenBlack

🇨🇦
View GitHub Profile
@StevenBlack
StevenBlack / crosstab.sql
Created May 12, 2016 02:39 — forked from romansklenar/crosstab.sql
PostgreSQL "pivot table" example using tablefunc extension
CREATE EXTENSION tablefunc;
CREATE TABLE sales(year int, month int, qty int);
INSERT INTO sales VALUES(2007, 1, 1000);
INSERT INTO sales VALUES(2007, 2, 1500);
INSERT INTO sales VALUES(2007, 7, 500);
INSERT INTO sales VALUES(2007, 11, 1500);
INSERT INTO sales VALUES(2007, 12, 2000);
INSERT INTO sales VALUES(2008, 1, 1000);
INSERT INTO sales VALUES(2009, 5, 2500);
@StevenBlack
StevenBlack / pr.md
Created November 7, 2015 04:44 — forked from piscisaureus/pr.md
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@StevenBlack
StevenBlack / gist:f5501b42dce78b047824
Last active August 29, 2015 14:17 — forked from Greyvy/gist:8872903
Arbitrary data passed to Jekyll partials
<!-- partial.html -->
<div class="Tile">
{% if include.title %}
<h1>{{ include.title }}</h1>
{% else %}
<h1>no content!</h1>
{% endif %}
</div><!-- .Tile -->
<!-- in any template, partial, layout or content file -->
require 'json'
require 'net/http'
# JSON parser tag, creating map for use in jekyll markdown
# Alex.Heneveld @ Cloudsoft Corp (remove spaces and add the .com)
# Released under APL 2.0
# usage: {% jsonball varname from TYPE PARAM %}
#
# where TYPE is one of {data,var,file,page}, described below

Discussion on reddit.

Each of these commands will run an ad hoc http static file server in your current (or specified) directory. Use this power wisely.

Python 2.x

$ python -m SimpleHTTPServer 8000
@StevenBlack
StevenBlack / git.rb
Created June 2, 2013 22:20 — forked from alx/git.rb
Jekyll plugin to add Git activity inside a list
require 'git'
module Jekyll
class GitActivityTag < Liquid::Tag
def initialize(tag_name, text, tokens)
super
end
def render(context)