This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Ripple | |
module Document | |
module DynamicFinders | |
class << self | |
def included(base) | |
base.module_eval do | |
extend DynamicFindersClassMethods | |
end | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
include Ripple::Document | |
property :custom_key, String | |
key_on :custom_key | |
before_save :set_key | |
def set_key | |
self[:custom_key] ||= "#{self.created_at.utc.to_s(:key)}-#{SecureRandom.hex(8)}" | |
self[:custom_key] | |
end | |
private :set_key |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
brew install riak | |
edit /usr/local/Cellar/riak/<riak version>/libexec/etc/app.config | |
change | |
{storage_backend, riak_kv_bitcask_backend}, | |
to | |
{storage_backend, riak_kv_eleveldb_backend}, | |
ulimit -n 1024 | |
riak start |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Include this method in your application_controller.rb | |
def self.expose(*variable_names) | |
variable_names.each do |variable_name| | |
define_method((variable_name.to_s+"=").to_sym) do |value| | |
@exposed ||= Hash.new | |
@exposed[variable_name]= value | |
end | |
private (variable_name.to_s+"=").to_sym | |
define_method(variable_name) do |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set -g default-terminal "xterm-256color" # More colors | |
set-option -g xterm-keys on # Work more nicely with odd key combos (emacs) | |
set -g base-index 1 # Tabs start at '1', not '0' | |
set -s escape-time 0 # Faster activation | |
# Bind <C-q> to leader | |
# Make sure to update status-right to include your leader! | |
unbind C-b | |
set -g prefix C-q | |
bind-key q send-prefix |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
include ActionView::Helpers # If you want to test from a Rails console | |
number_to_currency(12.34, :locale => :en) # => "$12.34" | |
number_to_currency(12.34, :locale => :ja) # => "12円" | |
number_to_currency(12.34, :locale => 'en-GB') # => "£12.34" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class PersonsController | |
extend ::Sentry | |
def show | |
# do stuff | |
end | |
sentry_for :show, :expect => [:person], :if_not => :handle_person_not_found | |
def subscribe | |
# do stuff |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
title: "My app server" | |
logfile: /var/log/fuey.log | |
notifications: | |
- | |
- "run.trace" | |
- "Fuey::Log" | |
traces: | |
VPN_UP: | |
- Ping: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class NullObject | |
def initialize | |
@origin = caller.first ### SETS ORIGIN FOR INSPECT INFO | |
end | |
def method_missing(*args, &block) | |
self | |
end | |
def nil?; true; end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Symlink the completion and prompt scripts from your Git install to your home directory | |
# Then add the following to your .bash_profile | |
source ~/git-completion.bash | |
source ~/git-prompt.sh | |
export GIT_PS1_SHOWDIRTYSTATE=1 | |
export GIT_PS1_SHOWUNTRACKEDFILES=1 | |
export PS1='\033[00;36m\]\W\[\033[01;37m\]$(__git_ps1)\[\033[01;36m\] \$\[\033[00m\] ' |