Skip to content

Instantly share code, notes, and snippets.

View dcrosby42's full-sized avatar

David Crosby dcrosby42

  • Cisco Systems, Inc.
  • Grand Rapids MI
View GitHub Profile
@dcrosby42
dcrosby42 / gist:8b928acb1cf5b4d0325b
Created May 4, 2015 14:50
Critical rspec update
def clever_girl
pending <<-EOVR
__ ______
,^.__.>--"~~'_.--~_)~^.
_L^~ ~ (~ _.-~ \\. |\\
CLEVER GIRL.... ,-~ __ __,^"/\\_A_/ /' \\
/ ,-" "~~" _) \\ ~_,^ /\\
// / ,-~\\ x~" \\._"-~ ~ _Y
Y' Y. (__.// / " , "\\_r ' ]
J-._l_>---r{ ~ \\__/ \\ _/
@dcrosby42
dcrosby42 / jr_serial_port.rb
Created December 4, 2012 05:40
JrSerialPort Example Code
require 'java'
require_relative 'RXTXcomm.jar'
import('gnu.io.CommPortIdentifier')
import('gnu.io.SerialPort') { 'GnuSerialPort' }
class JrSerialPort
NONE = GnuSerialPort::PARITY_NONE
def initialize name, baud, data, stop, parity
@dcrosby42
dcrosby42 / example_use_of_ish.rb
Created October 25, 2012 01:37
Example snippets for #ish blog post
assert_equal record.created_at, Time.now.ish
assert_equal bullet.velocity, 5.25.ish
@dcrosby42
dcrosby42 / Rakefile
Created September 19, 2012 03:18
Rake tasks to use Inkscape to convert SVGs into PDFs.
#
# This Rakefile provides convenience tasks for converting SVG documents to PDF on OS X using Inkscape.
#
# ASSUMES Inkscape IS INSTALLED IN /Applications (see below to modify this assumption).
#
# Examples:
# $ rake convert file=my_drawing.svg # => my_drawing.pdf
# $ rake all # => *.svg now accompanied by *.pdf
#
# David Crosby
@dcrosby42
dcrosby42 / nuke_plant.rb
Created June 7, 2012 03:47
Example of using piece_pipe to generate a health summary of multiple nuke plants based on reactor leakage.
PiecePipe::Pipeline.new.
source([{region: region}]).
step(FetchPowerPlantsByRegion).
step(FindWorstReactor).
step(DetermineStatusClass).
step(BuildPlantHealthSummary).
step(SortByRadiationLevelsDescending).
collect(:plant_health_summary).
to_enum
@dcrosby42
dcrosby42 / car_sample.rb
Created May 1, 2012 15:07
Conject blog post samples
class Car
construct_with :chassis, :engine, :highway
end
car = Conject.default_object_context[:car]
@dcrosby42
dcrosby42 / patiently_sample1_spec.rb
Created March 22, 2012 02:04
Sample of using FirePoll.patiently in a web spec
patiently do
page.should have_content("Task Table")
page.should have_selector(".row:nth-child(1)", text: "Ride to work")
page.should have_selector(".row:nth-child(2)", text: "Write some code")
page.should have_selector(".row:nth-child(3)", text: "Go to The Meanwhile")
end
@dcrosby42
dcrosby42 / mk_arduino_tags.sh
Created July 25, 2011 03:18
Shell script to generate Arduino ctags
ctags -f tags.cpp `find . -name "*.cpp" -o -name "*.h"`
ctags -f tags.pde --langmap=c++:.pde `find . -name "*.pde"`
cat tags.cpp tags.pde > tags
sort tags -o tags
rm -f tags.*
@dcrosby42
dcrosby42 / Rakefile
Created July 25, 2011 03:17
Rakefile for generating Arduino ctags
desc "Generate Arduino code tags"
task :tags do
sh %{ctags -f tags.cpp `find . -name "*.cpp" -o -name "*.h"`}
sh %{ctags -f tags.pde --langmap=c++:.pde `find . -name "*.pde"`}
sh %{cat tags.cpp tags.pde > tags}
sh %{sort tags -o tags}
rm_f Dir["tags.*"]
end
@dcrosby42
dcrosby42 / CrozSpecialAppDelegate.m
Created July 21, 2011 16:22
App delegate implementation
//
// CrozSpecialAppDelegate.m
// CrozSpecial
//
// Created by David Crosby on 7/21/11.
// Copyright 2011 __MyCompanyName__. All rights reserved.
//
#import "CrozSpecialAppDelegate.h"
#import "CrozSpecialObjectionModule.h"