<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <title>sneaq.</title>
    <description>stomping on a human face for 30 seconds at a time</description>
    <link>http://sneaq.net/</link>
    <item>
      <title>Autotest and Me</title>
      <description>&lt;p&gt;Today, &lt;a href="http://objectsinmirrors.com"&gt;Mark&lt;/a&gt; and I were talking about some of the open source projects we've been working on.  During our conversation, he mentioned how &lt;a href="http://davideisinger.com"&gt;David's&lt;/a&gt; recent post about &lt;a href="http://www.viget.com/extend/how-why-to-run-autotest-on-your-mac/"&gt;using Autotest on OSX&lt;/a&gt; was the catalyst for him to start using it on his projects.  I decided that I would do the same, so I went about using it on a &lt;a href="http://github.com/vigetlabs/unfuzzle"&gt;Ruby gem that I'm developing&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;From the original post, using it on Rails is pretty straightforward, but getting it to work on a vanilla Ruby project requires a bit of tweaking.  There's some &lt;a href="http://ph7spot.com/articles/getting_started_with_autotest"&gt;outdated information&lt;/a&gt; out there, but I was able to find &lt;a href="http://opensoul.org/tags/autotest"&gt;a solution&lt;/a&gt; that worked for me.  My resulting &lt;code&gt;.autotest&lt;/code&gt; file:&lt;/p&gt;

&lt;div class="CodeRay"&gt;
  &lt;div class="code"&gt;&lt;pre&gt;require &lt;span style="background-color:#fff0f0"&gt;&lt;span style="color:#710"&gt;'&lt;/span&gt;&lt;span style="color:#D20"&gt;autotest/growl&lt;/span&gt;&lt;span style="color:#710"&gt;'&lt;/span&gt;&lt;/span&gt;
require &lt;span style="background-color:#fff0f0"&gt;&lt;span style="color:#710"&gt;'&lt;/span&gt;&lt;span style="color:#D20"&gt;autotest/fsevent&lt;/span&gt;&lt;span style="color:#710"&gt;'&lt;/span&gt;&lt;/span&gt;

&lt;span style="color:#036; font-weight:bold"&gt;Autotest&lt;/span&gt;.add_hook &lt;span style="color:#A60"&gt;:initialize&lt;/span&gt; &lt;span style="color:#080; font-weight:bold"&gt;do&lt;/span&gt; |at|
  at.clear_mappings

  at.add_mapping &lt;span style="background-color:#fff0ff"&gt;&lt;span style="color:#404"&gt;%r%&lt;/span&gt;&lt;span style="color:#808"&gt;/^lib/(.*).rb$&lt;/span&gt;&lt;span style="color:#404"&gt;%&lt;/span&gt;&lt;/span&gt; &lt;span style="color:#080; font-weight:bold"&gt;do&lt;/span&gt; |_, m|
    possible = &lt;span style="color:#036; font-weight:bold"&gt;File&lt;/span&gt;.basename(m[&lt;span style="color:#00D; font-weight:bold"&gt;1&lt;/span&gt;])
    files_matching &lt;span style="background-color:#fff0ff"&gt;&lt;span style="color:#404"&gt;%r%&lt;/span&gt;&lt;span style="color:#808"&gt;^test/.*(&lt;/span&gt;&lt;span style="background: #eee"&gt;&lt;span style="font-weight: bold; color: #888"&gt;#{&lt;/span&gt;possible&lt;span style="font-weight: bold; color: #888"&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#808"&gt;_test|test_&lt;/span&gt;&lt;span style="background: #eee"&gt;&lt;span style="font-weight: bold; color: #888"&gt;#{&lt;/span&gt;possible&lt;span style="font-weight: bold; color: #888"&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#808"&gt;).rb$&lt;/span&gt;&lt;span style="color:#404"&gt;%&lt;/span&gt;&lt;/span&gt;
  &lt;span style="color:#080; font-weight:bold"&gt;end&lt;/span&gt;

  at.add_mapping(&lt;span style="background-color:#fff0ff"&gt;&lt;span style="color:#404"&gt;%r%&lt;/span&gt;&lt;span style="color:#808"&gt;^test/.*.rb$&lt;/span&gt;&lt;span style="color:#404"&gt;%&lt;/span&gt;&lt;/span&gt;) {|filename, _| filename }
&lt;span style="color:#080; font-weight:bold"&gt;end&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;


&lt;p&gt;With that patch in place, I get the results I want.&lt;/p&gt;</description>
      <pubDate>Fri, 03 Jul 2009 00:26:47 +0000</pubDate>
      <link>http://sneaq.net/autotest-and-me</link>
      <guid>http://sneaq.net/autotest-and-me</guid>
    </item>
    <item>
      <title>Access The Etsy API in Ruby</title>
      <description>&lt;p&gt;Long ago, my &lt;a href="http://littletjane.com"&gt;wife&lt;/a&gt; found a &lt;a href="http://littletjane.etsy.com"&gt;love for Etsy&lt;/a&gt;.  When I recently discovered their public API, I figured that it was meant to be that I begin working on a clean implementation of the &lt;a href="http://github.com/reagent/etsy/tree/master"&gt;Etsy API in Ruby&lt;/a&gt;.  So I did.&lt;/p&gt;

&lt;p&gt;I'm releasing the first version to the public tonight that includes support for retrieving users, their shops, and associated listings.&lt;/p&gt;

&lt;h2&gt;Installation&lt;/h2&gt;

&lt;p&gt;A simple gem installation is all you need:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;sudo gem install etsy
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;If you prefer to bleed:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;sudo gem install reagent-etsy --source=http://gems.github.com
&lt;/code&gt;&lt;/pre&gt;

&lt;h2&gt;Usage&lt;/h2&gt;

&lt;p&gt;Once installed, &lt;a href="http://developer.etsy.com/"&gt;set up your API key&lt;/a&gt; and you're ready to go:&lt;/p&gt;

&lt;div class="CodeRay"&gt;
  &lt;div class="code"&gt;&lt;pre&gt;require &lt;span style="background-color:#fff0f0"&gt;&lt;span style="color:#710"&gt;'&lt;/span&gt;&lt;span style="color:#D20"&gt;rubygems&lt;/span&gt;&lt;span style="color:#710"&gt;'&lt;/span&gt;&lt;/span&gt;
require &lt;span style="background-color:#fff0f0"&gt;&lt;span style="color:#710"&gt;'&lt;/span&gt;&lt;span style="color:#D20"&gt;etsy&lt;/span&gt;&lt;span style="color:#710"&gt;'&lt;/span&gt;&lt;/span&gt;

&lt;span style="color:#036; font-weight:bold"&gt;Etsy&lt;/span&gt;.api_key = &lt;span style="background-color:#fff0f0"&gt;&lt;span style="color:#710"&gt;'&lt;/span&gt;&lt;span style="color:#D20"&gt;snipsnap&lt;/span&gt;&lt;span style="color:#710"&gt;'&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;


&lt;p&gt;At the time of this post, all API calls are read-only so that's all you need to do.  Let's get started by finding a user's shop:&lt;/p&gt;

&lt;div class="CodeRay"&gt;
  &lt;div class="code"&gt;&lt;pre&gt;user = &lt;span style="color:#036; font-weight:bold"&gt;Etsy&lt;/span&gt;.user(&lt;span style="background-color:#fff0f0"&gt;&lt;span style="color:#710"&gt;'&lt;/span&gt;&lt;span style="color:#D20"&gt;littletjane&lt;/span&gt;&lt;span style="color:#710"&gt;'&lt;/span&gt;&lt;/span&gt;) &lt;span style="color:#888"&gt;# =&amp;gt; #&amp;lt;Etsy::User:0x1057624 ... &amp;gt;&lt;/span&gt;
user.seller?                    &lt;span style="color:#888"&gt;# =&amp;gt; true&lt;/span&gt;
user.shop.name                  &lt;span style="color:#888"&gt;# =&amp;gt; &amp;quot;littletjane&amp;quot;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;


&lt;p&gt;A shop can have multiple listings:&lt;/p&gt;

&lt;div class="CodeRay"&gt;
  &lt;div class="code"&gt;&lt;pre&gt;user.shop.listings  &lt;span style="color:#888"&gt;# =&amp;gt; [#&amp;lt;Etsy::Listing:0x1001788 ... &amp;gt;, ... ]&lt;/span&gt;

listing = user.shop.listings.first

listing.title       &lt;span style="color:#888"&gt;# =&amp;gt; &amp;quot;hanging with the bad boys matchbox&amp;quot;&lt;/span&gt;
listing.description &lt;span style="color:#888"&gt;# =&amp;gt; &amp;quot;standard size matchbox, approx. 1.5 x 2 ... &amp;quot;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;


&lt;p&gt;Each listing, in turn, can have one or more images:&lt;/p&gt;

&lt;div class="CodeRay"&gt;
  &lt;div class="code"&gt;&lt;pre&gt;image = listing.images.first

image.small_square &lt;span style="color:#888"&gt;# =&amp;gt; &amp;quot;http://ny-image2.etsy.com/il_25x25.67765346.jpg&amp;quot;&lt;/span&gt;
image.large        &lt;span style="color:#888"&gt;# =&amp;gt; &amp;quot;http://ny-image2.etsy.com/il_430xN.67765346.jpg&amp;quot;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;


&lt;p&gt;For more information and usage examples, check out the &lt;a href="http://etsy.rubyforge.org"&gt;documentation on Rubyforge&lt;/a&gt;.  If you have feature requests or comments, open an &lt;a href="http://github.com/reagent/etsy/issues"&gt;issue on Github&lt;/a&gt; or &lt;a href="mailto:reaganpr@gmail.com"&gt;send me an email&lt;/a&gt;.&lt;/p&gt;</description>
      <pubDate>Tue, 05 May 2009 03:32:19 +0000</pubDate>
      <link>http://sneaq.net/access-the-etsy-api-in-ruby</link>
      <guid>http://sneaq.net/access-the-etsy-api-in-ruby</guid>
    </item>
    <item>
      <title>SVN Cleansweep</title>
      <description>&lt;p&gt;Due to a very specific setup we have here at the office, I sometimes have to fix people's SVN working copies directly on the server. Sometimes I can run &lt;code&gt;svn cleanup&lt;/code&gt; from the top-level directory, sometimes I can't.&lt;/p&gt;

&lt;p&gt;With &lt;a href="http://conceptsahead.com/off-axis"&gt;Kevin's&lt;/a&gt; help, I came up with this script to start at the deepest directories and clean all the way to the current directory:&lt;/p&gt;

&lt;script src="http://gist.github.com/103779.js"&gt;&lt;/script&gt;</description>
      <pubDate>Wed, 29 Apr 2009 16:50:50 +0000</pubDate>
      <link>http://sneaq.net/svn-cleansweep</link>
      <guid>http://sneaq.net/svn-cleansweep</guid>
    </item>
    <item>
      <title>Grab Flickr Tags and Comments With Fleakr</title>
      <description>&lt;p&gt;I just pushed out &lt;a href="http://github.com/reagent/fleakr/tree/0.4.3"&gt;version 0.4.3&lt;/a&gt; of the &lt;a href="http://github.com/reagent/fleakr/tree/master"&gt;Fleakr gem&lt;/a&gt; that provides support for retrieving tags and comments for users, photos, and photosets.  These are non-authenticated methods, so all you need is your API key:&lt;/p&gt;

&lt;div class="CodeRay"&gt;
  &lt;div class="code"&gt;&lt;pre&gt;&lt;span style="color:#036; font-weight:bold"&gt;Fleakr&lt;/span&gt;.api_key = &lt;span style="background-color:#fff0f0"&gt;&lt;span style="color:#710"&gt;'&lt;/span&gt;&lt;span style="color:#D20"&gt;your_api_key&lt;/span&gt;&lt;span style="color:#710"&gt;'&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;


&lt;p&gt;Once that's set, you can retrieve tags for users and photos:&lt;/p&gt;

&lt;div class="CodeRay"&gt;
  &lt;div class="code"&gt;&lt;pre&gt;user = &lt;span style="color:#036; font-weight:bold"&gt;Fleakr&lt;/span&gt;.user(&lt;span style="background-color:#fff0f0"&gt;&lt;span style="color:#710"&gt;'&lt;/span&gt;&lt;span style="color:#D20"&gt;teamviget&lt;/span&gt;&lt;span style="color:#710"&gt;'&lt;/span&gt;&lt;/span&gt;)
user.tags.first.value
user.sets.first.photos.first.tags.first.value&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;


&lt;p&gt;Given a single tag, you can also retrieve a list of related tags:&lt;/p&gt;

&lt;div class="CodeRay"&gt;
  &lt;div class="code"&gt;&lt;pre&gt;user.tags.first.related.first&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;


&lt;p&gt;Tags associated with a photo have more information associated to them - see &lt;a href="http://fleakr.rubyforge.org/0.4.3/"&gt;the documentation&lt;/a&gt; for what's available.  Comments have no such limitation and are available for both sets and individual photos:&lt;/p&gt;

&lt;div class="CodeRay"&gt;
  &lt;div class="code"&gt;&lt;pre&gt;user = &lt;span style="color:#036; font-weight:bold"&gt;Fleakr&lt;/span&gt;.user(&lt;span style="background-color:#fff0f0"&gt;&lt;span style="color:#710"&gt;'&lt;/span&gt;&lt;span style="color:#D20"&gt;the decapitator&lt;/span&gt;&lt;span style="color:#710"&gt;'&lt;/span&gt;&lt;/span&gt;)
user.sets.first.comments
user.photos.first.comments&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;


&lt;p&gt;Give it a try for yourself - check out &lt;a href="http://fleakr.rubyforge.org/0.4.3/"&gt;the docs&lt;/a&gt; or &lt;a href="mailto:reaganpr@gmail.com"&gt;send me an email&lt;/a&gt; if you get stuck.  Enjoy&lt;/p&gt;</description>
      <pubDate>Sun, 12 Apr 2009 20:08:53 +0000</pubDate>
      <link>http://sneaq.net/grab-flickr-tags-and-comments-with-fleakr</link>
      <guid>http://sneaq.net/grab-flickr-tags-and-comments-with-fleakr</guid>
    </item>
    <item>
      <title>Am I Ruby 1.9?</title>
      <description>&lt;p&gt;&lt;a href="http://conceptsahead.com/off-axis"&gt;Kevin&lt;/a&gt; and I were chatting about how to tell if your locally installed gems were compatible with Ruby 1.9.  He was looking for a tool that would scan the list and figure out which ones worked.  I pointed him to &lt;a href="http://isitruby19.com/"&gt;Is It Ruby 1.9?&lt;/a&gt;, he found &lt;a href="http://forum.brightbox.co.uk/forums/isitruby19-com/topics/api-is-added"&gt;the API&lt;/a&gt; and &lt;a href="http://github.com/n3bulous/amiruby19/tree/master"&gt;whipped up a gem&lt;/a&gt; that would tell you which of your gems would likely work (or not work) with the latest version of Ruby.  Check it out:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;$ sudo gem install n3bulous-amiruby19 --source=http://gems.github.com
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Then let it loose on your system:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;$ amiruby19
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Oh, and it was built with &lt;a href="http://github.com/reagent/simple-gem/tree/master"&gt;simple-gem&lt;/a&gt; (shameless plug).&lt;/p&gt;</description>
      <pubDate>Fri, 03 Apr 2009 01:35:55 +0000</pubDate>
      <link>http://sneaq.net/am-i-ruby-19</link>
      <guid>http://sneaq.net/am-i-ruby-19</guid>
    </item>
    <item>
      <title>Hacking With GitJour</title>
      <description>&lt;p&gt;I finally figured out how to use &lt;a href="http://github.com/chad/gitjour/tree/master"&gt;gitjour&lt;/a&gt; effectively during "hack night" pairing sessions.  The benefit of gitjour over &lt;a href="http://www.kernel.org/pub/software/scm/git/docs/git-daemon.html"&gt;git-daemon&lt;/a&gt; is discovery over Bonjour - from there on out, simple git commands are all you need.  The secret is a setting in your project's &lt;code&gt;.git/config&lt;/code&gt;:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;[daemon]
  receivepack = true
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;The full post is over on the &lt;a href="http://www.viget.com/extend/adding-gitjour-to-your-hack-night-toolset/"&gt;Viget developer blog&lt;/a&gt;.  Enjoy.&lt;/p&gt;</description>
      <pubDate>Thu, 02 Apr 2009 20:18:09 +0000</pubDate>
      <link>http://sneaq.net/hacking-with-gitjour</link>
      <guid>http://sneaq.net/hacking-with-gitjour</guid>
    </item>
    <item>
      <title>Taming Your Feeds</title>
      <description>&lt;p&gt;I while back I was inspired by a talk that &lt;a href="http://crnixon.org"&gt;Clinton&lt;/a&gt; gave about &lt;a href="http://speakerrate.com/talks/9-unearthed-arcana-for-web-people"&gt;maximizing developer efficiency&lt;/a&gt;, so I set out to find ways of improving my own efficiency.  As part of that process, I ended up changing how I go about reading all the RSS feeds that I track.  It's a simple approach that's worked for me for some time, so I thought it worth sharing.&lt;/p&gt;

&lt;h2&gt;In the beginning, there was categorization&lt;/h2&gt;

&lt;p&gt;Once I started using a Macbook, I ditched my NetVibes account and picked up a free copy of &lt;a href="http://www.newsgator.com/INDIVIDUALS/NETNEWSWIRE/"&gt;NetNewsWire&lt;/a&gt; since I no longer needed to read my feeds online.  As part of this switchover, I spent a bit of time categorizing all the feeds that I had at the time.  I dropped feeds into well-named buckets like "Programming" or "Contacts", etc..&lt;/p&gt;

&lt;p&gt;While this was a very &lt;strong&gt;organized&lt;/strong&gt; way of keeping track of feeds, it wasn't quite efficient when it came time to actually &lt;strong&gt;read&lt;/strong&gt; them.&lt;/p&gt;

&lt;h2&gt;Then came prioritization&lt;/h2&gt;

&lt;p&gt;After spending some time analyzing my habits, I discovered that there were certain blogs that I wanted to devote more attention to and others that I could just safely skim.  The thought occurred to me: why not just have 2 groups, one for &lt;em&gt;reading&lt;/em&gt; and one for (gasp!) &lt;em&gt;skimming&lt;/em&gt;?  So, that's what I did:&lt;/p&gt;

&lt;p&gt;&lt;img src="http://sneaq.net/uploads/2009-03/2009-03-26_read_skim.png" alt="read / skim" /&gt;&lt;/p&gt;

&lt;p&gt;As I add new feeds I can quickly drop them into the appropriate bucket, and I can also promote or demote feeds into either bucket depending on the value I derive from the content.  Each day, I can focus on the important content in my "Read" list and then burn through the items I need to skim.&lt;/p&gt;</description>
      <pubDate>Thu, 26 Mar 2009 05:53:05 +0000</pubDate>
      <link>http://sneaq.net/taming-your-feeds</link>
      <guid>http://sneaq.net/taming-your-feeds</guid>
    </item>
    <item>
      <title>Fleakr In The Wild: Flittr</title>
      <description>&lt;p&gt;&lt;a href="http://www.helicopter.geek.nz/"&gt;James&lt;/a&gt; just &lt;a href="http://www.helicopter.geek.nz/2009/03/flittr-twitterflickr-mashup.html"&gt;launched a Twitter / Flickr mashup&lt;/a&gt; that matches tweets with relevant photos from Flickr and he's using &lt;a href="http://github.com/reagent/fleakr"&gt;Fleakr&lt;/a&gt; to make it happen:&lt;/p&gt;

&lt;p&gt;&lt;a href="http://www.helicopter.geek.nz/2009/03/flittr-twitterflickr-mashup.html"&gt;&lt;img src="http://sneaq.net/uploads/2009-03/2009-03-05_flitter_announcement.png" alt="Flittr Announcement" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Very cool.  &lt;a href="http://flittr.cc"&gt;Check out the app&lt;/a&gt; and vote for your favorite combos:&lt;/p&gt;

&lt;p&gt;&lt;a href="http://flittr.cc/user/reagent"&gt;&lt;img src="http://sneaq.net/uploads/2009-03/2009-03-05_flitter.png" alt="Flittr" /&gt;&lt;/a&gt;&lt;/p&gt;</description>
      <pubDate>Fri, 06 Mar 2009 04:21:27 +0000</pubDate>
      <link>http://sneaq.net/fleakr-in-the-wild-flittr</link>
      <guid>http://sneaq.net/fleakr-in-the-wild-flittr</guid>
    </item>
    <item>
      <title>Upload Images to Flickr With The Fleakr Gem</title>
      <description>&lt;p&gt;I just released &lt;a href="http://github.com/reagent/fleakr/tree/0.4.2"&gt;version 0.4.2 of the Fleakr gem&lt;/a&gt; which includes better support for options when uploading files. To get started, install the gem from RubyForge:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;$ sudo gem install fleakr
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Then make sure that you have an API key, shared secret, and auth token for the &lt;a href="http://www.flickr.com/services/api/keys/"&gt;Flickr API&lt;/a&gt;.  You can find instructions on how to do this in the &lt;a href="http://fleakr.rubyforge.org/0.4.2/"&gt;Fleakr documentation&lt;/a&gt; (see the "Authenticated Calls" section).  Once you have that data, you can configure the gem pretty quickly:&lt;/p&gt;

&lt;div class="CodeRay"&gt;
  &lt;div class="code"&gt;&lt;pre&gt;&lt;span style="color:#036; font-weight:bold"&gt;Fleakr&lt;/span&gt;.api_key       = &lt;span style="background-color:#fff0f0"&gt;&lt;span style="color:#710"&gt;'&lt;/span&gt;&lt;span style="color:#D20"&gt;ABC123&lt;/span&gt;&lt;span style="color:#710"&gt;'&lt;/span&gt;&lt;/span&gt;
&lt;span style="color:#036; font-weight:bold"&gt;Fleakr&lt;/span&gt;.shared_secret = &lt;span style="background-color:#fff0f0"&gt;&lt;span style="color:#710"&gt;'&lt;/span&gt;&lt;span style="color:#D20"&gt;sekrit&lt;/span&gt;&lt;span style="color:#710"&gt;'&lt;/span&gt;&lt;/span&gt;
&lt;span style="color:#036; font-weight:bold"&gt;Fleakr&lt;/span&gt;.auth_token    = &lt;span style="background-color:#fff0f0"&gt;&lt;span style="color:#710"&gt;'&lt;/span&gt;&lt;span style="color:#D20"&gt;DEADBEEF&lt;/span&gt;&lt;span style="color:#710"&gt;'&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;


&lt;p&gt;Now, let's start uploading.&lt;/p&gt;

&lt;h2&gt;Single Files&lt;/h2&gt;

&lt;p&gt;The simplest way to upload is using a single file:&lt;/p&gt;

&lt;div class="CodeRay"&gt;
  &lt;div class="code"&gt;&lt;pre&gt;photos = &lt;span style="color:#036; font-weight:bold"&gt;Fleakr&lt;/span&gt;.upload(&lt;span style="background-color:#fff0f0"&gt;&lt;span style="color:#710"&gt;'&lt;/span&gt;&lt;span style="color:#D20"&gt;/path/to/my/image.jpg&lt;/span&gt;&lt;span style="color:#710"&gt;'&lt;/span&gt;&lt;/span&gt;)&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;


&lt;p&gt;Once uploaded, you now have a reference to the new file through the &lt;code&gt;photos&lt;/code&gt; array.  By default, this image has a title based on the filename and is only viewable to you.  Let's change that:&lt;/p&gt;

&lt;div class="CodeRay"&gt;
  &lt;div class="code"&gt;&lt;pre&gt;photos = &lt;span style="color:#036; font-weight:bold"&gt;Fleakr&lt;/span&gt;.upload(&lt;span style="background-color:#fff0f0"&gt;&lt;span style="color:#710"&gt;'&lt;/span&gt;&lt;span style="color:#D20"&gt;image.jpg&lt;/span&gt;&lt;span style="color:#710"&gt;'&lt;/span&gt;&lt;/span&gt;, &lt;span style="color:#A60"&gt;:title&lt;/span&gt; =&amp;gt; &lt;span style="background-color:#fff0f0"&gt;&lt;span style="color:#710"&gt;'&lt;/span&gt;&lt;span style="color:#D20"&gt;My Mug&lt;/span&gt;&lt;span style="color:#710"&gt;'&lt;/span&gt;&lt;/span&gt;, 
                                    &lt;span style="color:#A60"&gt;:viewable_by&lt;/span&gt; =&amp;gt; &lt;span style="color:#A60"&gt;:everyone&lt;/span&gt;)&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;


&lt;p&gt;This new image is available to anyone and has a customized title.&lt;/p&gt;

&lt;h2&gt;Multiple Files&lt;/h2&gt;

&lt;p&gt;In addition to specifying a path to a single file, the &lt;code&gt;upload&lt;/code&gt; method accepts a fileglob.  This way, you can push out a full directory of images in a single call:&lt;/p&gt;

&lt;div class="CodeRay"&gt;
  &lt;div class="code"&gt;&lt;pre&gt;photos = &lt;span style="color:#036; font-weight:bold"&gt;Fleakr&lt;/span&gt;.upload(&lt;span style="background-color:#fff0f0"&gt;&lt;span style="color:#710"&gt;'&lt;/span&gt;&lt;span style="color:#D20"&gt;/party/images/*.jpg&lt;/span&gt;&lt;span style="color:#710"&gt;'&lt;/span&gt;&lt;/span&gt;, &lt;span style="color:#A60"&gt;:title&lt;/span&gt; =&amp;gt; &lt;span style="background-color:#fff0f0"&gt;&lt;span style="color:#710"&gt;'&lt;/span&gt;&lt;span style="color:#D20"&gt;Party Photo&lt;/span&gt;&lt;span style="color:#710"&gt;'&lt;/span&gt;&lt;/span&gt;,
                                              &lt;span style="color:#A60"&gt;:viewable_by&lt;/span&gt; =&amp;gt; &lt;span style="color:#A60"&gt;:everyone&lt;/span&gt;)&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;


&lt;p&gt;Once the upload finishes, &lt;code&gt;photos&lt;/code&gt; will contain a collection of the newly-uploaded images.&lt;/p&gt;

&lt;h2&gt;Additional Options&lt;/h2&gt;

&lt;p&gt;We saw how to set titles and permissions, but here are the full options that are available:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;:title&lt;/code&gt;&lt;/strong&gt; - Duh.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;:description&lt;/code&gt;&lt;/strong&gt; - The description of the image / photo.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;:tags&lt;/code&gt;&lt;/strong&gt; - A list of tags. This should be supplied as a single string value or an array of strings.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;:viewable_by&lt;/code&gt;&lt;/strong&gt; - A list of who can view this photo.  Can be either &lt;code&gt;:everyone&lt;/code&gt; or a combination of &lt;code&gt;:friends&lt;/code&gt; and &lt;code&gt;:family&lt;/code&gt; (e.g. &lt;code&gt;:viewable_by =&amp;gt; [:friends, :family]&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;:level&lt;/code&gt;&lt;/strong&gt; - The "safety level" of the photo.  Can be one of &lt;code&gt;:safe&lt;/code&gt;, &lt;code&gt;:moderate&lt;/code&gt;, or &lt;code&gt;:restricted&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;:type&lt;/code&gt;&lt;/strong&gt; - What does this image represent?  Can be one of &lt;code&gt;:photo&lt;/code&gt;, &lt;code&gt;:screenshot&lt;/code&gt;, or &lt;code&gt;:other&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;:hide?&lt;/code&gt;&lt;/strong&gt; - Should we hide this image from public searches?  Set to &lt;code&gt;true&lt;/code&gt; or &lt;code&gt;false&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This list is also available in the &lt;a href="http://fleakr.rubyforge.org/0.4.2/classes/Fleakr/Objects/Photo.html#M000056"&gt;documentation for &lt;code&gt;Photo#upload&lt;/code&gt;&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;Replacing Files&lt;/h2&gt;

&lt;p&gt;Remember when I said that the &lt;code&gt;upload&lt;/code&gt; method returned a list of newly-uploaded photos?  You can use that to replace the image if you'd like:&lt;/p&gt;

&lt;div class="CodeRay"&gt;
  &lt;div class="code"&gt;&lt;pre&gt;photos = &lt;span style="color:#036; font-weight:bold"&gt;Fleakr&lt;/span&gt;.upload(&lt;span style="background-color:#fff0f0"&gt;&lt;span style="color:#710"&gt;'&lt;/span&gt;&lt;span style="color:#D20"&gt;/path/to/image.jpg&lt;/span&gt;&lt;span style="color:#710"&gt;'&lt;/span&gt;&lt;/span&gt;, &lt;span style="color:#A60"&gt;:viewable_by&lt;/span&gt; =&amp;gt; &lt;span style="color:#A60"&gt;:everyone&lt;/span&gt;)
photos.first.replace_with &lt;span style="background-color:#fff0f0"&gt;&lt;span style="color:#710"&gt;'&lt;/span&gt;&lt;span style="color:#D20"&gt;/path/to/other_image.jpg&lt;/span&gt;&lt;span style="color:#710"&gt;'&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;


&lt;p&gt;The same applies to any photo in your photoset.  For example:&lt;/p&gt;

&lt;div class="CodeRay"&gt;
  &lt;div class="code"&gt;&lt;pre&gt;user = &lt;span style="color:#036; font-weight:bold"&gt;Fleakr&lt;/span&gt;.user(&lt;span style="background-color:#fff0f0"&gt;&lt;span style="color:#710"&gt;'&lt;/span&gt;&lt;span style="color:#D20"&gt;my_username&lt;/span&gt;&lt;span style="color:#710"&gt;'&lt;/span&gt;&lt;/span&gt;)
photo = user.photos.first.replace_with(&lt;span style="background-color:#fff0f0"&gt;&lt;span style="color:#710"&gt;'&lt;/span&gt;&lt;span style="color:#D20"&gt;~/embarrassing_photo.jpg&lt;/span&gt;&lt;span style="color:#710"&gt;'&lt;/span&gt;&lt;/span&gt;)&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;


&lt;p&gt;Enjoy!&lt;/p&gt;

&lt;h2&gt;Additional Resources&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="http://fleakr.rubyforge.org"&gt;Fleakr Documentation&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/reagent/fleakr/tree"&gt;Fleakr on GitHub&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://www.flickr.com/services/api/upload.api.html"&gt;Flickr Upload documentation&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</description>
      <pubDate>Fri, 06 Mar 2009 04:03:11 +0000</pubDate>
      <link>http://sneaq.net/upload-images-to-flickr-with-the-fleakr-gem</link>
      <guid>http://sneaq.net/upload-images-to-flickr-with-the-fleakr-gem</guid>
    </item>
    <item>
      <title>Srsly?</title>
      <description>&lt;p&gt;&lt;img src="http://sneaq.net/uploads/2009-02/2009-02-20_skratchin.png" alt="Skratchin'" /&gt;&lt;/p&gt;</description>
      <pubDate>Fri, 20 Feb 2009 16:22:47 +0000</pubDate>
      <link>http://sneaq.net/srsly</link>
      <guid>http://sneaq.net/srsly</guid>
    </item>
  </channel>
</rss>
