<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"><channel><atom:link rel="hub" href="http://tumblr.superfeedr.com/" xmlns:atom="http://www.w3.org/2005/Atom"/><description>The Tumblog of transatlantic entrepreneur, occasional raconteur, and code-slinger extraordinaire Stevie Graham.

god at swaggadocio.com</description><title>Swaggadocio</title><generator>Tumblr (3.0; @stevegraham)</generator><link>http://swaggadocio.com/</link><item><title>Math Joke</title><description>&lt;p&gt;Q. What’s the integral of &lt;sup&gt;1&lt;/sup&gt;/&lt;sub&gt;cabin&lt;/sub&gt;?&lt;/p&gt;
&lt;p&gt;A. A log cabin&lt;/p&gt;</description><link>http://swaggadocio.com/post/437879459</link><guid>http://swaggadocio.com/post/437879459</guid><pubDate>Wed, 10 Mar 2010 01:08:17 +0000</pubDate></item><item><title>Worst part of the job…</title><description>&lt;img src="http://25.media.tumblr.com/tumblr_kyyyz479gU1qzqoxro1_500.png"/&gt;&lt;br/&gt;&lt;br/&gt;&lt;p&gt;Worst part of the job…&lt;/p&gt;</description><link>http://swaggadocio.com/post/434784535</link><guid>http://swaggadocio.com/post/434784535</guid><pubDate>Mon, 08 Mar 2010 15:28:16 +0000</pubDate></item><item><title>Token</title><description>&lt;img src="http://24.media.tumblr.com/tumblr_kyxti3Ok961qzqoxro1_500.jpg"/&gt;&lt;br/&gt;&lt;br/&gt;&lt;p&gt;Token&lt;/p&gt;</description><link>http://swaggadocio.com/post/433444329</link><guid>http://swaggadocio.com/post/433444329</guid><pubDate>Mon, 08 Mar 2010 00:32:00 +0000</pubDate></item><item><title>Object#tap - Ruby's K Combinator</title><description>&lt;p&gt;Say we want a method that returns an instance of the class Logger. We want this method to either return a previously instantiated object, if it exists, or we want to instantiate one. In Ruby we have a nice piece of syntactic sugar known as “or equals”, previously &lt;a target="_blank" href="http://swaggadocio.com/post/298735258"&gt;covered here&lt;/a&gt;. To briefly recapitulate what it does is return the object on the lefthand side when it is not nil, or it evaluates the righthand side, assigns it to the lefthand side, and return that value.&lt;/p&gt;
&lt;pre class="brush: ruby;"&gt;def logger
  @logger ||= Logger.new
end&lt;/pre&gt;
&lt;p&gt;Very nice, beautiful, and simple. However what happens when you need to call a method on the resulting object? Something that can’t be passed as an argument into the constructor? Using the same example of our logger method, one might want different datetime formatting on their log entries.&lt;/p&gt;
&lt;pre class="brush: ruby;"&gt;def logger
  @logger ||= Logger.new
  @logger.datetime_format = '%c'
  @logger
end&lt;/pre&gt;
&lt;p&gt;&lt;b&gt;Terrible. &lt;/b&gt;The datetime setter is being called each time the logger method itself is called. Horrible, wasteful, unnecessary, and ugly. We could get around this by putting a return statement in there, but this too is ugly and quite quickly the method becomes bloated. I believe it is better to embrace what Ruby is: a synthesis of the most powerful and flexible computer science concepts and ideas.&lt;/p&gt;
&lt;p&gt;New in Ruby 1.9 and backported to 1.8.7 is Object#tap, Ruby’s implementation of the &lt;a target="_blank" href="http://en.wikipedia.org/wiki/Combinatory_logic#Examples_of_combinators"&gt;K combinator&lt;/a&gt;. Tap makes some really beautiful code possible. Simply put, what it does is take the object it is called on, pass it into a block, whatever is inside the block is evaluated, and the object is returned even if the block returns something different. This also means you can get your method chaining game on nice!&lt;/p&gt;
&lt;p&gt;Let’s see what our logger method would look like using this functional style:&lt;/p&gt;
&lt;pre class="brush: ruby;"&gt;def logger
  @logger ||= Logger.new.tap { |o| o.datetime_format = '%c' }
end&lt;/pre&gt;
&lt;p&gt;Come on dude! How beautiful is that? One line of ninjitsu, and I believe perfectly clear once you know what Object#tap is.&lt;/p&gt;
&lt;p&gt;Conceptually, Object#tap is very simple. When called on an object, the objects yields to a block, passing itself in as a block variable and finally returns self after that. So, if you’re still on 1.8.6 and are going a little green with envy right now, don’t worry, thanks to Ruby’s open classes you can still get the good stuff.&lt;/p&gt;
&lt;pre class="brush: ruby;"&gt;Object.class_eval { def tap() yield self; self end }&lt;/pre&gt;
&lt;p&gt;Ok, enough one liners for one day. :p&lt;/p&gt;
&lt;p&gt;S&lt;/p&gt;</description><link>http://swaggadocio.com/post/428927895</link><guid>http://swaggadocio.com/post/428927895</guid><pubDate>Fri, 05 Mar 2010 22:11:00 +0000</pubDate><category>Ruby</category><category>Functional Programming</category><category>Lambda Calculus</category></item><item><title>Haven't blogged about any Ruby for a minute. Coming up next…</title><link>http://swaggadocio.com/post/428471597</link><guid>http://swaggadocio.com/post/428471597</guid><pubDate>Fri, 05 Mar 2010 16:21:21 +0000</pubDate></item><item><title>Your high IQ will kill your startup</title><description>&lt;a href="http://blog.cubeofm.com/your-high-iq-will-kill-your-startup"&gt;Your high IQ will kill your startup&lt;/a&gt;</description><link>http://swaggadocio.com/post/428212870</link><guid>http://swaggadocio.com/post/428212870</guid><pubDate>Fri, 05 Mar 2010 12:52:50 +0000</pubDate></item><item><title>Jaq: then imma ask u another question since i just asked for ur e-mail&#13;</title><description>Jaq: then imma ask u another question since i just asked for ur e-mail&lt;br /&gt;&#13;
Stevie: ?&lt;br /&gt;&#13;
Jaq: my blackberry doesnt allow me to sync all my contacts into it from addy book, it always says someshit about error. porque??&lt;br /&gt;&#13;
Stevie: i dunno. what is the error?&lt;br /&gt;&#13;
Jaq: idk, some bullshit as usual. i tried editing all my contacts&lt;br /&gt;&#13;
Stevie: what is the error message?&lt;br /&gt;&#13;
Jaq: would have to tell u later, cuz i havent tried in weeks n dont have the usb with me&lt;br /&gt;&#13;
Stevie: ok. cos this is basically like going to the doctor and sayin 'yo i'm ill' and when he says 'what are the symptoms'…&lt;br /&gt;&#13;
Jaq: lmfao&lt;br /&gt;&#13;
Stevie: you say 'i don't know', doc ain't gonna be able to prescribe shit for you.&lt;br /&gt;&#13;
Jaq: word. he can perscribe me some weed though&lt;br /&gt;&#13;
Stevie: LMAO</description><link>http://swaggadocio.com/post/428208438</link><guid>http://swaggadocio.com/post/428208438</guid><pubDate>Fri, 05 Mar 2010 12:48:54 +0000</pubDate></item><item><title>Best pals</title><description>&lt;img src="http://29.media.tumblr.com/tumblr_kyl1x7PWqk1qzqoxro1_500.jpg"/&gt;&lt;br/&gt;&lt;br/&gt;&lt;p&gt;Best pals&lt;/p&gt;</description><link>http://swaggadocio.com/post/425006048</link><guid>http://swaggadocio.com/post/425006048</guid><pubDate>Wed, 03 Mar 2010 23:51:04 +0000</pubDate></item><item><title>"My mother always said that once someone shows you who they really are, believe it."</title><description>“My mother always said that once someone shows you who they really are, believe it.”&lt;br/&gt;&lt;br/&gt; - &lt;em&gt;Jay Wilson&lt;/em&gt;</description><link>http://swaggadocio.com/post/425006334</link><guid>http://swaggadocio.com/post/425006334</guid><pubDate>Wed, 03 Mar 2010 23:51:00 +0000</pubDate></item><item><title>"Just sold my BMW to a member of the Bloods. When I told him what I do and my age, he said,..."</title><description>“Just sold my BMW to a member of the Bloods. When I told him what I do and my age, he said, “You’re probably gonna have a lot of haters. Keep my number and I’ll take care of anything.””&lt;br/&gt;&lt;br/&gt; - &lt;em&gt;The ever ‘quotable’ &lt;a href="http://brandonthegreat.tumblr.com" target="_blank"&gt;Brandon Fletcher&lt;/a&gt;&lt;/em&gt;</description><link>http://swaggadocio.com/post/424021202</link><guid>http://swaggadocio.com/post/424021202</guid><pubDate>Wed, 03 Mar 2010 11:42:07 +0000</pubDate></item><item><title>If someone describes your code as exceptional, do you take it as a compliment or an insult?</title><link>http://swaggadocio.com/post/422403230</link><guid>http://swaggadocio.com/post/422403230</guid><pubDate>Tue, 02 Mar 2010 18:44:03 +0000</pubDate><category>code</category><category>pun</category></item><item><title>Hey man! Just RELAX!</title><description>&lt;img src="http://24.media.tumblr.com/tumblr_kynma7AvQ61qzqoxro1_500.png"/&gt;&lt;br/&gt;&lt;br/&gt;&lt;p&gt;Hey man! Just &lt;b&gt;RELAX&lt;/b&gt;!&lt;/p&gt;</description><link>http://swaggadocio.com/post/421926906</link><guid>http://swaggadocio.com/post/421926906</guid><pubDate>Tue, 02 Mar 2010 12:20:00 +0000</pubDate><category>LOL</category><category>bdd</category><category>cucumber</category><category>rails</category><category>relax</category><category>rspec</category><category>ruby</category><category>cukes</category></item><item><title>Pure Imagination from WIlly Wonka And The Chocolate Factory, the...</title><description>&lt;object width="400" height="336"&gt;&lt;param name="movie" value="http://www.youtube.com/v/RZ-uV72pQKI&amp;rel=0&amp;egm=0&amp;showinfo=0&amp;fs=1"&gt;&lt;/param&gt;&lt;param name="wmode" value="transparent"&gt;&lt;/param&gt;&lt;param name="allowFullScreen" value="true"&gt;&lt;/param&gt;&lt;embed src="http://www.youtube.com/v/RZ-uV72pQKI&amp;rel=0&amp;egm=0&amp;showinfo=0&amp;fs=1" type="application/x-shockwave-flash" width="400" height="336" allowFullScreen="true" wmode="transparent"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;br/&gt;&lt;br/&gt;&lt;p&gt;&lt;b&gt;Pure Imagination&lt;/b&gt; from &lt;b&gt;WIlly Wonka And The Chocolate Factory&lt;/b&gt;, the OG 1971 movie. Such a beautiful song.&lt;/p&gt;
&lt;p&gt;Did anyone else find it scary as f*** when Gene Wilder’s temper used to turn on a dime if one of the kids messed up?&lt;/p&gt;</description><link>http://swaggadocio.com/post/418405091</link><guid>http://swaggadocio.com/post/418405091</guid><pubDate>Sun, 28 Feb 2010 22:20:00 +0000</pubDate></item><item><title>Wayne Bridge. You sir, are a G!</title><description>&lt;object width="400" height="336"&gt;&lt;param name="movie" value="http://www.youtube.com/v/afzBynuqrdQ&amp;rel=0&amp;egm=0&amp;showinfo=0&amp;fs=1"&gt;&lt;/param&gt;&lt;param name="wmode" value="transparent"&gt;&lt;/param&gt;&lt;param name="allowFullScreen" value="true"&gt;&lt;/param&gt;&lt;embed src="http://www.youtube.com/v/afzBynuqrdQ&amp;rel=0&amp;egm=0&amp;showinfo=0&amp;fs=1" type="application/x-shockwave-flash" width="400" height="336" allowFullScreen="true" wmode="transparent"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;br/&gt;&lt;br/&gt;&lt;p&gt;Wayne Bridge. You sir, are a G!&lt;/p&gt;</description><link>http://swaggadocio.com/post/415891824</link><guid>http://swaggadocio.com/post/415891824</guid><pubDate>Sat, 27 Feb 2010 19:45:12 +0000</pubDate></item><item><title>FACT: I once told heavyweight champion of the world David Haye...</title><description>&lt;img src="http://25.media.tumblr.com/tumblr_kyibdbDcqj1qzqoxro1_500.png"/&gt;&lt;br/&gt;&lt;br/&gt;&lt;p&gt;&lt;b&gt;FACT&lt;/b&gt;: I once told heavyweight champion of the world David Haye “Dave, I don’t care if you unified the cruiserweight division, if you carry on I’ll f***ing chin you.”  when he was winding me up about something. Fortunately, Haye is a good sport.&lt;/p&gt;
&lt;p&gt;I believe that I may have been slightly inebriated at the time.&lt;/p&gt;</description><link>http://swaggadocio.com/post/415497285</link><guid>http://swaggadocio.com/post/415497285</guid><pubDate>Sat, 27 Feb 2010 15:36:00 +0000</pubDate></item><item><title>“Yeeeeew!”</title><description>&lt;img src="http://26.media.tumblr.com/tumblr_kyh4qhXgoD1qzqoxro1_500.jpg"/&gt;&lt;br/&gt;&lt;br/&gt;&lt;p&gt;“Yeeeeew!”&lt;/p&gt;</description><link>http://swaggadocio.com/post/414189084</link><guid>http://swaggadocio.com/post/414189084</guid><pubDate>Sat, 27 Feb 2010 00:15:53 +0000</pubDate></item><item><title>(via fuckforfashion)
I have one of these on my bookshelf. I also...</title><description>&lt;img src="http://24.media.tumblr.com/tumblr_kxjsc9R90g1qb3tfzo1_500.jpg"/&gt;&lt;br/&gt;&lt;br/&gt;&lt;p&gt;(via &lt;a href="http://fuckforfashion.tumblr.com/" target="_blank"&gt;fuckforfashion&lt;/a&gt;)&lt;/p&gt;
&lt;p&gt;I have one of these on my bookshelf. I also actually drunk one when I was mad thirsty and tossed the bottle lol.&lt;/p&gt;</description><link>http://swaggadocio.com/post/414012403</link><guid>http://swaggadocio.com/post/414012403</guid><pubDate>Fri, 26 Feb 2010 22:30:00 +0000</pubDate></item><item><title>http://uk.linkedin.com/in/sjtgraham</title><description>&lt;a href="http://uk.linkedin.com/in/sjtgraham"&gt;http://uk.linkedin.com/in/sjtgraham&lt;/a&gt;</description><link>http://swaggadocio.com/post/412009784</link><guid>http://swaggadocio.com/post/412009784</guid><pubDate>Thu, 25 Feb 2010 23:43:05 +0000</pubDate></item><item><title>I love green.</title><description>&lt;img src="http://24.media.tumblr.com/tumblr_kyewkgyB8n1qzqoxro1_r1_500.png"/&gt;&lt;br/&gt;&lt;br/&gt;&lt;p&gt;I love green.&lt;/p&gt;</description><link>http://swaggadocio.com/post/411594956</link><guid>http://swaggadocio.com/post/411594956</guid><pubDate>Thu, 25 Feb 2010 19:24:00 +0000</pubDate><category>BDD</category><category>RSpec</category><category>green FTW</category><category>svn ci -m 'i love green'</category></item><item><title>coryheywood:

Stevie Wonder - She’s A Bad Mamma Jamma
Tune is...</title><description>&lt;embed type="application/x-shockwave-flash" src="http://swaggadocio.com/swf/audio_player.swf?audio_file=http://www.tumblr.com/audio_file/409867381/tumblr_kycw14RtPr1qzvv2t&amp;color=FFFFFF" height="27" width="207" quality="best"&gt;&lt;/embed&gt;&lt;br/&gt;&lt;br/&gt;&lt;p&gt;&lt;a href="http://coryheywood.tumblr.com/post/409559443/stevie-wonder-shes-a-bad-mamma-jamma-tune-is" target="_blank"&gt;coryheywood&lt;/a&gt;:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;b&gt;Stevie Wonder - She’s A Bad Mamma Jamma&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;Tune is still badass.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Certainly is. Except that it’s by Carl Carlton. Nod to the Koch for pointing that out.&lt;/p&gt;</description><link>http://swaggadocio.com/post/409867381</link><guid>http://swaggadocio.com/post/409867381</guid><pubDate>Wed, 24 Feb 2010 23:22:00 +0000</pubDate></item></channel></rss>
