Skip to content

Instantly share code, notes, and snippets.

@bradwright
bradwright / .zshrc
Created September 14, 2012 15:16
Git completion
# -*- mode: sh -*-
autoload -Uz compinit
compinit
source_if_exists() {
[ -f $1 ] && source $1
}
# These are installed by homebrew
@bradwright
bradwright / gist:2490524
Created April 25, 2012 15:15 — forked from czottmann/gist:2490462
The Unfollow Manifesto

The Unfollow Manifesto

At some point in the past, I've decided to follow you on Twitter or any other social network, because you appeared to be a person whose postings I might be interested in.

But recently you noticed me unfollowing you.

Now you're confused/sad/angry. Don't be. Because here are the three simple rules I adhere to.

  1. You may unfollow me at any given time, because what I post might not be your cup of tea. It's okay, no hard feelings. I won't take that as an insult. (Really.) I assume we're still cool outside said service, unless of course I wrote some horrible shit that offended you, in which case I am probably sorry.
@bradwright
bradwright / bash_emacs.sh
Created April 25, 2012 12:13
Emacs path mangling on OS X
emacsen=`find ~/Applications/ -name Emacs | head -n 1`
if [ -n "$emacsen" ]; then
alias emacs="$emacsen"
emacsclient=`find ~/Applications -name emacsclient | head -n 1`
alias emacsclient="'$emacsclient'"
alias vemacs="'$emacsclient' -c -n"
export EDITOR="'$emacsclient' -t"
export VISUAL="'$emacsclient' -c"
fi
@bradwright
bradwright / init.pp
Created April 1, 2012 12:26
Install PIL with Puppet on Ubuntu 11.10
# installs PIL. PIL is rubbish to install because of broken
# dependencies on libjpeg etc, so we need to do some symlinking
class pil {
# libpng is already installed, and I don't care about libfreetype etc.
package { [ 'libjpeg-dev', 'zlib1g' ]:
ensure => 'installed'
}
file { '/usr/lib/libjpeg.so':
@bradwright
bradwright / erc-mode.el
Created March 15, 2012 13:51
ERC configuration
;; erc configuration for IRC
(require 'erc)
(require 'erc-services nil t)
(erc-services-mode 1)
;; don't show join/part etc.
(setq erc-hide-list '("JOIN" "PART" "QUIT" "NICK"))
@bradwright
bradwright / index.jinja
Created March 6, 2012 09:42
Flask-MustacheJS integration
<!doctype html>
<html>
<head>
<title>Example</title>
<script type="text/javascript" src="{{ url_for('mustache.static', filename='mustache-loader.js') }}"></script>
{{ mustache_templates }}
</head>
<body>
</body>
</html>
@bradwright
bradwright / preorders.eml
Created March 2, 2012 10:44
Gameplay Mass Effect 3 preorders
Hi,
Thank you for your email.
Unfortunately we are not in a position to supply you with your copy of
Mass Effect 3. As dedicated gamers, we know how disappointing this
will be for you, and we apologise sincerely for the inconvenience that
this will cause.
@bradwright
bradwright / compiled-hogan.js
Created February 29, 2012 22:20
Compiled Hogan.js files
/*
* Copyright 2011 Twitter, Inc.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
from flask import current_app
import pystache
@template_helper
def mustache(template, **kwargs):
"""Usage:
{{ mustache('path/to/whatever.mustache', key=value, key1=value1.. keyn=valuen) }}
"""
template, _, _ = current_app.jinja_loader.get_source(current_app.jinja_env, template)
return pystache.render(template, kwargs, encoding='utf-8')
@bradwright
bradwright / custom-theme-dirs.el
Created February 16, 2012 08:00
Get all directories under a certain one
;; add all theme directories to the `custom-theme-load-path`
;; directory automatically so `load-theme` can find them.
(let ((base "/home/user/.emacs.d/vendor/themes"))
(add-to-list 'custom-theme-load-path base)
(dolist (f (directory-files base))
(let ((name (concat base "/" f)))
(when (and (file-directory-p name)
(not (equal f ".."))
(not (equal f ".")))
(add-to-list 'custom-theme-load-path name)))))