Skip to content

Instantly share code, notes, and snippets.

View StevenBlack's full-sized avatar
🇨🇦

Steven Black StevenBlack

🇨🇦
View GitHub Profile
@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 -->
@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 / 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)

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 / 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 / better-nodejs-require-paths.md
Created September 23, 2016 02:27 — forked from branneman/better-nodejs-require-paths.md
Better local require() paths for Node.js

Better local require() paths for Node.js

Problem

When the directory structure of your Node.js application (not library!) has some depth, you end up with a lot of annoying relative paths in your require calls like:

var Article = require('../../../models/article');

Those suck for maintenance and they're ugly.

Possible solutions

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
Standups:
2-3 times per night
post issues to Slack
designate scrum master and rotate who the master will be
scrum master gives everyone a turn to speak
Conflicts:
Write down your conflict
Spend 15 minutes tops to resolve the conflict and move on.
We are all on the same team with the same goal
// Node.js CheatSheet.
// Download the Node.js source code or a pre-built installer for your platform, and start developing today.
// Download: http://nodejs.org/download/
// More: http://nodejs.org/api/all.html
// 0. Synopsis.
// http://nodejs.org/api/synopsis.html
@StevenBlack
StevenBlack / postgres-cheatsheet.md
Created April 8, 2018 19:04 — forked from Kartones/postgres-cheatsheet.md
PostgreSQL command line cheatsheet

PSQL

Magic words:

psql -U postgres

Some interesting flags (to see all, use -h):

  • -E: will describe the underlaying queries of the \ commands (cool for learning!)
  • -l: psql will list all databases and then exit (useful if the user you connect with doesn't has a default database, like at AWS RDS)