Skip to content

Instantly share code, notes, and snippets.

View stewart's full-sized avatar
🆗
Computer

Andrew Stewart stewart

🆗
Computer
View GitHub Profile
@stewart
stewart / hid.js
Created February 14, 2014 23:41
Using node-hid to show all HID device names
// note, requires node-hid (npm install node-hid)
var HID = require('node-hid'),
devices = HID.devices();
for (var i = 0; i < devices.length; i++) {
console.log(devices[i].product);
}
@stewart
stewart / 1-color.js
Last active January 3, 2016 10:09
cylon-sphero examples
var Cylon = require('cylon');
Cylon.robot({
connection: { name: 'sphero', adaptor: 'sphero', port: '/dev/cu.Sphero-RRG-AMP-SPP' },
device: { name: 'sphero', driver: 'sphero' },
work: function(my) {
var on = false;
every((1).second(), function() {
// flash light
@stewart
stewart / leap-up.zsh
Created November 13, 2013 00:36
Shell function to start Leap Motion detection on OS X
function leap-up() {
(sleep 1 && open /Applications/Leap\ Motion.app)&
/Applications/Leap\ Motion.app/Contents/MacOS/leapd
}
function leap-down() {
killall leapd
killall Leap\ Motion
}
@stewart
stewart / gist:6842764
Created October 5, 2013 16:11
bundle install --path vendor/bundle fails to load rubysl
An exception occurred running /Users/stewart/.gem/rbx/2.1.0/bin/bundle:
(LoadError)
The library "resolv" is a provided by the "rubysl-resolv" gem and needs to be
installed to be loaded.
If using Bundler, add this library or the standard library meta-gem to the
Gemfile as follows:
gem "rubysl-resolv", "~> 2.0"
@stewart
stewart / scope.rb
Created September 30, 2013 23:08
Weird scope bug?
class WorkingClass
def call
hidden_method
end
private
def self.hidden_method
"Found me!"
end
@stewart
stewart / git.diff
Created September 27, 2013 06:11
Artoo - Allow JRuby to run on Travis, and accept failures
diff --git a/.travis.yml b/.travis.yml
index 5dcd333..f5a0ed1 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -2,5 +2,8 @@ language: ruby
rvm:
- 2.0.0
- 1.9.3
-# - jruby-1.7.4
+ - jruby-1.7.4
@stewart
stewart / Gemfile
Created July 16, 2013 06:19
base gemfile for rails 4
source 'https://rubygems.org'
ruby '2.0.0'
gem 'bcrypt-ruby', '~> 3.0.0'
gem 'coffee-rails', '~> 4.0.0'
gem 'jbuilder', '~> 1.2'
gem 'jquery-rails'
gem 'pg'
gem 'puma'
@stewart
stewart / imessage-search.rb
Created April 13, 2013 06:53
imessage-search
#!/usr/bin/env ruby
# Constants
OSX_EPOCH = 978307200
MESSAGES_LOCATION = "#{ENV['HOME']}/Library/Messages/chat.db"
# Load dependencies
begin
require 'sqlite3'
rescue LoadError