The absurdity of this is just plain hilarious. “I’m on a horse.”
Old Spice - The Man Your Man Could Smell Like (via oldspice)
User Agent Detection in Java
I was looking for a way to detect mobile devices in Java and hoping someone had done the heavy lifting for me. It turns out someone had. There’s a port of a PHP script I found at Hand Interactive that looks like it does what I need.
Basically if I detect a mobile device I want to use a different stylesheet on Quote Crate but I didn’t want to have to find all the user agent strings myself. This should work nicely. I’ve loaded the file into a Gist on Github and plan to make some improvements to it.
functional programming ftw
Simple, but fun:
def partition[T](items: List[T], p: (T, T) => Boolean): List[List[T]] = { items.foldRight[List[List[T]]](Nil)((item: T, items: List[List[T]]) => items match { case (first :: rest) :: last if p (first, item) => (List(item)) :: (first :: rest) :: last case (first :: rest) :: last => (item :: first :: rest) :: last case _ => List(List(item)) }) }If you understand what this does, or know someone who does, I’m hiring. Send me an e-mail.
It took me a bit but I did sort this out. I like Scala and how it lets you express powerful things concisely but I have to give my brain time parse stuff like this still.
Task Queue Java API Overview - Google App Engine - Google Code
Today I implemented the Task Queue functionality on Quote Crate in an effort to speed up saving quotes. Basically instead of adding things to the index on save it fires off what is essentially a background task to add the quote to the index. Since it’s not getting much traffic (or any really) things are added almost immediately and the request to save quotes is sped up a bit.
Next up, exposing search.
Coming and Crying
I just backed this project on Kickstarter because I believe these ladies have got the right idea. Also because I like books and sex.