++ Railsflavored

*04/12/2010*

Ruby openssl & readline: I was getting complaints from ruby abount not being compiled with openssl or readline. I had the libraries installed so what’s the deal? Apparently I needed for the compilter to not ask permission to compile the libraries. I did so by adding this

--disable-option-checking

*04/12/2010*

Ubuntu and Github keys: I use a RSA key with my Mac to authenticate with Github but with Ubuntu it would never seem to take. Generating a DSA key did the trick however.

Zsh: I’m finally riding the zshell train. I had bookmarked this set of scripts a long time ago but have finally made the switch. The completions and aliases are fun to use as well as time savers.

Hardlink: Warning, Windows tip here. Hardlink is similar to symbolic linking in Unix. However they decided to reverse the order of the arguments for some reason. There are also some odd flags to designate the source and target.

  hardlink /l:link_file_name /t:target_file_name
  hardlink /l:.gitignore /t:tools/etc/gitignore

*03/30/2010*

Lightweight Desktop for Ubuntu Server: When trying to incorporate Linux into an environment dominated by Windows it helps to do what you can to smooth the transition. One way to do this is to give the even the server a desktop environment.

Now you most likely don’t want the full workstation desktop since it has tons of unnecessary programs for a server like OpenOffice. Here are some packages that give you a basic desktop environment with some useful tools.

This is a single command but I’ve broke it across multiple lines for readability.

  sudo apt-get install 
  compiz-gnome 
  firefox 
  gdm 
  gnome-core 
  gnome-media 
  gnome-system-monitor 
  gnome-system-tools 
  gnome-volume-manager 
  gnome-utils 
  gnome-app-install 
  gnome-applets 
  synaptic 
  sysv-rc-conf
  ubuntu-artwork 
  xorg 

*02/22/2010*

Gathering Logs: I keep my notes in dated folders like this

2010/02/_log.txt

It is a temporal style system where things can slowly fade into history but are still searchable and readily retrievable. When I want to browse through my log notes I just run this.

find . -name \_log.txt | xargs cat | less

Find is recursive by default. The xargs tips the stack of filenames on its side for the cat command. And less gives me vim-like navigability. Couple this with an alias and I’ve got an easy way to go back in time.

*01/29/2010*

Vim spellcheck: Vim has a pretty good spell checker that even draws dashed underlines. To spin it up run

:set spell

Conquering Spaces: For the longest time I was dissatisfied with how spaces on mac would switch to an application that wasn’t in the current workspace. Then I would switch the setting that would turn that off but it would stick make that program the active program in the OS title bar but not give you a window to it at all. Then I found a setting the in the key mappings called “move focus to active or next window”.

This is what I wanted it will cycle only the apps in the current workspace. I didn’t like the default keymapping. I have liked to make it ^tab but that wasn’t possible. So I settled for ^`. It’s like doing a ^tab but just a little bit higher.

*01/12/2010*

Shorthand: I have my own home grown way of taking notes. My goal is to use the same formatting for handwritten notes and text files. I’ve tried plenty of tools like wikis and Things on the Mac but its hard to beat plain text.

I’ve created some highlighting for this in Vim. Here is what it looks like.

++ shorthand

*section*
-item
-Done: completed item
?question
?favor option1 over option2
  +favors option1
  $favors option2
-[person] [askPerson] [date or time] [ file.txt ]
# Comment.
-xxx xxx xxx #End of line comment.
*Bookmark
$unfavorable
$ command-line
  code
<subsection>
// Documentation.
-subject: search mail archive for this subject

*01/08/2010*

Color Test: This is just a highlighting color test. I prefer a high contrast on a dark background.

module HasOneMilestone
  # Notice: has_many_polymorphs are creating two associations for the base
  # class including this module, for example TaskList.
  # 1) has_many :schedules
  # 2) has_many :milestones, :through => :schedules
  #
  # This module wraps the has_many relationship and looks more like a has_one
  # relationship.  It's sort of like
  #    has_one :milestone, :through => :schedules, :polymorphic => true

  def milestone=(milestone)
    transaction do 
      self.schedules = []
      self.milestones << milestone if milestone
    end
  end
  
  def milestone(reload = false)
    self.milestones.first if self.milestones(reload)
  end
  
  # This method must be called for milestone associations to be saved.  This is 
  # because the record id must be generated before it can be associated with 
  # a milestone.
  def commit_milestone
    self.milestone = Milestone.find(@milestone_id) unless @milestone_id.blank?
  end

end