Skip to content

Instantly share code, notes, and snippets.

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);
#
# 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. tutum.co>
#
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;
}
});
});
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
*/
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;
@ashaffer
ashaffer / gist:9161652
Created February 22, 2014 20:16
.npmrc
save = true
prefix = /home/andrew/.npm
// 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
[
{ "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" },