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
Ruby 1.9.2 -- Rails 3.2.8 | |
1.9.2p320 :001 > Date.today | |
=> Mon, 15 Oct 2012 | |
1.9.2p320 :002 > Date.tomorrow | |
=> Wed, 17 Oct 2012 | |
1.9.2p320 :003 > Date.yesterday | |
=> Mon, 15 Oct 2012 | |
1.9.2p320 :004 > Time.zone | |
=> (GMT+00:00) UTC |
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
saturday.each_with_index { |k,i| datehash[k] = friday[i] } | |
saturday (array one) | |
datehash (resulting hash) | |
friday (array two) |
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
def data_links_helper(data, model) | |
output = "" | |
for report in data | |
output << "<tr>" | |
report.each do |k,v| | |
output << "<td>#{v}</td>" | |
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
@select_options = { "value" => "value", "name" => "name" } | |
<%= select_tag 'group_by', options_from_collection_for_select(@select_options, "value", "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
asd = Price.where("min_color <= ? AND min_qty <= ? ", 1, 34) |
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
def self.clean(value, level) | |
case level | |
when 1 #strip html and tags | |
results = Sanitize.clean(value) | |
when 2 #includes level 1, regex to allow symbols | |
leveltwo = Sanitize.clean(value) | |
leveltwo.strip! | |
results = leveltwo.gsub(/[^0-9a-zA-Z\(\)\|\:\/\,\'\.\-\@\_\[\]\&\?\=\s]/, "") |
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
cat /Users/.rvm/gems/ruby-2.0.0-p0@gems/gems/therubyracer-0.11.4/ext/v8/gem_make.out | |
/Users/.rvm/rubies/ruby-2.0.0-p0/bin/ruby extconf.rb | |
checking for main() in -lpthread... yes | |
checking for main() in -lobjc... yes | |
creating Makefile | |
make | |
compiling accessor.cc | |
accessor.cc:1: error: bad value (corei7) for -march= switch | |
accessor.cc:1: error: bad value (corei7) for -mtune= switch |
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:: v.first == "1,000" or v.first == "$15,000.00" | |
<td> | |
<div> | |
<span title=<%= !v.first.nil? ? v.first.gsub(',', '') : nil %>></span> | |
<% v.each do |col_value| %> | |
<%= col_value %> | |
<% end %> | |
</div> | |
</td> |
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] pry(main)> asd = ('A'..'Z') | |
=> "A".."Z" | |
[5] pry(main)> asd.each do |p| | |
[5] pry(main)* puts p | |
[5] pry(main)* end | |
A | |
B | |
C | |
D | |
E |
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
<div id='search_div'> | |
<input type="text" class="search-query" id="search_text"> | |
<button class="btn" id='search_button'><i class='icon-search'></i></button> | |
</div> | |
<address id="2106"> | |
<strong>RandoZZ ZZMcCracken</strong><br> | |
<small>home:</small> <a href="mailto:home@email.com">home@email.com</a><br><small>work:</small> <a href="mailto:work@email.com">work@email.com</a><br><small>primary:</small> <a href="mailto:primary@email.com">primary@email.com</a><br><small>other:</small> <a href="mailto:other@email.com">other@email.com</a><br> | |
<small>home phone:</small> 1-310-555-5555 <br><small>work phone:</small> 1-310-555-3333 <br><small>cell phone:</small> 1.310.555.1212 | |
</address> |
OlderNewer