Skip to content

Instantly share code, notes, and snippets.

Barry Hess bjhess

Block or report user

Report or block bjhess

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 close applications in alfred
on alfred_script(q)
tell application "Sequel Pro" to quit
tell application "Dash" to quit
tell application "Tower" to quit
tell application "iTerm" to quit
tell application "Sublime Text 2" to quit
end alfred_script
View kid_questions.md
  1. How old are you going to be?
  2. What is your favorite color?
  3. How tall are you?
  4. What is your favorite food?
  5. Who are some of your best friends?
  6. What is your favorite TV show?
  7. What is your favorite thing to do?
  8. What is the best part of your day?
  9. Where would you like to go for vacation?
  10. What do you want to do when you grow up?
View athing.rb
def total_price
[
total_price_without_discounts - self.yearly_discount - self.recurring_coupon_discount - self.special_deal_discount,
0
].max
end
View CVE-2013-0269_JSON-1_7_7.diff
---
CHANGES | 8 ++++++
Gemfile | 1 +
ext/json/ext/parser/parser.c | 2 +-
ext/json/ext/parser/parser.rl | 2 +-
java/src/json/ext/Parser.java | 2 +-
java/src/json/ext/Parser.rl | 2 +-
json.gemspec | 2 +-
json_pure.gemspec | 2 +-
lib/json/common.rb | 21 +++++++++-----
View CVE-2013-0276_Rails-3_0.diff
Fixes: CVE-2013-0276
Conflicts:
activemodel/lib/active_model/attribute_methods.rb
activerecord/test/cases/mass_assignment_security_test.rb
---
activemodel/lib/active_model/attribute_methods.rb | 2 +-
activemodel/lib/active_model/mass_assignment_security/permission_set.rb | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
View CVE-2013-0277_Rails-3_0.diff
.../lib/active_record/attribute_methods/write.rb | 9 ++++++++-
activerecord/test/cases/base_test.rb | 6 ++++++
2 files changed, 14 insertions(+), 1 deletion(-)
diff --git a/activerecord/lib/active_record/attribute_methods/write.rb b/activerecord/lib/active_record/attribute_methods/write.rb
index 3c4dab3..4684c4b 100644
--- a/activerecord/lib/active_record/attribute_methods/write.rb
+++ b/activerecord/lib/active_record/attribute_methods/write.rb
@bjhess
bjhess / languages.txt
Created Jun 8, 2012
Languages I've been paid to code.
View languages.txt
Ruby
CoffeeScript
JavaScript
Java
VBScript
VB
COBOL
Easytrieve
JCL
CSS
@bjhess
bjhess / pull_request_webhook.md
Created May 18, 2012
The way I had to add a github repo webhook for pull requests
View pull_request_webhook.md

This is more complex than necessary.

GitHub webhooks for a URL by default only fire on repo pushes. There appears to be no way in the web UI to set up webhooks for other events. And so we go to the API. I prefer to do this type of thing with Hurl.

{
  "name": "web",
  "active": true,
View array_corecion.rb
irb> Array(nil)
=> []
irb> Array("string")
=> ["string"]
irb> Array([:blah, :sah])
=> [:blah, :sah]
irb> "string".to_a
NoMethodError: undefined method `to_a' for "string":String
from (irb):5
from /Users/barry/.rbenv/versions/1.9.3-p125/bin/irb:12:in `<main>'
@bjhess
bjhess / st_cheat.txt
Created Jan 11, 2012
Sublime Text Cheatsheet
View st_cheat.txt
Navigation:
cmd-p Goto Anything ('@' for functions, ':' for line number)
cmd-r Function finder
ctl-g Goto line number
cmd-sft-p Command palette
cmd-sft-f Find in Files
cmd-opt-r Toggle regex when finding
cmd-opt-# Columns
ctr-# Switch columns
You can’t perform that action at this time.