Skip to content

Instantly share code, notes, and snippets.

David Crosby dcrosby42

Block or report user

Report or block dcrosby42

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:8b928acb1cf5b4d0325b
def clever_girl
pending <<-EOVR
__ ______
,^.__.>--"~~'_.--~_)~^.
_L^~ ~ (~ _.-~ \\. |\\
CLEVER GIRL.... ,-~ __ __,^"/\\_A_/ /' \\
/ ,-" "~~" _) \\ ~_,^ /\\
// / ,-~\\ x~" \\._"-~ ~ _Y
Y' Y. (__.// / " , "\\_r ' ]
J-._l_>---r{ ~ \\__/ \\ _/
@dcrosby42
dcrosby42 / jr_serial_port.rb
Created Dec 4, 2012
JrSerialPort Example Code
View jr_serial_port.rb
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 Oct 25, 2012
Example snippets for #ish blog post
View example_use_of_ish.rb
assert_equal record.created_at, Time.now.ish
assert_equal bullet.velocity, 5.25.ish
@dcrosby42
dcrosby42 / Rakefile
Created Sep 19, 2012
Rake tasks to use Inkscape to convert SVGs into PDFs.
View Rakefile
#
# 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 Jun 7, 2012
Example of using piece_pipe to generate a health summary of multiple nuke plants based on reactor leakage.
View nuke_plant.rb
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
Conject blog post samples
View car_sample.rb
class Car
construct_with :chassis, :engine, :highway
end
car = Conject.default_object_context[:car]
@dcrosby42
dcrosby42 / patiently_sample1_spec.rb
Created Mar 22, 2012
Sample of using FirePoll.patiently in a web spec
View patiently_sample1_spec.rb
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 Jul 25, 2011
Shell script to generate Arduino ctags
View mk_arduino_tags.sh
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 Jul 25, 2011
Rakefile for generating Arduino ctags
View Rakefile
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 Jul 21, 2011
App delegate implementation
View CrozSpecialAppDelegate.m
//
// CrozSpecialAppDelegate.m
// CrozSpecial
//
// Created by David Crosby on 7/21/11.
// Copyright 2011 __MyCompanyName__. All rights reserved.
//
#import "CrozSpecialAppDelegate.h"
#import "CrozSpecialObjectionModule.h"
You can’t perform that action at this time.