Last active
January 2, 2016 11:09
Revisions
-
seanpdoyle revised this gist
Jan 12, 2014 . 2 changed files with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -3,7 +3,7 @@ class CreatePlaces < ActiveRecord::Migration include Paperclip::Schema #exclude this line in Rails apps def self.change create_table :places do |t| t.boolean :location_locked, default: false, null: false Binary file not shown. -
seanpdoyle revised this gist
Jan 12, 2014 . 2 changed files with 9 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1,15 @@ #!/usr/bin/env ruby # # Scrape the location from a JPG file # # Example: # # $ ./location photo_with_gps_metadata.jpg # $ Processing love.jpg..... # $ Processed file. # $ ------- latitude: 39.95116666666667 # $ ------- longitude: -75.19433333333333 # require "./setup" LoadingSorry, something went wrong. Reload?Sorry, we cannot display this file.Sorry, this file is invalid so it cannot be displayed. -
seanpdoyle revised this gist
Jan 12, 2014 . 5 changed files with 15 additions and 8 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,7 +1,7 @@ require 'paperclip' #exclude this line in Rails apps class CreatePlaces < ActiveRecord::Migration include Paperclip::Schema #exclude this line in Rails apps def self.up create_table :places do |t| This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -2,6 +2,7 @@ source 'https://rubygems.org' ruby '2.0.0' gem 'paperclip-location' gem 'activerecord' gem 'sqlite3' This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -4,16 +4,18 @@ require "./setup" unless file_name = ARGV.pop raise ArgumentError, "Don't forget to pass in the path to the image" end puts "Processing #{file_name}....." puts puts "-------" puts image_file = File.open(file_name) place = Place.new(photo: image_file) puts puts "-------" This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1,10 @@ class Place < ActiveRecord::Base include Paperclip::Glue # exclude this line in Rails apps has_attached_file :photo, styles: { large: '600x600#' }, processors: [:thumbnail, :location] validates_attachment :photo, content_type: { content_type: %w[image/jpeg image/tiff] } end This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -13,7 +13,7 @@ ActiveRecord::Schema.define(version: 20140110012324) do create_table "places", force: true do |t| t.boolean "location_locked", default: false, null: false t.decimal "lat", precision: 10, scale: 15 t.decimal "lng", precision: 10, scale: 15 t.string "photo_file_name" -
seanpdoyle revised this gist
Jan 7, 2014 . 2 changed files with 8 additions and 7 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -2,18 +2,12 @@ # # Scrape the location from a JPG file require "./setup" unless image_file = ARGV.pop raise ArgumentError, "Don't forget to pass in the path to the image" end puts "Processing #{image_file}....." puts puts "-------" This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,7 @@ require "active_record" require "paperclip/location" require "./place" ActiveRecord::Base.establish_connection YAML.load_file("database.yml")["development"] Paperclip::Location::Processor.register! :location -
seanpdoyle revised this gist
Jan 7, 2014 . 8 changed files with 7 additions and 19 deletions.There are no files selected for viewing
File renamed without changes.This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -4,13 +4,10 @@ require 'active_record' include ActiveRecord::Tasks DatabaseTasks.env = 'development' DatabaseTasks.db_dir = '.' DatabaseTasks.database_configuration = YAML.load(File.read('database.yml')) DatabaseTasks.migrations_paths = 'migrate' task :environment do ActiveRecord::Base.configurations = DatabaseTasks.database_configuration This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,5 @@ development: adapter: sqlite3 database: development.sqlite3 pool: 5 timeout: 5000 Binary file not shown.This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,7 +0,0 @@ This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -4,15 +4,15 @@ require "active_record" require "paperclip/location" require "./place" Paperclip::Location::Processor.register! :location unless image_file = ARGV.pop raise ArgumentError, "Don't forget to pass in the path to the image" end ActiveRecord::Base.establish_connection YAML.load_file("database.yml")["development"] puts "Processing #{image_file}....." puts File renamed without changes.This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -12,7 +12,6 @@ # It's strongly recommended that you check this file into your version control system. ActiveRecord::Schema.define(version: 20140110012324) do create_table "places", force: true do |t| t.boolean "location_locked", default: false, null: false t.decimal "lat", precision: 10, scale: 15 @@ -22,5 +21,4 @@ t.integer "photo_file_size" t.datetime "photo_updated_at" end end -
seanpdoyle revised this gist
Jan 7, 2014 . 8 changed files with 159 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,7 @@ source 'https://rubygems.org' ruby '2.0.0' gem 'activerecord' gem 'paperclip-location' gem 'sqlite3' This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,50 @@ GEM remote: https://rubygems.org/ specs: activemodel (4.0.2) activesupport (= 4.0.2) builder (~> 3.1.0) activerecord (4.0.2) activemodel (= 4.0.2) activerecord-deprecated_finders (~> 1.0.2) activesupport (= 4.0.2) arel (~> 4.0.0) activerecord-deprecated_finders (1.0.3) activesupport (4.0.2) i18n (~> 0.6, >= 0.6.4) minitest (~> 4.2) multi_json (~> 1.3) thread_safe (~> 0.1) tzinfo (~> 0.3.37) arel (4.0.1) atomic (1.1.14) builder (3.1.4) climate_control (0.0.3) activesupport (>= 3.0) cocaine (0.5.3) climate_control (>= 0.0.3, < 1.0) exifr (1.1.3) i18n (0.6.9) mime-types (2.0) minitest (4.7.5) multi_json (1.8.2) paperclip (3.5.2) activemodel (>= 3.0.0) activesupport (>= 3.0.0) cocaine (~> 0.5.3) mime-types paperclip-location (0.0.5) exifr (~> 1.1) paperclip (~> 3.5) sqlite3 (1.3.8) thread_safe (0.1.3) atomic tzinfo (0.3.38) PLATFORMS ruby DEPENDENCIES activerecord paperclip-location sqlite3 This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,20 @@ require 'bundler/setup' require 'active_record' include ActiveRecord::Tasks db_dir = File.expand_path('../db', __FILE__) config_dir = File.expand_path('../config', __FILE__) DatabaseTasks.env = ENV['ENV'] || 'development' DatabaseTasks.db_dir = db_dir DatabaseTasks.database_configuration = YAML.load(File.read(File.join(config_dir, 'database.yml'))) DatabaseTasks.migrations_paths = File.join(db_dir, 'migrate') task :environment do ActiveRecord::Base.configurations = DatabaseTasks.database_configuration ActiveRecord::Base.establish_connection DatabaseTasks.env end load 'active_record/railties/databases.rake' This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,6 @@ class Place < ActiveRecord::Base include Paperclip::Glue has_attached_file :photo, styles: { large: '600x600#' }, processors: [:thumbnail, :location] end This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,5 @@ development: adapter: sqlite3 database: db/development.sqlite3 pool: 5 timeout: 5000 This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,16 @@ require 'paperclip' class CreatePlaces < ActiveRecord::Migration include Paperclip::Schema def self.up create_table :places do |t| t.boolean :location_locked, default: false, null: false t.decimal :lat, precision: 10, scale: 15 t.decimal :lng, precision: 10, scale: 15 end add_attachment :places, :photo end end This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,26 @@ # encoding: UTF-8 # This file is auto-generated from the current state of the database. Instead # of editing this file, please use the migrations feature of Active Record to # incrementally modify your database, and then regenerate this schema definition. # # Note that this schema.rb definition is the authoritative source for your # database schema. If you need to create the application database on another # system, you should be using db:schema:load, not running all the migrations # from scratch. The latter is a flawed and unsustainable approach (the more migrations # you'll amass, the slower it'll run and the greater likelihood for issues). # # It's strongly recommended that you check this file into your version control system. ActiveRecord::Schema.define(version: 20140110012324) do create_table "places", force: true do |t| t.boolean "location_locked", default: false, null: false t.decimal "lat", precision: 10, scale: 15 t.decimal "lng", precision: 10, scale: 15 t.string "photo_file_name" t.string "photo_content_type" t.integer "photo_file_size" t.datetime "photo_updated_at" end end This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,29 @@ #!/usr/bin/env ruby # # Scrape the location from a JPG file require "active_record" require "paperclip/location" require "./app/models/place" Paperclip::Location::Processor.register! :location unless image_file = ARGV.pop raise ArgumentError, "Don't forget to pass in the path to the image" end ActiveRecord::Base.establish_connection YAML.load_file("config/database.yml")["development"] puts "Processing #{image_file}....." puts puts "-------" puts place = Place.new photo: File.open(image_file) puts puts "-------" puts puts "Processed file." puts "------- latitude: #{place.lat}" puts "------- longitude: #{place.lng}" -
seanpdoyle created this gist
Jan 7, 2014 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,7 @@ source 'https://rubygems.org' ruby '2.0.0' gem 'activerecord' gem 'paperclip-location' gem 'sqlite3'