Ruby

http://s.erious.ly

Posts tagged "Snippet"

“Mad Libs” Style Forms

Luke Wroblewski, Chief Design Architect at Yahoo! and author of “Web Form Design“, published a very interesting post about “Mad Libs” Style Forms and how he improved the conversation of vast.com by 25-40%. This is how Luke tweaked the contact form: Read the full post: “Mad Libs” Style Form Increases Conversion 25-40% I wondered whether there is...

Using will_paginate in sinatra

Want some sweet pagination on your sinatra app? I know it’s a loaded question with sinatra’s methodology of keeping things slim, but here goes. There is a framework agnostic branch of mislav-will_paginate on github. What I did was pull that into vendor/gems and added the following code to make it work. $LOAD_PATH.unshift File.dirname(__FILE__) + '/vendor/gems/will_paginate/lib' # using...

Installing ruby-filemagic on MacOS X using Homebrew

Homebrew is a new package management system for OS X that supports formulas written in Ruby language. Here is quick HowTo about creating a new formula for file(1) (You can find the MacPort version here). First ask brew to create a new formula: $ brew create file-magic Then copy the following snippet and replace the file-magic.rb content with it. require...

Quick Database Conversion Using taps

taps is a database agnostic import/export gem that works with all the databases that sequel supports, including Amalgalite, ADO, DataObjects, DB2, DBI, Firebird, Informix, JDBC, MySQL, ODBC, OpenBase, Oracle, PostgreSQL and SQLite3. It is also used by Heroku to push and pull your apps databases. ~ % [sudo] gem install taps Here is a quick snippet that shows how...