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
" reload .vimrc when editing it: :so % | |
set nocompatible " be iMproved | |
filetype off " required! | |
set nu " show line numbers | |
set hlsearch " highlight search terms | |
" Clear last search highlighting | |
nnoremap <c-m> :noh<cr> | |
" Easier navigation between split windows |
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
# from http://quanterium.blogspot.com/2012/01/creating-self-signed-ssl-certificate.html | |
# see also http://www.mail-archive.com/openssl-users@openssl.org/msg47647.html | |
# to use: | |
# first, change alt_names | |
# then, openssl req -new -x509 -days 365 -nodes -out example.crt -keyout example.key -config example.conf | |
# and follow instructions | |
[ ca ] | |
default_ca = CA_default |
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
#!/bin/sh | |
# An example hook script to verify what is about to be pushed. Called by "git | |
# push" after it has checked the remote status, but before anything has been | |
# pushed. If this script exits with a non-zero status nothing will be pushed. | |
# | |
# This hook is called with the following parameters: | |
# | |
# $1 -- Name of the remote to which the push is being done | |
# $2 -- URL to which the push is being done |
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 take_select n, &block | |
count = 0 | |
res = [] | |
select do |x| | |
r = yield x | |
if r == true | |
count += 1 | |
res << x | |
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
Benchmarking 127.0.0.1 (be patient) | |
Finished 448 requests | |
Server Software: WEBrick/1.3.1 | |
Server Hostname: 127.0.0.1 | |
Server Port: 3080 | |
Document Path: /api/v1/users/1/cabinets/1/drinks | |
Document Length: 801 bytes |
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
Benchmarking 127.0.0.1 (be patient) | |
Finished 390 requests | |
Server Software: thin | |
Server Hostname: 127.0.0.1 | |
Server Port: 3080 | |
Document Path: /api/v1/users/1/cabinets/1/drinks | |
Document Length: 801 bytes |
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
Benchmarking 127.0.0.1 (be patient) | |
Finished 199 requests | |
Server Software: | |
Server Hostname: 127.0.0.1 | |
Server Port: 3080 | |
Document Path: /api/v1/users/1/cabinets/1/drinks | |
Document Length: 801 bytes |
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
Benchmarking 127.0.0.1 (be patient) | |
Finished 450 requests | |
Server Software: | |
Server Hostname: 127.0.0.1 | |
Server Port: 3080 | |
Document Path: /api/v1/users/1/cabinets/1/drinks | |
Document Length: 801 bytes |
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
/** | |
* Builder pattern for factories, mimic use of FactoryGirl traits. | |
* usage: factories.boostedBoost({retweets: 1}).twitter().withdrawn().geo(11217).generate(); | |
* must call `generate` as last step | |
* may pass options to initial method call, as well as subsequent method calls | |
*/ | |
function addFactory(factoryName, config) { | |
// add trait function to generated Factory | |
function addTrait(k, Factory, config) { | |
Factory.prototype[k] = function() { |
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
# this is ugly and terrible, don't do this | |
module ActiveRecord | |
module ConnectionAdapters | |
class TableDefinition | |
def column(name, type, options = {}) | |
name = name.to_s | |
type = type.to_sym | |
column = self[name] || new_column_definition(@base, name, type) |
OlderNewer