This file contains hidden or 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
# This is how I leveraged twitter bootstrap modals http://twitter.github.com/bootstrap/javascript.html#modals | |
# in Rails 3.2 with bootstrap-sass working. This is HAML syntax. With Twitter Bootstrap > 2.0.3.1. The pictures are | |
# pulled from Google Picasa Web Albums and are the url to the thumbnail image. This also explains the .gsub in the | |
# helper as I swap the thumbnail out out with a larger image. This will give you a thumbnail array similar to the | |
# "more examples" one on this page http://twitter.github.com/bootstrap/components.html#thumbnails | |
# in your helper file. | |
require 'securerandom' | |
def modal_page( image ) |
This file contains hidden or 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
some_string.gsub(/\s+/, "") |
This file contains hidden or 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
# install git | |
sudo apt-get install g++ curl libssl-dev apache2-utils | |
sudo apt-get install git-core | |
# download the Node source, compile and install it | |
git clone https://github.com/joyent/node.git | |
cd node | |
./configure | |
make | |
sudo make install | |
# install the Node package manager for later use |
This file contains hidden or 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
# assumptions: rails, object responds to errors | |
# in your test use this line where object is the object being validated | |
# :msg => flay_the_errors(__method__).call( object.errors) | |
def flay_the_errors( method ) | |
Proc.new do |x| | |
y = "\n### oh noes #{method} failed! ###\n" | |
y << "Full Inspect:\n" | |
y << x.inspect << "\n" | |
x.each {|k,v| y << "- #{k} #{v}\n"} | |
y |
This file contains hidden or 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
# also check out this sweet gem! https://github.com/alexdunae/holidays | |
class Christmas | |
attr_reader :christmastime, :christmas, :usa_thanksgiving | |
def initialize | |
@christmastime = is_christmastime? | |
end | |
def is_christmastime?(seed_date = Date.today, padding = 0) |
This file contains hidden or 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
a = [] | |
@user.user_logins.each do |x| | |
a << x.created_at | |
end | |
# now a should have all the entries you need | |
a.inspect |
This file contains hidden or 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
<% @user.login_list.each do |n| %> | |
<li><%= n %></li> | |
<% end %> | |
# chain this onto the object | |
def self.last_five(id) | |
where(:id => id).limit(5).sort('descending') | |
end |
This file contains hidden or 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
#!/usr/bin/env bash | |
# Modified for Rails 3 by Dave Southard January 17th, 2012 | |
# Now with more princess bride! | |
RAILS_ENV=production | |
APP_ROOT=/var/rails/unicorn/$1 | |
CURRENT_APP=$APP_ROOT/current | |
PID=/etc/unicorn/pids/$1.pid | |
OLD_PID=$PID.oldbin | |
START_COMMAND="bundle exec unicorn -D -E $RAILS_ENV -c /etc/unicorn/conf/$1.conf" |
This file contains hidden or 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
{ | |
"binary_file_patterns": | |
[ | |
"*.jpg", | |
"*.jpeg", | |
"*.png", | |
"*.gif", | |
"*.ttf", | |
"*.tga", | |
"*.dds", |
This file contains hidden or 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
.meows { | |
position: fixed; | |
top: 0; | |
right: 0; | |
} | |
.meow { | |
margin: 20px 20px 0 0; | |
position: relative; |