Skip to content

Instantly share code, notes, and snippets.

View benaskins's full-sized avatar
🍑
Peachy

Ben Askins benaskins

🍑
Peachy
View GitHub Profile
postcodes = FasterCSV.read(data_source_for("postcodes.csv"))
postcodes.each do |(post_code, name, state_name, _, _, _, _, _, _, category)|
if category.squish == "Delivery Area"
post_code = sprintf("%04d", post_code.to_i)
state = State.find_or_create_by_name(state_name)
Locality.create(:post_code => post_code, :name => name, :state => state)
end
end
ssh-dss AAAAB3NzaC1kc3MAAACBAPokVOhBB0AeBGqbV4ue11dwPAMQfN0qSYZCdd3VwqWn2gG9sTLrLGv8JzZcCS800+BUm++dPO7byQARK9EgsNkQuI0IS9f+6SOVgYpSSPm1fgiWRBSqLoiWjbJ4zTrA1cFq17VJbpT2euWgoxx5kK8DbxxFVdJz+zO+yk7CAd3TAAAAFQDfYTTSHFwRG36sKnfS2/EIkwp10wAAAIEAqmb8WyCe3J9q/zPPzHf3x4YkYm8xClJWMoWHs5AxIpn0gcg7sHI1cT8PvMUY70xfGzMubWuT6g5+mk2mAQCt9qaBOicR7FFaV72x/pYDuWJafUzjpuxRUharFCuKqCLeIKyPxnbs8g0XiSXNP6SlghTcBMBtB/RWxSgfxIWhS70AAACAXN8XInxk75Wu0wpUQ/sjslRfejvKIMbOvgI4vryNnBjx+xjGN0jB8yLZ6Fl/eS/Oj1qMiCLsvc7Gvbxtk/eRbIKd/vZQ4Fow9GWpGQ3p/Ye/jLJTLinOUUWfP/1JFr4VLrElXg4h0u6ag1gaDJXk4XWBuuoXBdzFCaG29EvRYsg= [email protected]
def v1(value)
value || "-"
end
def v2(object, method)
object && value = object.send(method) ? value : "-"
end
Rehearsal -----------------------------------------
v1 o1 0.400000 0.000000 0.400000 ( 0.532133)
v1 o2 0.490000 0.000000 0.490000 ( 0.904147)
v2 o1 0.570000 0.000000 0.570000 ( 0.989526)
v2 o2 0.670000 0.010000 0.680000 ( 1.149990)
v2 o3 0.340000 0.000000 0.340000 ( 0.540038)
-------------------------------- total: 2.480000sec
user system total real
v1 o1 0.400000 0.000000 0.400000 ( 0.636844)
Scenario: Visit the local conditions page for a location where conditions are available
Given I have a demonstration site
And the web service knows about "Sydney, NSW"
When I visit "/weather/local-conditions/nsw/sydney"
Then I should see "Sydney current conditions"
And I should see "Dew point" defined as "18.7"
And I should see "Relative humidity" defined as "78"
And I should see "feels like" defined as "22.7"
And I should see "Wind" defined as "SE 5"
And I should see "Rainfall since 9am" defined as "0.0"
<% if @current_site.google_analytics_web_property_id %>
<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
try {
var pageTracker = _gat._getTracker("<%= @current_site.google_analytics_web_property_id %>");
pageTracker._trackPageview();
} catch(err) {}
ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAuVEY6eJuZy37j+eJDjMEzHzUatP+gyqKtq7c73Evo5Q/F68b4Kq1zD1O5F7ncKAeiOtqwwm8kFeFYJjwfAYr5/4fl4APaAGfwpPxBwxY4JIG2AAL1IIBiKBemWmKroOO6Ypt6S6W4N7ZVxPrwI+dnE7e/jojIsSxSa+awnKB8ApXIcBDQKU9z3Oj+/DmWcI9pyuH6mj0785RRSVbPUols98loWJNsAejccsYPuxfwsZHpETiGo7C5UbpOdgdsx6Mi5d5UZ6i07c0sntiJPGYmShBgQT0WH5Zq9JjNvK3UfRlKVBpSCSn8e0DD785cuJFPIWUbhd+sibfH8Kev+1Y1w== [email protected]
- if @items
- @items.collect { |item| item.gsub(/views\/.+\/(.+).haml/, '\1') }.each do |name|
- unless name == "index" || name[/^hide-/]
%p do some stuff
- @items.collect { |item| item.split("/").last.split(".").first }.each do |name|
- unless name == "index" || name.match(/hide-.+/)
%p do some stuff
<div class="formContainer">
<script type="text/javascript">
function activateConditionals() {
var from_load = arguments ? arguments[0] : false;
$('body').getElementsBySelector('conditional').each(function(e) {
eval(e.readAttribute('condition_change'));
});
}