Category: Code

You need Ensurance

Update Nov. 2017:  Took these ideas and created a gem 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 […]

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 […]

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 […]