Skip to content

Instantly share code, notes, and snippets.

matt knox mattknox

Block or report user

Report or block mattknox

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
mattknox /
Created Oct 26, 2018 — forked from dergachev/
OS X Screencast to animated GIF

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF


To capture the video (filesize: 19MB), using the free "QuickTime Player" application:

View memcached.ruby
require "socket"
class Memcached
attr_accessor :client
def initialize(store = {})
@client = client
@store = store
def get(key)
mattknox / blockstack
Created Nov 6, 2017
blockstack verification
View blockstack
Verifying my Blockstack ID is secured with the address 1ALEXweBWEeGVpeQYiYoqpkfjDVz7MZmmS
mattknox /
Created Nov 1, 2017
keybase verification

Keybase proof

I hereby claim:

  • I am mattknox on github.
  • I am mattknox ( on keybase.
  • I have a public key ASCyzg1VoVlb5wEtV8Ah5OUhfMlyaWfQcsm6otEhVtcWzgo

To claim this, I am signing this object:

mattknox /
Created Apr 21, 2017 — forked from idibidiart/
Building an Agile, Maintainable Architecture with GraphQL

Building a Maintainable, Agile Architecture for Realtime, Transactional Apps

A maintainable application architecture requires that the UI only contain the rendering logic and execute queries and mutations against the underlying data model on the server. A maintainable architecture must not contain any logic for composing "app state" on the client as that would necessarily embed business logic in the client. App state should be persisted to the database and the client projection of it should be composed in the mid tier, and refreshed as mutations occur on the server (and after network interruption) for a highly interactive, realtime UX.

With GraphQL we are able to define an easy-to-change application-level data schema on the server that captures the types and relationships in our data, and wiring it to data sources via resolvers that leverage our db's own query language (or data-oriented, uniform service APIs) to resolve client-specified "queries" and "mutations" against the schema.

We use GraphQL to dyn

View postgres_queries_and_commands.sql
-- 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%'
mattknox / repo_cleanup.rb
Created Sep 2, 2016
cleanup merged branches
View repo_cleanup.rb
#! /usr/bin/env ruby
# if run inside a git repo, this will pull current master and force remove all branches that have no diff against master.
# this is useful if you use squash-merge- or rebase-based merge strategies, and does not require anything particular of the
# developer to use.
in_repo = system("git status")
unless in_repo
puts "run this from inside a git repo"
exit 1

Keybase proof

I hereby claim:

  • I am mattknox on github.
  • I am mattknox ( on keybase.
  • I have a public key whose fingerprint is DB08 CCF5 5322 B554 384C 8206 F755 6801 897B 2779

To claim this, I am signing this object:


Developer Cheat Sheets

This are my cheat sheets that I have compiled over the years. Tired of searching Google for the same things, I started adding the information here. As time went on, this list has grown. I use this almost everyday and this Gist is the first bookmark on my list for quick and easy access.

I recommend that you compile your own list of cheat sheets as typing out the commands has been super helpful in allowing me to retain the information longer.

View gist:85f3e9e68772b145c6f5
// candidate syntax for a go-like language with less boilerplate around error return
func doStuff() (string, error) {
var err error
returnOn err, func() { return nil, err } // return the result of calling func if variable is ever non-nil
thing1, err := possiblyFailingCall()
thing2, err := possiblyFailingCall(thing1)
thing3, err := possiblyFailingCall(thing2)
thing4, err := possiblyFailingCall(thing3)
return thing4, err
You can’t perform that action at this time.