Archives
Tags
- General (18)
- Food (1)
- Cooking (1)
- Ruby (6)
- Rails (2)
- Svn (2)
- Linux (9)
- Git (1)
- Firefox (8)
- Porn (1)
- Freyja (1)
- Witchhammer (6)
- Music (1)
- Merb (3)
- Poetry (0)
- Bolverk (3)
- Sinatra (1)
- Discogs (1)
- Centos (1)
- Python (1)
- Whinging (2)
- Travel (2)
- Scheme (7)
- Lisp (8)
- Sicp (1)
- Rot13 (1)
- Czech (2)
- Metal (3)
- Passenger (1)
- Fun (5)
- Fractals (2)
- Plt (2)
- Clojure (1)
- Continuations (1)
- Javascript (1)
- Presentation (1)
My first Merb site
Just a quick note to my legions of loyal followers (hey, Mum), I've just finished my first website written using the Merb framework.
Development travelled along relatively well. I ran into a few issues early on with dependency hell and some bugs and/or missing functionality in a few gems. I blogged about a few of my hacks.
Here is my (partial) technology stack:
- ORM: DataMapper
- Tests: RSpec
- Views: HAML/SASS (which I won't be using again, even though it's very well written)
- Hosting: Dreamhost (using Phusion Passenger, which was easy to use with a config.ru file for Rack)
I still haven't worked out how to properly get Capistrano working with the Dreamhost setup, but shit happens...
Auf wiedersehen!
Bash shells, curly braces, substitutions, attack!
Here is something I do all the time:
$ cp a-file-that-is-badass a-file-that-is-badass.old ... $ cp a-file-that-is-badass.old a-file-that-is-badass
But, considering I'm a wannabe hacker, I knew there was going to be a much faster way of achieving the same thing. Enter the curly brace of doom!
Let me slip on my hack suit and try that again:
$ cp a-file-that-is-badass{,-old}
$ cp a-file-that-is-badass{-old,}Here, we are utilising a feature in bash called brace expansion. Basically, it is telling the shell to prepend the contents of the command to the left of the first brace to each string inside the comma-delimited list within the braces. Anything remaining to the right of the braces is appending to each expanded string.
Brace expansion can take place anywhere inside your command. You can even nest them!
Another example (in the case of a collegue with horrible spelling):
$ mv lib/complex/{fisicks,physics}.pyThe possibilities are endless...