Skip to content

Instantly share code, notes, and snippets.

View presstube's full-sized avatar

James Paterson presstube

View GitHub Profile

Keybase proof

I hereby claim:

  • I am presstube on github.
  • I am presstube ( on keybase.
  • I have a public key whose fingerprint is 9551 C79B A2E9 FE6A 86ED 40EA 7EC0 7C38 AF3A 9A82

To claim this, I am signing this object:

presstube / gist:4255541
Created December 11, 2012 02:55
angularjs directive optional attributes
angular.module('formComponents', [])
.directive('formInput', function() {
return {
restrict: 'E',
compile: function(element, attrs)
var type = attrs.type || 'text';
var required = attrs.hasOwnProperty('required') ? "required='required'" : "";
var htmlText = '<div class="control-group">' +
'<label class="control-label" for="' + attrs.formId + '">' + attrs.label + '</label>' +
presstube / gist:2479607
Created April 24, 2012 13:17
Encrypt email on a website
presstube / gist:2332073
Created April 7, 2012 20:55
rakefile for bundling less/css fand javascript files
# This is a simple rakefile that compiles LESS to CSS, minifies CSS and javascript files using YUI
# compressor, and bundles them into a single file to speed up loading.
# The manifest files are just simple YAML blobs that describe how to build the bundles. All paths are
# relative to the CSS_DIR (or JS_DIR), depending on what kind of bundle you're creating. You can create
# as many bundles as you like.
# The format for the manifest files is:
# bundle
presstube /
Created March 31, 2012 15:24 — forked from erikh/
OSX For Hackers
#!/usr/bin/env sh
# This is script with usefull tips taken from:
# install it:
# curl -sL | sh
presstube /
Created March 25, 2012 19:35 — forked from isaacs/
Use one of these techniques to install node and npm without having to sudo. Discussed in more detail at Note: npm >=0.3 is *safer* when using sudo.
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
. ~/.bashrc
mkdir ~/local
mkdir ~/node-latest-install
cd ~/node-latest-install
curl | tar xz --strip-components=1
./configure --prefix=~/local
make install # ok, fine, this step probably takes more than 30 seconds...
curl | sh
presstube / gist:1330362
Created November 1, 2011 11:34
Mirror your gh-pages to master so they auto-update
Add the following 2 lines to the [remote "origin"] section of .git/config:
push = +refs/heads/master:refs/heads/gh-pages
push = +refs/heads/master:refs/heads/master
thanks to:
presstube / gist:1299452
Created October 19, 2011 19:45
Show handy git info in your terminal prompt
Add this snippet to your .bash_profile to show handy git info in your prompt
Thanks to
# Snazzy git prompt
function _git_prompt() {
local git_status="`git status -unormal 2>&1`"
if ! [[ "$git_status" =~ Not\ a\ git\ repo ]]; then
if [[ "$git_status" =~ nothing\ to\ commit ]]; then
local ansi=42