Skip to content
Browse files

Initial commit of working site.

  • Loading branch information...
0 parents commit a61adb4ada95a7b5377113113a41c5c5e21d2b32 @funkaoshi committed
Showing with 165 additions and 0 deletions.
  1. BIN .DS_Store
  2. 0 README.markdown
  3. +14 −0 config.ru
  4. +5 −0 dreamhost.rb
  5. +85 −0 i_shoot_film.rb
  6. +8 −0 public/site.css
  7. +9 −0 views/_analytics.haml
  8. +29 −0 views/index.haml
  9. +15 −0 views/wtf.haml
BIN .DS_Store
Binary file not shown.
0 README.markdown
No changes.
14 config.ru
@@ -0,0 +1,14 @@
+require 'dreamhost.rb' # loads rubygems on Dreamhost.
+
+require 'sinatra'
+Sinatra::Base.set(:run, false)
+Sinatra::Base.set(:env, :production);
+
+require 'rack/cache'
+use Rack::Cache,
+ :verbose => true,
+ :metastore => "file:cache/meta",
+ :entitystore => "file:cache/body"
+
+require 'i_shoot_film.rb'
+run Sinatra::Application
5 dreamhost.rb
@@ -0,0 +1,5 @@
+# Used to get Rubygems running properly on Dreamhost.
+ENV['GEM_HOME'] = '/home/ramanan/local/gems'
+ENV['GEM_PATH'] = '$GEM_HOME:/usr/lib/ruby/gems/1.8'
+require 'rubygems'
+Gem.clear_paths
85 i_shoot_film.rb
@@ -0,0 +1,85 @@
+require 'sinatra'
+require 'flickraw'
+require 'haml'
+
+# Sinatra !!
+
+configure do
+ # Set API Key
+ FlickRaw.api_key = '2b5c553e493e6c9729509bf699ffbfc9'
+
+ # use HTML5 when generating HTML
+ set :haml, :format => :html5
+
+ # set the last mod time to now, when the app starts up. Updated via /update/now
+ @@last_mod_time = Time.now
+
+ # grab my user id
+ @@user_id = flickr.people.findByUsername(:username => 'funkaoshi').id
+
+ # for google analytics
+ @@analytics_token = 'UA-2675737-9'
+end
+
+before do
+ unless request.path_info =~ /update/
+ expires 300, :public, :must_revalidate # always cache for 5 minutes ...
+ last_modified(@@last_mod_time) # ... and rely on 304 query after that
+ end
+end
+
+helpers do
+ def get_film_rolls(get_bw=false)
+ search_params = { :user_id => @user_id,
+ :machine_tags => 'funkaoshi:roll=',
+ :extras => "machine_tags, tags, url_sq",
+ :per_page => '500',
+ :page => '1' }
+ photos = flickr.photos.search(search_params)
+
+ bw_film_rolls, colour_film_rolls = {}, {}
+ photos.each do |photo|
+ roll_no = photo.machine_tags.match(/funkaoshi:roll=([0-9]*)/)[1].to_i
+ roll_map = photo.tags.match(/byobw/) ? bw_film_rolls : colour_film_rolls
+ if !roll_map.has_key?(roll_no)
+ roll_map[roll_no] = []
+ end
+ roll_map[roll_no] << photo
+ end
+ @bw_film_rolls = bw_film_rolls.to_a.sort
+ @colour_film_rolls = colour_film_rolls.to_a.sort
+ end
+
+ def get_film_dev_info(photo)
+ if photo.machine_tags =~ /filmdev:recipe=([0-9]+)/
+ "<span class='small'><a href='http://filmdev.org/recipe/show/#{$~[1]}'>development receipe #{$~[1]}</a></span>"
+ end
+ end
+end
+
+# Routes
+
+get '/' do
+ get_film_rolls
+ haml :index
+end
+
+# Lame web-cache thing which I don't think really works.
+
+get '/update/now' do
+ @@last_mod_time = Time.now
+end
+
+get '/update/show' do
+ "Last-Update: #{@@last_mod_time}"
+end
+
+# Error Handlers in Production
+
+not_found do
+ haml :wtf
+end
+
+error do
+ haml :wtf
+end
8 public/site.css
@@ -0,0 +1,8 @@
+body { font-family: Calibri, Lucdia Grande, Gill Sans, Verdana; font-size: 75%; margin:50px auto; width:640px; }
+h2 { margin-top:30px; }
+h3 { padding:0; margin:20px 0 0 0; }
+header h1, header h2 { padding:0; margin:0 10px 0 0; display:inline; }
+header h2, h3, footer { color:gray; }
+header p { border-left: 1px solid black; padding:0 200px 0 10px; }
+footer, .small { font-size:50%; }
+a { color:#888; }
9 views/_analytics.haml
@@ -0,0 +1,9 @@
+- if @@analytics_token
+ :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"));
+ :javascript
+ try {
+ var pageTracker = _gat._getTracker("#{@@analytics_token}");
+ pageTracker._trackPageview();
+ } catch(err) {}
29 views/index.haml
@@ -0,0 +1,29 @@
+!!! 5
+%html
+ %head
+ %meta(charset='utf-8')
+ %title I Shoot Film
+ %link(rel='stylesheet' href='/site.css' type='text/css' media='screen' title='default style sheet')
+ %body
+ %header
+ %h1 I Shoot Film
+ %h2 Some rolls are better than others.
+ %p I started tracking the rolls of film I shot more methodically at the start of 2008. I assigned each roll of film a number, each frame a numerical id. These are (almost) all the photos I've shot on film and <a href="http://flickr.com/photos/funkaoshi">posted to Flickr</a> since switching to this system. The <a href="http://www.flickr.com/photos/funkaoshi/sets/72157611013506478/">B&W I processed myself</a> is a complete listing, the colour not so much. Eventually I'll go back through all my pictures and tag them properly so they show up here. Film comes in rolls of 24 or 36 frames. That should give you a sense of just how many pictures don't get posted online.
+ - @colour_film_rolls.each do |roll|
+ .roll
+ %h3= "Roll #{roll[0]}"
+ - roll[1].each do |photo|
+ %a{:href => FlickRaw::url_photopage(photo)}
+ %img{:src => photo.url_sq}
+ %h2 Black & White Film Processed by Me
+ - @bw_film_rolls.each do |roll|
+ .roll
+ %h3
+ = "Roll #{roll[0]}"
+ = get_film_dev_info(roll[1].first)
+ - roll[1].each do |photo|
+ %a{:href => FlickRaw::url_photopage(photo)}
+ %img{:src => photo.url_sq}
+ %footer
+ %p Site designed and built by <a href="http://funkaoshi.com">Ramanan Sivaranjan</a>.
+ = haml(:_analytics, :layout => false)
15 views/wtf.haml
@@ -0,0 +1,15 @@
+!!! 5
+%html
+ %head
+ %meta(charset='utf-8')
+ %title I Shoot Film :: Error
+ %link(rel='stylesheet' href='/site.css' type='text/css' media='screen' title='default style sheet')
+ %body
+ #content
+ %header
+ %h1 I Shoot Film :: Error
+ %content
+ %p Something has gone wrong. Yeah, it sucks for me too.
+ %footer
+ %p Site designed and built by <a href="http://funkaoshi.com">Ramanan Sivaranjan</a>.
+ = haml(:_analytics, :layout => false)

0 comments on commit a61adb4

Please sign in to comment.
Something went wrong with that request. Please try again.