Curious George

Posted by Jason Terk on Wednesday, May 26

Curious George

tags:
0 comments

Amelie and Kerri

Posted by Jason Terk on Friday, April 16

Some recent photos of the girls:

Amelie

Amelie

But wait, there's more!

0 comments

San Francisco

Posted by Jason Terk on Tuesday, April 06

After work yesterday I walked around Soma, Potrero Hill and the Mission.

United Meat Co.

Car

But wait, there's more!

1 comment

April In Boston

Posted by Jason Terk on Sunday, April 04

I spent the bulk of a beautiful day yesterday walking around Somerville, Cambridge and Boston taking photos:

Rogers Foam

Somerville

But wait, there's more!

tags:
1 comment

Tofu Massaman Curry

Posted by Jason Terk on Wednesday, March 24

Another day, another dinner. This time it's tofu massaman curry.

In the wok

In a bowl

0 comments

Rajas and Refritos

Posted by Jason Terk on Tuesday, March 23

I made refried beans and rajas from Rick Bayless' Authentic Mexican tonight. Man it was good.

Rajas and Refritos

0 comments

A Couple More

Posted by Jason Terk on Monday, March 22

Amelie

A Rainy Day

tags:
0 comments

Some Photos

Posted by Jason Terk on Sunday, March 21

I took some photos with my new T2i:

Amelie

Dan

But wait, there's more!

tags:
1 comment

Little Man

Posted by Jason Terk on Monday, January 18

Kerri and I found this little man while walking through Boston on Saturday:

A little man.

tags:
1 comment

SmugMug

Posted by Jason Terk on Friday, December 25

Updated 2010-04-04 - The regex in the to_html methos was updated again to do an even better job of preserving whitespace.

Updated 2010-03-21 - The regex in the to_html method on the SmugMug class was updated to preserve whitespace.

Up until now to post photos from SmugMug I've crafted the link and image markup by hand, which is pretty tedious and prone to error. Today I ginned up an extension to Markdown (RDiscount, really) that allows automatic generation of the markup from the image title and URL. Here's how it works:

The first step is to create a new Hobix entry class (located in BLOG_ROOT/lib/local.rb):

module Hobix
  # Entries that use Markdown for formatting and automatically handle SmugMug
  # photos.
  class SmugMugEntry < Entry
    # Use SmugMug
    def self.text_processor
      SmugMug
    end

    # The YAML type for this entry class.
    def to_yaml_type
      "!goterkyourself.com,2009/SmugMugEntry"
    end

    # Register with the YAML engine.
    YAML::add_domain_type('goterkyourself.com,2009', 'SmugMugEntry') do |type, val|
      self.maker(val)
    end
  end
end

Now, any Hobix entry created with the type goterkyourself.com,2009/SmugMugEntry will use the SmugMug photo processor. All that remains now is to define the SmugMug class, which does the heavy lifting. This class is nested inside Hobix::SmugMugEntry:

# A SmugMug text processor that wraps Markdown with SmugMug specific
# capabilities.
#
# The syntax is:
#
#   $[Image Caption](Image URL)
#
#   i.e.: $[Bob Swimming](http://account.smugmug.com/Some/Category/1234567_abc12#123456789_AaBbC)
#
# Note that, for simplicity's sake, a SmugMug image blob must be on its
# own line
#
class SmugMug < RDiscount
  def to_html
    # Create a temporary string for the replacement so @text doesn't get
    # mangled.
    text = @text

    # Replace
    if text and not text.empty?
      text.gsub!(/^([ \t]*)\$\[(.*)\]\((.*)\)([ \t]*)$/) do |match|
        begin
          caption = $2
          image_url = $3
          image_id = image_url.split("#")[1]
          image_uri = URI.parse(image_url)

          raise "Missing image ID" if image_id.nil? or image_id.empty?

          "#{$1}" +
          "<a href=\"#{image_url}\">" +
            "<img src=\"http://#{image_uri.host}/photos/#{image_id}-640x640.jpg\" "+
                 "alt=\"#{caption}\" " +
                 "title=\"#{caption}\" " +
                 "class=\"photo\"/>" +
          "</a>" +
          "#{$4}"
        rescue
          # Just return the match on poorly formatted image blobs.
          $stderr.puts "Bad SmugMug blob: #{match}"
          match
        end
      end
    end

    m = RDiscount.new(text)
    m.to_html
  end
end

Once this is in place $[Amelie in her sheep hat!](http://gty.smugmug.com/Children/Amelie/7135981_oYtj9#705169136_SeMGC) becomes:

Amelie in her sheep hat!

0 comments

Camden and Cape Cod

Posted by Jason Terk on Tuesday, July 14

Some photos from our recent trips to Camden and Cape Cod.

Amelie!

But wait, there's more!

0 comments

Recent Photos

Posted by Jason Terk on Wednesday, May 27

0 comments

Baseball Season Is Almost Here

Posted by Jason Terk on Thursday, March 12

Baseball Season Is Almost Here

0 comments

Snowed In

Posted by Jason Terk on Wednesday, January 21

Snowed In

tags:
0 comments

SmugMug

Posted by Jason Terk on Tuesday, January 06

To expand on my "switching to SmugMug" comment from a few days ago:

Jeff

  1. If you're a big nerd like me and you subscribe to people's photo RSS feeds the firehose for my photos is now at this URL. There are a bunch of other feeds available too...
  2. The most interesting photos, if I do what I want instead of being a lazy slob, will be in the Email gallery. This is where all the stuff I take with my iPhone will go. Hooray for having the internet in my pocket.
  3. Switching to SmugMug was super easy. There's a Firefox extension called Smugglr that does the job easily.
  4. If you sign up for SmugMug I encourage you to use a coupon code to get a discount on the first year. If you're coming from Flickr use the code flickr to save 50% or, if you feel like helping me pay for my subscription, use hwrh3klDBOGlI - this will save you $5 and send $10 to me - it's win/win!

Addendum

Cool SmugMug feature: resizing images via URL. Take the photo above. The default size is accessed via the URL http://gty.smugmug.com/photos/442170176_d5a4f-L.jpg. Everything after the "-" tells SmugMug what size photo you want to see. You can use some predefined sizes, like "-L" (large), "-O" (original), etc. But you can also tell it to resize the photo on the fly by giving it the desired dimensions, i.e. "-250x250". So the URL for embedding the above image is http://gty.smugmug.com/photos/442170176_d5a4f-250x250.jpg.

0 comments

Pan-Asian Gallivanting

Posted by Jason Terk on Wednesday, August 20

My brother Adam graduated from Syracuse this year and he's been wandering aimlessly around Vermont, New York and the rest of the northeast since then. In September he leaves for what he hopes will be a year long sojourn through Asia. If you're interested in this sort of thing Adam will be updating his blog, Pan-Asian Gallivanting, with stories and photos from the trip.

0 comments