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 (https://keybase.io/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
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
presstube / gist:2479607
Created April 24, 2012 13:17
Encrypt email on a website
http://hivelogic.com/enkoder/index.php
@presstube
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
presstube / hack.sh
Created March 31, 2012 15:24 — forked from erikh/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#
@presstube
presstube / node-and-npm-in-30-seconds.sh
Created March 25, 2012 19:35 — forked from isaacs/node-and-npm-in-30-seconds.sh
Use one of these techniques to install node and npm without having to sudo. Discussed in more detail at http://joyeur.com/2010/12/10/installing-node-and-npm/ 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 http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1
./configure --prefix=~/local
make install # ok, fine, this step probably takes more than 30 seconds...
curl http://npmjs.org/install.sh | sh
@presstube
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:
http://stackoverflow.com/questions/5807459/github-mirroring-gh-pages-to-master
@presstube
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 http://opinionated-programmer.com/2011/01/colorful-bash-prompt-reflecting-git-status/
# 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