This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" Christopher Meiklejohn ([email protected]) | |
" .vimrc -- parts stolen from all over the place. | |
set nocompatible " We don't want vi compatibility. | |
set viminfo^=! | |
let g:miniBufExplMapWindowNavVim = 1 | |
let g:miniBufExplMapWindowNavArrows = 1 | |
let g:miniBufExplMapCTabSwitchBufs = 1 | |
let g:miniBufExplModSelTarget = 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/ruby | |
require 'openssl' | |
require 'base64' | |
require 'rubygems' | |
require 'aws' | |
# Open master s3 connection | |
master_s3 = Aws::S3.new( | |
'key', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Setup status bar | |
set -g status-bg black | |
set -g status-fg white | |
set -g message-bg black | |
set -g message-fg green | |
set -g status-left '#[fg=green]#H #S' | |
# Highlight active window | |
set-window-option -g window-status-current-attr bright | |
set-window-option -g window-status-current-fg white |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def to_key | |
new_record? ? nil : [self.send(self.class.primary_key)] | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
> db.collection.getIndexes(); | |
[ | |
{ | |
"name" : "_id_", | |
"ns" : "test.collection", | |
"key" : { | |
"_id" : 1 | |
} | |
}, | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Rails 2 way. | |
SomeController.new.process( request, response ) | |
# Rails 3 way. | |
status, headers, body = SomeController.action(:show).call(request.env) | |
response = ActionDispatch::Response.new(status, headers, body) | |
self.response_body = response |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MicropostsController < ApplicationController | |
before_filter :set_micropost, :only => [:show, :edit, :update, :create, :new] | |
before_filter :authenticate, :only => [:create, :destroy] # Same here? | |
# Omitted. | |
def destroy | |
@micropost.destroy | |
redirect_back_or root_path |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Utf8Header < Thor | |
desc "add", "Add Content UTF-8 on top of all .rb/.feature files" | |
# copy & pasted from https://gist.github.com/738245 | |
def add | |
files = Array.new | |
["*.rb", "*.rake","*.feature"].each do |extension| | |
files.concat(Dir[ File.join(Dir.getwd.split(/\\/), "**", extension) ]) | |
end | |
files.each do |file| |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'capybara' | |
require 'capybara/dsl' | |
require 'capybara-webkit' | |
Capybara.run_server = false | |
Capybara.current_driver = :webkit | |
Capybara.app_host = 'http://www.google.com' | |
module MyCapybaraTest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Array | |
def include_by_regexp_or_string?(str) | |
any? do |o| | |
o.is_a?(Regexp) ? o =~ str : o == str | |
end | |
end | |
end |
OlderNewer