Methods in ruby have a special feature if the last attribute is a hash
def dashed_keys(h1, h2)
"h1(#{ h1.keys.join("-") }) h2(#{ h2.keys.join("-") })"
end
> dashed_keys({:a => 1, :b => 2}, {:m => 13, :n => 14})
=> "h1(a-b) h2(m-n)"
Something else I found helpful along the way (as I had old stuff installed): | |
gem uninstall --install-dir /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8 rails |
<html> | |
<head> | |
<meta http-equiv="content-type" content="text/html; charset=utf-8" /> | |
<title>KML Test</title> | |
<script src="https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false"></script> | |
<script type="text/javascript" charset="utf-8"> | |
// this is a function to be called when the page has loaded. In Rails we'll be using jQuery and this will be a little different |
import Ember from 'ember'; | |
export default Ember.Controller.extend({ | |
appName:'Ember Twiddle', | |
sortProperties: ['position'], | |
sorted: Ember.computed.sort('model', 'sortProperties'), | |
actions: { | |
upPosition(m) { |
<!DOCTYPE HTML> | |
<html> | |
<head> | |
<meta http-equiv="content-type" content="text/html; charset=utf-8" /> | |
<title>Evented Programming</title> | |
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script> | |
<script type="text/javascript" charset="utf-8"> | |
<html> | |
<head> | |
<meta http-equiv="content-type" content="text/html; charset=utf-8" /> | |
<title>Index</title> | |
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script> | |
<style type="text/css" media="all"> | |
.container { width: 960px; margin: 0 auto; } | |
.item { height: 30px; } | |
</style> |
import Ember from 'ember'; | |
export default Ember.Controller.extend({ | |
appName:'Ember Twiddle' | |
}); |
# opens file | |
f = File.new('small.csv','r') | |
# grab all the lines (array) | |
lines = f.readlines | |
# header will be first line, take it out and strip white space | |
headers = lines.shift.strip | |
keys = headers.split(',') | |
# value to hold presidents | |
presidents = [] | |
# loop over remaining lines |
Methods in ruby have a special feature if the last attribute is a hash
def dashed_keys(h1, h2)
"h1(#{ h1.keys.join("-") }) h2(#{ h2.keys.join("-") })"
end
> dashed_keys({:a => 1, :b => 2}, {:m => 13, :n => 14})
=> "h1(a-b) h2(m-n)"
#!/usr/bin/env bash | |
# executables prefix | |
_prefix="/usr/local/bin" | |
# git executable | |
_git="$_prefix/git" | |
# site generation executable | |
_generate="$_prefix/jekyll" | |
# options for the generator |
# == Schema Information | |
# | |
# Table name: showings | |
# | |
# id :integer not null, primary key | |
# start_time :datetime | |
# end_time :datetime | |
class Showing < ActiveRecord::Base | |
attr_accessor :showing_date, :start_date, :end_date |