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
# dirty way to completely remove the automatic escaping of html in rails helpers | |
# useful to get your Rails 2 -> 3 upgrade running to the point where the raw/.html_safe additions can be delegated | |
module CustomHtmlSafe | |
def html_safe? | |
true | |
end | |
end | |
class ActionView::OutputBuffer |
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
# RDoc can use a custom generator but it isn't that well documentated. Here is a | |
# sample custom generator to get you going. | |
# | |
# Ruby comes with an `rdoc` executable but most of us generate our docs via Rake. To | |
# use your custom generator with Rake do something like the following in your Rakefile.. | |
# | |
# require 'rdoc/task' | |
# require 'simple_rdoc' | |
# | |
# RDoc::Task.new('simple_doc') do |i| |
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
require 'rack' | |
require 'rack/static' | |
class App | |
def initialize(app) | |
@app = app | |
end | |
def call(env) | |
req = Rack::Request.new(env) |
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
[1] pry(main)> require "active_support/testing/time_helpers" | |
=> true | |
[2] pry(main)> include ActiveSupport::Testing::TimeHelpers | |
=> Object | |
[3] pry(main)> travel_to("1969-01-01".to_time){ puts Time.current } | |
1969-01-01 00:00:00 +0100 |
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
@charset "utf-8"; | |
@import "normalize"; | |
html { | |
font-size: 62.5%; | |
} | |
body { | |
font-family: -apple-system, BlinkMacSystemFont, Helvetica, Arial, sans-serif; |
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
➜ tmp cat no_way.rb | |
def ☃ | |
puts "Oh look, it's a ☃" | |
end | |
☃ | |
➜ tmp ruby no_way.rb | |
Oh look, it's a ☃ | |
➜ tmp |
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
" Vundle Setup | |
set nocompatible " be iMproved | |
filetype off " required! | |
set rtp+=~/.vim/bundle/vundle/ | |
call vundle#rc() | |
" let Vundle manage Vundle | |
" required! | |
Bundle 'gmarik/vundle' |
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
project_path='~/apps/'$app'/current' | |
frontend_path=$project_path$subdir | |
cmd='' | |
cmd+='. ~/.bash_profile;' | |
cmd+='cd '$project_path';' | |
cmd+='git pull;' | |
cmd+='kill `cat '$frontend_path'/tmp/pids/unicorn.pid`;' | |
sleep 5 |
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
# install by getting the raw url from the github interface and run something like.. | |
# curl -L https//gist.github.com/blahblah | bash | |
mkdir -p ~/backups | |
mkdir -p ~/bin | |
# a backup for each day of the month overwritting old days | |
echo "mysqldump -u root --all-databases > ~/backups/all-`date +20XX-XX-%d`.sql" > ~/bin/backup_all_mysql_databases | |
chmod 777 ~/bin/backup_all_mysql_databases |
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
package main | |
import ( | |
"fmt" | |
"strconv" | |
"crypto/sha256" | |
"encoding/base64" | |
) | |
func main(){ |
NewerOlder