🎯
- GitHub Staff
- https://fjcasas.es
- @nflamel@hachyderm.io
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 = 'production.paypal.account@domain.com' | |
else | |
PAYPAL_ACCOUNT = 'test.paypal.account@domain.com' | |
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 |
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
<!-- Don't forget to include flowplayer js and fancybox js and css --> | |
<div style="width:665px;height:480px;display:none;" id="player"> | |
</div> | |
<a id="play-flv-video" href="#player">Play video</a> | |
<script language="JavaScript"> | |
$(document).ready(function() { | |
$("a#play-flv-video").fancybox({ |