🎯
- GitHub Staff
- https://fjcasas.es
- @[email protected]
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/initializer/simple_form.rb | |
SimpleForm.setup do |config| | |
config.hint_class = "hint input" | |
config.error_class = 'error input' | |
config.wrapper_class = :clearfix | |
config.wrapper_error_class = :error | |
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
var property = "property_name"; | |
var object = new Object() | |
alert(object[property]) //will alert object.property_name | |
alert(object["property_name"]); //will alert object.property_name | |
alert(window["object"]["property_name"]) //will alert object.property_name |
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
# db/seeds.rb | |
Dir.glob("#{base_dir}/*.sql").each do |file_name| | |
puts "Seeding #{ file_name }" | |
sql_file = File.new(file_name) | |
while statements = sql_file.gets("") do | |
ActiveRecord::Base.connection.execute(statements) | |
end | |
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
gs -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=merged.pdf file1.pdf file2.pdf file3.pdf | |
# -q -dNOPAUSE -dBATCH -> means just quietly and close ghostscript after running | |
# -sOutputFile=merged.pdf is the merged file | |
# file1.pdf file2.pdf file3.pdf is the list of files thar are going to be merged. |
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
# Gemfile | |
# For ruby 1.8 | |
gem "rack-debug", "~> 1.4", :group => :development | |
# For ruby 1.9.2 | |
gem "rack-debug", :group => :development |
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
[-4, 5] in /projects/889122/small_script.rb | |
=> 1 dude = true | |
2 | |
3 if dude | |
4 puts "Hey dude" | |
5 else | |
/projects/889122/small_script.rb:1 | |
dude = true | |
(rdb:1) |
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/initializer/active_merchant.rb | |
if Rails.env.production? | |
PAYPAL_ACCOUNT = '[email protected]' | |
else | |
PAYPAL_ACCOUNT = '[email protected]' | |
ActiveMerchant::Billing::Base.mode = :test | |
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
#Newest versions | |
import File.expand_path(File.join(Gem.datadir('paperclip'), '..', '..', 'lib', 'tasks', 'paperclip.rake')) | |
# Versions older than 2.3.2 | |
import File.expand_path(File.join(Gem.datadir('paperclip'), '..', '..', 'tasks', 'paperclip_tasks.rake')) |
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 File.expand_path(File.join(Gem.datadir('paperclip'), '..', '..', 'shoulda_macros', 'paperclip.rb')) | |
class ActiveSupport::TestCase | |
# ... | |
# here comes your custom test options | |
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
class Article | |
has_many :categories, :through => :category_articles | |
has_many :category_articles | |
end |