Skip to content

Instantly share code, notes, and snippets.

Andrew Shaffer ashaffer

View GitHub Profile
View Display focus slate script
function getRectCenter(rect) {
return {
x: rect.x + rect.width/2,
y: rect.y + rect.height/2
function getScreenForegroundWindow(id) {
var center = getRectCenter(slate.screenForRef(id).rect());
return slate.windowUnderPoint(center);
View git push docker build
# Simple post-receive hook that builds a docker image and pushes it somewhere. In order for it to work
# you need to define your docker registry credentials in a .dockerrc file in your home directory:
# export DOCKER_USER=<user>
# export DOCKER_PASS=<password>
# export DOCKER_EMAIL=<email>
# export DOCKER_REGISTRY=<registry, e.g.>
View gist:8ca54d65c54334638f77
browser.addMockModule('inject-latency', function() {
angular.module('inject-latency', ['models'])
.config(['$provide', function($provide) {
$provide.decorator('api', function($delegate) {
return $delegate({
transformParams: function(params) {
params.latency = true;
View gist:24099bc41684df07b023
var async = require('async');
var AsyncEventEmitter = require('async-eventemitter');
var propertyPath = require('property-path');
var _ = require('lodash');
var debug = require('debug')('weo:hooks');
* Mimics backbone events api with pre and post modifiers
View gist:11385932
angular.module('chttp', [])
.factory('chttp', ['$http', function($http) {
Allow a url to be passed instead of an object, since its
by far the most common use-case
function normalize(config) {
if('string' === typeof config)
return {url: config};
return config;
View gist:9161652
save = true
prefix = /home/andrew/.npm
View Sublime text preferences
// Place your settings in the file "User/Preferences.sublime-settings", which
// overrides the settings in here.
// Settings may also be placed in file type specific options files, for
// example, in Packages/Python/Python.sublime-settings for python files.
// Sets the colors used within the text area
"color_scheme": "Packages/Color Scheme - Default/Monokai.tmTheme",
// Note that the font_face and font_size are overriden in the platform
View Sublime text key bindings
{ "keys": ["ctrl+q"], "command": "exit" },
{ "keys": ["ctrl+shift+n"], "command": "new_window" },
{ "keys": ["ctrl+shift+w"], "command": "close_window" },
{ "keys": ["ctrl+o"], "command": "prompt_open_file" },
{ "keys": ["ctrl+shift+t"], "command": "reopen_last_file" },
{ "keys": ["alt+o"], "command": "switch_file", "args": {"extensions": ["cpp", "cxx", "cc", "c", "hpp", "hxx", "h", "ipp", "inl", "m", "mm"]} },
{ "keys": ["ctrl+n"], "command": "new_file" },
{ "keys": ["ctrl+s"], "command": "save" },
You can’t perform that action at this time.