<?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>notes so i can remember the little but useful things i’ve done</description><title>pggbee</title><generator>Tumblr (3.0; @pggbee)</generator><link>http://blog.pggbee.com/</link><item><title>Merbivore and Merbivore Soft</title><description>&lt;p&gt;I just posted two of my favorite, everyday themes to the &lt;a href="http://macromates.com"&gt;TextMate&lt;/a&gt; &lt;a href="http://wiki.macromates.com/Themes/UserSubmittedThemes"&gt;Themes Gallery&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;These colors are based on the old &lt;a href="http://merbivore.com"&gt;Merbivore&lt;/a&gt; wiki site.&lt;/p&gt;

&lt;p&gt;I’ve got an emacs color theme too on my github, get it here: &lt;a href="http://github.com/mig/color-theme-merbivore"&gt;color-theme-merbivore&lt;/a&gt;, that one is more a work in progress.&lt;/p&gt;</description><link>http://blog.pggbee.com/post/70479771</link><guid>http://blog.pggbee.com/post/70479771</guid><pubDate>Wed, 14 Jan 2009 13:47:57 -0500</pubDate></item><item><title>meta key xmodmap ubuntu w/ a mac keyboard fix</title><description>&lt;p&gt;I like using the apple Command key as both Alt and Meta in ubuntu.  This makes switching windows feel the same as it does in OS X and makes the Command key act as the Meta key in Emacs.&lt;/p&gt;

&lt;p&gt;The current “Layout Options” dialog in the Keyboard Preferences is a nice GUI to xmodmap, unfortunately, when you remap Alt to the Command key, Emacs picks it up as the Super key, which is a huge bummer.&lt;/p&gt;

&lt;p&gt;All I had to do in the end is create a ~/.Xmodmap file and use this configuration:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;! set the proper order for keys mapped to the apple command key
clear mod1
add mod1 = Meta_L Super_L Alt_L
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;All fixed!&lt;/p&gt;</description><link>http://blog.pggbee.com/post/67712458</link><guid>http://blog.pggbee.com/post/67712458</guid><pubDate>Wed, 31 Dec 2008 15:30:01 -0500</pubDate></item><item><title>emacs-rails-kit</title><description>&lt;h3&gt;Inspiration&lt;/h3&gt;

&lt;p&gt;After watching the &lt;a href="http://peepcode.com/products/meet-emacs"&gt;Meet Emacs&lt;/a&gt; screencast, I’ve been giving emacs another whirl.  I’m a new-school programmer, ruby being the first language that I’ve actually programmed for a living.  So &lt;a href="http://macromates.com"&gt;TextMate&lt;/a&gt; has been pretty much all I’ve known.&lt;/p&gt;

&lt;h3&gt;emacs-rails-kit&lt;/h3&gt;

&lt;p&gt;I’ve started building an emacs configuration, that should be general enough for the uses of most ruby/rails programmers.  The configuration is based primarily on &lt;a href="http://technomancy.us/"&gt;technomancy’s&lt;/a&gt; &lt;a href="http://github.com/technomancy/emacs-starter-kit"&gt;emacs-starter-kit&lt;/a&gt;, I’m trying to keep it as stripped down as possible though.  It can be found on github: &lt;a href="http://github.com/mig/emacs-rails-kit"&gt;emacs-rails-kit&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;It should be enough so that the ruby/rails programmer can be up and running in just a few minutes.  Note, it is currently a work in development, but it IS certainly usable in it’s current state.  I am using every day at work, and it’s been great.  Have fun.&lt;/p&gt;</description><link>http://blog.pggbee.com/post/67415572</link><guid>http://blog.pggbee.com/post/67415572</guid><pubDate>Mon, 29 Dec 2008 22:05:00 -0500</pubDate></item><item><title>Setting Font in Carbon Emacs</title><description>&lt;p&gt;Within emacs:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;M-x mac-font-panel-mode
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Choose your desired font&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;M-x describe-font
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Copy the X font string&lt;/p&gt;

&lt;p&gt;Then add a line to your emacs config&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;(set-face-font 'default "-apple-bitstream vera sans mono-medium-r-normal--14-0-72-72-m-0-iso10646-1")
&lt;/code&gt;&lt;/pre&gt;</description><link>http://blog.pggbee.com/post/64990860</link><guid>http://blog.pggbee.com/post/64990860</guid><pubDate>Mon, 15 Dec 2008 12:08:00 -0500</pubDate></item><item><title>Installing geoip-ruby on Leopard</title><description>&lt;p&gt;Using GeoIP libraries in Ruby is easy….&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;curl -O &lt;a href="http://geolite.maxmind.com/download/geoip/api/c/GeoIP-1.4.5.tar.gz"&gt;http://geolite.maxmind.com/download/geoip/api/c/GeoIP-1.4.5.tar.gz&lt;/a&gt;
tar xvzf GeoIP-1.4.5.tar.gz
cd GeoIP-1.4.5/
./configure --prefix=/usr/local
make
sudo make install
sudo gem i geoip

curl -O &lt;a href="http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz"&gt;http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz&lt;/a&gt;
gunzip GeoLiteCity.dat.gz
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Then you can just do something like this in your application:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;require 'rubygems'
require 'geoip'

g = GeoIP.new(PATH_TO + "/GeoLiteCity.dat")
g.city("google.com")
=&gt; ["google.com", "209.85.171.100", "US", "USA", "United States", "NA", "CA", "Mountain View", "94043", 37.4192, -122.0574, 807, 650]
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Easy&lt;/p&gt;</description><link>http://blog.pggbee.com/post/63976715</link><guid>http://blog.pggbee.com/post/63976715</guid><pubDate>Tue, 09 Dec 2008 18:02:00 -0500</pubDate></item><item><title>Pragmatic Bash Scripts</title><description>&lt;a href="http://pragmactic-osxer.blogspot.com/2008/06/pimp-my-shell.html"&gt;Pragmatic Bash Scripts&lt;/a&gt;: &lt;p&gt;Best thing to happen to me in a long time.  In the terminal, that is.&lt;/p&gt;</description><link>http://blog.pggbee.com/post/61539087</link><guid>http://blog.pggbee.com/post/61539087</guid><pubDate>Tue, 25 Nov 2008 14:35:20 -0500</pubDate></item><item><title>Using paperclip with ImageMagick on Leopard</title><description>&lt;p&gt;Thoughtbot’s &lt;a href="http://github.com/thoughtbot/paperclip"&gt;paperclip&lt;/a&gt; plugin does not need ImageMagick unless you want to start resizing and cropping image attachments.&lt;/p&gt;

&lt;p&gt;After &lt;a href="http://www.aldenta.com/2007/11/26/installing-imagemagickrmagick-on-leopard/"&gt;installing ImageMagick&lt;/a&gt; on leopard, I had to add this initializer to config/initializers in order for paperclip to find my ImageMagick binaries.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;# config/initializers/paperclip.rb
Paperclip.options[:image_magick_path] = "/usr/local/bin"
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;After that, it worked fine.&lt;/p&gt;</description><link>http://blog.pggbee.com/post/60768417</link><guid>http://blog.pggbee.com/post/60768417</guid><pubDate>Thu, 20 Nov 2008 19:03:00 -0500</pubDate></item><item><title>Installing Ultraviolet Gem</title><description>&lt;p&gt;Ultraviolet gem needs the &lt;a href="http://www.geocities.jp/kosako3/oniguruma/"&gt;oniguruma&lt;/a&gt; library installed.&lt;/p&gt;

&lt;p&gt;In Leopard:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;$ curl -O &lt;a href="http://www.geocities.jp/kosako3/oniguruma/archive/onig-5.8.0.tar.gz"&gt;http://www.geocities.jp/kosako3/oniguruma/archive/onig-5.8.0.tar.gz&lt;/a&gt;
$ tar xvzf onig-5.8.0.tar.gz
$ cd onig-5.8.0/
$ ./configure --prefix=/usr/local
$ make
$ sudo make install
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Easy, you can then install the ultraviolet gem the normal way:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;$ sudo gem i ultraviolet
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;In Ubuntu:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;$ sudo apt-get install libonig2 libonig-dev
$ sudo gem i ultraviolet
&lt;/code&gt;&lt;/pre&gt;</description><link>http://blog.pggbee.com/post/60768119</link><guid>http://blog.pggbee.com/post/60768119</guid><pubDate>Thu, 20 Nov 2008 19:00:00 -0500</pubDate></item><item><title>acts_as_state_machine (AASM) and factory_girl</title><description>&lt;p&gt;I was having trouble with initial states and factories on a recent project.  I wanted to set the state of a factory object, but no matter what, it would be overwritten immediately.&lt;/p&gt;

&lt;p&gt;The easiest solution I found is stubbing out set_initial_state on whatever model is carrying the state.&lt;/p&gt;

&lt;p&gt;For example, if Order had state.  In our order test:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;require 'mocha'
class OrderTest &lt; ActiveSupport::TestCase
  def setup
    Order.any_instance.stubs(:set_initial_state)
    @order = Factory(:order, :state =&gt; "other_state")
  end

  ...
end
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Now, when you create your factory, the state will be set to whatever you pass it.&lt;/p&gt;</description><link>http://blog.pggbee.com/post/60249296</link><guid>http://blog.pggbee.com/post/60249296</guid><pubDate>Tue, 18 Nov 2008 02:11:29 -0500</pubDate></item><item><title>Beethoven - Piano Sonata No 8, Op 13</title><description>&lt;embed type="application/x-shockwave-flash" src="http://blog.pggbee.com/swf/audio_player.swf?audio_file=http://www.tumblr.com/audio_file/60248629/MPinQqTlbgfqxkfmfJFlTywG&amp;color=FFFFFF" height="27" width="207" quality="best"&gt;&lt;/embed&gt;&lt;br/&gt;&lt;br/&gt;&lt;p&gt;Beethoven - Piano Sonata No 8, Op 13&lt;/p&gt;</description><link>http://blog.pggbee.com/post/60248629</link><guid>http://blog.pggbee.com/post/60248629</guid><pubDate>Tue, 18 Nov 2008 02:05:00 -0500</pubDate></item><item><title>Using Mocha in Development is Handy</title><description>&lt;p&gt;I wanted to manually run a script, that was going to be setup as a cronjob.  This script looked for order objects in the database, having a delivery_date in the next 24 hours.&lt;/p&gt;

&lt;p&gt;I wanted to test this script, and the orders that it pulled back for processing, however, almost all of the delivery_dates we days in advance, so I just used mocha…&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;require 'mocha'
Time.stubs(:now).returns("11/20/2008 16:00:00".to_time)
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;That way I can just run the script, and mocha will make my call to Time.now thing that it is indeed November 20th 2008 at 4pm.&lt;/p&gt;</description><link>http://blog.pggbee.com/post/60248165</link><guid>http://blog.pggbee.com/post/60248165</guid><pubDate>Tue, 18 Nov 2008 02:01:15 -0500</pubDate></item><item><title>Morgen</title><description>&lt;p&gt;I am starting to change shape&lt;/p&gt;</description><link>http://blog.pggbee.com/post/60048208</link><guid>http://blog.pggbee.com/post/60048208</guid><pubDate>Sun, 16 Nov 2008 22:50:54 -0500</pubDate></item><item><title>The Essence of ARBWOT</title><description>&lt;p&gt;module ActiveRecord
    class BaseWithoutTable &lt; Base
      self.abstract_class = true&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;  def create_or_update
    errors.empty?
  end

  class &lt;&lt; self
    def columns()
      @columns ||= []
    end

    def column(name, sql_type = nil, default = nil, null = true)
      columns &lt;&lt; ActiveRecord::ConnectionAdapters::Column.new(name.to_s, default, sql_type.to_s, null)
      reset_column_information
    end

    # Do not reset @columns
    def reset_column_information
      generated_methods.each { |name| undef_method(name) }
      @column_names = @columns_hash = @content_columns = @dynamic_methods_hash = @read_methods = nil
    end
  end
end
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;end&lt;/p&gt;</description><link>http://blog.pggbee.com/post/59194585</link><guid>http://blog.pggbee.com/post/59194585</guid><pubDate>Tue, 11 Nov 2008 14:41:00 -0500</pubDate></item><item><title>Pretty Mary K (Other Version)</title><description>&lt;embed type="application/x-shockwave-flash" src="http://blog.pggbee.com/swf/audio_player.swf?audio_file=http://www.tumblr.com/audio_file/59194341/MPinQqTlbg6hqngmgZzT2fDr&amp;color=FFFFFF" height="27" width="207" quality="best"&gt;&lt;/embed&gt;&lt;br/&gt;&lt;br/&gt;&lt;p&gt;Pretty Mary K (Other Version)&lt;/p&gt;</description><link>http://blog.pggbee.com/post/59194341</link><guid>http://blog.pggbee.com/post/59194341</guid><pubDate>Tue, 11 Nov 2008 14:38:31 -0500</pubDate></item><item><title>"Going to go down in the water,
fill my mouth up full of sand.
I’ll be waiting still impatient..."</title><description>“Going to go down in the water,
fill my mouth up full of sand.
I’ll be waiting still impatient with my dead imagination while you’re with some other man.”</description><link>http://blog.pggbee.com/post/59194273</link><guid>http://blog.pggbee.com/post/59194273</guid><pubDate>Tue, 11 Nov 2008 14:37:42 -0500</pubDate></item><item><title>Create getters and setters from a ActiveRecord serialized db column</title><description>&lt;p&gt;class Blog &lt; ActiveRecord::Base
      serialize :metadata&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;  class &lt;&lt; self
    def attr_serialized_on(column, *attributes)
      attributes.each do |a|
        class_eval do
          define_method(a) { meta(a) }
          define_method(a.to_s + "=(value)") { metadata[a] = value }
        end
      end
    end
  end

  def meta(key)
    metadata[key]
  end

  attr_serialized_on(:metadata, :title, :subtitle, :background, :foreground)

end
&lt;/code&gt;&lt;/pre&gt;</description><link>http://blog.pggbee.com/post/55500918</link><guid>http://blog.pggbee.com/post/55500918</guid><pubDate>Mon, 20 Oct 2008 17:30:00 -0400</pubDate></item><item><title>Fingerapp.com | Rails Rumble 08</title><description>&lt;p&gt;With the help of my good friends, I’ve created &lt;a href="http://fingerapp.com"&gt;http://fingerapp.com&lt;/a&gt; for &lt;a href="http://railsrumble.com"&gt;railsrumble&lt;/a&gt;, it’s not perfect, needs work, but I’m proud of what we were able to build in 48 hours.  Thanks Tony, Chris, and Owen.&lt;/p&gt;</description><link>http://blog.pggbee.com/post/55385060</link><guid>http://blog.pggbee.com/post/55385060</guid><pubDate>Mon, 20 Oct 2008 01:03:03 -0400</pubDate></item><item><title>In my tux going to my buddy Steve Ds wedding.</title><description>&lt;img src="http://24.media.tumblr.com/MPinQqTlbey44svmutIZj7Hgo1_400.png"/&gt;&lt;br/&gt;&lt;br/&gt;&lt;p&gt;In my tux going to my buddy Steve Ds wedding.&lt;/p&gt;</description><link>http://blog.pggbee.com/post/54109643</link><guid>http://blog.pggbee.com/post/54109643</guid><pubDate>Sat, 11 Oct 2008 14:14:32 -0400</pubDate></item><item><title>This morning in bed</title><description>&lt;img src="http://25.media.tumblr.com/MPinQqTlbeu1lrc0FcmiGsPBo1_400.png"/&gt;&lt;br/&gt;&lt;br/&gt;&lt;p&gt;This morning in bed&lt;/p&gt;</description><link>http://blog.pggbee.com/post/53682141</link><guid>http://blog.pggbee.com/post/53682141</guid><pubDate>Wed, 08 Oct 2008 17:53:17 -0400</pubDate></item><item><title>"Hey dean! James Dean wore jeans, dean!"</title><description>“Hey dean! James Dean wore jeans, dean!”&lt;br/&gt;&lt;br/&gt; - &lt;em&gt;Steve D&lt;/em&gt;</description><link>http://blog.pggbee.com/post/53677794</link><guid>http://blog.pggbee.com/post/53677794</guid><pubDate>Wed, 08 Oct 2008 17:15:42 -0400</pubDate></item></channel></rss>
