<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DZone Snippets: Justinwr's Code Snippets</title>
    <link>http://snippets.dzone.com/posts</link>
    <pubDate>Sat, 17 May 2008 14:10:37 GMT</pubDate>
    <description>DZone Snippets: Justinwr's Code Snippets</description>
    <item>
      <title>Really Kill Rails (as well as Restart)</title>
      <link>http://snippets.dzone.com/posts/show/5002</link>
      <description>More lovely alias commands... this time to kill/restart Rail's script/server from any Terminal session or login on your box... (as long as your the same user).&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;alias dierails='ps -a|grep "/usr/local/bin/ruby script/server"|grep -v "grep /usr"|cut -d " " -f1|xargs -n 1 kill -KILL $1'&lt;br /&gt;alias resetrails='ps -a|grep "/usr/local/bin/ruby script/server"|grep -v "grep /usr"|cut -d " " -f1|xargs -n 1 kill -HUP $1'&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Fri, 18 Jan 2008 04:11:20 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/5002</guid>
      <author>justinwr (Justin R)</author>
    </item>
    <item>
      <title>Archive Flagged Items from NetNewsWire into Yojimbo</title>
      <link>http://snippets.dzone.com/posts/show/5001</link>
      <description>This lil Ruby-OSA script will allow you to import your "Flagged Items" in NetNewsWire as Web Archive Items in Yojimbo. Thus allowing you to save RSS articles for off-line viewing/storage.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;#!/usr/local/bin/ruby&lt;br /&gt;['rubygems', 'rbosa'].each {|lib| require lib}&lt;br /&gt;nnw = OSA.app('NetNewsWire')&lt;br /&gt;yojimbo = OSA.app('Yojimbo')&lt;br /&gt;&lt;br /&gt;nnw.subscriptions.find { |s| s if s.display_name == 'Flagged Items' }.headlines.each do |article|&lt;br /&gt;  unless yojimbo.web_archive_items.map { |f| f.source_url }.include?(article.url)&lt;br /&gt;    archived = yojimbo.make(OSA::Yojimbo::WebArchiveItem, &lt;br /&gt;                            article.url, &lt;br /&gt;                            :name =&gt; article.title)&lt;br /&gt;    # Adjust this for slower/faster bandwidth connections (or your feeling lucky, punk)&lt;br /&gt;    sleep(5)&lt;br /&gt;    # Uncomment below to remove the flagged items upon successfully archiving&lt;br /&gt;    # if archived.name == 'untitled' &amp;&amp; archived.source_url.empty?&lt;br /&gt;    #   puts "!!! #{article.title} does not look to be imported !!!"&lt;br /&gt;    # else&lt;br /&gt;    #   article.delete&lt;br /&gt;    # end&lt;br /&gt;  end&lt;br /&gt;end&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Fri, 18 Jan 2008 04:02:07 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/5001</guid>
      <author>justinwr (Justin R)</author>
    </item>
    <item>
      <title>Alias to a Nice Default Gitk</title>
      <link>http://snippets.dzone.com/posts/show/4992</link>
      <description>Just a really quick and easy shell alias for my preferred defaults for Git's repository and branch viewer, Gitk.&lt;br /&gt;&lt;br /&gt;This runs "gitk"...&lt;br /&gt;...including all branches,&lt;br /&gt;...outputting errors to the black hole,&lt;br /&gt;...and any extra command-line arguments.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;# Run like this&lt;br /&gt;# gitk --since="2 days ago" &amp;&lt;br /&gt;&lt;br /&gt;alias gitk="gitk --all $1 2&gt;/dev/null"&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Thu, 17 Jan 2008 04:44:18 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/4992</guid>
      <author>justinwr (Justin R)</author>
    </item>
    <item>
      <title>Recursively Remove .DS_Store files in OS X</title>
      <link>http://snippets.dzone.com/posts/show/4982</link>
      <description>This shell alias will recursively remove all .DS_Store files from the current directory up.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;alias rmdsstores='find ./ -type f | grep .DS_Store | xargs rm'&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Mon, 14 Jan 2008 03:07:29 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/4982</guid>
      <author>justinwr (Justin R)</author>
    </item>
    <item>
      <title>Rails Environment Specific Capistrano Includes/Overrides</title>
      <link>http://snippets.dzone.com/posts/show/4950</link>
      <description>This cap technique allows you to include environment specific tasks and namespaces as well as override anything in the master deploy.rb. Its rather simplistic.&lt;br /&gt;&lt;br /&gt;Add your environment specific cap scripts into RAILS_ROOT/config/deployments/.&lt;br /&gt;&lt;br /&gt;Example command-line usage:&lt;br /&gt;&lt;br /&gt;# RAILS_ENV=production cap deploy&lt;br /&gt;&lt;br /&gt;...or...&lt;br /&gt;&lt;br /&gt;# cap deploy rails_env=beta&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;# Example needed variables at the top of your deploy.rb&lt;br /&gt;&lt;br /&gt;set :default_env,  'beta'&lt;br /&gt;set :rails_env,     ENV['rails_env'] || ENV['RAILS_ENV'] || default_env&lt;br /&gt;set :extra_deploys, 'config/deployments/'&lt;br /&gt;&lt;br /&gt;...&lt;br /&gt;&lt;br /&gt;# Now add this to the bottom of your deploy.rb, last thing to load.&lt;br /&gt;&lt;br /&gt;if extra_deploys &amp;&amp; File.exists?(extra_deploys+rails_env+".rb")&lt;br /&gt;  puts "Loaded #{extra_deploys+rails_env}.rb" if load extra_deploys+rails_env&lt;br /&gt;else&lt;br /&gt;  puts "Could not find #{extra_deploys+rails_env}.rb"&lt;br /&gt;end&lt;br /&gt;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;You may change your default_env or any other piece to fit into your deployments. The secret is "load" method call burried in that latter code portion above. The reason you load at the end of your deploy.rb is so you can override anything defined above that call in your environment specific scripts.</description>
      <pubDate>Sat, 05 Jan 2008 19:21:40 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/4950</guid>
      <author>justinwr (Justin R)</author>
    </item>
    <item>
      <title>Git-diff last two commits through TextMate</title>
      <link>http://snippets.dzone.com/posts/show/4866</link>
      <description>I believe this is how svn diff operates... but anyway, this alias will allow you to diff the last two commits in Git through TextMate. If you have a theme that supports Diff's then you'll see the differences clearly. Remove the last pipe statement (the mate part) to expose your diff in the console.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;alias gitdiff='git log|grep commit|cut -d " " -f2|head -n 2|xargs -n 2 git diff -R|mate'&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Sun, 09 Dec 2007 04:52:30 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/4866</guid>
      <author>justinwr (Justin R)</author>
    </item>
  </channel>
</rss>
