{{ message }}

Instantly share code, notes, and snippets.

Web Apprentice webapprentice

Created Nov 15, 2013
Embed an image from Flickr in a web page
Last active Dec 28, 2015
Server action code for this tutorial
View tutorial_22_example_1_file_1.rb
 # Extract EXIF metadata from a photo on the server get '/tutorial_22_demo_1' do # load the library file that contains methods used this tutorial require 'lib/tutorial_22.rb' # Extract the metadata from an image file on the server @photo = MiniExiftool.new(File.join(root_dir, "/public/assets/photo_metadata_1_400.jpg")) # Get the Latitude and Longitude values and convert to decimal format
Last active Dec 28, 2015
ERB view file for tutorial 22 server code
View tutorial_22_example_1_file_3.html


Latitude / Longitude   <%= sprintf("%10.5f", @latitude_0) %>, <%= sprintf("%10.5f", @longitude_0) %>

Dump of all the Metadata for this Image

Last active Dec 28, 2015
View tutorial_22_example_1_file_2.rb
 # lib/tutorial_22.rb - methods related to tutorial_22 require 'mini_exiftool_vendored' # Convert Lat Lon in Deg, Min, Sec to Decimal format # e.g 122 deg 25' 25.20" W -> 122.42366666 def dms_to_decimal(coordinate) decimal = 0.0 if coordinate =~ /^(\d+)\s+deg\s+(\d+)\'\s+([\d\.]+)\"\s+(\S)\s*\$/ deg = \$1.to_f
Last active Dec 28, 2015
Access the Google Maps Geocoding API to get the Latitude and Longitude for a user-supplied address
View tutorial_24_example_1.html


Geocode

e.g. The White House, Washington DC

Latitude :

Longitude :

Reverse Geocode

Enter Latitude, Longitude Pair and hit Return

e.g. 38.897847,-77.036499

Last active Dec 28, 2015
Embedding Gravatars in a Web page
View tutorial_25_example_1.html


Web Apprentice Gravatar

http://www.gravatar.com/avatar/68bbbd2c1cefab1b0104d53cd6a15bab?s=80

Default Gravatar

http://www.gravatar.com/avatar/00000000000000000000000000000000?s=80

Specific Default Gravatar - 'mm'

Last active Dec 29, 2015
View tutorial_26_example_1.erb

Last active Dec 29, 2015
Simple example of using spin.js (http://fgnass.github.io/spin.js) from Felix Gnass
View tutorial_27_example_1.html

Created Dec 3, 2013
View tutorial_28_example_1.geojson