Skip to content

Instantly share code, notes, and snippets.

@ivey
ivey / pretty_print_middleware.go
Created August 26, 2015 21:53
Pretty print middleware for Go
import "net/http/httptest"
func (a *IndentJSONMiddleware) ServeHTTP(w http.ResponseWriter, r *http.Request) {
rec := httptest.NewRecorder()
a.handler.ServeHTTP(rec, r)
for k, v := range rec.Header() {
w.Header()[k] = v
}
testing gist
omg this rocks
### Keybase proof
I hereby claim:
* I am ivey on github.
* I am ivey (https://keybase.io/ivey) on keybase.
* I have a public key whose fingerprint is F4E1 D771 731E ED83 BFEF 6F4A 6604 D5C0 D25C DBF6
To claim this, I am signing this object:
### Keybase proof
I hereby claim:
* I am ivey on github.
* I am ivey (https://keybase.io/ivey) on keybase.
* I have a public key whose fingerprint is 2ABD 95F6 54E1 7E04 70D4 B8D1 8473 F73D E6D0 EB16
To claim this, I am signing this object:
@ivey
ivey / gist:b34177cb7e9d4111583a
Created December 29, 2014 22:27
behavior_tree_builder.go
b := gobt.NewTreeBuilder()
tree := b.Tree("test",
b.Sequence("try some things",
b.Selector("1 of 3",
b.Action("fail at something",
func(player interface{}, bb *gobt.Blackboard) bool {
fmt.Println("a1: ", bb)
return false
}),
@ivey
ivey / gist:c7a693ba3347792f802c
Created April 23, 2015 15:04
Text of email "Bay Minette Elementary Update" dated 4/22/2015 8:58 PM from news@bcbe.org
Bay Minette Elementary School Parents:
As you are likely aware, Amec Foster Wheeler, an environmental consulting firm, and the Environmental Protection Agency have been on-site at Bay Minette Elementary School conducting inspections of the facility and reviewing test results.
I am including a link to the review letter issued today by the environmental consulting firm and a link to the data upon which the review letter is based. According to Richard Brown, "The preliminary findings of the EPA inspection did not identify immediate health hazards relative to asbestos exposure at the school. Results of the air testing at the school for fibers such as asbestos did not indicate fibers above regulatory levels." Please note that the testing and inspections have been conducted in consultation with the Board's consultant and the Environmental Protection Agency. In the event of any differences in testing standards, the more rigorous standards have been used.
Along with the letter, the Board is complying with the f
def following
@following ||= twitter.friends_for(uid, :list_only => true)
end
def followers
@followers ||= twitter.followers_for(uid, :list_only => true)
end
def following_pages
twitter_user.friends_count.to_i / 100 + 1
end
def following
return @following if @following
@following = []
1.upto(following_pages) do |i|
@following += twitter.friends_for(uid, :page => i, :lite => true)
end
diff --git a/lib/merb-core/bootloader.rb b/lib/merb-core/bootloader.rb
index 5853c1a..fd15c31 100644
--- a/lib/merb-core/bootloader.rb
+++ b/lib/merb-core/bootloader.rb
@@ -9,7 +9,6 @@ module Merb
self.subclasses, self.after_load_callbacks, self.before_load_callbacks, self.finished = [], [], [], []
class << self
-
# Adds the inheriting class to the list of subclasses in a position
# Michael Ivey's RPS entry
# Implements the TenutaRSB strategy, named for former
# Georgia Tech defensive coordinator John Tenuta
class JohnTenutaRSBBot
attr_accessor :their_plays
attr_accessor :do_debugging
def initialize
@their_plays = Hash.new(0)