Get Homebrew installed on your mac if you don't already have it
Install highlight. "brew install highlight". (This brings down Lua and Boost as well)
if Rails.env.development? | |
ActiveRecord::ConnectionAdapters::Mysql2Adapter.send(:include, QueryTracer::MysqlAdapterExtensions) | |
Object.send(:include, QueryTracer::ObjectExtensions) | |
end |
#!/bin/bash -e | |
#### | |
# Helper script to update the Last modified timestamp of files in a Git SCM | |
# Projects working Copy | |
# | |
# When you clone a Git repository, it sets the timestamp of all the files to the | |
# time when you cloned the repository. | |
# | |
# This becomes a problem when you want the cloned repository, which is part of a | |
# Web application have a proper cacheing mechanism so that it can re-cache files |
require 'haml' | |
class ErbEngine < Haml::Engine | |
def push_script(text, preserve_script, in_tag = false, preserve_tag = false, | |
escape_html = false, nuke_inner_whitespace = false) | |
push_text "<%= #{text.strip} %>" | |
end | |
def push_silent(text, can_suppress = false) | |
push_text "<% #{text.strip} %>" |
Get Homebrew installed on your mac if you don't already have it
Install highlight. "brew install highlight". (This brings down Lua and Boost as well)
I've been using this technique in most of my Ruby projects lately where Ruby versions are required:
.rbenv-version
containing the target Ruby using a definition name defined in ruby-build (example below). These strings are a proper subset of RVM Ruby string names so far....rvmrc
(with rvm --create --rvmrc "1.9.3@myapp"
) and edit the environment_id=
line to fetch the Ruby version from .rbenv-version
(example below).Today I learned about another Ruby manager, rbfu, where the author is using a similar technique with .rbfu-version
.
group :development, :test do | |
gem 'rspec-rails', '~> 2.9' # rails generate rspec:install | |
gem 'factory_girl_rails' | |
end | |
group :test do | |
gem 'spork-rails' # spork rspec --bootstrap | |
gem 'capybara' | |
gem 'launchy' | |
gem 'timecop' |
define ruby_stack_trace | |
set $VM_FRAME_MAGIC_METHOD = 0x11 | |
set $VM_FRAME_MAGIC_BLOCK = 0x21 | |
set $VM_FRAME_MAGIC_CLASS = 0x31 | |
set $VM_FRAME_MAGIC_TOP = 0x41 | |
set $VM_FRAME_MAGIC_FINISH = 0x51 | |
set $VM_FRAME_MAGIC_CFUNC = 0x61 | |
set $VM_FRAME_MAGIC_PROC = 0x71 | |
set $VM_FRAME_MAGIC_IFUNC = 0x81 | |
set $VM_FRAME_MAGIC_EVAL = 0x91 |
class ActiveRecord::Base | |
mattr_accessor :shared_connection | |
@@shared_connection = nil | |
def self.connection | |
@@shared_connection || ConnectionPool::Wrapper.new(:size => 1) { retrieve_connection } | |
end | |
end | |
ActiveRecord::Base.shared_connection = ActiveRecord::Base.connection |
Locate the section for your github remote in the .git/config
file. It looks like this:
[remote "origin"]
fetch = +refs/heads/*:refs/remotes/origin/*
url = git@github.com:joyent/node.git
Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/*
to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:
#!/bin/bash | |
## Short introduction ## | |
# It is supposed that you have MySQL and lot of files to backup. Done via mk-parallel-dump (maatkit). | |
# Files (as well as DB dumps) are keept versioned, so you can revert to any state during last 20 days. Done via rdiff-backup. | |
# Afterwards, files (with versioning metainfo) are transfered to FTP server. Done via duplicity. | |
# Required software: | |
# 1. maatkit (mk-parallel-dump) | |
# 2. rdiff-backup |