This file contains hidden or 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
| .selector.to.the.links.to.disable a { | |
| pointer-events: none; | |
| cursor: default; | |
| color: #whatever-color-you-have-chosen-for-normal-text; | |
| } |
This file contains hidden or 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
| @database[:events] | |
| .where(:aggregate_id => aggregate_id){ version > since_version } | |
| .order(:version).map do |record| | |
| Event.new( | |
| record[:version], | |
| record[:type].to_sym, | |
| JSON.parse(record[:data], :symbolize_names => true) | |
| ) | |
| end |
This file contains hidden or 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 'yaml' | |
| require 'set' | |
| class C | |
| end | |
| YAML::load(YAML::dump(Set[C.new])) | |
| # ArgumentError: syntax error on line 3, col -1: ` : true ' | |
| # method load in syck.rb at line 135 |
This file contains hidden or 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
| #### simple case first | |
| - if @person.viewable_by?(current_user) | |
| puts @person.name | |
| # vs. | |
| - @person.render_for(current_user) do |person| | |
| puts person.name |
This file contains hidden or 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 ActionMailer::Base | |
| def perform_delivery_file(mail) | |
| File.open("#{RAILS_ROOT}/tmp/mails/#{mail.to}", 'a') { |f| f.write(mail) } | |
| end | |
| end | |
| config.action_mailer.delivery_method = :file |
This file contains hidden or 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
| #!/bin/bash | |
| JIRA_HOME="/var/lib/jira" | |
| JRE_HOME="/usr" | |
| case $1 in | |
| start) | |
| export JRE_HOME=$JRE_HOME | |
| sudo -u jira sh $JIRA_HOME/bin/startup.sh | |
| ;; |
This file contains hidden or 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
| irb --> GraphViz.new( "<World", :type => :digraph ).output( :svg => String ) | |
| RuntimeError: Error from "/usr/local/bin/dot" -q1 -Tsvg /var/folders/jG/jGGNYPbXE6WwtIkPbM12X++++TI/-Tmp-/graphviz.rb20100714-23405-10bm2sr-0: | |
| Error: /var/folders/jG/jGGNYPbXE6WwtIkPbM12X++++TI/-Tmp-/graphviz.rb20100714-23405-10bm2sr-0:1: syntax error near line 1 | |
| from /usr/local/Cellar/ruby/1.9.1-p378/lib/ruby/gems/1.9.1/gems/ruby-graphviz-0.9.14/lib/graphviz/utils.rb:72:in `output_from_command' | |
| from /usr/local/Cellar/ruby/1.9.1-p378/lib/ruby/gems/1.9.1/gems/ruby-graphviz-0.9.14/lib/graphviz.rb:507:in `output' | |
| from (irb):8 | |
| from /usr/local/bin/irb:12:in `<main>' | |
| irb --> |
This file contains hidden or 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
| module UnderscoredWithoutPluralizationWithoutModule | |
| def self.call(name) | |
| ActiveSupport::Inflector.underscore(ActiveSupport::Inflector.demodulize(name)) | |
| end | |
| end |
This file contains hidden or 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 Foo | |
| def to_ary | |
| ["A", "B", "C", "D"] | |
| end | |
| end | |
| def func(&block) | |
| yield(Foo.new) | |
| end |
This file contains hidden or 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
| ➜ ruby -v | |
| MacRuby version 0.6 (ruby 1.9.0) [universal-darwin10.0, x86_64] | |
| ➜ rake --trace | |
| (in ~/Projects/hamster) | |
| rake aborted! | |
| no such file to load -- spec/rake/spectask | |
| ~/Projects/hamster/rakefile:2:in `block' | |
| ~/Projects/hamster/rakefile:1:in `<main>' | |
| /Library/Frameworks/MacRuby.framework/Versions/0.6/usr/lib/ruby/1.9.0/rake.rb:2327:in `raw_load_rakefile' |