trickeries! 2011-04-29T22:30:36-07:00 http://trickeries.com/ atom smith re5etsmyth@gmail.com Finding a file in a git repo with Emacs 2011-04-29T00:00:00-07:00 http://trickeries.com.com//archive/find-file-in-git-repo-with-emacs <p>I was looking for an even faster way to find files in the projects I work on than just using <a href='http://www.emacswiki.org/emacs/InteractivelyDoThings'>ido</a>, so I looked at a whole bunch of different solutions that did not work for me. After realizing that pretty much all of the time I am working on a project, it is a <a href='git'>http://git-scm.com/</a> repo. Luckily for me, git provides <a href='http://www.kernel.org/pub/software/scm/git/docs/git-ls-files.html'>git-ls-files</a>, which dumps out a list of all the files tracked in the repo. I made the following:</p> <div class='highlight'><pre><code class='cl'><span class='c1'>;;; find-file-in-git-repo.el --- Utility to find files in a git repo</span> <span class='c1'>;; Copyright 2011 atom smith</span> <span class='c1'>;; Author: atom smith</span> <span class='c1'>;; URL: http://github.com/re5et/find-file-in-git-repo</span> <span class='c1'>;; Version: 0.1.2</span> <span class='c1'>;;; Commentary:</span> <span class='c1'>;; Using default-directory searches upward for a .git repo directory,</span> <span class='c1'>;; then, feeds files into ido-completing-read using git ls-files.</span> <span class='p'>(</span><span class='nb'>defun</span> <span class='nv'>find-file-in-git-repo</span> <span class='p'>()</span> <span class='p'>(</span><span class='nv'>interactive</span><span class='p'>)</span> <span class='p'>(</span><span class='k'>let*</span> <span class='p'>((</span><span class='nv'>repo</span> <span class='p'>(</span><span class='nv'>find-git-repo</span> <span class='nv'>default-directory</span><span class='p'>))</span> <span class='p'>(</span><span class='nv'>files</span> <span class='p'>(</span><span class='nv'>shell-command-to-string</span> <span class='p'>(</span><span class='nb'>format</span> <span class='s'>&quot;cd %s &amp;&amp; git ls-files&quot;</span> <span class='nv'>repo</span><span class='p'>))))</span> <span class='p'>(</span><span class='nv'>find-file</span> <span class='p'>(</span><span class='nv'>concat</span> <span class='nv'>repo</span> <span class='p'>(</span><span class='nv'>ido-completing-read</span> <span class='s'>&quot;find in git repo: &quot;</span> <span class='p'>(</span><span class='nb'>remove-if</span> <span class='p'>(</span><span class='k'>lambda</span> <span class='p'>(</span><span class='nv'>x</span><span class='p'>)</span> <span class='p'>(</span><span class='nb'>string=</span> <span class='s'>&quot;&quot;</span> <span class='nv'>x</span><span class='p'>))</span> <span class='p'>(</span><span class='nv'>split-string</span> <span class='nv'>files</span> <span class='s'>&quot;\n&quot;</span><span class='p'>)))))))</span> <span class='p'>(</span><span class='nb'>defun</span> <span class='nv'>find-git-repo</span> <span class='p'>(</span><span class='nv'>dir</span><span class='p'>)</span> <span class='p'>(</span><span class='k'>if</span> <span class='p'>(</span><span class='nb'>string=</span> <span class='s'>&quot;/&quot;</span> <span class='nv'>dir</span><span class='p'>)</span> <span class='p'>(</span><span class='nv'>message</span> <span class='s'>&quot;not in a git repo.&quot;</span><span class='p'>)</span> <span class='p'>(</span><span class='k'>if</span> <span class='p'>(</span><span class='nv'>file-exists-p</span> <span class='p'>(</span><span class='nv'>expand-file-name</span> <span class='s'>&quot;.git/&quot;</span> <span class='nv'>dir</span><span class='p'>))</span> <span class='nv'>dir</span> <span class='p'>(</span><span class='nv'>find-git-repo</span> <span class='p'>(</span><span class='nv'>expand-file-name</span> <span class='s'>&quot;../&quot;</span> <span class='nv'>dir</span><span class='p'>)))))</span> <span class='c1'>;;; find-file-in-git-repo.el ends here</span> <span class='p'>(</span><span class='nb'>provide</span> <span class='ss'>&#39;find-file-in-git-repo</span><span class='p'>)</span> </code></pre> </div> <p>This works quite well for my purposes so I thought I would share it. I don&#8217;t claim to be an Emacs Lisp expert, so I would be more than happy with suggestions for improvements, or you could be really awesome and <a href='https://github.com/re5et/find-file-in-git-repo'>fork it</a> and send me a pull request.</p> <p>This is also <a href='http://marmalade-repo.org/packages/find-file-in-git-repo/0.1.1'>available for installation</a> from <a href='http://marmalade-repo.org/'>Marmalade</a> with <a href='https://github.com/technomancy/package.el'>package.el</a> or <a href='http://tromey.com/elpa/'>ELPA</a>.</p> pretty diff rubygem 2011-02-17T00:00:00-08:00 http://trickeries.com.com//archive/pretty-diff-rubygem <p>I was looking for a gem that would allow diffing two multiline-strings and generate a pretty looking html diff ala github, but didn&#8217;t find anything so I made <a href='http://rubygems.org/gems/pretty-diffhttp://rubygems.org/gems/pretty-diff'>this gem</a>, <a href='http://markmcb.com/2008/11/04/ruby-on-rails-diff-text-to-html-ins-and-del/'>taking inspiration from this post</a>. You can use it like so:</p> <h2 id='you_can_install_like_usual'>You can install like usual:</h2> <div class='highlight'><pre><code class='sh'>gem install pretty-diff </code></pre> </div> <h2 id='and_use_like_so'>And use like so:</h2> <div class='highlight'><pre><code class='ruby'><span class='c1'># for comparing two files</span> <span class='n'>myDiff</span> <span class='o'>=</span> <span class='no'>PrettyDiff</span><span class='o'>::</span><span class='n'>files</span><span class='p'>(</span><span class='s1'>&#39;/path/to/first/file&#39;</span><span class='p'>,</span> <span class='s1'>&#39;/path/to/second/file&#39;</span><span class='p'>)</span> <span class='c1'># for comparing two strings</span> <span class='n'>string1</span> <span class='o'>=</span> <span class='s2'>&quot;Some</span> <span class='s2'>Big</span> <span class='s2'>Long</span> <span class='s2'>string</span> <span class='s2'>with</span> <span class='s2'>a</span> <span class='s2'>bunch</span> <span class='s2'>of</span> <span class='s2'>lines</span> <span class='s2'>that</span> <span class='s2'>wasn&#39;t</span> <span class='s2'>very</span> <span class='s2'>well</span> <span class='s2'>thought</span> <span class='s2'>out.&quot;</span> <span class='n'>string2</span> <span class='o'>=</span> <span class='s2'>&quot;A</span> <span class='s2'>Big</span> <span class='s2'>Long</span> <span class='s2'>string</span> <span class='s2'>that</span> <span class='s2'>has</span> <span class='s2'>been</span> <span class='s2'>revised</span> <span class='s2'>and</span> <span class='s2'>is</span> <span class='s2'>now</span> <span class='s2'>well</span> <span class='s2'>thought</span> <span class='s2'>out.&quot;</span> <span class='n'>myDiff</span> <span class='o'>=</span> <span class='no'>PrettyDiff</span><span class='o'>::</span><span class='n'>strings</span><span class='p'>(</span><span class='n'>string1</span><span class='p'>,</span> <span class='n'>string2</span><span class='p'>)</span><span class='o'>.</span><span class='n'>to_html</span> <span class='c1'># you can then do</span> <span class='n'>myDiff</span><span class='o'>.</span><span class='n'>to_s</span> <span class='c1'># to output the normal diff</span> <span class='c1'># or what I made it for</span> <span class='n'>myDiff</span><span class='o'>.</span><span class='n'>to_html</span> </code></pre> </div> <h2 id='the_html_output_will_look_something_like_this'>The html output will look something like this:</h2> <div class='highlight'><pre><code class='html'><span class='nt'>&lt;ul&gt;</span> <span class='nt'>&lt;li&gt;</span>--- /tmp/fileone20110217-26623-aci0rq 2011-02-17 09:29:38.343173000 -0800<span class='nt'>&lt;/li&gt;</span> <span class='nt'>&lt;li&gt;</span>+++ /tmp/filetwo20110217-26623-zto770 2011-02-17 09:29:38.343173000 -0800<span class='nt'>&lt;/li&gt;</span> <span class='nt'>&lt;li&gt;</span>@@ -1,15 +1,14 @@<span class='nt'>&lt;/li&gt;</span> <span class='nt'>&lt;li</span> <span class='na'>class=</span><span class='s'>&quot;del&quot;</span><span class='nt'>&gt;&lt;del&gt;</span>-Some<span class='nt'>&lt;/del&gt;&lt;/li&gt;</span> <span class='nt'>&lt;li</span> <span class='na'>class=</span><span class='s'>&quot;ins&quot;</span><span class='nt'>&gt;&lt;ins&gt;</span>+A<span class='nt'>&lt;/ins&gt;&lt;/li&gt;</span> <span class='nt'>&lt;li&gt;</span> Big<span class='nt'>&lt;/li&gt;</span> <span class='nt'>&lt;li&gt;</span> Long<span class='nt'>&lt;/li&gt;</span> <span class='nt'>&lt;li&gt;</span> string<span class='nt'>&lt;/li&gt;</span> <span class='nt'>&lt;li</span> <span class='na'>class=</span><span class='s'>&quot;del&quot;</span><span class='nt'>&gt;&lt;del&gt;</span>-with<span class='nt'>&lt;/del&gt;&lt;/li&gt;</span> <span class='nt'>&lt;li</span> <span class='na'>class=</span><span class='s'>&quot;del&quot;</span><span class='nt'>&gt;&lt;del&gt;</span>-a<span class='nt'>&lt;/del&gt;&lt;/li&gt;</span> <span class='nt'>&lt;li</span> <span class='na'>class=</span><span class='s'>&quot;del&quot;</span><span class='nt'>&gt;&lt;del&gt;</span>-bunch<span class='nt'>&lt;/del&gt;&lt;/li&gt;</span> <span class='nt'>&lt;li</span> <span class='na'>class=</span><span class='s'>&quot;del&quot;</span><span class='nt'>&gt;&lt;del&gt;</span>-of<span class='nt'>&lt;/del&gt;&lt;/li&gt;</span> <span class='nt'>&lt;li</span> <span class='na'>class=</span><span class='s'>&quot;del&quot;</span><span class='nt'>&gt;&lt;del&gt;</span>-lines<span class='nt'>&lt;/del&gt;&lt;/li&gt;</span> <span class='nt'>&lt;li&gt;</span> that<span class='nt'>&lt;/li&gt;</span> <span class='nt'>&lt;li</span> <span class='na'>class=</span><span class='s'>&quot;del&quot;</span><span class='nt'>&gt;&lt;del&gt;</span>-wasn&#39;t<span class='nt'>&lt;/del&gt;&lt;/li&gt;</span> <span class='nt'>&lt;li</span> <span class='na'>class=</span><span class='s'>&quot;del&quot;</span><span class='nt'>&gt;&lt;del&gt;</span>-very<span class='nt'>&lt;/del&gt;&lt;/li&gt;</span> <span class='nt'>&lt;li</span> <span class='na'>class=</span><span class='s'>&quot;ins&quot;</span><span class='nt'>&gt;&lt;ins&gt;</span>+has<span class='nt'>&lt;/ins&gt;&lt;/li&gt;</span> <span class='nt'>&lt;li</span> <span class='na'>class=</span><span class='s'>&quot;ins&quot;</span><span class='nt'>&gt;&lt;ins&gt;</span>+been<span class='nt'>&lt;/ins&gt;&lt;/li&gt;</span> <span class='nt'>&lt;li</span> <span class='na'>class=</span><span class='s'>&quot;ins&quot;</span><span class='nt'>&gt;&lt;ins&gt;</span>+revised<span class='nt'>&lt;/ins&gt;&lt;/li&gt;</span> <span class='nt'>&lt;li</span> <span class='na'>class=</span><span class='s'>&quot;ins&quot;</span><span class='nt'>&gt;&lt;ins&gt;</span>+and<span class='nt'>&lt;/ins&gt;&lt;/li&gt;</span> <span class='nt'>&lt;li</span> <span class='na'>class=</span><span class='s'>&quot;ins&quot;</span><span class='nt'>&gt;&lt;ins&gt;</span>+is<span class='nt'>&lt;/ins&gt;&lt;/li&gt;</span> <span class='nt'>&lt;li</span> <span class='na'>class=</span><span class='s'>&quot;ins&quot;</span><span class='nt'>&gt;&lt;ins&gt;</span>+now<span class='nt'>&lt;/ins&gt;&lt;/li&gt;</span> <span class='nt'>&lt;li&gt;</span> well<span class='nt'>&lt;/li&gt;</span> <span class='nt'>&lt;li&gt;</span> thought<span class='nt'>&lt;/li&gt;</span> <span class='nt'>&lt;li&gt;</span> out.<span class='nt'>&lt;/li&gt;</span> <span class='nt'>&lt;/ul&gt;</span> </code></pre> </div> <p>The ul, li, .del and .ins classes and del and ins tags are there to allow for nice styling, so you can put out something like the following:</p> <ul class='pretty-diff'> <li>--- /tmp/fileone20110217-26623-aci0rq 2011-02-17 09:29:38.343173000 -0800</li> <li>+++ /tmp/filetwo20110217-26623-zto770 2011-02-17 09:29:38.343173000 -0800</li> <li>@@ -1,15 +1,14 @@</li> <li class='del'><del>-Some</del></li> <li class='ins'><ins>+A</ins></li> <li> Big</li> <li> Long</li> <li> string</li> <li class='del'><del>-with</del></li> <li class='del'><del>-a</del></li> <li class='del'><del>-bunch</del></li> <li class='del'><del>-of</del></li> <li class='del'><del>-lines</del></li> <li> that</li> <li class='del'><del>-wasn't</del></li> <li class='del'><del>-very</del></li> <li class='ins'><ins>+has</ins></li> <li class='ins'><ins>+been</ins></li> <li class='ins'><ins>+revised</ins></li> <li class='ins'><ins>+and</ins></li> <li class='ins'><ins>+is</ins></li> <li class='ins'><ins>+now</ins></li> <li> well</li> <li> thought</li> <li> out.</li> </ul> <h1 id='the_css_for_the_above_if_you_want_it'>the css for the above if you want it</h1> <div class='highlight'><pre><code class='css'><span class='nc'>.pretty-diff</span><span class='p'>{</span> <span class='k'>list-style</span><span class='o'>:</span><span class='k'>none</span><span class='p'>;</span> <span class='k'>padding</span><span class='o'>:</span><span class='m'>0</span><span class='p'>;</span> <span class='k'>margin</span><span class='o'>:</span><span class='m'>0</span><span class='p'>;</span> <span class='k'>background</span><span class='o'>:</span><span class='m'>#FFF</span><span class='p'>;</span> <span class='k'>font-family</span><span class='o'>:</span><span class='k'>monospace</span><span class='p'>;</span> <span class='k'>color</span><span class='o'>:</span><span class='m'>#333</span><span class='p'>;</span> <span class='k'>font-size</span><span class='o'>:</span><span class='m'>12px</span><span class='p'>;</span> <span class='p'>}</span> <span class='nc'>.pretty-diff</span> <span class='nt'>li</span><span class='p'>{</span> <span class='k'>padding</span><span class='o'>:</span><span class='m'>2px</span> <span class='m'>5px</span><span class='p'>;</span> <span class='k'>margin</span><span class='o'>:</span><span class='m'>0</span><span class='p'>;</span> <span class='p'>}</span> <span class='nc'>.pretty-diff</span> <span class='nt'>ins</span><span class='o'>,</span> <span class='nc'>.pretty-diff</span> <span class='nt'>del</span><span class='p'>{</span> <span class='k'>text-decoration</span><span class='o'>:</span><span class='k'>none</span><span class='p'>;</span> <span class='p'>}</span> <span class='nc'>.pretty-diff</span> <span class='nt'>li</span><span class='nc'>.ins</span><span class='p'>{</span> <span class='k'>background</span><span class='o'>:</span><span class='m'>#CFC</span><span class='p'>;</span> <span class='k'>color</span><span class='o'>:</span><span class='m'>#070</span><span class='p'>;</span> <span class='p'>}</span> <span class='nc'>.pretty-diff</span> <span class='nt'>li</span><span class='nc'>.del</span><span class='p'>{</span> <span class='k'>background</span><span class='o'>:</span><span class='m'>#FCC</span><span class='p'>;</span> <span class='k'>color</span><span class='o'>:</span><span class='m'>#700</span><span class='p'>;</span> <span class='p'>}</span> </code></pre> </div> <p>If you have any issues with anything, or have ideas for how to improve this, feel free to leave a comment or <a href='https://github.com/re5et/pretty-diff/issues'>open an issue on the github repo for this project</a></p> RiffTrax and piracy, chicken and egg 2011-02-16T00:00:00-08:00 http://trickeries.com.com//archive/rifftrax-and-piracy <!-- http://twitter.com/#!/re5et/status/38041850166116353 --> <style type='text/css'>.bbpBox38041850166116350 {background:url(http://a0.twimg.com/profile_background_images/2385677/Untitled-7.jpg) #000000;padding:20px;} p.bbpTweet{background:#fff;padding:10px 12px 10px 12px;margin:0;min-height:48px;color:#000;font-size:18px !important;line-height:22px;-moz-border-radius:5px;-webkit-border-radius:5px} p.bbpTweet span.metadata{display:block;width:100%;clear:both;margin-top:8px;padding-top:12px;height:40px;border-top:1px solid #fff;border-top:1px solid #e6e6e6} p.bbpTweet span.metadata span.author{line-height:19px} p.bbpTweet span.metadata span.author img{float:left;margin:0 7px 0 0px;width:38px;height:38px} p.bbpTweet a:hover{text-decoration:underline}p.bbpTweet span.timestamp{font-size:12px;display:block}</style> <div class='bbpBox38041850166116350'><p class='bbpTweet'>when @<a class='tweet-url username' href='http://twitter.com/michaeljnelson' rel='nofollow'>michaeljnelson</a> @<a class='tweet-url username' href='http://twitter.com/kwmurphy' rel='nofollow'>kwmurphy</a> and @<a class='tweet-url username' href='http://twitter.com/rifftrax' rel='nofollow'>rifftrax</a> recently mentioned piracy, i immediately thought "keep circulating the tapes"<span class='timestamp'><a href='http://twitter.com/#!/re5et/status/38041850166116353' title='Thu Feb 17 01:07:38 +0000 2011'>less than a minute ago</a> via <a href='http://wiki.github.com/mooz/keysnail' rel='nofollow'>KeySnail</a></span><span class='metadata'><span class='author'><a href='http://twitter.com/re5et'><img src='http://a2.twimg.com/profile_images/1144834804/39547d48-a058-4c6d-b20c-9804ec4de3a6_normal.png' /></a><strong><a href='http://twitter.com/re5et'>atom smith</a></strong><br />re5et</span></span></p></div> <!-- end of tweet --> <p>I recently tweeted the above, and hit a sore spot with whoever is running the RiffTrax twitter account.</p> <p>The &#8221;<a href='http://tvtropes.org/pmwiki/pmwiki.php/Main/KeepCirculatingTheTapes'>keep circulating the tapes</a>&#8221; bit is a reference to the <a href='http://www.imdb.com/title/tt0094517/crazycredits'>MST3K credits</a>. During seasons 1-4 the credits ended with this message.</p> <p>My tweet was in response to a flare-up earlier in the day when <a href='http://twitter.com/rifftrax'>@RiffTrax</a>, <a href='http://twitter.com/#!/michaeljnelson'>@michaeljnelson</a> and <a href='http://twitter.com/kwmurphy'>@kwmurphy</a> re/tweeted stuff like:</p> <!-- http://twitter.com/#!/RiffTrax/status/37914904430260225 --> <style type='text/css'>.bbpBox37914904430260220 {background:url(http://a3.twimg.com/profile_background_images/2387304/riff-logo-tile.jpg) #4387d9;padding:20px;} p.bbpTweet{background:#fff;padding:10px 12px 10px 12px;margin:0;min-height:48px;color:#000;font-size:18px !important;line-height:22px;-moz-border-radius:5px;-webkit-border-radius:5px} p.bbpTweet span.metadata{display:block;width:100%;clear:both;margin-top:8px;padding-top:12px;height:40px;border-top:1px solid #fff;border-top:1px solid #e6e6e6} p.bbpTweet span.metadata span.author{line-height:19px} p.bbpTweet span.metadata span.author img{float:left;margin:0 7px 0 0px;width:38px;height:38px} p.bbpTweet a:hover{text-decoration:underline}p.bbpTweet span.timestamp{font-size:12px;display:block}</style> <div class='bbpBox37914904430260220'><p class='bbpTweet'>Currently twice as many people have illegally downloaded our Inception riff from one torrent site alone then have bought it.<span class='timestamp'><a href='http://twitter.com/#!/RiffTrax/status/37914904430260225' title='Wed Feb 16 16:43:12 +0000 2011'>less than a minute ago</a> via <a href='http://www.tweetdeck.com' rel='nofollow'>TweetDeck</a></span><span class='metadata'><span class='author'><a href='http://twitter.com/RiffTrax'><img src='http://a2.twimg.com/profile_images/421232840/RT-Bomb2_normal.jpg' /></a><strong><a href='http://twitter.com/RiffTrax'>RiffTrax</a></strong><br />RiffTrax</span></span></p></div> <!-- end of tweet --> <p>and</p> <!-- http://twitter.com/#!/RiffTrax/status/37914945089835008 --> <style type='text/css'>.bbpBox37914945089835010 {background:url(http://a3.twimg.com/profile_background_images/2387304/riff-logo-tile.jpg) #4387d9;padding:20px;} p.bbpTweet{background:#fff;padding:10px 12px 10px 12px;margin:0;min-height:48px;color:#000;font-size:18px !important;line-height:22px;-moz-border-radius:5px;-webkit-border-radius:5px} p.bbpTweet span.metadata{display:block;width:100%;clear:both;margin-top:8px;padding-top:12px;height:40px;border-top:1px solid #fff;border-top:1px solid #e6e6e6} p.bbpTweet span.metadata span.author{line-height:19px} p.bbpTweet span.metadata span.author img{float:left;margin:0 7px 0 0px;width:38px;height:38px} p.bbpTweet a:hover{text-decoration:underline}p.bbpTweet span.timestamp{font-size:12px;display:block}</style> <div class='bbpBox37914945089835010'><p class='bbpTweet'>When you create rifftrax torrents and upload them, you do our small business a great deal of harm. Please don't do it.<span class='timestamp'><a href='http://twitter.com/#!/RiffTrax/status/37914945089835008' title='Wed Feb 16 16:43:21 +0000 2011'>less than a minute ago</a> via <a href='http://www.tweetdeck.com' rel='nofollow'>TweetDeck</a></span><span class='metadata'><span class='author'><a href='http://twitter.com/RiffTrax'><img src='http://a2.twimg.com/profile_images/421232840/RT-Bomb2_normal.jpg' /></a><strong><a href='http://twitter.com/RiffTrax'>RiffTrax</a></strong><br />RiffTrax</span></span></p></div> <!-- end of tweet --> <p>and</p> <!-- http://twitter.com/#!/kwmurphy/status/38027191346413568 --> <style type='text/css'>.bbpBox38027191346413570 {background:url(http://a0.twimg.com/profile_background_images/2674062/RCMBlogo1.jpg) #333333;padding:20px;} p.bbpTweet{background:#fff;padding:10px 12px 10px 12px;margin:0;min-height:48px;color:#000;font-size:18px !important;line-height:22px;-moz-border-radius:5px;-webkit-border-radius:5px} p.bbpTweet span.metadata{display:block;width:100%;clear:both;margin-top:8px;padding-top:12px;height:40px;border-top:1px solid #fff;border-top:1px solid #e6e6e6} p.bbpTweet span.metadata span.author{line-height:19px} p.bbpTweet span.metadata span.author img{float:left;margin:0 7px 0 0px;width:38px;height:38px} p.bbpTweet a:hover{text-decoration:underline}p.bbpTweet span.timestamp{font-size:12px;display:block}</style> <div class='bbpBox38027191346413570'><p class='bbpTweet'>Thanks to all of you who bought our riff of Inception instead of nabbing if from a torrent site like some uncommon dildo.<span class='timestamp'><a href='http://twitter.com/#!/kwmurphy/status/38027191346413568' title='Thu Feb 17 00:09:23 +0000 2011'>less than a minute ago</a> via <a href='http://www.tweetdeck.com' rel='nofollow'>TweetDeck</a></span><span class='metadata'><span class='author'><a href='http://twitter.com/kwmurphy'><img src='http://a1.twimg.com/profile_images/1177813683/FF_1069_normal.jpg' /></a><strong><a href='http://twitter.com/kwmurphy'>Kevin Murphy</a></strong><br />kwmurphy</span></span></p></div> <!-- end of tweet --> <p>There were a quick couple of replies to my comment:</p> <!-- http://twitter.com/#!/RiffTrax/status/38057437072334848 --> <style type='text/css'>.bbpBox38057437072334850 {background:url(http://a3.twimg.com/profile_background_images/2387304/riff-logo-tile.jpg) #4387d9;padding:20px;} p.bbpTweet{background:#fff;padding:10px 12px 10px 12px;margin:0;min-height:48px;color:#000;font-size:18px !important;line-height:22px;-moz-border-radius:5px;-webkit-border-radius:5px} p.bbpTweet span.metadata{display:block;width:100%;clear:both;margin-top:8px;padding-top:12px;height:40px;border-top:1px solid #fff;border-top:1px solid #e6e6e6} p.bbpTweet span.metadata span.author{line-height:19px} p.bbpTweet span.metadata span.author img{float:left;margin:0 7px 0 0px;width:38px;height:38px} p.bbpTweet a:hover{text-decoration:underline}p.bbpTweet span.timestamp{font-size:12px;display:block}</style> <div class='bbpBox38057437072334850'><p class='bbpTweet'>@<a class='tweet-url username' href='http://twitter.com/re5et' rel='nofollow'>re5et</a> I'm sure that you can acknowledge that there are non-subtle differences between that and what we were discussing earlier<span class='timestamp'><a href='http://twitter.com/#!/RiffTrax/status/38057437072334848' title='Thu Feb 17 02:09:34 +0000 2011'>less than a minute ago</a> via <a href='http://www.tweetdeck.com' rel='nofollow'>TweetDeck</a></span><span class='metadata'><span class='author'><a href='http://twitter.com/RiffTrax'><img src='http://a2.twimg.com/profile_images/421232840/RT-Bomb2_normal.jpg' /></a><strong><a href='http://twitter.com/RiffTrax'>RiffTrax</a></strong><br />RiffTrax</span></span></p></div> <!-- end of tweet --> <p>Absolutely true. At the time when &#8220;keep circulating the tapes&#8221; was encouraged, there was only possibility for gain. More people see the tapes, more fans. It made the show much more popular. More people found out about the show and tuned in, and the show made it 10 seasons. It is possible that without people taping the show and sending it around to their friends and family, that the show would not have ever made it past a few seasons, and RiffTrax might not have happened because it might not have had the momentum and weight of MST3K behind it.</p> <p>This was piracy. It helped everyone involved. But it was encouraging illegal behaviour:</p> <p>From <a href='http://www.mst3kinfo.com/mstfaq/legal.html'>Sattellite News (the official mst3k fan site)</a>:</p> <blockquote> <p>It&#8217;s true that, in the closing credits of seasons one through four, there was a line in the credits that read: &#8220;Keep Circulating The Tapes.&#8221; They included that line because, at that time, CC was a new station and was not available everywhere. <strong>They were encouraging fans who were taping the show from TV and circulating those tapes, free of charge, to friends who had not yet seen the show or did not have CC on their cable systems. The line was never intended to encourage tape selling or duplicating.</strong> Beginning with the fifth season, the line was removed from the credits, apparently because BBI&#8217;s lawyers were worried about just this sort of misunderstanding.</p> </blockquote> <p>I can see misunderstandings happening, the two highlighted sentences are <strong>very</strong> confusing.</p> <!-- http://twitter.com/#!/RiffTrax/status/38057529875505152 --> <style type='text/css'>.bbpBox38057529875505150 {background:url(http://a3.twimg.com/profile_background_images/2387304/riff-logo-tile.jpg) #4387d9;padding:20px;} p.bbpTweet{background:#fff;padding:10px 12px 10px 12px;margin:0;min-height:48px;color:#000;font-size:18px !important;line-height:22px;-moz-border-radius:5px;-webkit-border-radius:5px} p.bbpTweet span.metadata{display:block;width:100%;clear:both;margin-top:8px;padding-top:12px;height:40px;border-top:1px solid #fff;border-top:1px solid #e6e6e6} p.bbpTweet span.metadata span.author{line-height:19px} p.bbpTweet span.metadata span.author img{float:left;margin:0 7px 0 0px;width:38px;height:38px} p.bbpTweet a:hover{text-decoration:underline}p.bbpTweet span.timestamp{font-size:12px;display:block}</style> <div class='bbpBox38057529875505150'><p class='bbpTweet'>@<a class='tweet-url username' href='http://twitter.com/re5et' rel='nofollow'>re5et</a> Not to even mention the fact that we never attached RiffTrax to that sentiment at any time<span class='timestamp'><a href='http://twitter.com/#!/RiffTrax/status/38057529875505152' title='Thu Feb 17 02:09:56 +0000 2011'>less than a minute ago</a> via <a href='http://www.tweetdeck.com' rel='nofollow'>TweetDeck</a></span><span class='metadata'><span class='author'><a href='http://twitter.com/RiffTrax'><img src='http://a2.twimg.com/profile_images/421232840/RT-Bomb2_normal.jpg' /></a><strong><a href='http://twitter.com/RiffTrax'>RiffTrax</a></strong><br />RiffTrax</span></span></p></div> <!-- end of tweet --> <p>MST3K is intrinsically linked with RiffTrax. It would be hard to refute being that they often use MST3K to promote RiffTrax, like on their home page. I reply:</p> <!-- http://twitter.com/#!/re5et/status/38060972539256832 --> <style type='text/css'>.bbpBox38060972539256830 {background:url(http://a0.twimg.com/profile_background_images/2385677/Untitled-7.jpg) #000000;padding:20px;} p.bbpTweet{background:#fff;padding:10px 12px 10px 12px;margin:0;min-height:48px;color:#000;font-size:18px !important;line-height:22px;-moz-border-radius:5px;-webkit-border-radius:5px} p.bbpTweet span.metadata{display:block;width:100%;clear:both;margin-top:8px;padding-top:12px;height:40px;border-top:1px solid #fff;border-top:1px solid #e6e6e6} p.bbpTweet span.metadata span.author{line-height:19px} p.bbpTweet span.metadata span.author img{float:left;margin:0 7px 0 0px;width:38px;height:38px} p.bbpTweet a:hover{text-decoration:underline}p.bbpTweet span.timestamp{font-size:12px;display:block}</style> <div class='bbpBox38060972539256830'><p class='bbpTweet'>@<a class='tweet-url username' href='http://twitter.com/RiffTrax' rel='nofollow'>RiffTrax</a> spoken or not it is attached, rifftrax would not be as popular without mst3k, mst3k would not be as popular without the tapes.<span class='timestamp'><a href='http://twitter.com/#!/re5et/status/38060972539256832' title='Thu Feb 17 02:23:37 +0000 2011'>less than a minute ago</a> via <a href='http://wiki.github.com/mooz/keysnail' rel='nofollow'>KeySnail</a></span><span class='metadata'><span class='author'><a href='http://twitter.com/re5et'><img src='http://a2.twimg.com/profile_images/1144834804/39547d48-a058-4c6d-b20c-9804ec4de3a6_normal.png' /></a><strong><a href='http://twitter.com/re5et'>atom smith</a></strong><br />re5et</span></span></p></div> <!-- end of tweet --><!-- http://twitter.com/#!/re5et/status/38060053638557696 --> <style type='text/css'>.bbpBox38060053638557700 {background:url(http://a0.twimg.com/profile_background_images/2385677/Untitled-7.jpg) #000000;padding:20px;} p.bbpTweet{background:#fff;padding:10px 12px 10px 12px;margin:0;min-height:48px;color:#000;font-size:18px !important;line-height:22px;-moz-border-radius:5px;-webkit-border-radius:5px} p.bbpTweet span.metadata{display:block;width:100%;clear:both;margin-top:8px;padding-top:12px;height:40px;border-top:1px solid #fff;border-top:1px solid #e6e6e6} p.bbpTweet span.metadata span.author{line-height:19px} p.bbpTweet span.metadata span.author img{float:left;margin:0 7px 0 0px;width:38px;height:38px} p.bbpTweet a:hover{text-decoration:underline}p.bbpTweet span.timestamp{font-size:12px;display:block}</style> <div class='bbpBox38060053638557700'><p class='bbpTweet'>@<a class='tweet-url username' href='http://twitter.com/RiffTrax' rel='nofollow'>RiffTrax</a> not trying to wind anyone up, it is of course different. just what came to mind. would rifftrax be as popular without piracy?<span class='timestamp'><a href='http://twitter.com/#!/re5et/status/38060053638557696' title='Thu Feb 17 02:19:58 +0000 2011'>less than a minute ago</a> via <a href='http://wiki.github.com/mooz/keysnail' rel='nofollow'>KeySnail</a></span><span class='metadata'><span class='author'><a href='http://twitter.com/re5et'><img src='http://a2.twimg.com/profile_images/1144834804/39547d48-a058-4c6d-b20c-9804ec4de3a6_normal.png' /></a><strong><a href='http://twitter.com/re5et'>atom smith</a></strong><br />re5et</span></span></p></div> <!-- end of tweet --><!-- http://twitter.com/#!/RiffTrax/status/38060620712640512 --> <style type='text/css'>.bbpBox38060620712640510 {background:url(http://a3.twimg.com/profile_background_images/2387304/riff-logo-tile.jpg) #4387d9;padding:20px;} p.bbpTweet{background:#fff;padding:10px 12px 10px 12px;margin:0;min-height:48px;color:#000;font-size:18px !important;line-height:22px;-moz-border-radius:5px;-webkit-border-radius:5px} p.bbpTweet span.metadata{display:block;width:100%;clear:both;margin-top:8px;padding-top:12px;height:40px;border-top:1px solid #fff;border-top:1px solid #e6e6e6} p.bbpTweet span.metadata span.author{line-height:19px} p.bbpTweet span.metadata span.author img{float:left;margin:0 7px 0 0px;width:38px;height:38px} p.bbpTweet a:hover{text-decoration:underline}p.bbpTweet span.timestamp{font-size:12px;display:block}</style> <div class='bbpBox38060620712640510'><p class='bbpTweet'>@<a class='tweet-url username' href='http://twitter.com/re5et' rel='nofollow'>re5et</a> Yep, we've heard that one today. (not trying to wind you up either. It's just been a long day, dealt with a lot of justifications.)<span class='timestamp'><a href='http://twitter.com/#!/RiffTrax/status/38060620712640512' title='Thu Feb 17 02:22:13 +0000 2011'>less than a minute ago</a> via <a href='http://www.tweetdeck.com' rel='nofollow'>TweetDeck</a></span><span class='metadata'><span class='author'><a href='http://twitter.com/RiffTrax'><img src='http://a2.twimg.com/profile_images/421232840/RT-Bomb2_normal.jpg' /></a><strong><a href='http://twitter.com/RiffTrax'>RiffTrax</a></strong><br />RiffTrax</span></span></p></div> <!-- end of tweet --> <p>Then another string of replies</p> <!-- http://twitter.com/#!/RiffTrax/status/38061548480106496 --> <style type='text/css'>.bbpBox38061548480106500 {background:url(http://a3.twimg.com/profile_background_images/2387304/riff-logo-tile.jpg) #4387d9;padding:20px;} p.bbpTweet{background:#fff;padding:10px 12px 10px 12px;margin:0;min-height:48px;color:#000;font-size:18px !important;line-height:22px;-moz-border-radius:5px;-webkit-border-radius:5px} p.bbpTweet span.metadata{display:block;width:100%;clear:both;margin-top:8px;padding-top:12px;height:40px;border-top:1px solid #fff;border-top:1px solid #e6e6e6} p.bbpTweet span.metadata span.author{line-height:19px} p.bbpTweet span.metadata span.author img{float:left;margin:0 7px 0 0px;width:38px;height:38px} p.bbpTweet a:hover{text-decoration:underline}p.bbpTweet span.timestamp{font-size:12px;display:block}</style> <div class='bbpBox38061548480106500'><p class='bbpTweet'>@<a class='tweet-url username' href='http://twitter.com/re5et' rel='nofollow'>re5et</a> People who make a "best of" you tube compliation are promoting rifftrax. Uploading a 80 movie megatorrent is not promotion.<span class='timestamp'><a href='http://twitter.com/#!/RiffTrax/status/38061548480106496' title='Thu Feb 17 02:25:54 +0000 2011'>less than a minute ago</a> via <a href='http://www.tweetdeck.com' rel='nofollow'>TweetDeck</a></span><span class='metadata'><span class='author'><a href='http://twitter.com/RiffTrax'><img src='http://a2.twimg.com/profile_images/421232840/RT-Bomb2_normal.jpg' /></a><strong><a href='http://twitter.com/RiffTrax'>RiffTrax</a></strong><br />RiffTrax</span></span></p></div> <!-- end of tweet --><!-- http://twitter.com/#!/RiffTrax/status/38062000588328960 --> <style type='text/css'>.bbpBox38062000588328960 {background:url(http://a3.twimg.com/profile_background_images/2387304/riff-logo-tile.jpg) #4387d9;padding:20px;} p.bbpTweet{background:#fff;padding:10px 12px 10px 12px;margin:0;min-height:48px;color:#000;font-size:18px !important;line-height:22px;-moz-border-radius:5px;-webkit-border-radius:5px} p.bbpTweet span.metadata{display:block;width:100%;clear:both;margin-top:8px;padding-top:12px;height:40px;border-top:1px solid #fff;border-top:1px solid #e6e6e6} p.bbpTweet span.metadata span.author{line-height:19px} p.bbpTweet span.metadata span.author img{float:left;margin:0 7px 0 0px;width:38px;height:38px} p.bbpTweet a:hover{text-decoration:underline}p.bbpTweet span.timestamp{font-size:12px;display:block}</style> <div class='bbpBox38062000588328960'><p class='bbpTweet'>@<a class='tweet-url username' href='http://twitter.com/re5et' rel='nofollow'>re5et</a> Well, I hope you realize that the intent of those words is not what it may be interpretted as in 2011, (80 movie megatorrents)<span class='timestamp'><a href='http://twitter.com/#!/RiffTrax/status/38062000588328960' title='Thu Feb 17 02:27:42 +0000 2011'>less than a minute ago</a> via <a href='http://www.tweetdeck.com' rel='nofollow'>TweetDeck</a></span><span class='metadata'><span class='author'><a href='http://twitter.com/RiffTrax'><img src='http://a2.twimg.com/profile_images/421232840/RT-Bomb2_normal.jpg' /></a><strong><a href='http://twitter.com/RiffTrax'>RiffTrax</a></strong><br />RiffTrax</span></span></p></div> <!-- end of tweet --> <p>I am not sure what the difference is exactly. I do know that people who download 80 movie megatorrents were not going to buy 80 rifftraxs, then buy the 80 movies to accompany them. If those torrents weren&#8217;t there, they would watch something else for free. The people who download the torrents will however tell their friends and families how funny they are.</p> <!-- http://twitter.com/#!/RiffTrax/status/38062405372231680 --> <style type='text/css'>.bbpBox38062405372231680 {background:url(http://a3.twimg.com/profile_background_images/2387304/riff-logo-tile.jpg) #4387d9;padding:20px;} p.bbpTweet{background:#fff;padding:10px 12px 10px 12px;margin:0;min-height:48px;color:#000;font-size:18px !important;line-height:22px;-moz-border-radius:5px;-webkit-border-radius:5px} p.bbpTweet span.metadata{display:block;width:100%;clear:both;margin-top:8px;padding-top:12px;height:40px;border-top:1px solid #fff;border-top:1px solid #e6e6e6} p.bbpTweet span.metadata span.author{line-height:19px} p.bbpTweet span.metadata span.author img{float:left;margin:0 7px 0 0px;width:38px;height:38px} p.bbpTweet a:hover{text-decoration:underline}p.bbpTweet span.timestamp{font-size:12px;display:block}</style> <div class='bbpBox38062405372231680'><p class='bbpTweet'>@<a class='tweet-url username' href='http://twitter.com/re5et' rel='nofollow'>re5et</a> I'd caution quoting as gospel a phrase that is unattributed. The people who work here had nothing to do with it.<span class='timestamp'><a href='http://twitter.com/#!/RiffTrax/status/38062405372231680' title='Thu Feb 17 02:29:19 +0000 2011'>less than a minute ago</a> via <a href='http://www.tweetdeck.com' rel='nofollow'>TweetDeck</a></span><span class='metadata'><span class='author'><a href='http://twitter.com/RiffTrax'><img src='http://a2.twimg.com/profile_images/421232840/RT-Bomb2_normal.jpg' /></a><strong><a href='http://twitter.com/RiffTrax'>RiffTrax</a></strong><br />RiffTrax</span></span></p></div> <!-- end of tweet --> <p>It is attributed, to the MST3K credits. Directly to RiffTrax? I guess not really. But they sure do say &#8220;from the team who brought you MST3K&#8221; a lot.</p> <p>I didn&#8217;t mean to stir up shit, and my tweet was not a battle cry to pirate the hell out of them (although that is typically a side effect of publicly complaining about your thing being pirated). I recognize that they were dealing with a bunch of shit from a bunch of people who were just being dicks. I did not intend to be one of those people, even though based on the defensive responses, that is how I was perceived. And that sucks, because the people behind rifftrax are some of my very favorite people. I nearly simutaniously wet myself and cried when I found out that MST3K was coming back in the form of rifftrax. My idea of heaven is being marooned on the SOL. I absolutely love rifftrax, and those guys. I want them to be successful, because they deserve it. I merely think that in many cases, piracy does more good than harm.</p> <p>The following link is what I saw as their first response to piracy some time ago, I thought and still think that this is the way to go:</p> <h1 id='donate_to_rifftrax'><a href='http://www.rifftrax.com/donate'>donate to rifftrax</a>.</h1> Too lazy to leave Emacs, playing or queing with mpd/mpc 2011-01-26T00:00:00-08:00 http://trickeries.com.com//archive/too-lazy-to-leave-emacs <p>One of the great things about Emacs is that it can do damn near anything you feel like doing, which enhances your lazy a great deal. I often find myself wanting to play an album or queue one up and I don&#8217;t want to jump all over the place to do it. I also love the hell out of <a href='http://www.emacswiki.org/emacs/InteractivelyDoThings'>ido</a>, and so I wrote the following to quickly play or queue files with <a href='http://mpd.wikia.com/wiki/Music_Player_Daemon_Wiki'>mpd</a> through <a href='http://mpd.wikia.com/wiki/MPC'>mpc</a> commands.</p> <div class='highlight'><pre><code class='cl'><span class='p'>(</span><span class='nb'>defvar</span> <span class='nv'>mpd-default-music-dir</span> <span class='s'>&quot;/home/atom/music/&quot;</span> <span class='s'>&quot;mpd music dir, full path, none of that ~/ junk.&quot;</span><span class='p'>)</span> <span class='p'>(</span><span class='nb'>defun</span> <span class='nv'>mpc-find-dir</span> <span class='p'>(</span><span class='nv'>dir</span><span class='p'>)</span> <span class='s'>&quot;Finds a directory for mpd playing or queueing&quot;</span> <span class='p'>(</span><span class='nv'>interactive</span> <span class='s'>&quot;D&quot;</span><span class='p'>)</span> <span class='p'>(</span><span class='nv'>replace-regexp-in-string</span> <span class='nv'>mpd-default-music-dir</span> <span class='s'>&quot;&quot;</span> <span class='p'>(</span><span class='nv'>substring</span> <span class='nv'>dir</span> <span class='mi'>0</span> <span class='mi'>-1</span><span class='p'>)))</span> <span class='p'>(</span><span class='nb'>defun</span> <span class='nv'>mpc-play-or-queue-dir</span> <span class='p'>(</span><span class='k'>&amp;optional</span> <span class='nv'>clear-and-play</span><span class='p'>)</span> <span class='s'>&quot;Plays or queues a directory with mpd&quot;</span> <span class='p'>(</span><span class='nv'>interactive</span><span class='p'>)</span> <span class='p'>(</span><span class='k'>let</span> <span class='p'>((</span><span class='nv'>default-directory</span> <span class='nv'>mpd-default-music-dir</span><span class='p'>)</span> <span class='p'>(</span><span class='nv'>cmd</span> <span class='s'>&quot;mpc add &#39;%s&#39;;&quot;</span><span class='p'>))</span> <span class='p'>(</span><span class='k'>if</span> <span class='nv'>clear-and-play</span> <span class='p'>(</span><span class='k'>setq</span> <span class='nv'>cmd</span> <span class='p'>(</span><span class='nv'>concat</span> <span class='s'>&quot;mpc clear;&quot;</span> <span class='nv'>cmd</span> <span class='s'>&quot;mpc play;&quot;</span><span class='p'>)))</span> <span class='p'>(</span><span class='nv'>shell-command</span> <span class='p'>(</span><span class='nb'>format</span> <span class='nv'>cmd</span> <span class='p'>(</span><span class='nv'>call-interactively</span> <span class='ss'>&#39;mpc-find-dir</span><span class='p'>)))))</span> <span class='p'>(</span><span class='nb'>defun</span> <span class='nv'>mpc-play-dir</span> <span class='p'>()</span> <span class='p'>(</span><span class='nv'>interactive</span><span class='p'>)</span> <span class='p'>(</span><span class='nv'>mpc-play-or-queue-dir</span> <span class='no'>t</span><span class='p'>))</span> <span class='p'>(</span><span class='nb'>defun</span> <span class='nv'>mpc-queue-dir</span> <span class='p'>()</span> <span class='p'>(</span><span class='nv'>interactive</span><span class='p'>)</span> <span class='p'>(</span><span class='nv'>mpc-play-or-queue-dir</span><span class='p'>))</span> <span class='p'>(</span><span class='nb'>defun</span> <span class='nv'>mpc-clear-playlist</span> <span class='p'>()</span> <span class='p'>(</span><span class='nv'>interactive</span><span class='p'>)</span> <span class='p'>(</span><span class='nv'>shell-command</span> <span class='s'>&quot;mpc clear&quot;</span><span class='p'>))</span> </code></pre> </div> <p>I am new to LISP, so feel free to tell me how to do it better, I promise I will not take offense.</p> Rotten Tomatoes Rubygem 2011-01-08T00:00:00-08:00 http://trickeries.com.com//archive/rotten-tomatoes-rubygem <p>I have introduced a <a href='http://rubygems.org/gems/rotten-tomatoes'>Rotten Tomatoes Rubygem</a> that allows you to search for and pull information on movies. Another step towards a crazy personal movie database / player I am casually working on.</p> <p>Currently this only lets you pull information on movies, but I intend to add the ability to get person information as well. The movie info fetcher is pretty thorough, although it could stand to be fancier, and probably will be.</p> <p>The below is a simple script that demonstrates some of this:</p> <div class='highlight'><pre><code class='ruby'><span class='c1'>#! /usr/bin/env ruby</span> <span class='nb'>require</span> <span class='s1'>&#39;rubygems&#39;</span> <span class='nb'>require</span> <span class='s1'>&#39;rotten-tomatoes&#39;</span> <span class='nb'>print</span> <span class='s2'>&quot;Movie Name: &quot;</span> <span class='n'>movie_name</span> <span class='o'>=</span> <span class='no'>STDIN</span><span class='o'>.</span><span class='n'>gets</span><span class='o'>.</span><span class='n'>chomp</span> <span class='nb'>require</span> <span class='s1'>&#39;rubygems&#39;</span> <span class='nb'>require</span> <span class='s1'>&#39;rotten-tomatoes&#39;</span> <span class='c1'># get a movie</span> <span class='n'>movie</span> <span class='o'>=</span> <span class='no'>Rotten_tomatoes</span><span class='o'>::</span><span class='n'>lucky_get_info</span> <span class='n'>movie_name</span> <span class='c1'># do stuff with it</span> <span class='nb'>puts</span> <span class='n'>movie</span><span class='o'>.</span><span class='n'>title</span> <span class='nb'>puts</span> <span class='s2'>&quot;Released in </span><span class='si'>#{</span><span class='n'>movie</span><span class='o'>.</span><span class='n'>year</span><span class='si'>}</span><span class='s2'>&quot;</span> <span class='nb'>puts</span> <span class='s2'>&quot;</span><span class='si'>#{</span><span class='n'>movie</span><span class='o'>.</span><span class='n'>runtime</span><span class='si'>}</span><span class='s2'> long&quot;</span> <span class='nb'>puts</span> <span class='s2'>&quot;Rated </span><span class='si'>#{</span><span class='n'>movie</span><span class='o'>.</span><span class='n'>rating</span><span class='si'>}</span><span class='s2'>&quot;</span> <span class='nb'>puts</span> <span class='s2'>&quot;Tomatometer Freshness rating of </span><span class='si'>#{</span><span class='n'>movie</span><span class='o'>.</span><span class='n'>tomatometer</span><span class='si'>}</span><span class='s2'>%&quot;</span> <span class='nb'>puts</span> <span class='s2'>&quot;Average critic rating of </span><span class='si'>#{</span><span class='n'>movie</span><span class='o'>.</span><span class='n'>tomatometer_average_rating</span><span class='si'>}</span><span class='s2'>&quot;</span> <span class='nb'>puts</span> <span class='s2'>&quot;</span><span class='si'>#{</span><span class='n'>movie</span><span class='o'>.</span><span class='n'>tomatometer_reviews_counted</span><span class='si'>}</span><span class='s2'> reviews taken into consideration.&quot;</span> <span class='nb'>puts</span> <span class='s2'>&quot;</span><span class='si'>#{</span><span class='n'>movie</span><span class='o'>.</span><span class='n'>tomatometer_fresh</span><span class='si'>}</span><span class='s2'> critic/s said it was fresh.&quot;</span> <span class='nb'>puts</span> <span class='s2'>&quot;</span><span class='si'>#{</span><span class='n'>movie</span><span class='o'>.</span><span class='n'>tomatometer_rotten</span><span class='si'>}</span><span class='s2'> critic/s said it was rotten.&quot;</span> <span class='nb'>puts</span> <span class='s2'>&quot;Audience rating of </span><span class='si'>#{</span><span class='n'>movie</span><span class='o'>.</span><span class='n'>audience_rating</span><span class='si'>}</span><span class='s2'>% fresh.&quot;</span> <span class='nb'>puts</span> <span class='s2'>&quot;Average audience rating of </span><span class='si'>#{</span><span class='n'>movie</span><span class='o'>.</span><span class='n'>audience_average_rating</span><span class='si'>}</span><span class='s2'>.&quot;</span> <span class='nb'>puts</span> <span class='s2'>&quot;</span><span class='si'>#{</span><span class='n'>movie</span><span class='o'>.</span><span class='n'>audience_number_of_ratings</span><span class='si'>}</span><span class='s2'> audience ratings.&quot;</span> <span class='nb'>puts</span> <span class='s2'>&quot;Released </span><span class='si'>#{</span><span class='n'>movie</span><span class='o'>.</span><span class='n'>release</span><span class='si'>}</span><span class='s2'>&quot;</span> <span class='nb'>puts</span> <span class='s2'>&quot;Distributed by </span><span class='si'>#{</span><span class='n'>movie</span><span class='o'>.</span><span class='n'>distributor</span><span class='si'>}</span><span class='s2'>&quot;</span> <span class='n'>movie</span><span class='o'>.</span><span class='n'>genres</span><span class='o'>.</span><span class='n'>each</span> <span class='k'>do</span> <span class='o'>|</span><span class='n'>genre</span><span class='o'>|</span> <span class='nb'>puts</span> <span class='s2'>&quot;In the </span><span class='si'>#{</span><span class='n'>genre</span><span class='si'>}</span><span class='s2'> genre.&quot;</span> <span class='k'>end</span> <span class='n'>movie</span><span class='o'>.</span><span class='n'>people</span><span class='o'>.</span><span class='n'>each</span> <span class='k'>do</span> <span class='o'>|</span><span class='n'>role</span><span class='p'>,</span> <span class='n'>people</span><span class='o'>|</span> <span class='nb'>puts</span> <span class='s2'>&quot;</span><span class='se'>\n</span><span class='si'>#{</span><span class='n'>role</span><span class='si'>}</span><span class='s2'>&quot;</span> <span class='n'>people</span><span class='o'>.</span><span class='n'>each</span> <span class='k'>do</span> <span class='o'>|</span><span class='n'>person</span><span class='o'>|</span> <span class='k'>if</span> <span class='n'>person</span><span class='o'>[</span><span class='ss'>:characters</span><span class='o'>]</span> <span class='o'>&amp;&amp;</span> <span class='o'>!</span><span class='n'>person</span><span class='o'>[</span><span class='ss'>:characters</span><span class='o'>].</span><span class='n'>empty?</span> <span class='nb'>print</span> <span class='s2'>&quot;</span><span class='se'>\t</span><span class='si'>#{</span><span class='n'>person</span><span class='o'>[</span><span class='ss'>:characters</span><span class='o'>]</span><span class='si'>}</span><span class='s2'> portrayed by &quot;</span> <span class='k'>else</span> <span class='nb'>print</span> <span class='s2'>&quot;</span><span class='se'>\t</span><span class='s2'>&quot;</span> <span class='k'>end</span> <span class='nb'>puts</span> <span class='s2'>&quot;</span><span class='si'>#{</span><span class='n'>person</span><span class='o'>[</span><span class='ss'>:name</span><span class='o'>]</span><span class='si'>}</span><span class='s2'>&quot;</span> <span class='k'>end</span> <span class='k'>end</span> <span class='c1'># Alternatively, people can be accessed by role</span> <span class='c1'># like so:</span> <span class='c1'># movie.cast.each do |cast_member|</span> <span class='c1'># p cast_member</span> <span class='c1'># end</span> <span class='c1'># movie.writers.each do |writer|</span> <span class='c1'># p writer</span> <span class='c1'># end</span> <span class='c1'># movie.directors.each do |director|</span> <span class='c1'># p director</span> <span class='c1'># end</span> <span class='c1'>#</span> <span class='c1'># you can also just:</span> <span class='c1'># p movie.writer</span> <span class='c1'># and</span> <span class='c1'># p movie.director</span> </code></pre> </div> <p>For anyone interested, the <a href='http://github.com/re5et/rotten-tomatoes'>git repo is here</a></p> Local User Customizable Keyboard Shortcuts 2010-10-09T00:00:00-07:00 http://trickeries.com.com//archive/local-user-customizable-keyboard-shortcuts <p>Another thing I wanted for a project that I didn&#8217;t see out there so I made it. <a href='http://github.com/re5et/UserKeyboardShortcuts'>UserKeyboardShortcuts</a> is a refactor of the <a href='http://mootools.net/docs/more/Interface/Keyboard'>Keyboard</a> class provided by mootools-more. It makes it easy for you to provide local user-customizable keyboard shortcuts for your users that you don&#8217;t have to care about.</p> <p>You just use <a href='http://mootools.net/docs/more/Interface/Keyboard.Extras#Keyboard:addShortcut'>Keyboard.addShortcuts</a> (provided by <a href='http://mootools.net/docs/more/Interface/Keyboard.Extras'>Keyboard.Extras</a>) as you usually would, then the user can change the keys to their liking. The assignments they make will be stored using localStorage (failing that a cookie) and will be restored on each subsequent page load.</p> <h4 id='demonstration'><a href='http://re5et.github.com/projects/userKeyboardShortcuts/demo/'>Demonstration</a></h4> <h4 id='how_to_use'>How to use</h4> <p>Create a new UserKeyboardShortcuts instance:</p> <div class='highlight'><pre><code class='js'><span class='kd'>var</span> <span class='nx'>myKeyboard</span> <span class='o'>=</span> <span class='k'>new</span> <span class='nx'>UserKeyboardShortcuts</span><span class='p'>();</span> </code></pre> </div> <p>Add some shortcuts:</p> <div class='highlight'><pre><code class='js'><span class='nx'>myKeyboard</span><span class='p'>.</span><span class='nx'>addShortcuts</span><span class='p'>({</span> <span class='s1'>&#39;logSomething&#39;</span><span class='o'>:</span> <span class='p'>{</span> <span class='s1'>&#39;keys&#39;</span><span class='o'>:</span> <span class='s1'>&#39;ctrl+alt+l&#39;</span><span class='p'>,</span> <span class='s1'>&#39;description&#39;</span><span class='o'>:</span> <span class='s1'>&#39;logs &quot;something&quot;.&#39;</span><span class='p'>,</span> <span class='s1'>&#39;handler&#39;</span><span class='o'>:</span> <span class='kd'>function</span><span class='p'>(){</span> <span class='nx'>console</span><span class='p'>.</span><span class='nx'>log</span><span class='p'>(</span><span class='s1'>&#39;something&#39;</span><span class='p'>);</span> <span class='p'>}</span> <span class='p'>},</span> <span class='s1'>&#39;alertSomething&#39;</span><span class='o'>:</span> <span class='p'>{</span> <span class='s1'>&#39;keys&#39;</span><span class='o'>:</span> <span class='s1'>&#39;a&#39;</span><span class='p'>,</span> <span class='s1'>&#39;description&#39;</span><span class='o'>:</span> <span class='s1'>&#39;alerts &quot;something&quot;&#39;</span><span class='p'>,</span> <span class='s1'>&#39;handler&#39;</span><span class='o'>:</span> <span class='kd'>function</span><span class='p'>(){</span> <span class='nx'>alert</span><span class='p'>(</span><span class='s1'>&#39;something&#39;</span><span class='p'>);</span> <span class='p'>}</span> <span class='p'>}</span> <span class='p'>});</span> </code></pre> </div> <p>If you want an easy way for users to show and change the shortcuts, you can run:</p> <div class='highlight'><pre><code class='js'><span class='nx'>myKeyboard</span><span class='p'>.</span><span class='nx'>showAndChange</span><span class='p'>();</span> </code></pre> </div> <p>You can restore the default shortcuts with this:</p> <div class='highlight'><pre><code class='js'><span class='nx'>myKeyboard</span><span class='p'>.</span><span class='nx'>restoreDefaults</span><span class='p'>();</span> </code></pre> </div> <p>You can also just add the two above methods as shortcuts for users to use:</p> <div class='highlight'><pre><code class='js'><span class='nx'>myKeyboard</span><span class='p'>.</span><span class='nx'>addShortcut</span><span class='p'>(</span><span class='s1'>&#39;showAndChangeShortcuts&#39;</span><span class='p'>,</span> <span class='p'>{</span> <span class='s1'>&#39;keys&#39;</span><span class='o'>:</span> <span class='s1'>&#39;m&#39;</span><span class='p'>,</span> <span class='s1'>&#39;description&#39;</span><span class='o'>:</span> <span class='s1'>&#39;Toggle this menu.&#39;</span><span class='p'>,</span> <span class='s1'>&#39;handler&#39;</span><span class='o'>:</span> <span class='nx'>myKeyboard</span><span class='p'>.</span><span class='nx'>showAndChange</span> <span class='p'>});</span> </code></pre> </div> <p>and</p> <div class='highlight'><pre><code class='js'><span class='nx'>myKeyboard</span><span class='p'>.</span><span class='nx'>addShortcut</span><span class='p'>(</span><span class='s1'>&#39;restoreDefaults&#39;</span><span class='p'>,</span> <span class='p'>{</span> <span class='s1'>&#39;keys&#39;</span><span class='o'>:</span> <span class='s1'>&#39;d&#39;</span><span class='p'>,</span> <span class='s1'>&#39;description&#39;</span><span class='o'>:</span> <span class='s1'>&#39;Restore default shortcuts.&#39;</span><span class='p'>,</span> <span class='s1'>&#39;handler&#39;</span><span class='o'>:</span> <span class='nx'>myKeyboard</span><span class='p'>.</span><span class='nx'>restoreDefaults</span> <span class='p'>});</span> </code></pre> </div> <p>Since this is a refactor of <a href='http://mootools.net/docs/more/Interface/Keyboard'>Keyboard</a>, knowing how to use <a href='http://mootools.net/docs/more/Interface/Keyboard'>Keyboard</a> and <a href='http://mootools.net/docs/more/Interface/Keyboard.Extras'>Keyboard.Extras</a> will help quite a bit.</p> Menuify Mootools Keyboard Navigable Menus 2010-10-06T00:00:00-07:00 http://trickeries.com.com//archive/menuify-mootools-keyboard-navigable-menus <p><a href='http://github.com/re5et/Menuify'>Menuify</a> is a MooTools class that allows you to create keyboard navigable menus from groups of elements. I made this because I hace a number of projects coming down the line that I want to be able to use well with my keyboard.</p> <p>The main idea is to utilize existing brower features to achieve this, with a few added benefits. Most everything is handled with the html attribute &#8216;tabindex&#8217; and the css pseudo selector &#8216;:focus&#8217;. The extras include adding arrow key navigation, as well as tabindex management so it doesn&#8217;t screw with what is already there. Checkout the demo below, or an extended demo here.</p> <div class='eval-example-code'> <div class='highlight'><pre><code class='js'><span class='k'>new</span> <span class='nx'>Menuify</span><span class='p'>(</span><span class='nx'>$$</span><span class='p'>(</span><span class='s1'>&#39;#menu1 li&#39;</span><span class='p'>));</span> </code></pre> </div> </div><ul id='menu1'> <li>click to focus</li> <li>or tab here</li> <li>This</li> <li>is</li> <li>my</li> <li>simple</li> <li>menu</li> </ul> <p>The menu below is a tad more complex. When focused the menu items will show the RGB value of the hexidecimal html color representation shown, and change the border-color.</p> <div class='eval-example-code'> <div class='highlight'><pre><code class='js'><span class='k'>new</span> <span class='nx'>Menuify</span><span class='p'>(</span><span class='nx'>$$</span><span class='p'>(</span><span class='s1'>&#39;#menu2 li&#39;</span><span class='p'>)).</span><span class='nx'>addEvents</span><span class='p'>({</span> <span class='s1'>&#39;focus&#39;</span><span class='o'>:</span> <span class='kd'>function</span><span class='p'>(</span><span class='nx'>item</span><span class='p'>){</span> <span class='nx'>item</span><span class='p'>.</span><span class='nx'>set</span><span class='p'>(</span><span class='s1'>&#39;text&#39;</span><span class='p'>,</span> <span class='nx'>item</span><span class='p'>.</span><span class='nx'>get</span><span class='p'>(</span><span class='s1'>&#39;text&#39;</span><span class='p'>).</span><span class='nx'>hexToRgb</span><span class='p'>())</span> <span class='nx'>item</span><span class='p'>.</span><span class='nx'>setStyle</span><span class='p'>(</span><span class='s1'>&#39;border-color&#39;</span><span class='p'>,</span> <span class='nx'>item</span><span class='p'>.</span><span class='nx'>get</span><span class='p'>(</span><span class='s1'>&#39;text&#39;</span><span class='p'>));</span> <span class='p'>},</span> <span class='s1'>&#39;blur&#39;</span><span class='o'>:</span> <span class='kd'>function</span><span class='p'>(</span><span class='nx'>item</span><span class='p'>){</span> <span class='nx'>item</span><span class='p'>.</span><span class='nx'>set</span><span class='p'>(</span><span class='s1'>&#39;text&#39;</span><span class='p'>,</span> <span class='nx'>item</span><span class='p'>.</span><span class='nx'>get</span><span class='p'>(</span><span class='s1'>&#39;text&#39;</span><span class='p'>).</span><span class='nx'>rgbToHex</span><span class='p'>())</span> <span class='p'>},</span> <span class='s1'>&#39;keypress&#39;</span><span class='o'>:</span> <span class='kd'>function</span><span class='p'>(</span><span class='nx'>item</span><span class='p'>,</span> <span class='nx'>event</span><span class='p'>){</span> <span class='k'>if</span><span class='p'>(</span><span class='nx'>event</span><span class='p'>.</span><span class='nx'>key</span> <span class='o'>==</span> <span class='s1'>&#39;+&#39;</span><span class='p'>){</span> <span class='kd'>var</span> <span class='nx'>width</span> <span class='o'>=</span> <span class='nx'>item</span><span class='p'>.</span><span class='nx'>getStyle</span><span class='p'>(</span><span class='s1'>&#39;border-width&#39;</span><span class='p'>);</span> <span class='nx'>item</span><span class='p'>.</span><span class='nx'>setStyle</span><span class='p'>(</span><span class='s1'>&#39;border-width&#39;</span><span class='p'>,</span> <span class='nx'>width</span><span class='p'>.</span><span class='nx'>replace</span><span class='p'>(</span><span class='s1'>&#39;px&#39;</span><span class='p'>,</span> <span class='s1'>&#39;&#39;</span><span class='p'>).</span><span class='nx'>toInt</span><span class='p'>()</span> <span class='o'>+</span> <span class='mi'>1</span> <span class='o'>+</span> <span class='s1'>&#39;px&#39;</span><span class='p'>)</span> <span class='p'>}</span> <span class='p'>}</span> <span class='p'>});</span> </code></pre> </div> </div> <p>Pressing the &#8217;+&#8217; key will thicken the border.</p> <ul id='menu2'> <li>#ff00ff</li> <li>#00ff00</li> <li>#0000ff</li> <li>#ffff00</li> <li>#ff6600</li> <li>#0066ff</li> <li>#6600ff</li> <li>#ff0066</li> </ul> <p>Download or get more into it: <a href='http://github.com/re5et/Menuify'>github repo is here.</a></p> Github Repo Widget And Hovercards With Mootools 2010-10-02T00:00:00-07:00 http://trickeries.com.com//archive/github-repo-widget-and-hovercards-with-mootools <p>I wanted something like this but couldn&#8217;t find it anywhere so I made a MooTools class for it. This uses Request.JSONP to make a remote call to the github api to grab information about a repo.</p> <p>It can be used like so:</p> <div class='eval-example-code'> <div class='highlight'><pre><code class='js'><span class='kd'>var</span> <span class='nx'>myRepoWidget</span> <span class='o'>=</span> <span class='k'>new</span> <span class='nx'>GithubRepoWidget</span><span class='p'>(</span><span class='s1'>&#39;mootools&#39;</span><span class='p'>,</span> <span class='s1'>&#39;mootools-more&#39;</span><span class='p'>);</span> <span class='nx'>myRepoWidget</span><span class='p'>.</span><span class='nx'>addEvent</span><span class='p'>(</span><span class='s1'>&#39;complete&#39;</span><span class='p'>,</span> <span class='kd'>function</span><span class='p'>(</span><span class='nx'>response</span><span class='p'>,</span> <span class='nx'>widget</span><span class='p'>){</span> <span class='nx'>$</span><span class='p'>(</span><span class='s1'>&#39;myElement&#39;</span><span class='p'>).</span><span class='nx'>grab</span><span class='p'>(</span><span class='nx'>widget</span><span class='p'>);</span> <span class='p'>});</span> </code></pre> </div> </div> <p>That should output something like this &#8595;</p> <div id='myElement'> </div> <p>or you can:</p> <div class='highlight'><pre><code class='js'><span class='kd'>var</span> <span class='nx'>myRepoWidget</span> <span class='o'>=</span> <span class='k'>new</span> <span class='nx'>GithubRepoWidget</span><span class='p'>(</span><span class='s1'>&#39;re5et&#39;</span><span class='p'>,</span> <span class='s1'>&#39;.dotfiles&#39;</span><span class='p'>,</span> <span class='p'>{</span> <span class='s1'>&#39;injectInto&#39;</span><span class='o'>:</span> <span class='nx'>$</span><span class='p'>(</span><span class='s1'>&#39;myElement&#39;</span><span class='p'>)</span> <span class='p'>});</span> </code></pre> </div> <p>My favorite feature is the hovercards static method, which will automatically find links to github repos in your page and fix a hovercard to them.</p> <p><a href='http://github.com/mootools/mootools-core'>Hover this link for an example</a>. All you have to do is:</p> <div class='highlight'><pre><code class='js'><span class='nx'>GithubRepoWidget</span><span class='p'>.</span><span class='nx'>hovercards</span><span class='p'>()</span> </code></pre> </div> <p>For more deftailed documentation and source code / images / css, head over to <a href='http://github.com/re5et/github-repo-widgets'>the repo for this on github</a>.</p> Simple is my new fancy. 2010-10-01T00:00:00-07:00 http://trickeries.com.com//archive/simple-is-my-new-fancy <p>My tastes have been changing a great deal over the past year and I figured it was high time I updated my site. I used to run WordPress, but I don&#8217;t really care for it anymore. I also haven&#8217;t touched PHP since I left my last position in July, and I couldn&#8217;t be more pleased with that. I was getting quite sick of it in general.</p> <p>I have been getting into things that are new and exciting for me since then, chiefly: Ruby and LISP, and the many things which go with those. This experience has been wonderful. I used to be of the opinion that I should focus my efforts on a single language(JavaScript), and be great at that. The whole &#8220;jack of all trades, master of none&#8221; thing. I have since had my mind changed, trying to follow my coder heroes, that hyperpolyglotism is the way to go. Learning a wide variety of languages makes you better at all of them.</p> <p>My site is now generated with Jekyll, and is (server side wise) totally static, and is just served up. A site that doesn&#8217;t do anything doesn&#8217;t do anything stupid. I am quite pleased with how simple it is, and it generally just feels right so far. I use the things I use for everything else to manage my blog, and don&#8217;t have to deal with a ridiculous leviathan application to do something that should be simple.</p> <p>I ditched my old posts, mostly because I didn&#8217;t care about much of it, and got rid of previous comments. Sorry to anyone who said anything clever or useful.</p> <p>Ruby is super duper awesome and I am really getting into it. I have a few gems in the works for a larger project I am working towards. Coming from a crusty stale world like PHP Ruby feels magical and refreshing. I used to miss JavaScript when I was writing PHP, now I miss Ruby when I am writing JavaScript.</p> <p>I have been getting into LISP mainly because I use emacs as my editor (being that it is the one true editor) and stumpwm (because I like emacs so much). Being able to change the whole deal of either on the fly is one of those things that keeps computing fun.</p> <p>In general I have begun to eschew fanceries and complexity for minimalism. I have stopped using a mouse in exchange for the efficiency of the keyboard. I used to have an insane compiz setup with spinning cubes and shit tons of animation and explosions, and now I have almost nothing. I used to have a wacky indulgent website theme, and now I have this, which was designed to look and feel like my terminal / emacs theme. There is a manner of zen-like freedom that comes with ditching the fluff in exchange for the bare necessities.</p> <p>Anyhow, the only reason that I have finally gotten around to updating this site is that I have been working on some stuff lately that I really like, and I need a place to prattle on about it. I look forward to posting more soon and continuing my crawl down the never-ending path of hacker enlightenment.</p>