#Ruby

  • Upgrading a Padrino app to 0.15.2

    I’m a big fan of Padrino . It’s always filled this “more than Sinatra, no Rails bulk” gap for me while still being batteries included. Friendly community. Easy to understand and use. Most importantly, it’s helped me get apps built. Fast. And have them run well and without issue in production.

    Code Reuse

    Case in point: A scientific app for a conservation NGO, chugging away happily without bugs or major issues for almost a decade ago (with a big upgrade 5 years ago) and despite traffic and time.

  • Supercharging Padrino admin with Datatables, will_paginate, and RABL

    One of the best things about Padrino is the drop-in admin generator (inspired by Django’s) that makes building simple, robust apps that need to work, run, and be admin-ed by real people a pleasure to work with. At some point though, the natural limits of the default generator will need to be extended as you return huge numbers of records. This is one battle-tested approach we used to be able to paginate and search across 7000+ records via ajax and DataTables setup with will_paginate when the default Padrino admin hit its limits.

  • Easy Excel exports from Padrino

    At some point in the lifecycle of any useful application you write, there will be a request to get something out of your system in Excel format. Here’s an easy, transparent method to get downloadable Excel reports out of your Padrino app.

    Spreadsheets are still king in most organizations and Excel is still the main tool business users and decision makers comfortably interact with, often for for end user reporting, data consolidation, or intermediary analysis purpose.

  • Securing Padrino apps with https and ssl on Heroku

    Let’s Encrypt has done an amazing job of making https the new normal for web sites and helping create a more secure and private internet by giving away free, automatic ssl certificates to domain owners.

    You should be encrypting your web traffic (and need to, to take advantage of new protocols like http/2. Some implementations have stated they will only support http/2 over an encrypted connection. And currently, no browser supports http/2 unencrypted afaik.). Add to this the fact Google will start penalizing non-secured sites in search results, and https is fast becoming the de facto standard.

  • Padrino with Foreman and Puma on Heroku

    Padrino works great on heroku with just a simple git push heroku master, but you can get a surprising bump in performance simply from using Puma in production rather than the default heroku web server.

    That also goes for using it on your local development machine, but heroku uses Procfile based spinning up of apps, so you should also test locally on your dev box, using heroku’s handy foreman before pushing it live to heroku.

  • Adding indexes with Padrino migrations

    I really like the Padrino web framework. Its simplicity and layer of just enough above Sinatra appeals to me over the burgeoning complexity of Rails of late.

    As my applications have become more complex though, the lack of documentation and good examples have become an increasing issue. I’m intending to write a few blog posts on common, yet more complex things, you need to do in Padrino to use it as a Rails replacement. Hopefully it can increase uptake and help other people with issues to solve some common gaps.

  • The Tundramonkey Cometh

    One of my goals this year was to up my foundation dev skills and a (sort of) semi-SMART goal of getting up four progressively more difficult apps I’d be scheming about releasing over the course of the year.

    Kobayashi, which powers my re-christened blog Tundramonkey, was one of those apps. Yeah, I know… blog software? Can’t you do that in, like… 15 minutes? I mean, there’s a Rails screencast and everything… Well, actually… no. What I found once I got going was that it ended up being quite the little project and while the basic coding behind getting core functionality up was quite easy, the vast collection of details that goes into migrating over eight years of posts and the functionality you’ve actually used means quite a bit of detail sweating.

  • Sinatra, SimpleNavigation and Bootstrap

    After getting a handle on it, I was really surprised that Twitter’s excellent Bootstrap UI framework didn’t have functionality to cover tabs on other pages of the site. Much like the slick ScrollSpy, where various menu items are highlighted when you scroll to their div id on the page, I was expecting a “PageSpy” type functionality to do the same with navigation tabs, and set a tab to active if the target url matched the URL the browser was on (especially since bootstrap does the more difficult in-page tab functionality. In fact, I was so surprised, I actually asked around and took a look at the js source code as I thought I was missing something obvious.

  • Rails for Zombies

    You know, one of the things I love best about the Rails community is its sense of fun and how damn helpful everyone is in helping you learn in novel (and yet, really useful) ways. Cause, seriously? Programming shouldn’t be as hard as your first year comp sci class made it out to be.

    Enter Rails for Zombies . Check it out, sign up and get learnin'.

    Brrraaaaiiinnnnnzzzz…

  • Serving up static sites on heroku - redux

    First off, I should probably tell you that I totally ♥ Heroku . I run a bunch of little apps off it and at work believe it’s production ready for our main platform. A while back someone posted a nice little snippet of how to get a static site working on it in two lines of code on heroku, however, with some change in heroku, gem packaging or the like (or fact I added in multiple custom domains for the site), these static served pages suddenly stopped working. Counterintuitive when looked at, and even @radar and I together looking at it couldn’t figure it out. Anyhow, I puzzled the following out. Probably a few of the gems can be removed but this definitely worked for me.