Skip to content

Instantly share code, notes, and snippets.

View brentmc79's full-sized avatar

Brent Collier brentmc79

View GitHub Profile
@brentmc79
brentmc79 / getting-started-with-quadcopters.md
Last active August 29, 2015 14:14
Getting Started with Quadcopters

Getting Started With Quadcopters

Learn to Fly

Buy a Hubsan X4. Fly it. Crash it. Repeat. Do this until you feel comfortable in the air.

Nomenclature

  • 250/450/etch - This refers to the size of the quad, specifically the motor-to-motor distance in millimeters. 250 is the standard FPV race quad size.
  • FPV - First Person View

Keybase proof

I hereby claim:

  • I am brentmc79 on github.
  • I am brentmc79 (https://keybase.io/brentmc79) on keybase.
  • I have a public key whose fingerprint is 5F29 03D2 B112 A145 BD8A 6050 73EA 5B38 8EA7 1767

To claim this, I am signing this object:

@brentmc79
brentmc79 / address_spec.rb
Created March 8, 2012 16:04 — forked from moklett/address_spec.rb
Toying around with an RSpec DSL for permutations. My real use case is more complex than this example - the large numbers of inputs and outputs makes it more concise to "demonstrate" correctness and expectations than to "spec" it out with traditional, one
describe Address do
permute "validations" do
cases [
[:address, :address_2, :city, :state, :zip, :country, :valid, :errors_on],
[ nil, nil, nil, nil, nil, nil, false, ['address', 'city', 'state', 'zip', 'country']],
['123 Main St', 'Apt 100', 'Pleasantville', 'NC', '12345', 'US', true, []],
['123 Main St' 'Apt 100', 'Pleasantville' 'NC' '12345' nil, false ['country']]
['123 Main St' 'Apt 100', 'Pleasantville' 'NC' '12345' 'U', false ['country']]
['123 Main St' 'Apt 100', 'Pleasantville' 'NC' '12345' 'USA', false ['country']]
]
@brentmc79
brentmc79 / gist:761236
Created December 31, 2010 18:41
raises_exception
def raises_exception?
begin
yield
rescue => ex
Rails.logger.info("Exception occurred (#{ex.class.to_s}): #{ex.message}")
flash[:error] = "There was a problem completing your request. Please try again later."
redirect_to request.referrer
return true
end
return false
colorscheme blackboard
set go-=T
set number
set guifont=monaco
set dir=/tmp,/var/tmp/,.
set co=200
set lines=54
set shiftwidth=2
set tabstop=2
set expandtab
#my controller action
def edit
respond_to do |format|
format.js {render :partial => "ajax_form", :locals => {:expense => @expense} && return}
format.html {raise "boom"}
end
end
#from the log
You have a nil object when you didn't expect it!
The error occurred while evaluating nil.expand_pastes?
/Users/brent/Intridea/presently/app/models/update.rb:623:in `to_xmpp_payload'
/Users/brent/.gem/ruby/1.8/gems/builder-2.1.2/lib/builder/xmlbase.rb:134:in `call'
/Users/brent/.gem/ruby/1.8/gems/builder-2.1.2/lib/builder/xmlbase.rb:134:in `_nested_structures'
/Users/brent/.gem/ruby/1.8/gems/builder-2.1.2/lib/builder/xmlbase.rb:58:in `method_missing'
/Users/brent/Intridea/presently/app/models/update.rb:563:in `to_xmpp_payload'
/Users/brent/.gem/ruby/1.8/gems/builder-2.1.2/lib/builder/xmlbase.rb:134:in `call'
/Users/brent/.gem/ruby/1.8/gems/builder-2.1.2/lib/builder/xmlbase.rb:134:in `_nested_structures'
/Users/brent/.gem/ruby/1.8/gems/builder-2.1.2/lib/builder/xmlbase.rb:58:in `method_missing'
class Book < ActiveRecord::Base
has_many :taggings, :as => :taggable
has_many :tags, :through => :taggings
end
class Tagging < ActiveRecord::Base
belongs_to :taggable, :polymorphic => true
belongs_to :tag
end
class Tag < ActiveRecord::Base
has_many :taggings, :dependent => :destroy
has_many :books, :through => :tagings, :source => :taggable, :source_type => "Book"
has_many :movies, :through => :tagings, :source => :taggable, :source_type => "Movie"
end