Wednesday May 14, 2008 at 20:26

I decided to throw together a lifestreaming app to aggregate all various activity feeds that make up my distributed “web identity”. It’s a rails app living over at lifestream.dustinselman.com. Along the way I ended up modifying the default behavior of the rails method time_ago_in_words to work a little  differently. Here’s the code I ended up with: 


def time_ago_in_words(time, options = {})
  start_date = options.delete(:start_date) || Time.new
  date_format = options.delete(:date_format) || :default
  delta_minutes = (start_date.to_i - time.to_i).floor / (60)
  distance = distance_of_time_in_words(delta_minutes);
end

def distance_of_time_in_words(minutes)
  hours = minutes.floor/60
  days = hours.floor/24
  today = Time.today.to_date
  startday = today - days
  starttime = Time.today - minutes*60
  startstr = starttime.strftime("%I").to_i.to_s + 
                   starttime.strftime(":%M %p")
  case
    when hours < 1
      "less than 1 hour ago"
    when hours < 24
      pluralize(hours, "hour") + " ago".downcase
    when days < 2
      "yesterday at #{start_time_str}".downcase
    when days < 7
      "#{(startday).strftime('%A')} at #{startstr}".downcase
    when days < 356
      "#{(startday).strftime('%B %d')} at #{startstr}".downcase
    else
      "#{(startday).strftime('%B %d, %Y')} at #{startstr}".downcase
  end
end
I decided to throw together a lifestreaming app to aggregate all various activity feeds that make up my distributed “web identity”. It’s a rails app living over at lifestream.dustinselman.com. Along the way I ended up modifying the default behavior of the rails method time_ago_in_words to work a little differently. Here’s the code I ended up with:

def time_ago_in_words(time, options = {})
  start_date = options.delete(:start_date) || Time.new
  date_format = options.delete(:date_format) || :default
  delta_minutes = (start_date.to_i - time.to_i).floor / (60)
  distance = distance_of_time_in_words(delta_minutes);
end

def distance_of_time_in_words(minutes)
  hours = minutes.floor/60
  days = hours.floor/24
  today = Time.today.to_date
  startday = today - days
  starttime = Time.today - minutes*60
  startstr = starttime.strftime("%I").to_i.to_s + 
                   starttime.strftime(":%M %p")
  case
    when hours < 1
      "less than 1 hour ago"
    when hours < 24
      pluralize(hours, "hour") + " ago".downcase
    when days < 2
      "yesterday at #{start_time_str}".downcase
    when days < 7
      "#{(startday).strftime('%A')} at #{startstr}".downcase
    when days < 356
      "#{(startday).strftime('%B %d')} at #{startstr}".downcase
    else
      "#{(startday).strftime('%B %d, %Y')} at #{startstr}".downcase
  end
end
Comments (View)

Friday May 02, 2008 at 14:38

Tryon Creek (via dsel)                     
As seen on recent hill walk with Ruth 

Tryon Creek (via dsel)

As seen on recent hill walk with Ruth 

Comments (View)

Friday April 25, 2008 at 1:36

Comments (View)

Friday April 18, 2008 at 18:45

Science Debate 2008

Everyone should go check out this out.

sciencedebate2008

From the site:

“Given the many urgent scientific and technological challenges facing America and the rest of the world, the increasing need for accurate scientific information in political decision making, and the vital role scientific innovation plays in spurring economic growth and competitiveness, we, the undersigned, call for a public debate in which the U.S. presidential candidates share their views on the issues of The Environment, Medicine and Health, and Science and Technology Policy.”

sciencedebate2008.com

Comments (View)

Thursday April 17, 2008 at 14:48

Atari Punk Console (via dsel)                      Whilst in Palo Alto visiting Bronwen &amp; Caleb, Caleb and I decided we needed to make stuff. So we did a Fry&#8217;s/Radio Shack run for parts and busted out the soldering iron. And thus was born Caleb&#8217;s TV-B-Gone (Much fun was had covertly turning off bar TV&#8217;s) and my Atari Punk Console (more photos here). 
I pretty much follwed the basic schematics but added an adittional pushbutton tact switch along with the on/off toggle. Will post some audio/video soon. Now we just need to do something with the Arduino boards we also got that week&#8230;

Atari Punk Console (via dsel)

Whilst in Palo Alto visiting Bronwen & Caleb, Caleb and I decided we needed to make stuff. So we did a Fry’s/Radio Shack run for parts and busted out the soldering iron. And thus was born Caleb’s TV-B-Gone (Much fun was had covertly turning off bar TV’s) and my Atari Punk Console (more photos here).

I pretty much follwed the basic schematics but added an adittional pushbutton tact switch along with the on/off toggle. Will post some audio/video soon. Now we just need to do something with the Arduino boards we also got that week…

Comments (View)

Thursday April 17, 2008 at 13:49

beer &#8216;n carc (via dsel)                     
Me and J over at the Lucky Lab playing the best game ever. 

beer ‘n carc (via dsel)

Me and J over at the Lucky Lab playing the best game ever. 

Comments (View)

Wednesday April 16, 2008 at 16:34

Body-Laptop Interface (via Bekathwia) 
Body-Laptop Interface (via Bekathwia
Comments (View)

Saturday April 05, 2008 at 20:17

TENORI-ON Product Demo Performance (via )
Comments (View)

Tuesday October 23, 2007 at 0:19

Reverse Graffiti : Ossario : Alexandre Orion (via )
Comments (View)

Monday October 22, 2007 at 23:52

Comments (View)

Page 1 of 4