Skip to content

Instantly share code, notes, and snippets.

View StevenBlack's full-sized avatar
🇨🇦

Steven Black StevenBlack

🇨🇦
View GitHub Profile
@StevenBlack
StevenBlack / postgres_queries_and_commands.sql
Created April 8, 2018 21:18 — forked from rgreenjr/postgres_queries_and_commands.sql
Useful PostgreSQL Queries and Commands
-- show running queries (pre 9.2)
SELECT procpid, age(query_start, clock_timestamp()), usename, current_query
FROM pg_stat_activity
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
-- show running queries (9.2)
SELECT pid, age(query_start, clock_timestamp()), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'
@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)
  • This phone had its original cracked screen replaced at an iService frachise.
  • The current screen worked for awhile, then gradually failed
  • The current screen doesn't work at all, and the phone is disabled.

Please replace the screen, then ship to the address on the work order.

@StevenBlack
StevenBlack / genesis_public_key
Last active February 8, 2018 03:42
genesis_public_key
04d4dbb7d597566748e73f79c76aff1b58ac727b35c6feaea0d90b21b115783525007b5224e46e08dadfaa52b9c76dd9fbbc47278482880b7c82b0a54b54b643e2
// 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
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
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
@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

@StevenBlack
StevenBlack / sessionfactory.prg
Last active June 22, 2016 10:58
SessionFactory creates objects that are wrapped in a private data session. Note that the factory can die but its private datasession lives until all its products are out of scope.
*=======================================
DEFINE CLASS SessionFactory AS Session
*=======================================
DataSession = 2 && private
*==========================
FUNCTION Init()
*==========================
SET CENTURY TO 20 ROLLOVER 50
SET CENTURY ON
@StevenBlack
StevenBlack / gist:4702345
Created February 3, 2013 16:14
Twitter search for Jekyll, the blog aware site generator
lang:en filter:links jekyll -rt -hyde -hide -movie -NBC -island -jekyll_hydee -jekyll_andhyde -jekyll_.{1-} -*\_jekyll -_Dr__Jekyll_ -Jekyll.{1-} -henry_jekyll -lemonade_jekyll -W{1-}jekyll -watching -jekyll_hyde96 -jackie_jekyll