skwpspace yan pritzker’s home on the web

skwpspace is Yan Pritzker's home on the web

Blog :: Photography :: About Me

TwitterCounter for @skwp

Get the news feed
Get updates by email
Follow me on twitter

hello, i'm yan

This blog is about startups, blogging, Ruby On Rails, virtualization and cloud computing, photography, customer service, marketing, ux and design, git, and lots more.

Top Posts

planypus

I'm the founder of Planypus, the place to share your plans!

cohesiveft

Accessible, manageable, virtualized application stacks ready to download or deploy to the cloud!

flickr

it's hailing in san franciscojessatianalyndaBird in the handkerimodeldanielle pettee and models-4449

Archives

Contact

Reach me at yan at pritzker.ws

Posts Tagged ruby

Long running Threads in Rails and metaprogramming fun

Disclaimer: This post contains evil (but highly fun!) code. Proceed at your own peril…
I was recently designing an application that needed to execute some long running requests against an external host. If you’ve ever tried doing something like this in Rails, you’ll find your mongrels will block up waiting for the request to complete, bringing [...]


Testing your ActiveRecord migrations

Sometimes you have a data migration that creates or modifies records in some way, and you would like to test it in your unit tests right? Except that Rails typically just clones the structure of your dev database, not its data. So how do you test that a migration succeeded? Simple, just invoke it during [...]


Ruby/html trick: wrap long strings with invisible wordwrap characters

def wrap_long_string(text,max_width = 20)
(text.length < max_width) ?
text :
text.scan(/.{1,#{max_width}}/).join(“<wbr>“)
end


Twitter opens the floodgates of FUD

TechCrunch is reporting on rumors that twitter is leaving Ruby on Rails. Of course the comment threads are covered by a heated debate by people either bashing RoR, suggesting their favorite language and platform as the ‘only possible solution’, or both. Nevermind that Friends For Sale, with 630k active daily users scales just fine on [...]


fix for TextMate Ruby tests broken with stack level too deep

If you experience problems running single unit tests in TextMate with Rails 2, it may be due to a bug. The problem has something to due with conflicting builder.rb instances in Rails and TextMate. The simplest and least intrusive fix is to add this to the top of your test_helper.rb

$LOAD_PATH.reject! { |e| e.include? ‘TextMate’ }


Posted
13 March 2008 @ 7pm

Tagged
rails, ruby

webcrawler bot detection

def self.bot_agent_list
[ "panscient", "larbin", "dummy", "Teoma", "alexa",
"froogle", "inktomi", "looksmart", "URL_Spider_SQL",
"Firefly", "NationalDirectory", "Ask Jeeves", "TECNOSEEK",
"InfoSeek", "WebFindBot", "crawler", "girafobot", "Scooter",
"Baidu", "bot", "Google", "SiteUptime", "Slurp",
[...]


acts_as_versioned for a set of columns

acts_as_versioned is a great plugin for versioning a set of model attributes transparently every time you save. The plugin seems to be built with exclusion in mind (version all except these) but to get it to work only on a specific set of columns, this simple trick can be applied:
class Foo [:description_t]
def [...]


Clean svn tag support for Capistrano 2

If you find capistrano’s release directory naming conventions hard to use, a great alternative is to base releases on your svn tags. It turns out that implementing this in cap2 is quite simple. Unfortunately I can’t quite figure out how to turn this into a library so at this point it exists as a cut-n-paste [...]


ruby tricks: simple caching of method results

This is a simple trick based on the idea that everything in ruby returns a result. By using the block syntax we can do a series of expensive operations and cache the result somewhere. Here I’ve shown the result cached in an instance variable but it may just as well be something more exotic.
[...]


Noobkit: a better way to get your Rails API docs

Recently launched Noobkit is a great new way to get at your Rails API docs. The visual design is pleasing and it’s got an OpenID login system and ability to make bookmarks. It covers the Rails API and many common gems. The look is much more pleasing than the similar gotapi.com which covers more programming [...]


← Before