Skip to content

Instantly share code, notes, and snippets.

View richardhartme's full-sized avatar

Richard Hart richardhartme

View GitHub Profile
@richardhartme
richardhartme / gist:7995676
Created December 16, 2013 22:34
nginx SSL stapling
http {
ssl_stapling on;
ssl_stapling_verify on;
ssl_trusted_certificate /etc/nginx/ssl/stapling.trusted.crt;
resolver 8.8.4.4 8.8.8.8 valid=300s;
resolver_timeout 15s;
}
# NOTICE: to get Nginx+Unicorn best-practices configuration see the gist https://gist.github.com/3052776
$ cd /usr/src
$ wget http://nginx.org/download/nginx-1.2.1.tar.gz
$ tar xzvf ./nginx-1.2.1.tar.gz && rm -f ./nginx-1.2.1.tar.gz
$ wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.30.tar.gz
$ tar xzvf pcre-8.30.tar.gz && rm -f ./pcre-8.30.tar.gz
$ wget http://www.openssl.org/source/openssl-1.0.1c.tar.gz

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
def self.affiliates_for_dropdown
affiliate_options = [['Please select (optional)', '0']]
affiliate_options << Affiliate.active.show_in_step1.order(:name).collect { |a| [a.name, a.id.to_s] }
affiliate_options
end
ActionView::MissingTemplate (Missing templateI"$spree/layouts/spree_application:ET with {:locale=>[:en], :formats=>[:html], :handlers=>[:erb, :builder, :raw, :ruby, :coffee, :rabl], :versions=>[:v1]}
# Return the brand root taxon.
#
# Brands -> A -> B -> C
#
# Returns taxon [A]
def brand_taxon_root
@base_brand_taxon ||= (taxons.
find { |t| t.is_descendant_of?(Spree::Taxon.brand_taxon) }.
self_and_ancestors.
find { |t| t.level == 1 } rescue nil)
module IHateMyLife
class Application < Rails::Application
config.to_prepare do
# Load application's model / class decorators
Dir.glob(File.join(File.dirname(__FILE__), "../app/**/*_decorator*.rb")) do |c|
Rails.configuration.cache_classes ? require(c) : load(c)
end
# Load application's view overrides
@richardhartme
richardhartme / gist:5413777
Created April 18, 2013 15:44
Vim relative line numbers
" Relative numbers when not in insert mode
au BufEnter * :set rnu
au BufLeave * :set nu
au WinEnter * :set rnu
au WinLeave * :set nu
au InsertEnter * :set nu
au InsertLeave * :set rnu
au FocusLost * :set nu
au FocusGained * :set rnu
@richardhartme
richardhartme / .gitconfig
Last active December 15, 2015 09:09
Git .gitconfig
[color]
diff = auto
status = auto
branch = auto
[core]
excludesfile = ~/.gitignore
editor = /usr/bin/vim
pager = less -+$LESS -R
[alias]
s = status
@richardhartme
richardhartme / gist:5165987
Created March 14, 2013 22:58
Go Resources
http://www.youtube.com/watch?v=2-pPAvqyluI
http://www.youtube.com/watch?v=wjLK-WMNVgM
http://www.youtube.com/watch?v=sAh8x3_RFQE
http://www.youtube.com/watch?v=jmQLawO30eA
http://www.youtube.com/watch?v=rKnDgT73v8s
http://www.youtube.com/watch?v=-i0hat7pdpk