Skip to content

Instantly share code, notes, and snippets.

View thegengen's full-sized avatar

Eugen Minciu thegengen

  • GroupCollect
  • Bucharest
View GitHub Profile
@thegengen
thegengen / gist:2c14e63f0d494a126b14
Created September 29, 2014 13:13
rubygems EU mirror is misbehaving
Gem::RemoteFetcher::FetchError: Errno::ETIMEDOUT: Operation timed out - connect(2) for "aws-eu-cache01.rubygems.org" port 80 (http://rubygems.org/gems/rdoc-3.12.2.gem)
@thegengen
thegengen / gist:4954405
Created February 14, 2013 17:18
easily select method contents in vim
" === Selecting methods ===
" MAP: vim, vam to visually select, but almost anything goes. Examples:
" cim: change method contents
" dam: delete whole method
" ,cim: comment out method contents
vmap im <Esc>[mjV]Mk
vmap am <Esc>[mV]M
omap im :normal vim<CR>
@thegengen
thegengen / gist:2320989
Created April 6, 2012 15:57
use Tab instead of Enter for VIM's completion (including acp.vim)
" put this in your .vimrc
inoremap <Tab> <C-R>=pumvisible() ? "\<lt>C-N>" : "\<lt>Tab>"<CR>
inoremap <CR> <C-R>=pumvisible() ? "\<lt>ESC>o" : "\<lt>CR>"<CR>
require 'test_helper'
class InteractionTest < Test::Unit::TestCase
include Less
setup do
unless defined?(TestInteraction)
class TestInteraction < Less::Interaction
def run
end
end
should "fail if an expected parameter is not found" do
class InteractionExpectingParameter < Less::Interaction
expects :title, String
def run
end
end
assert_raise(MissingParameterError) { InteractionExpectingParameter.run }
end
@thegengen
thegengen / gist:193414
Created September 25, 2009 08:44
generate random strings
>> ActiveSupport::SecureRandom.hex(10)
=> "8a2cf0a838e64f6f85d1"
>> ActiveSupport::SecureRandom.base64(10)
=> "fUL81hGd77YyGg=="