Metaprogramming in Sinatra: A Peek Under the Hood

While wrapping up the second week of Hacker School and finishing Constantin’s “Sinatra: Up and Running”, I decided to peer under the hood of Sinatra itself and investigate how the magic unfolded. I was quite pleased when I ran into one of my favourite Ruby black-magic methods: define_method.

Prima facie, it may rather deceptively appear that Sinatra’s basic HTTP route definitions (get ‘/’, post ‘/’, put ‘/’, delete ‘/’) are method definitions, but au contraire- they are method calls deep inside the Sinatra lair. Let’s take a peek.

Polite Clojurian Monkeys: Patching and Protocols

According to Mr. Fogus in the sexy “Joy of Clojure”, the expression problem refers to the desire (hehe) to implement an existing set of abstract methods for an existing concrete class without having to change the code that defines either.

Deploy to Heroku: Sinatra + DataMapper + PostGresQL

My partner in crime Luis and I stayed up until 5AM last night trudging through the slimy bogs of a PostGresQL database install for my ‘secret’ Sinatra app. We embarked on our voyage around midnight. Prior to our trek, he advised I use DataMapper, a Ruby wrapper to allow me to indulge gluttonously in object-oriented conversations with the database. “Heroku makes it really easy to set up a PostGresQL”, he stated. “” Unfortunately, what transpired next was little short of footslogging through a grisly Amazonian jungle.

I Could Not See to See

I heard a Fly buzz - when I died -
The Stillness in the Room
Was like the Stillness in the Air -
Between the Heaves of Storm -

Back Full Throttle

(def ignite-engine []
     (cond (= dawning-of-a-new-chapter romys-life)
                (fire-pistons nerd-blog)
          (simmer-in-limbo ill-fated-nerd-blog)))

Some personal and professional developments took the better of me since I started tinkering with this blog. The saddest of all was when my company suddenly folded overnight. Subsequently, I have visibly been remiss in chronicling my coding discoveries/joys. I have a number of private posts, however, that I had tarried in posting to the public, as they were rather personal in nature. I have decided to release a number of them slowly, rolling forward.

A Polyphonic Blog Is Poly-F-ing-Complicated

The problem with this blog-project of mine is I am starting to run into the same problem many of my software engineer friends have had:

Programming posts vs Personal posts:
How do I separate or unite the two?
Should I create two entirely different blogs? And what of posts that mix both?

When I first started this blog, I had every intention of keeping it coding-heavy, as I am one of the few contentedly insane people whose programming_life == personal_life. I simply could not imagine going through a single day without framing thoughts inside the backdrop of some computer science analogy.

Upon Rebounding and Running in the Rain at Midnight

Sunday night, April 22, 2012, 11:15pm

A memory I will carve indelible into the palms of my hands:

Running feverishly to the subway in the pouring rain at 11:15 PM, moments before having breathlessly fled my desk at General Assembly (greeting the night custodian, beaming at the doorman), homeward bound to Washington Heights, unfazed by the awaiting one-hour commute:

Upon Regaining Sight After Two Years


Walking to the subway on a Friday night, I started to close in on the Flatiron Art Space Exhibit, a daily fixture in my path to and from work. The Exhibit, rooted firmly in the midst of an intersection, would usually elicit little elsen on my part than a vague, uncomprehending glance.

It did not further its case that the intersection was unendingly thronged by tourists.

‘Tis a Luxury to Code [Poetry]

It is a great luxury to code, and to be able to code.

It is perhaps an equally great luxury to write- in prose or in verse.

In theory, I recognize one needs not be greater than the other. Yet I feel greater sadness and loss, when several days pass without retreating into the confines of machine code.

After a lifetime of writing stanzas that slant too quickly to the convenience of glinting adjectives and gleaming adverbs, I find the immediate transparency of my literary rhetoric- shrill. And telling. (Am I really so thespian?) While ambling through stages of being human and earthly (the plight of not being invincible), there is something to be said about the refuge of waking, sleeping, and breathing inside the walls of a nocturnal den.

Hence, I surge more, to compose stanzas for machines.

I harbor less guilt that way.

Lingering in the Kernel

While working at my desk, catching an occasional glimpse of a mist-laden Jersey shoreline from the window, a friend of mine, a soft-spoken British computer game developer, and I chatted to each other from across the Atlantic.

Specifically, we were chatting about the inner particulars of Ruby and the implications of a purely object-oriented paradigm upon its objects and classes. He steered me to open up a session of Pry (a read-eval-print-loop environment), and gave some instructions:

“Navigate into the kernel.”

Bonjour, Neptune. Comment Allez-vous?

Dear Neptune, how are all your brothers and sisters faring in that frightfully black, frigid, void? Do you and your siblings breathe?

What sort of epiphanies have you gathered, while bearing the silence of such an awfully long stretch of time?