Skip to content

Instantly share code, notes, and snippets.

View brookr's full-sized avatar
💭
🚀

Brook R brookr

💭
🚀
View GitHub Profile
@brookr
brookr / gist:4158424
Created November 28, 2012 01:23
S3 issues with Paperclip
IOError in Batch entriesController#create
closed stream
RAILS_ROOT: /Library/WebServer/Documents/scope5
Application Trace | Framework Trace | Full Trace
/Library/WebServer/Documents/scope5/config/initializers/monkeypatch_aws-sdk.rb:6:in `rebuild_request'
/Users/brookr/.rvm/gems/ruby-1.8.7-p352@carbonsalon/gems/aws-sdk-1.7.1/lib/aws/core/client.rb:275:in `rebuild_http_request'
/Users/brookr/.rvm/gems/ruby-1.8.7-p352@carbonsalon/gems/aws-sdk-1.7.1/lib/aws/core/client.rb:265:in `retry_server_errors'
/Users/brookr/.rvm/gems/ruby-1.8.7-p352@carbonsalon/gems/aws-sdk-1.7.1/lib/aws/core/client.rb:226:in `make_sync_request'
def(username)
possibilities = profiles.keys.select { |u| username.downcase == u.downcase[0, username.length] }
if possibilities.include? username
[username]
else
possibilities
end
end
@brookr
brookr / index.html.erb
Created June 2, 2012 05:01
How to link an image file to the upvote action in the q_man demo app
<h1>Listing questions</h1>
<table>
<tr>
<th>Title</th>
<th>Body</th>
<th>Votes</th>
<th>Upvote</th>
<th></th>
<th></th>
@brookr
brookr / table.rb
Created May 31, 2012 19:54
A basic Table class
# Assignment: Fill in this Table class so the tests pass!
class Table
end
# Unit tests
@brookr
brookr / Google Apps Standard DNS Settings
Last active May 25, 2017 16:11
All the DNS records for a new Google Apps account, as entered in AWS:Route53
A: # If using naked domain redirects via Google
216.239.32.21
216.239.34.21
216.239.36.21
216.239.38.21
MX: # If using Google Mail
1 ASPMX.L.GOOGLE.COM.
5 ALT1.ASPMX.L.GOOGLE.COM.
5 ALT2.ASPMX.L.GOOGLE.COM.
@brookr
brookr / core_extensions.rb
Created May 15, 2012 06:24
Add collector methods for all attributes on objects in an array.
class Array
def method_missing(method_name, *args, &block)
if method_name.to_s.is_plural?
map{ |e| e.send(method_name.to_s.singularize) }
else
super
end
end
def respond_to?(method_name, include_private = false)
@brookr
brookr / to_inventory.rb
Created May 8, 2012 17:10
Get a human-readable listing of what is in an array in Rails.
class Array
include ActionView::Helpers::TextHelper
def to_inventory
c = {}
each { |e| c[e.class.name] = c[e.class.name].to_i + 1 }
c.sort.map{ |k, v| pluralize(v, k) }.to_sentence
end
end
@brookr
brookr / gist:2493622
Created April 25, 2012 21:34 — forked from derekharmel/gist:2399684
How to fix pow not using the correct gemset
# From the project root
rvm env -- `rvm current` >> .powenv
@brookr
brookr / config.ru
Created April 16, 2012 04:36
Rackup file I use for running WordPress on Pow
# config.ru for Pow + Wordpress, based on http://stuff-things.net/2011/05/16/legacy-development-with-pow/
# added hackery to work around wordpress issues - Patrick Anderson (patrick@trinity-ai.com)
# clearly this could be cleaner, but it does work
require 'rack'
require 'rack-legacy'
require 'rack-rewrite'
# patch Php from rack-legacy to substitute the original request so
# WP's redirect_canonical doesn't do an infinite redirect of /
var Person = function(name) {
this.name = name
}
Person.prototype.getName = function() { return this.name }
var thomas = new Person('Thomas');
var amy = new Person('Amy');
thomas.name // --> "Thomas"
Person.prototype.name = "Amy"