-

If you say so…
Posted on November 17, 2009
-
http://www.flickr.com/photos/theremina/3365578708/
I love vintage surrealism. 19th Century owns.
Posted on November 17, 2009
-

Posted on November 15, 2009
-
Pale blind diver, luckless slinger,
lost discoverer, in you everything sank!
It is the hour of departure, the hard cold hour
which the night fastens to all the timetables.
The rustling belt of the sea girdles the shore.
Cold stars heave up, black birds migrate.
Deserted like the wharves at dawn.
Only the tremulous shadow twists in my hands.
- Pablo Neruda, from The Song of DespairPosted on November 15, 2009
-
So come, my friends, be not afraid.
We are so lightly here.
It is in love that we are made;
In love we disappear.
Though all the maps of blood and flesh
Are posted on the door,
There’s no one who has told us yet
What Boogie Street is for.“Boogie Street” by Leonard CohenPosted on November 12, 2009
-
.bashrc vs .bash_profile vs .profile
Despite years of various Unix flavor development, I can never remember the difference between the above mentioned files. So, I thought I’d finally document the outcome of my experiment here for posterity:
bash_profile: interactive login shells
bashrc: non-interactive login shells
profile: I’m guessing this is used when you do not have a bash_profile file. I found it hard to find a definitive answer, though.
$ cat .bashrc
export BASHRC=’loaded’
$ cat .bash_profile
export BASH_PROFILE=’loaded’
$ cat .profile
export PROFILE=’loaded’
$ echo $BASHRC$ echo $BASH_PROFILE
loaded
$ echo $PROFILERemoving my .bash_profile file gives the following results:
$ echo $BASHRC
$ echo $BASH_PROFILE
$ echo $PROFILE
loadedSo, it looks like the .profile is loaded when no .bash_profile exists, but that the .bash_profile supercedes .profile when it is found, preventing it from being loaded.
At least in Snow Leopard :)
Posted on November 6, 2009
-
Rails - Delegate Attributes with Override Ability
Ever find yourself in a situation where you wanted to delegate attributes from one model to an associated model unless they were specified in the original model?
I did, and I came up with a revamped version of Rails’ delegate method that not only checks if the original model has a value specified before delegating it to the associated model, but also checks that the associated model exists.
Grab the gist here: http://gist.github.com/70186
Example usage is included in it.
(originally posted on brighter.net)
Posted on October 12, 2009
-
FakeWeb with Regular Expression support for registering URIs
I have recently started using a gem called FakeWeb to fake http requests in my specs. It’s awesome - FakeWeb allowed me to ensure that I had stubbed out all external API requests (on a rather API-dependent application) with one line of code:
# prevent specs from trying to hit external api'srequire 'fakeweb'FakeWeb.allow_net_connect = false
However, I ran into an issue with it on another project that needed to block all requests except those going to a specific service. The issue was that each request had a different query string, and soon our spec helper was full of lines like this:
FakeWeb.register_uri("http://www.external.service.com/api/some/script?crazy=true¶m=foo&list=0&whatever=3", :string => "foo") FakeWeb.register_uri("http://www.external.service.com/api/some/script?crazy=true¶m=foo&list=0&whatever=4&additional=etc", :string => "foo") FakeWeb.register_uri("http://www.external.service.com/api/some/script?crazy=true¶m=foo&list=0&whatever=5&additional=bar", :string => "foo") FakeWeb.register_uri("http://www.external.service.com/api/some/script?crazy=true¶m=foo&list=0&whatever=6", :string => "foo")The query params differed depending on the request issued. Where we really got into trouble was with escaped URIs - these are harder for mere humans to read, and we missed differences in the longer ones quite a few times.
FakeWeb.register_uri("http://example.com/?a=%09%0D&b=%09%0D&ca=%09dog%4D&d=%26%0D&g=%09%0D&b=%09%0D&ca=%09dog%4D&d=%26%0D") FakeWeb.register_uri("http://example.com/?a=%09%0D&b=%09%0D&ca=%09dog%4D&d=%26%0D&g=%09%0D&b=%09%0E&ca=%09dog%4D&d=%26%0D") FakeWeb.register_uri("http://example.com/?bc=%09%0D&b=%09%0D&ca=%09dog%4D&d=%26%0D&g=%09%0D&b=%09%0D&ca=%09dog%4D&d=%26%0D")This prompted me to ask, “why not pass a regexp to FakeWeb’s register_uri method?” That way, we could pass something like /example.com\/?a=(.*)$/ for example and not have to worry about the query parameters changing… and thus have less clutter in our spec helper.
FakeWeb didn’t support this (it allowed you to pass URI and String objects) but it wasn’t too hard to add it. You can check out my fork here:
FakeWeb with Regular Expression support for registering URIs
I hope that other people find this useful. Oh yeah - please let me know on github if you find a bug in the code, and of course, feel free to fork it too!
(originally posted on brighter.net)
Posted on October 12, 2009
-
who says romance has to be a box of chocolates?
Wilson Bilkovich:It is. I love that a scottish man kicked a terrorist in the balls so hard that he hurt his foot.Wilson Bilkovich:A terrorist who was on fire at the time.Jacqui Maher:yesJacqui Maher:that made me think of youWilson Bilkovich:That's pretty much the most romantic thing I have ever had anyone say to mePosted on September 15, 2009
-
How to write a love song, Part I
Out of sorrow entire worlds have been built
Out of longing great wonders have been willed
They’re only little tears, darling, let them spill
And lay your head upon my shoulder
Outside my window the world has gone to war
Are you the one that I’ve been waiting for?
O we will know, won’t we?
The stars will explode in the sky
O but they don’t, do they?
Stars have their moment and then they die
There’s a man who spoke wonders though I’ve never met him
He said, “He who seeks finds and who knocks will be let in”
I think of you in motion and just how close you are getting
And how every little thing anticipates you
All down my veins my heart-strings call
Are you the one that I’ve been waiting for?— Nick Cave
Posted on September 14, 2009