Nullcreations.net | Ramblings & Photography of Jerrett Taylor

Nanaimo movie listings

April 3rd, 2008 | 2 comments

A friend was complaining that there was nowhere he could find to get an RSS listing of movie showtimes... so I made a little script using Hpricot to parse forreel.com - hopefully they don't mind...

So for those of you locally, feel free to use it!

http://nullcreations.net/files/nanaimo_movies.xml

Viviti Launched!

March 13th, 2008 | 0 comments

Well we've finally launched Viviti - It's a web based/hosted CMS system that's component based. Fully themable using normal HTML, and all editable in browser (drag-n-drop to move stuff around, etc.). As it is now, it supports adding custom blocks (text or html blocks), rss feeds, blogs, and a few other components. It's pretty neat, and as we add more components will become more and more flexible.

Currently it's still in a invite only phase, as we work through some final touches - but we will start sending out invites to people who request a beta key soon.

Ruby shared-mime-info gem and OS X

February 18th, 2008 | 1 comment

For anyone doing stuff requiring a good MIME library in Ruby, shared-mime-info works well. On OS X a few things are necessary to make it work though.

First, use ports to install the shared-mime-info database:


sudo port install shared-mime-info

Then you have to set XDG_DATA_DIRS to point at the right place on OS X, which is /opt/local/share. Put this in your .bashrc file:


export XDG_DATA_DIRS=:/opt/local/share

XDG_DATA_DIRS is where freedesktop.org stuff looks to find files, and if not specified will look in /usr/share or /usr/local/share. Since ports on OS X puts everything in /opt/local, you have to set it.

That's pretty much it! If you don't install the shared-mime-info database and set the ENV variable the gem will still work, just not as well (returning text/plain instead of text/css for css files, etc.)

ZSH Prompt to show git branch

February 15th, 2008 | 1 comment

After using git for a little bit I started tinkering with ZSH, to get the current branch in my prompt.

What I ended up with is this:

git-zsh

Turns out it's pretty easy - somewhere in your .zshrc you need to put the following:

1
2
3
4
5
6
7
8
9
10
11
# get the name of the branch we are on
git_prompt_info() {
  ref=$(git-symbolic-ref HEAD 2> /dev/null) || return
  echo "(${ref#refs/heads/})"
}

autoload -U colors
colors
setopt prompt_subst

PROMPT='%{$fg_bold[green]%}%n@%m %{$fg[blue]%}%c %{$fg_bold[red]%}$(git_prompt_info)%{$fg[blue]%} %% %{$reset_color%}'

The git_prompt_info function just asks git what branch we are in (and returns if we're not in a git repo), and then strips out regs/heads from the output. The colors bit is just so you can use colors like "green" instead of this awesomeness. prompt_subst is needed to tell zsh we want the git_prompt_info substituted with it's results, otherwise it will just show it as a string.

Thats pretty much it!

I initially had a right hand prompt for the branch, which while looks nicer, makes it less likely to be seen... My original prompt looked like this:

1
2
PROMPT='%{$fg_bold[green]%}%m %{$fg[blue]%}%c %% %{$reset_color%}'
RPROMPT='%{$fg_bold[yellow]%}$(git_prompt_info)%{$reset_color%}'

Clearing floated elements without extra markup

January 16th, 2008 | 0 comments

Clearing floating elements is pretty commonly handled by a a div or br tag with 'clear: both'.

Recently I ran into a problem with this; the layout I was working with was using floats for the sidebar and part of the main content had floated list of images. Using the clear both trick caused it to clear past the bottom of the sidebar.

While there are ways around that I've never been a big fan of adding the clearing divs, so I was pretty happy to find an alternative, and even happier to find one that's nice and simple.

1
2
3
4
<ul style="overflow: auto; zoom: 1;">
  <li style="float: left">A</li>
  <li style="float: left">B</li>
</ul>

Basically all you have to do is set the overflow to hidden, which forces the parent to expand to contain all it's children. The zoom: 1 is an IE6 specific property, which is needed to trigger IE's hasLayout.

There are lots of other posts on the topic, if you are feeling like doing some more reading.

Older entries

Musings

04.14.08

Trying to decide where to travel to? Wikitravel.org Random Page has the answers!

02.23.08

sd's embedded_actions has a new home on github

02.18.08

Very cool.

02.17.08

Open Source Food? - looks like a nice recipe site!

02.15.08

For anyone using capistrano with more than one target for deployment (staging, production), check out cap multistage

02.15.08

Wow, I just realized how bad my code blocks break my blog in safari. I should fix that!

01.27.08

Mike has created another nice netbeans theme - go check it out, if you use netbeans!

01.21.08

A handy tool, Rubular is a web based regex editor

01.15.08

Dan put together a sweet code editor plugin for mce with syntax highlighting etc.

12.13.07

On OSX? Add RubyImporter to Spotlight and search your source!

12.04.07

sd has released a new version of embedded_actions

11.27.07

RejectConf videos are online thanks to confreaks!

11.19.07

Good news - we upgraded a project at work to rails 2.0 rc2 and the speed to run specs dropped from 30-35 seconds to 10-15 seconds!

11.08.07

Eigenclass.org has a great big list of Ruby 1.9 changes that is being kept up to date!

11.06.07

Rein is working on a trac replacement in ruby called eskort , and it looks cool. More info on his goals