Skip to content

Instantly share code, notes, and snippets.

View brian-lc's full-sized avatar

Brian Chamberlain brian-lc

View GitHub Profile
describe "actions on rails init" do
# Tiffany should hook in to the rails init in development
# mode and generate the specification
before(:all) do
# Generate a rails application
@app_location = File.join(FileUtils.pwd,'spec')
FileUtils.cd(@app_location)
`rails test_app`
end
@brian-lc
brian-lc / gist:168747
Created August 16, 2009 20:16
rmagick script that takes an array of images and turns them into photobooth layout
#!/usr/bin/env ruby
require 'rubygems'
require 'RMagick'
include Magick
class BoothPhoto
IMAGES_ROWS = 2
BORDER = 5
@brian-lc
brian-lc / test_boot.rb
Created November 8, 2010 01:34
Test boot file generated from Rails 2.3.10 and modified to use Bundler
# Don't change this file!
# Configure your app in config/environment.rb and config/environments/*.rb
RAILS_ROOT = "#{File.dirname(__FILE__)}/.." unless defined?(RAILS_ROOT)
module Rails
class << self
def boot!
unless booted?
preinitialize
@brian-lc
brian-lc / test_Gemfile
Created November 8, 2010 01:40
Test Gemfile that we will copy into our Rails app
plugin_root = File.expand_path("../../..", __FILE__)
self.instance_eval File.read("#{plugin_root}/Gemfile") #Copying in the gem file from the parent
gem 'the_name_of_the_gem_goes_here', :path => plugin_root
@brian-lc
brian-lc / test_preinitializer.rb
Created November 8, 2010 01:41
Test preinitializer file that is required by Bundler for Rails 2.3.*
# To go in base of gem spec folder
begin
require "rubygems"
require "bundler"
rescue LoadError
raise "Could not load the bundler gem. Install it with `gem install bundler`."
end
if Gem::Version.new(Bundler::VERSION) <= Gem::Version.new("0.9.24")
@brian-lc
brian-lc / Rakefile_mods
Created November 8, 2010 02:45
This is what you should put in the Rakefile for your gem to build in a test Rails app
namespace "testbed" do
RAPPNAME = "test_app" #This is also hardcoded in the spec/spec_helper.rb and gitignore file. Change it there too...
desc "Install rails base app in spec dir"
task :build_app do
directory "spec"
chdir("spec") do
sh "rails #{RAPPNAME}"
puts "Put a test_app in the spec folder"
@brian-lc
brian-lc / Stepper motor demo
Created November 9, 2010 21:39
This is a simple Processing script to drive a Nema motor through the Easystepper driver and an Arduino
/********************************************************
** More info about the project at: **
** http://lusorobotica.com/viewtopic.php?t=103&f=106 **
** by TigPT at [url=http://www.LusoRobotica.com]www.LusoRobotica.com[/url] **
*********************************************************/
int dirPin = 2;
int stepperPin = 3;
void setup() {
pinMode(dirPin, OUTPUT);
@brian-lc
brian-lc / .vimrc
Created May 9, 2011 17:02
my .vimrc
set nocompatible
set backspace=indent,eol,start
set directory^=$HOME/.vim_swap// "put all swap files together in one place
" Switch syntax highlighting on, when the terminal has colors
" Also switch on highlighting the last used search pattern.
if &t_Co > 2 || has("gui_running")
syntax on
set hlsearch
@brian-lc
brian-lc / ami_hostname_set
Created September 25, 2012 16:04
Attempt to set a hostname in the /etc/rc.local file of an AMI instance. I could not get it to work...
# AMI EC2 /etc/rc.local snipit I could not get to work
META_HOSTNAME = `ec2-describe-tags --filter "resource-type=instance" --filter "resource-id=$(ec2-metadata -i | cut -d ' ' -f2)" --filter "key=Name" | cut -f5`
hostname $META_HOSTNAME
@brian-lc
brian-lc / BB_helper
Created May 31, 2013 19:13
BeagleBone Command helper doc
To list the USB connections
ls /dev/ttyUSB*
To start a USB screen session with the BB
sudo screen /dev/ttyUSB0 115200
To Eject a mounted BB
sudo eject /dev/sdx - where ‘x’ is the id for the device to exject