Skip to content

Instantly share code, notes, and snippets.

@johnrees
johnrees / hstore_accessor.rb
Created Jun 14, 2012 — forked from inopinatus/hstore_accessor.rb
hstore accessor class method for AR
View hstore_accessor.rb
# include from an initializer
module HstoreAccessor
def self.included(base)
base.extend(ClassMethods)
end
module ClassMethods
def hstore_accessor(hstore_attribute, *keys)
Array(keys).flatten.each do |key|
@johnrees
johnrees / es.sh
Created Sep 15, 2012
Install ElasticSearch on Ubuntu 12.04
View es.sh
cd ~
sudo apt-get update
sudo apt-get install openjdk-7-jre -y
wget https://github.com/downloads/elasticsearch/elasticsearch/elasticsearch-0.19.9.tar.gz -O elasticsearch.tar.gz
tar -xf elasticsearch.tar.gz
rm elasticsearch.tar.gz
sudo mv elasticsearch-* elasticsearch
sudo mv elasticsearch /usr/local/share
View hack.sh
#!/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://gist.github.com/johnrees/7581236/raw/hack.sh | sh
#
View tmux-cheatsheet.markdown

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
View bashrc.sh
// by @noffle
autoinstall () {
local MODULES=$(cat $1 | grep "require('.*')" | sed "s/.*require('\(.*\)')/\1/" | grep -v '^\.' | tr '\n' ' ')
shift
shift
npm install $MODULES $@
}
@johnrees
johnrees / hamlhtml5boilerplate.html.haml
Created Nov 15, 2011 — forked from neiled/hamlhtml5boilerplate.html.haml
Rails 3.1.1 barebones HAML HTML5Boilerplate
View hamlhtml5boilerplate.html.haml
!!!
/[if lt IE 7] <html class="no-js ie6 oldie" lang="en">
/[if IE 7] <html class="no-js ie7 oldie" lang="en">
/[if IE 8] <html class="no-js ie8 oldie" lang="en">
<!--[if (gt IE 8)]><html lang="en" class="no-js"><![endif]-->
%head
%meta{charset: "utf-8"}
%meta{:content => "IE=edge,chrome=1", "http-equiv" => "X-UA-Compatible"}
%title 'Rails 3.1.1 barebones HTML5Boilerplate'