Skip to content

Instantly share code, notes, and snippets.

@bjhess
bjhess / st_cheat.txt
Created January 11, 2012 21:39
Sublime Text Cheatsheet
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
@bjhess
bjhess / pull_request_webhook.md
Created May 18, 2012 15:58
The way I had to add a github repo webhook for pull requests

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,
actionview (7.0.1) lib/action_view/helpers/translation_helper.rb:73:in `translate'
will_paginate (3.1.8) lib/will_paginate/view_helpers/action_view.rb:83:in `will_paginate_translate'
will_paginate (3.1.8) lib/will_paginate/view_helpers.rb:77:in `will_paginate'
will_paginate (3.1.8) lib/will_paginate/view_helpers/action_view.rb:33:in `will_paginate'
app/views/families/show.html.erb:50
actionview (7.0.1) lib/action_view/base.rb:244:in `public_send'
actionview (7.0.1) lib/action_view/base.rb:244:in `_run'
actionview (7.0.1) lib/action_view/template.rb:157:in `block in render'
activesupport (7.0.1) lib/active_support/notifications.rb:206:in `block in instrument'
activesupport (7.0.1) lib/active_support/notifications/instrumenter.rb:24:in `instrument'
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
  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?
# Specific rewrite rules for blog traffic
<Directory /server/directory/to/app/current/public/blog>
RewriteEngine On
RewriteBase /blog/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /blog/index.php [L]
</Directory>
@bjhess
bjhess / athing.rb
Created February 21, 2013 15:36
a thing
def total_price
[
total_price_without_discounts - self.yearly_discount - self.recurring_coupon_discount - self.special_deal_discount,
0
].max
end
---
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 +++++++++-----
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(-)
.../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