Skip to content

Instantly share code, notes, and snippets.

View brian-lc's full-sized avatar

Brian Chamberlain brian-lc

View GitHub Profile
@brian-lc
brian-lc / BTLE_CO2_TEST.cpp
Last active August 29, 2015 14:16
CO2 BTLE Serial Prototype code
#include <Wire.h>
#include "Adafruit_LEDBackpack.h"
#include "Adafruit_GFX.h"
#include <SPI.h>
#include <Adafruit_BLE_UART.h>
#define ADAFRUITBLE_REQ 10
#define ADAFRUITBLE_RDY 3
#define ADAFRUITBLE_RST 9
@brian-lc
brian-lc / packet.h
Created March 15, 2015 09:01
Sample Arduino for Bartendro dispenser - Packet.h
#ifndef __PACKET_H__
#define __PACKET_H__
#include <stdint.h>
/* IMPORTANT!!
This file defines the constants and packet structure for the communication
between the router and the dispensers. These values are duplicated in
the python code in ui/bartendro/router/driver.py. This should be improved
at some point.
@brian-lc
brian-lc / SenseAirCO2K30_Breadboard.svg
Last active August 29, 2015 14:18
SVG content for SenseAir CO2 Fritzing part
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@brian-lc
brian-lc / pg_scraper.coffee
Last active August 29, 2015 14:23
Scrapes the PG&E website for energy and billing data using your login/password
# Call this from casperjs cli like this
# casperjs pge_scrape.coffee --user=<your_username> --password=<your_password>
# Works on Phantom 1.98 and Casper 1.1 beta
casper = require('casper').create
viewportSize: {width: 800, height: 600},
pageSettings: {webSecurityEnabled: false}
user = casper.cli.get('user')
password = casper.cli.get('pass')
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_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 / 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 / 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_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")