Author: bsharpe

You need Ensurance

Been plowing through a massive refactoring of a legacy Rails app.   One of the things I find myself doing all the time now is ensuring.  It’s a handy little concern that works like this: In the old days, we’d do this: class SomeClass def some_method(person_id) person = Person.find(person_id)   # then proceed to do […]

Iterating a Date Range in Ruby by Day

I wanted to take a date range and iterate over it to produce results by day, but when I went to check the results, there were results by second. def my_date_thing(a_range) a_range.each do |date| # something interesting by date end end   my_date_thing(10.days.ago .. 0.days.ago) Turns out, that by default those cool days.ago methods return […]

Refactoring Rails: Introduction

This photo is available in my Instacanvas gallery at: http://instacanv.as/bsharpe A post shared by Ben Sharpe (@bsharpe) on Jul 26, 2012 at 7:35am PDT I have loved green-fielding apps in Rails for years. I think my first Rails app, a timesheet for my wife’s employees, was in sub 1.0 Rails. I ended up migrating that […]

ProTip for Corona: Finding Typos

One of the most common mistakes in programming is typos.   Your brain wants to type one thing and your fingers another. In Corona (and Lua in general), variables aren’t declared explicitly before you use them.  When  Lua sees a variable name that you haven’t declared as local, it starts looking up the chain of […]

CoronaSDK and SublimeText2 Build System

[Update May 15, 2013 –  Fixed launcher for osx and windows] I’ve recently been trying out different editors as I can see the end of the road for TextMate from where I’m sitting.   I really wanted to be super-awesome and finally learn vi or emacs, but despite several attempts, my brain hasn’t really latched […]

Amazon's Kindle Fire

CoronaSDK: Building and installing on a Kindle Fire

Build the app using  File > Build > Amazon/Kindle… On the Fire, go to Settings and tap More Tap Device Turn ON “Allow Installation of Applications — from unknown sources” Plug in a Micro-B usb cable into the Fire and the other into your computer (in this case a MacBook Air) The Kindle should be […]

CoronaSDK: How to know if a file exists?

Update: Dejay was correct, you have to try and open the file to know for sure if it’s there or not. Want to know if a file exists before you use it? Lately, I’ve been wanting something a little more dynamic in my projects for opening various Scenes (think Director, but not).   I needed […]

Optimize your Rails on OS X

Getting your development environment setup just the way you like it takes some time.   I’ve done it several times recently and this is the setup I feel most productive with.