Skip to content

Instantly share code, notes, and snippets.

View kennon's full-sized avatar

Kennon Ballou kennon

  • Leipzig, Germany
View GitHub Profile
### Keybase proof
I hereby claim:
* I am kennon on github.
* I am kennon (https://keybase.io/kennon) on keybase.
* I have a public key ASADLMxW-sqT2QjuofViM9Bzz3rfxxAr01pxnt4b3TI6TAo
To claim this, I am signing this object:
@kennon
kennon / rspec_rails_cheetsheet.rb
Last active August 29, 2015 14:02 — forked from them0nk/rspec_rails_cheetsheet.rb
Changed .should to expect() syntax
# Rendering
expect(response).to render_template(:index)
# Redirecting
expect(response).to redirect_to(movies_path)
# Capybara Matchers
expect(response.body).to have_content("Hello world")
expect(response.body).to have_no_content("Hello world")
@kennon
kennon / gist:2701219
Created May 15, 2012 12:03
If architects had to work like programmers

(I didn't write this, not sure of the original source)

#If architects had to work like programmers...

Dear Mr. Architect:

Please design and build me a house. I am not quite sure of what I need, so you should use your discretion.

My house should have between two and forty-five bedrooms. Just make sure the plans are such that the bedrooms can be easily added or deleted. When you bring the blueprints to me, I will make the final decision of what I want. Also, bring me the cost breakdowns for each configuration so that I can arbitrarily pick one at a later time.

@kennon
kennon / nginx.conf
Created April 11, 2012 08:04 — forked from alaz/nginx.conf
Edits and comments to the Nginx config for Riak
# Config for Nginx to act as a front-end for Riak
# The main goal is to proxy all GETs directly to Riak, and disallow anything else (POST, PUT, etc)
# Also, disallow use of the map/reduce query links (i.e. /riak/bucket/key/_,_,_)
# Config is in /etc/nginx/sites-available/default or somewhere like that
# Set up load-balancing to send requests to all nodes in the Riak cluster
# Replace these IPs/ports with the locations of your Riak nodes
upstream riak_hosts {
server 127.0.0.1:8098;
[kennon@Rilian myproj (master)]$ rake routes --trace
(in /Projects/myproj)
** Invoke routes (first_time)
** Invoke environment (first_time)
** Execute environment
rake aborted!
value must be enumerable
/Users/kennon/.rvm/rubies/ruby-1.9.2-rc2/lib/ruby/1.9.1/set.rb:85:in `do_with_enum'
/Users/kennon/.rvm/rubies/ruby-1.9.2-rc2/lib/ruby/1.9.1/set.rb:310:in `merge'
/Users/kennon/.rvm/gems/ruby-1.9.2-rc2/gems/actionpack-3.0.6/lib/action_view/helpers/sanitize_helper.rb:205:in `sanitized_allowed_tags='
[2011-01-28 15:34:07,370][DEBUG][action.search.type ] [Sunset Bain] [development][1], node[jqu8Mb3RQVGc4OQEtjVB2w], [P], s[STARTED]: Failed to execute [org.elasticsearch.action.search.SearchRequest@48c7aaef]
org.elasticsearch.search.SearchParseException: [development][1]: from[-1],size[-1]: Parse Failure [Failed to parse source [_na_]]
at org.elasticsearch.search.SearchService.parseSource(SearchService.java:420)
at org.elasticsearch.search.SearchService.createContext(SearchService.java:336)
at org.elasticsearch.search.SearchService.executeQueryPhase(SearchService.java:169)
at org.elasticsearch.search.action.SearchServiceTransportAction.sendExecuteQuery(SearchServiceTransportAction.java:131)
at org.elasticsearch.action.search.type.TransportSearchQueryThenFetchAction$AsyncAction.sendExecuteFirstPhase(TransportSearchQueryThenFetchAction.java:76)
at org.elasticsearch.action.search.type.TransportSearchTypeAction$BaseAsyncAction.performFirstPhase(TransportSearchTypeAction.java:193)
at org.elasticsearch
@kennon
kennon / rails_log_tailer.gawk
Created November 23, 2010 11:36
A gawk script for tailing Rails 2.3.x logfiles to show more condensed output
#!/usr/bin/env gawk
# rails_log_tailer.gawk
# usage: tail -f log/production.log | gawk -f rails_log_tailer.gawk
# This gives you a nice condensed 1 line output from the Rails logfile
BEGIN { RS = "" }
/^Processing/ {
match($0, /Processing ([a-zA-Z#]+)/, processing)
match($0, /Completed in ([0-9]+)ms \((View: [0-9]+, )?DB: ([0-9]+)\) \| ([0-9]+) [a-zA-Z]+ \[(.*)\]/, completed)
node.js:63
throw e;
^
Error: Cannot find module 'connect'
at loadModule (node.js:275:15)
at require (node.js:411:14)
at Object.<anonymous> (/opt/lib/node/express/index.js:16:32)
at Module._compile (node.js:462:23)
at Module._loadScriptSync (node.js:469:10)
at Module.loadSync (node.js:338:12)
<VirtualHost *:80>
ServerName rails
ServerAlias *.rails
<Location />
ProxyPass http://127.0.0.1:3000/ retry=0
ProxyPassReverse http://127.0.0.1:3000/
</Location>
</VirtualHost>
map:
function(doc) {
if (doc.attackers) {
for (var i in doc.attackers) {
if( doc.attackers[i].name ) {
emit(doc.attackers[i].corporation, 1);
}
}
}