Developer Dan

Fetch all records updated since…

Recently I needed my APIs to filter index responses with records updated since a particular date and time. This requirement was not just for a single API, but for almost all my index queries. To add to the requirements, the new updated_since param is optional. Rather than adding a scope to each model to handle this optional param, I made use of the new ActiveSupport::Concern class and included it in the relevant models. By moving the updated_since scope to a module, I not only prevented code duplication, but was able to add logging without bloating my models.

Example Usage:

@customers = Customer.updated_since(params[:updated_since])


Complete UpdatedSince module can be seen below, or take a look at the Gist

module UpdatedSince
  extend ActiveSupport::Concern
  module ClassMethods
    def updated_since(time)
      if parsed_time = convert_time(time)
        where("updated_at >= ?", parsed_time)
Read more
Overclocking Raspberry Pi

I'm trying to overclock my Raspberry Pi and ran into some issue, so I decided to document them incase anyone else has the same problem. I've been following this tutorial and noticed differences almost immediately. The first step is to get your CPU info by running cat /proc/cpuinfo. This is the first step that I noticed something different. In the tutorial BogoMIPS is 697.95, but for mine I have 464.48:

Processor       : ARMv6-compatible processor rev 7 (v6l)
BogoMIPS        : 464.48
Features        : swp half thumb fastmult vfp edsp java tls
CPU implementer : 0x41
CPU architecture: 7
CPU variant     : 0x0
CPU part        : 0xb76
CPU revision    : 7

Hardware        : BCM2708
Revision        : 000f
Serial          : 0000000035dfc68c


From everything I've been able to find, having a lower BogoMIPS doesn't really...

Read more
TideSDK - Quick Cross-Platform Apps

Last week I started working on a desktop client for the Clipster Rails Engine. My goals of the desktop client were to be quick, simple, and most of all cross-platform. I initially looked at Qt’s C++ Framework. While I love using Qt for cross-platform development, the libraries are quite large and it seemed overkill for such a simple application. After searching around I stumbled across TideSDK. TideSDK is essentially a compilable website. It uses HTML5 & CSS for the GUI. For any back-end processing, it can use JavaScript, Ruby, Python, and even PHP.

Using TideSDK for Clipster Desktop was almost a no-brainer. Not only was it a simple cross-platform solution, but it allowed me to re-use many styling elements from the Clipster engine. Also the Clipser API supports JSON, so what better handling language could I ask for than JavaScript? My only initial concern going with TideSDK was user properties. To complete my goal of a quick application I needed to allow users to set...

Read more
Blogging With Monologue

I recently decided my poor website needed more content to cheer it up a bit, so naturally I looked into blogging frameworks. Since this is a Ruby on Rails site, I first searched for blogging engines and quickly came across Monologue. Like any rails engine should be - it was a breeze to integrate into my existing site and database. From first glance the default look & feel of Monologue is somewhat lacking - but that was exactly what I was looking for. Without a ton of existing styling, I was easily able to override the styling to match my existing site.

First, I looked inside of Monologue's source and found custom.css. The great thing about rails engines are that any file can be overridden by the hosting application. All I had to do was create a custom.css file inside of host_app\app\assets\stylesheets\monologue\blog - e.g. the same path and file name as monologue's custom.css except inside of my host application. Putting all my CSS into...

Read more