Skip to content

Instantly share code, notes, and snippets.

@johnrees
johnrees / hstore_accessor.rb
Created June 14, 2012 23:10 — forked from inopinatus/hstore_accessor.rb
hstore accessor class method for AR
# 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 September 15, 2012 00:30
Install ElasticSearch on Ubuntu 12.04
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
@johnrees
johnrees / hack.sh
Last active December 28, 2015 23:48 — forked from linssen/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
#
@johnrees
johnrees / tmux-cheatsheet.markdown
Created January 28, 2016 11:55 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
// 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 November 15, 2011 10:32 — forked from neiled/hamlhtml5boilerplate.html.haml
Rails 3.1.1 barebones HAML HTML5Boilerplate
!!!
/[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'