All posts tagged Ruby

Interesting alpha version of a new book for Ruby developers wanting to use a IOS fronted:

iOS on Rails (Beta)
The reference for writing superb iOS apps with Ruby on Rails backends.
Once it comes out of Beta, this book will sell for $39. Get it now for just $29.

Read a free sample
This book is really two books in one.

The the first book covers building a backend API in Rails. We will demonstrate how to create a robust, clean, flexible JSON API. Along the way, we’ll discuss different approaches that we didn’t choose and discuss their drawbacks.

[From thoughtbot Learn : iOS on Rails (Beta): a book by thoughtbot]

I will have to investigate this one tonight :

Firehose is a minimally invasive way of building realtime web apps without complex protocols or rewriting your app from scratch. Its a dirt simple pub/sub server that keeps client-side Javascript models in synch with the server code via WebSockets or HTTP long polling. It fully embraces RESTful design patterns, which means you’ll end up with a nice API after you build your app

[From Firehose | Build realtime web applications]

This was a lifesaver – as it took me quite a while to find out how to terminate a subprocess in Ruby properly.

I was trying to run a script from a Ruby program, but occasionally (every few hours) the script would fail and not return, leaving my program locked.


# Runs a specified shell command in a separate thread.
# If it exceeds the given timeout in seconds, kills it.
# Returns any output produced by the command (stdout or stderr) as a String.
# Uses Kernel.select to wait up to the tick length (in seconds) between
# checks on the command’s status
#
# If you’ve got a cleaner way of doing this, I’d be interested to see it.
# If you think you can do it with Ruby’s Timeout module, think again.
def run_with_timeout(command, timeout, tick)

This looks interesting – as I have RubyMotion (and as I am on holiday this week) I may just have to give this a try.

UnderOS (or shortly uOS) is a project that aims to build a web-browser like environment on top of RubyMotion so you could build native iOS apps while keeping your web-developer’s habbits.

[From Untitled]

I;ve been trying out the “Dashing” dashboard framework (originally from Etsy) and finding it very easy to use and run (even runs form my raspberry pi)

Here’s my first real example

201312311411.jpg

Team_dashboard looks a lot better, but Dashing wins hands down when it comes to adding new custom dashboard widgets.

While writing up some guidelines for good software engineering principles I found this guide for Ruby coding standards.

To start using the Pridopia 24*16 LED matrix daughter board for the Raspberry Pi I found this on GitHub and cloned it to my own repository.

I found one bug which meant that all rows were displayed with a offset – fixed this, and started adding code to display on more than on 8*8 module – made slightly more difficult by a couple of small bugs in the original code, but I have uploaded a new (working) library here.

This is not of production quality yet – but the library module works – just need to update the tests. Then I need to make the code a lot more elegant than it is.

A new and interesting IDE for editing of software

Light Table is a new interactive IDE that lets you modify running programs and embed anything from websites to games. It provides the real time feedback we need to not only answer questions about our code, but to understand how our programs really work.

[From Light Table]

I’m getting a little bit of time to look at my CUL decoding – and am now getting :

201302212043.jpg

the last 2 messages are intercepted from my home automation systems – there are 2 wireless relays in the house, with FS20 addresses 56 and 57, one is turned off and one is turned on by these commands.

The first line shows that the actuators for the living room radiators is 3% open – i.e. hot water is just barely reaching them to keep the temperature in the room stable at the moment.

And here is the very short program for reading your AQE data as a JSON stream from COSM

require ‘cosm-rb’

require ‘pp’

require ‘json’

COSM_API_KEY = ‘USE YOUR API KEY FROM THE DASHBOARD HERE’

FEED_ID = XXXXX # your feed id

response = Cosm::Client.get(“/v2/feeds/#{FEED_ID}.json”, :headers => {“X-ApiKey” => COSM_API_KEY})

stream_name = response[‘datastreams’][0][“id”]

Easy isn’t it?

12346Next