impress.js with substeps

On 2013/04/10, in html, signal, webdev, by a b

I have to give a presentation. Being a code guy, I’m using impress.js instead of Keynote or those other things.

In addition to the magical steps provided in impress.js, I also want substeps, which are apparently ‘powerpointish‘, but I want them anyway. What’s a code guy to do? Add them yourself!

My fork on github implements the elusive, gentle, and often misunderstood substep. You can try them out in the demo presentation I made.

I will likely pull request this back to impress.js, but I’m not the first to try, so I’m not holding my breath on getting merged.

Hopefully someone else gets some use from this! Ping me on github if you have questions or comments.

EDIT: I submitted a pull request. Not optimistic, but it was a good learning experience:


easy gravitar for Rails

On 2013/03/07, in rails, ruby, signal, by a b

So, I just used Michael Deering’s handy gem for a gravitar_image_tag. Two lines of code and I have a gravitar in my app header.

Yay! I love the way the coding community works these days. It also helps that I’m working on stuff that’s a few years behind the curve…

I ended up wanting this to be available as a helper on the model, so I just wrote what I needed myself:

  def gravatar_url
    mailhash = Digest::MD5.hexdigest email
    return "" + mailhash

That’s all that is.

Tagged with:

Devise RTFM

On 2013/03/06, in rails, ruby, signal, by a b

I was just setting up a Rails project with Devise and ended up frustrated. No matter what I did, I couldn’t get the login page to show. I just kept seeing the stupid default Rails page. I was ready to cry, and was about to pitch all my code and start completely over.

Then I read the default rails page, and noticed the bit where it says “Set up a default route and remove public/index.html”.




You know what happens if you don’t remove public/index.html? You waste quite a few brain cells wondering why your default root doesn’t load, and why Devise isn’t working.

Man, do I feel dumb. Lesson learned; RTFM, and read the placeholder blah blah blah default pages for tricky code things you’re installing, since there’s noob advice on there that you might not be remembering if you haven’t done noob stuff in a while.


new terminal at current path

On 2013/02/22, in osx, signal, by a b

So… it’s possible I’m a nerd.

My latest reason for suspecting this is that I was laying awake at night wondering how to open a new OSX Terminal window at the path of the current window. Then I woke up, figured it out while I was on the bus to work, and was happy. When I got to my office I plugged into the Goog and found about 50 answers to my question, all from about 12 years ago. Le Sigh. However, I’m still quite proud because my solution is bang-on what most folks had come up with, and lacking in feature creep by comparison.

# new terminal window at current location
function terminal-here() {
    osascript -e 'on run argv
        tell app "Terminal"
            do script "cd " & item 1 of argv
        end tell
    end run' `pwd`

That’s all.


Let’s do cocaine!

On 2013/01/07, in html, rails, signal, webdev, by a b

As it turns out, I have a cocaine problem. I found this out on Stackoverflow. Such is my life.

I’m trying to build and run a complex Rails project that has been collecting dust for about a year. The stack includes Backbone, Devise, FactoryGirl, Paperclip, Plupload, Imagemagick, and about 47 other things. It had been a slog, but I was through ‘bundle install’, had somehow survived ‘rake db:migrate’, and was now attempting ‘rake db:seed’.

Then, all the party time fun came crashing down.

rake aborted!
Validation failed: Data /path/to/foo.png is not recognized by the 'identify' command.

Oh, noes. Lucky for me, stackoverflow exists and people use it. They figured that paperclip had a dependency on cocaine, and the new cocaine API breaks paperclip. Thanks, smart people! What might of took me a long time to resolve was a few google clicks away.

I put my gemfile into rehab:

gem "cocaine", "0.3.2"

You would never guess that you can fix a cocaine problem by simply using older cocaine, but there it is. We learn something every day.


Upgrade Ruby in OSX… Eventually…

On 2012/11/15, in osx, rant, webdev, by a b

I’m enjoying learning Ruby.  I recently was doing some fooling around, training, and came across the need for the money gem.

$ gem install money
ERROR:  While executing gem ... (Gem::FilePermissionError)
    You don't have write permissions into 
      the /Library/Ruby/Gems/1.8 directory.

Oh! My bad. I forgot I’m on a new laptop, with the system install of Ruby. No worries, just sudo…

$ sudo gem install money
ERROR:  Error installing money:
	money requires Ruby version >= 1.9.2.

$ ruby -v
 ruby 1.8.7 (2012-02-08 patchlevel 358) [universal-darwin12.0]

I didn’t realize I wasn’t on the bleeding edge. No problem, though, because Ruby is magical and it will be snap to upgrade. Just use RVM:

$ rvm install 1.9.3
 No binary rubies available for: osx/10.8/x86_64/ruby-1.9.3-p286.

 ... blah blah ...

  The provided compiler '/usr/bin/gcc' is LLVM based, it 
  is not yet fully supported by ruby and gems, please 
   read `rvm requirements`.

 ... blah blah ...

 ruby-1.9.2-p320 is not installed.
 To install do: 'rvm install ruby-1.9.3-p286'

Right. I thought I just did that, and trying the full suggested version gives the same LLVM compiler problem. I vaguely remember something like this on OSX 10.6, so I guess it’s time to ask the Googz. After not too much poking around, it looks like I can try to install with clang as the C compiler (which is non-LLVM, and should make rvm STFU).

$ rvm install ruby-1.9.3-p286 --with-gcc=clang
 Installing Ruby from source to: ~/.rvm/rubies/ruby-1.9.3-p286, 
   this may take a while depending on your cpu(s)...
 1.9.3-p286 - #downloading 1.9.3-p286, 
   this may take a while depending on your connection...

... blah blah blah depending on blah blah ...

Install of 1.9.3-p286 - #complete 

Great! It’s complete. Not great, though, because the OSX install of ruby is still linked in ‘/usr/bin’. Weee! Being one to try and follow the way things are already being done, I just want set things up so links in ‘usr/bin’ work, not relink them somewhere else. So, I have to go first to ‘~/.rvm/rubies/’ and link my 1.9.3 build,

$ cd ~/.rvm/rubies/
$ ln -s 1.9.3-p289 1.9.3

then go into that folder and for some reason create a ‘usr’ dir with symlink back up to ‘../bin’,

$ mkdir usr; cd usr
$ ln -s ../bin bin

then go to ‘/System/Library/Frameworks/Ruby.framework/Versions’ and get busy with ‘sudo’ and ‘ln’ again so the system path ‘Current’ links to my ‘~/.rvm/rubies/1.9.3’ link.

$ cd /System/Library/Frameworks/Ruby.framework/Versions
$ sudo rm Current
$ sudo ln -s ~/.rvm/rubies/1.9.3  1.9.3
$ sudo ln -s 1.9.3 Current

Phew. The end result is the rvm install of 1.9.3 linked as ‘Current’, and ‘ruby -v’ returns 1.9.3 as the version. So, back to the original problem, and trying to get money. Mo’ money, forthereals. So I take another crack at it…

$ sudo gem install money
$  ERROR:  Error installing money:
	money requires Ruby version >= 1.9.2.

Hoe. Lee. Crap. Looking into it, the problem becomes quickly clear. The symlink to ‘gem’ is still running the OSX install version of 1.8, and ‘ls -l’ confirms this.

$ gem -> ../../System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/gem

Really? Apple created a ‘Current’ symlink, then ignores that and hard links to the source?. Awesome! After all my ‘do it like they do’ thinking, I actually do have to fix the symlink, anyway:

$ sudo rm gem
$ sudo ln -s ../../System/Library/Frameworks/Ruby.framework/Versions/Current/usr/bin/gem gem

Maybe now ‘sudo gem install money’ will work? Ah… no.

 /lib/ruby/1.9.1/yaml.rb:56:in `':

  It seems your ruby installation is missing psych (for YAML output).
  To eliminate this warning, please install libyaml and reinstall your ruby.

Wow. Ok, now I need to ask Googz again. The solution seems to be ‘rvm pkg install libyaml’. Which is awesome. That also tells me ‘Please note that it’s required to reinstall all rubies: rvm reinstall all –force’. I’m pretty over trying to get anything else done today, so let’s do this. And… of course, that fails, because reinstall falls back to the default gcc, which has LLVM issues. So, trying again with ‘–with-gcc=clang’ added solves that problem. But reinstalling blew away the ‘~/.rvm/rubies/1.9.3/usr/bin’ symlink I made, so I have to fix that to get ‘gem’ working again.

Got all that? Now, after a colossal amount of stupid, I can try ‘sudo gem install money’ one more time.

And it works.

Sweet. Hopefully I can remember what I was working on 3 hours ago, when that who crazy detour started.