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
source "http://rubygems.org" | |
gem 'nokogiri' |
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
# /config/initializers/setup_mail.rb | |
# ... | |
ActionMailer::Base.default :from => "Company Name <no-reply@yourcompany.com>" |
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
Typeahead is a javascript plugin from Twitter Bootstrat [1] that allows quickly creating typeaheads with any | |
form text input element. | |
[1] http://twitter.github.com/bootstrap/javascript.html#typeahead |
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
hash = {'a' => 1, 'b' => 2} | |
# => {"a"=>1, "b"=>2} | |
hash.merge hash.symbolize_keys | |
# => {"a"=>1, "b"=>2, :a=>1, :b=>2} | |
hash.to_json | |
# => "{\"a\":1,\"b\":2}" | |
hash[:a] = 3 |
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
'pt-BR': | |
activerecord: | |
attributes: | |
student: | |
name: 'Nome' | |
student_users: 'Usuários' | |
# ... | |
student/student_users: |
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
sudo apt-get install pavucontrol; pavucontrol &; | |
echo "Go to configuration tab and select the correct profile" |
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
sql="select 1" | |
for tenant_name in tenant_1 tenant_2 tenant_3 tenant_4 | |
do | |
psql -d $tenant_name -c "$sql" | |
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
$jruby_bin = '/path/to/jruby/bin/jruby' | |
$children_script = File.join File.expand_path('.'), 'children.rb' | |
def call_children command = '' | |
full_command = "#{$jruby_bin} -r#{$children_script} -e '#{command}'" | |
puts "Executing command: #{full_command}" | |
system full_command | |
end | |
puts "Hello from parent!" |
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
// example from book "Head First Design Patterns". | |
// without factory pattern | |
public class PizzaStore { | |
public Pizza orderPizza(String type) { | |
Pizza pizza; | |
// bad! we have a lot of ifs here... | |
if (type.equals("cheese")) { |
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
# enable security manager checks | |
export VERIFY_JRUBY="yes" | |
jruby sandbox.rb |