Skip to content

Instantly share code, notes, and snippets.

View mattknox's full-sized avatar

matt knox mattknox

View GitHub Profile
// 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

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.

Keybase proof

I hereby claim:

  • I am mattknox on github.
  • I am mattknox (https://keybase.io/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:

@mattknox
mattknox / repo_cleanup.rb
Created September 2, 2016 20:33
cleanup merged branches
#! /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
@mattknox
mattknox / postgres_queries_and_commands.sql
Created December 14, 2016 23:44 — forked from indigoviolet/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%'
@mattknox
mattknox / GraphQL-Architecture.md
Created April 21, 2017 21:32 — forked from idibidiart/GraphQL-Architecture.md
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

@mattknox
mattknox / keybase.md
Created November 1, 2017 20:46
keybase verification

Keybase proof

I hereby claim:

  • I am mattknox on github.
  • I am mattknox (https://keybase.io/mattknox) on keybase.
  • I have a public key ASCyzg1VoVlb5wEtV8Ah5OUhfMlyaWfQcsm6otEhVtcWzgo

To claim this, I am signing this object:

@mattknox
mattknox / blockstack
Created November 6, 2017 19:55
blockstack verification
Verifying my Blockstack ID is secured with the address 1ALEXweBWEeGVpeQYiYoqpkfjDVz7MZmmS https://explorer.blockstack.org/address/1ALEXweBWEeGVpeQYiYoqpkfjDVz7MZmmS
require "socket"
class Memcached
attr_accessor :client
def initialize(store = {})
@client = client
@store = store
end
def get(key)
@mattknox
mattknox / GIF-Screencast-OSX.md
Created October 26, 2018 21:15 — forked from dergachev/GIF-Screencast-OSX.md
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

Instructions

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