spicycode

The rants and ravings of Chad Humphries.

Languages of interest

I’ve been tinkering with a lot of other languages recently, here are a few of them.  What languages are you looking at?

 ROCamlLisp, and IO

Comments (View)

Standing up: 100% complete

Recently I decided to try a stand up desk again.  I’ve used one a few jobs previous where I had to assemble all manor of electronic devices and rather liked it.   At home this has the duel benefit of keeping me focused, and keeping my son out of my computer equipment.   

I’ll keep you up to date with how it goes.  I’m interested to see how standing at home and sitting at work compare with regards to comfort.  

Comments (View)
Comments (View)
Comments (View)
Install this to twitter from quicksilver hogeLog » Quicksilver Twitter Plugin
Comments (View)
Comments (View)
No one told me there was a Ninjabread man game!  Too bad it’s apparently one of the worst games of the year.
No one told me there was a Ninjabread man game!  Too bad it’s apparently one of the worst games of the year.
Comments (View)
Comments (View)

Bitten By The Hard Breaks Again

Another turn around the textile wheel of fortune in a rails application today yielded a lesson learned long ago but forgotten. The textilize helper included with rails enables the hard_breaks mode by default. Hard Breaks converts 1 new line to a br and 2 newlines to a p tag. When you disable hard breaks mode you only get p tags.

Here’s how the source for that method looks:

def textilize(text)

  if text.blank? "" else textilized = RedCloth.new(text, [ :hard_breaks ])

  textilized.hard_breaks = true if textilized.respond_to?("hard_breaks=") textilized.to_html

end

end

Here’s a simple override of it you can put in your application_helper.rb if you want the no hard breaks behaviour.

def textilize(text)

  if text.blank?

    ""

  else

    RedCloth.new(text).to_html

  end

end

Nothing new, just posting it here as a reminder to myself and a hopefully helpful tip to anyone not yet familiar with this difference.

Comments (View)

Globzilla - Destroyer Of Subversion

At the office today Nick and I tried an experiment. It was a failed one, but who said all news has to be good news? Here’s how it breaks down.

Step 1: Optimal Optimism

Be lazy enough that you don’t want to use one of the plentiful svn add scripts on the net.

Step 2: Arbitrary Assumptions

Decide, hey, I can make that happen with fewer characters!

Step 3: Shiny Shells

Try to run the following in your sleek zsh shell:

svn add **/*

So, this step is awesome! It adds all the new files, while not re-adding existing files. It also has the added benefit of scrolling so much text in your console you have time to get a refreshing drink.

Step 4: Reversion Regret

However, the last step has the added benefit of adding svn ignored files by calling them as explicit targets. This gives us a wonderful experience of learning how to selectly svn revert everything our nuclear svn add option just did.

Step 5: Bowing Back

So what have we learned? Sometimes globs do not solve all problems. Most perhaps, but definitely not all. Also, I’d like to give a shout out to my friend subversion, who enabled me to rollback this mess of a command.

Comments (View)