View AASM_FactoryGirl.rb
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
TestObject.any_instance.stubs(:set_initial_state) |
View gist:1354244
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
def send_task | |
self.class.execute { self.prepare!; self } | |
end | |
def self.execute | |
begin | |
ActiveRecord::Base.connection.execute("LOCK TABLE tasks WRITE") | |
tasks = [*yield] | |
ensure | |
ActiveRecord::Base.connection.execute("UNLOCK TABLE") |
View gist:1354248
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
<td> | |
<%= link_to("Send", send_task_admin_path(task, params.slice(:page))) %> | |
</td> |
View gist:1363082
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
"----------------------------------------------------------------------------- | |
" General | |
"----------------------------------------------------------------------------- | |
set nocompatible | |
set history=1024 | |
set cf " enable error files and error jumping | |
set ffs=unix,dos,mac " support these files | |
filetype on | |
filetype plugin on | |
filetype indent on |
View gist:1380019
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
History: Ctrl + r | |
Find: find /home/user -name abc.txt | |
Pipeline: vi `find /home/user -name abc.txt` | |
Ctrl-x, Ctrl-e will bring up an $EDITOR containing whatever is currently entered into the prompt. (opposed to editing last command actually entered) | |
Managing remote systems and trying to figure out what hardware you're on and whether it's healthy or not: dmidecode | |
Repeat last command with "sudo" prepended: sudo !! | |
Execute <command> with the argument to your previous command: <command> !$ / !* for get all args. |
View gist:1813644
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
# http://blog.tstmedia.com/news_article/show/85364?referrer_id=308069 | |
class << self | |
RemovedColumns = {'column_to_remove' => true} | |
def columns | |
cols = super | |
cols.reject { |col| RemovedColumns.has_key? col.name } | |
end | |
end | |
# http://pedro.herokuapp.com/past/2011/7/13/rails_migrations_with_no_downtime/ |
View gist:1814610
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
http://www.slideshare.net/martin_j_andrews/code-quality-analysis?type=presentation |
View gist:1814612
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
http://lostechies.com/ryansvihla/2011/09/25/rail-3-1-ci-setup-with-jenkins-test-unit-simplecov-on-os-x-lion/ | |
http://danseaver.com/blog/2011/11/22/using-jenkins-with-rails/ | |
http://rails-jenkins.danseaver.com/#1 | |
Setup Redis server | |
http://www.denofubiquity.com/nosql/412/ |
View gist:1862679
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
# Replace text across files | |
:args dir_path/*/* #(for 2 levels) | |
:argdo %s/, :expire.*)/)/gc | update |
View gist:2000353
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
#!/bin/bash | |
mkdir -p ~/local | |
command -v identify > /dev/null | |
if [ $? -eq 1 ]; then | |
echo "${bldgrn}Installing imagemagick into ${txtwht}$HOME/local/imagemagick${txtrst}" | |
wget -N --retr-symlinks ftp://ftp.imagemagick.org/pub/ImageMagick/ImageMagick.tar.gz | |
tar -xzvf ImageMagick.tar.gz | |
cd ImageMagick-* | |
./configure --prefix=$HOME/local/imagemagick | |
make |
OlderNewer