- Get into a library
- bundle open wicked
- Make sure you've set your
$EDITOR
- Forget fancy debuggers
- All you need is
puts
- A rubyist's tracer round:
puts "================="
- All you need is
- Notation
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
#ssh-keygen -t rsa | |
cat ~/.ssh/id_rsa.pub | ssh user@hostname 'cat >> .ssh/authorized_keys' |
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
apt-get install python-software-properties -y | |
apt-get install software-properties-common -y |
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 'rubygems' | |
require 'nokogiri' | |
require 'fileutils' | |
require 'date' | |
require 'uri' | |
# usage: ruby import.rb my-blog.xml | |
# my-blog.xml is a file from Settings -> Basic -> Export in blogger. | |
data = File.read ARGV[0] |
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
# in spec/support/omniauth_macros.rb | |
module OmniauthMacros | |
def mock_auth_hash | |
# The mock_auth configuration allows you to set per-provider (or default) | |
# authentication hashes to return during integration testing. | |
OmniAuth.config.mock_auth[:twitter] = { | |
'provider' => 'twitter', | |
'uid' => '123545', | |
'user_info' => { | |
'name' => 'mockuser', |
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
ssh -R 10002:localhost:22 rocinante |
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
for i in `find . -name "*.php"`; do iconv -f utf8 -t utf8 $i 2>&1 > /dev/null | perl -e "while(<>){print \"$i\\n\"}";done | |
for i in `cat convertir`; do cp $i tmp; iconv -f iso-8859-1 -t utf8 tmp > $i;done |
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
# encoding: utf-8 | |
class ImageUploader < CarrierWave::Uploader::Base | |
include CarrierWave::MiniMagick | |
storage :file | |
# storage :fog | |
# Process files as they are uploaded (if width >1024): | |
process :resize_to_limit =>[1024, 10000] |
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
f.inputs 'Content' do | |
f.form_buffers.last << f.template.render("shared/partial_name") | |
f.input :content | |
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
desc "tail production log files" | |
task :tail_logs, :roles => :app do | |
trap("INT") { puts 'Interupted'; exit 0; } | |
run "tail -f #{shared_path}/log/production.log" do |channel, stream, data| | |
puts # for an extra line break before the host name | |
puts "#{channel[:host]}: #{data}" | |
break if stream == :err | |
end | |
end |
OlderNewer