Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: kristjan/unicorn_alert
base: 10eaebea17
...
head fork: kristjan/unicorn_alert
compare: 6328bc7518
Checking mergeability… Don't worry, you can still create the pull request.
  • 2 commits
  • 4 files changed
  • 0 commit comments
  • 1 contributor
Commits on May 06, 2012
@noahsilas noahsilas Adding SF Crime data for March 2012
sourced from data.sfgov.org
76f8e57
@noahsilas noahsilas Added Crime model 6328bc7
Showing with 10,576 additions and 0 deletions.
  1. +1 −0  Gemfile
  2. +1 −0  Gemfile.lock
  3. +10 −0 app/models/crime.rb
  4. +10,564 −0 data/sf_crime.2012_03.json
View
1  Gemfile
@@ -21,6 +21,7 @@ group :assets do
end
gem 'jquery-rails'
+gem 'multi_json'
# To use ActiveModel has_secure_password
# gem 'bcrypt-ruby', '~> 3.0.0'
View
1  Gemfile.lock
@@ -105,6 +105,7 @@ PLATFORMS
DEPENDENCIES
coffee-rails (~> 3.2.1)
jquery-rails
+ multi_json
rails (= 3.2.3)
sass-rails (~> 3.2.3)
sqlite3
View
10 app/models/crime.rb
@@ -0,0 +1,10 @@
+class Crime
+ def self.crimes
+ @crimes ||= begin
+ crimefile = Rails.root + 'data/sf_crime.2012_03.json'
+ raw_crimes = File.open(crimefile) {|f| MultiJson.load(f)}
+ columns = raw_crimes['meta']['view']['columns'].map{|column| column['name']}
+ raw_crimes['data'].map{|row| Hash[columns.zip(row)]}
+ end
+ end
+end
View
10,564 data/sf_crime.2012_03.json
10,564 additions, 0 deletions not shown

No commit comments for this range

Something went wrong with that request. Please try again.