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
moment.tz.add({ | |
"zones": { | |
"Africa/Algiers": [ | |
"0:12:12 - LMT 1891_2_15_0_1 0:12:12", | |
"0:9:21 - PMT 1911_2_11 0:9:21", | |
"0 Algeria WE%sT 1940_1_25_2", | |
"1 Algeria CE%sT 1946_9_7 1", | |
"0 - WET 1956_0_29", | |
"1 - CET 1963_3_14 1", | |
"0 Algeria WE%sT 1977_9_21 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
def height | |
rows_in_legend = (editors.size.to_f / 6.to_f).ceil | |
case rows_in_legend | |
when 1 then 580 | |
when 2 then 722 | |
when 3 then 870 | |
when 4 then 1020 | |
else 1160 | |
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
file_field.fileupload | |
dataType: 'xml' | |
fileInput: file_input | |
url: "#{document.location.protocol}//s3.amazonaws.com/#{opts.as3.bucket}" | |
add: (e, data) -> | |
data_context = data | |
file_name_wrapper.show().text(get_file_name(data)) if file_valid(data) | |
send: (e, data) -> | |
file_name_wrapper.fadeOut 300, -> progress_bar.fadeIn() | |
progress: (e, data) -> |
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
# Assumes your `days` method will return an array of hashes where the | |
# key specifies the month number (i.e. 1-12) and the value is an array | |
# containing the days of the month (i.e. 1-31) when the streets will | |
# be cleaned. | |
# | |
# Following that scheme then your data might looks something like: | |
# | |
# [ | |
# 1: [7, 8], # January 7th and 8th | |
# 2: [2, 4], |
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
# Assumes your `days` method will return an array of hashes where the | |
# key specifies the month number (i.e. 1-12) and the value is an array | |
# containing the days of the month # (i.e. 1-31) when the streets will | |
# be cleaned. | |
# | |
# Following that scheme then your data might looks something like: | |
# | |
# [ | |
# 1: [7, 8], # January 7th and 8th | |
# 2: [2, 4], |
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 test | |
puts "alkjdfalkjf" | |
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
first = 0 | |
last = 1000 | |
total = 0 | |
multipules = [] | |
# build the array of multipules | |
(first..last).each do |list| | |
if (list % 5 == 0) or (list % 3 == 0) | |
multipules.push(list) | |
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
print "What is your start year? " | |
start = gets.chomp.to_i | |
print "What is your finish year? " | |
finish = gets.chomp.to_i | |
while finish > start | |
puts finish -= 1 | |
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
bottle_num = 100 | |
# You can clean up the the puts statement using interpolation (i.e. "Some words #{a_variable} and more words") | |
# | |
while bottle_num > 0 | |
puts "#{bottle_num -= 1} bottles of beer on the wall" | |
end | |
# Or you could even one line it. | |
# |
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
<h1>A better way to manage HTML emails with Ruby on Rails</h1> | |
<p>With Transis Planner nearly completed, we're starting to focus on the finer details, making sure everything's nicely polished and ready for launch. Among other things, this means creating great looking HTML emails. After all, Planner is a collaboration tool. Our users will be working together to hammer out effective media plans, and that means we'll be sending lots of media briefs, insertion orders, and so on.</p> | |
<p>Sending multipart emails (i.e. HTML and plain text) with Rails is very straight forward. Just write a mailer action and create two corresponding view templates — one with an `.html` extension and one with a `.text` extension. But this method has a few shortcomings:</p> | |
<ul> | |
<li>You end up duplicating text (and probably logic) since you need to create both a `.text` and `.html` template.</li> | |
<li>Emails are a total pain to style. In the process, you'll lay waste to all sorts of web standards — using table-based la |
NewerOlder