Q: Can I use my iPad at the dinner table?
A: No. If Steve Jobs had wanted you to use your iPad at the table, he would have put a camera in it so you could take pictures of your future poo and upload them to Foodspotting

()

Foursquare Authentication with Ruby + OAuth

This requires the OAuth Gem

# sudo gem install oauth

Add your route and create the Foursquare auth controller

map.resources :foursquare_auth
class FoursquareAuthController .> ApplicationController
  before_filter :load_consumer, :except => :destroy
  
  def index
    if session[:foursquare_request_token] && params[:oauth_token]
      request_token = OAuth::RequestToken.new(@consumer, session[:foursquare_request_token], session[:foursquare_request_secret])
      @access_token = request_token.get_access_token(:oauth_verifier => params[:oauth_token])
      current_person.update_attributes(:foursquare_oauth_token => @access_token.token, :foursquare_oauth_secret => @access_token.secret)
      flash[:notice] = "Foursquare! Yay!"
      redirect_to edit_person_path(current_person)
    else
      redirect_to edit_person_path(current_person)
    end
  end
  
  def create

    request_token = @consumer.get_request_token(:oauth_callback => foursquare_auth_index_url)
    
    session[:foursquare_request_token]  = request_token.token
    session[:foursquare_request_secret] = request_token.secret

    redirect_to request_token.authorize_url
    
  end
  
  def destroy
    current_person.update_attributes(:foursquare_oauth_token => nil, :foursquare_oauth_secret => nil)
    respond_to do |format|
      format.js
    end
  end
  
private

  def load_consumer
    @consumer = OAuth::Consumer.new(
      FOURSQUARE_OAUTH_KEY, 
      FOURSQUARE_OAUTH_SECRET, 
      {:site => 'http://foursquare.com'}
    )
  end
end
Thursday, March 25, 2010   ()

Ruby Foursquare Helpers

The Foursquare API documentation is a little hard to filter through. Here are a few helpers I created using the OAuth Gem and Ruby’s JSON implementation

module FoursquareHelpers
  require "oauth"
  require 'json'
  
  def foursquare_user_details
    create_access_token
    user_info = @access_token.get("http://api.foursquare.com/v1/user.json")
    JSON.parse(user_info.body)
  end
  
  def venue_search(query, lat, lng)
    create_access_token
    results = @access_token.get("http://api.foursquare.com/v1/venues.json?q=#{URI.escape(query)}&l=1&geolat=#{lat}&geolong=#{lng}")
    response = JSON.parse(results.body)
  end
  
  def checkin(options)
    create_access_token
    response = @access_token.post("http://api.foursquare.com/v1/checkin.json", options)
    response = JSON.parse(response.body)
  end
  
  def tip(options)
    create_access_token
    response = @access_token.post("http://api.foursquare.com/v1/addtip", options)
  end
  
private

  def create_access_token
    load_consumer
    @access_token = OAuth::AccessToken.new(@consumer, current_person.foursquare_oauth_token, current_person.foursquare_oauth_secret)
  end

  def load_consumer
    @consumer = OAuth::Consumer.new(
      FOURSQUARE_OAUTH_KEY, 
      FOURSQUARE_OAUTH_SECRET, 
      {:site => 'http://foursquare.com'}
    )
  end
  
end
Thursday, March 25, 2010   ()
 

Foodspotting’s first TV spot on KTLA! (via http://www.nomsnotbombs.com)

()

2010 list of products I use every day.

  1. Twitter
  2. Foursquare
  3. Foodspotting
  4. TextMate
  5. Github
  6. Slicehost
  7. Skitch
  8. GMail
  9. Netflix
  10. iPhone 3GS
  11. Photoshop
  12. XCode
  13. Google Calendar
  14. Google Apps
  15. SMS
  16. Google Maps

Monday, March 22, 2010 — 1 note   ()
Checked into the Motel 6 in Cedar City, UT, just north of Zion. OMG shower!!!

Checked into the Motel 6 in Cedar City, UT, just north of Zion. OMG shower!!!

()

Ain’t nuthin’ close by ‘round ‘ere

Toothless man in death valley
()
Leaving Yosemite - rained out this morning. omw to Zion by way of the one and only extraterrestrial highway.

Leaving Yosemite - rained out this morning. omw to Zion by way of the one and only extraterrestrial highway.

()
Death Valley - spent the whole day driving through mountains and valleys to arrived at the entrance around 5pm where it was 120 degrees outside. Death valley is HUGE!

Death Valley - spent the whole day driving through mountains and valleys to arrived at the entrance around 5pm where it was 120 degrees outside. Death valley is HUGE!

()
Back to the Knobs. Bouldered with a crazy Romanian guy. (his name is in the tuolumne bouldering guide)

Back to the Knobs. Bouldered with a crazy Romanian guy. (his name is in the tuolumne bouldering guide)

()