Ruby

Keymando Finally Released!

August 3rd, 2011 0 Comments

Well it finally happened. Monday, August 1st, I released my application, Keymando. A little over two years in the making, after many long nights, it’s finally for sale in the Mac App store.
Keymando began as a simple global hotkey mapping utility that allow users to use vi-like hjkl navigation instead of arrow keys. Initially called “ViKing” because of its vi user focus, it grew into an entire key mapping and automation tool poised to completely change the way you get things done on the Mac.

Controlling a Sprinkler System with an iPhone, Arduino, and Sinatra

July 25th, 2011 18 Comments

Sasha felt the need to make a cameo.

Zlib Error on Ubuntu 10.10 with RVM

January 15th, 2011 0 Comments

If you’re getting a “no such file to load — zlib” when trying to install gems, make sure you

sudo apt-get install zlib1g-dev

Getting Started With iCuke

June 1st, 2010 2 Comments

Tonight I decided to give iCuke a try but I couldn’t find any good getting started guides.  iCuke is a BDD gem for cucumber that enables integration testing for the iPhone.  I’m familiar with using cucumber with Rails so getting going wasn’t terribly difficult but thought the pre-reqs should be a little more clear.

Here are five simple steps for getting started:

Step 1: Setup directories

$ cd path/to/your/iphone/app
$ mkdir features
$ cd features
$ mkdir support step_definitions

Step 2: Create cucumber.yml with the following content:
default: -r support -r step_definitions .

Step 3: Create support/iphone.rb with the following content:
require 'icuke/cucumber'

Step 4: Enable the iPhone Simulator Accessibility Inspector in System Preferences
Step 5:  Create app.feature with the following content:

Background:  Given "MyApp" from "../MyApp.xcodeproj" is loaded in the simulator
Scenario: User views the Home screen When I tap "Home"   Then I should see "Welcome"

RSpec Formating

August 25th, 2009 0 Comments

Using the -f switch with rspec you can choose several ways to format the output of your test results.  One that I recently found very interesting was

$ spec -fs spec

which will output something similar to this

CustomersController without a logged in user
- should not have access to view a list of customers.
- should have access to view a list of customers.

CustomersController with a user with permissions
- should view a list of customers.
- should view a customer.

The ’s’ format option outputs your specs as a specdoc, describing the behavior of the system under test.

Other formats include:

silent|l                                     : No output
progress|p                              : Text-based progress bar
profile|o                                  : Text-based progress bar with profiling of 10 slowest examples
specdoc|s                                : Code example doc strings
nested|n                                  : Code example doc strings with nested groups indented
html|h                                      : A nice HTML report
failing_examples|e               : Write all failing examples – input for –example
failing_example_groups|g  : Write all failing example groups – input for –example

Installing Ruby Oracle Libraries on Cygwin, OSX, and Linux.

July 22nd, 2009 2 Comments

A month or so ago I needed to connect a Rails site to an Oracle database from cygwin, osx, and linux (both 32 and 64 bit).

I’ve release the fruits of my labors as a collection of rakes files for each OS on github:

http://github.com/kevincolyar/ruby_oracle_libs/tree/master

Hopefully this will help someone else out.  Feel free to fork and let me know of any updates and improvements that are needed.

HTTParty

July 30th, 2008 0 Comments

HTTParty

Check out this ruby gem to consistently and easily access web services.

Syncing Your SSH Keys with Ruby

June 4th, 2008 0 Comments
 1 #!/usr/bin/env ruby
 2 
 3 def sync_ssh_key
 4 
 5   # Default servers
 6   servers = ['my.server.com']
 7 
 8   # Use passed in list of servers.
 9   servers = $* unless $*.empty?
10 
11   servers.each do |server|
12     puts "---------------#{server}----------------"
13 
14     puts "Touching .ssh/authorized_keys on #{server}"
15     next unless system("ssh #{server} \"mkdir -p .ssh; touch .ssh/authorized_keys; touch .ssh/authorized_keys2\" ")
16 
17     puts "Copying public key to #{server}"
18     next unless system("scp ~/.ssh/id_rsa.pub #{server}:.ssh/authorized_keys")
19     next unless system("scp ~/.ssh/id_rsa.pub #{server}:.ssh/authorized_keys2")
20 
21     puts 'Setting public key permissions'
22     next unless system("ssh #{server} \"chmod 700 .ssh; chmod 600 .ssh/authorized_keys; chmod 600 .ssh/authorized_keys2\"")
23   end
24 
25 end
26 
27 
28 sync_ssh_key if __FILE__ == $0