Skip to content

Instantly share code, notes, and snippets.

Andrew Radev AndrewRadev

Block or report user

Report or block AndrewRadev

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
AndrewRadev / utl_mapping.vim
Created Oct 10, 2009
NERDTree integration with Utl
View utl_mapping.vim
" Requires: Utl
call NERDTreeAddKeyMap({
\ 'key': 'gu',
\ 'callback': 'OpenCurrentNodeWithUtl',
\ 'quickhelpText': 'open current node with the Utl plugin' })
function! OpenCurrentNodeWithUtl()
" Get the path of the item under the cursor if possible:
let currentDir = g:NERDTreeFileNode.GetSelected()
View gist:513976
" Remap the 'Enter' key to process the command line before executing
cnoremap <cr> <c-r>=<SID>DoSomeChecks()<cr><cr>
function! s:DoSomeChecks()
let g:debug = getcmdline()
" and some more stuff...
" :doautocmd with a custom event maybe?
return ''
View mappings.vim
" <space>x -> :X
" For easier typing of custom commands
noremap <space> :call <SID>SpaceMapping()<cr>
function! s:SpaceMapping()
let c = nr2char(getchar())
call feedkeys(':'.toupper(c))
View monads.rb
require 'pp'
class Monad
class Wrapper
def initialize(monad)
@monad = monad
@lets = {}
def let(name, value)
View map_toggle.vim
" Toggle settings:
command! -nargs=+ MapToggle call s:MapToggle(<f-args>)
function! s:MapToggle(key, opt)
let cmd = ':set '.a:opt.'! \| set '.a:opt."?\<CR>"
exec 'nnoremap '.a:key.' '.cmd
" To toggle search highlighting on and off with <F9>, just do:
" MapToggle <F9> hlsearch
View generate-rails-gem-tags
#! /usr/bin/env ruby
# Generate all tags for all gems included by bundler in gems.tags
# Basically does the same as "bundle show gemname", except for all gems.
# Interestingly enough, "bundle show" without any arguments falls back to
# "bundle list", otherwise the whole thing could have been a bash one-liner.
require 'bundler'
AndrewRadev / fs_buffer_menu.vim
Created Apr 23, 2011
NERDTree plugin for filesystem manipulation using a temporary buffer for its input
View fs_buffer_menu.vim
" vim: foldmethod=marker
" This NERDTree plugin adds a filesystem manipulation menu almost exactly like
" the default one. The difference is that operations that require entering a
" file path, namely "add", "move" and "copy", use a separate one-line buffer
" to receive the input, instead of the default vim dialog. This allows you to
" use vim keybindings to move around the file path.
" Most of the code here is taken directly from Marty Grenfell's original
" fs_menu plugin, which can be found here:
AndrewRadev / not.rb
Created May 25, 2011
View not.rb
if not defined? BasicObject
class BasicObject
m = %w"__id__ __send__ instance_eval == equal?"
(instance_methods - m).each{|m| undef_method(m)}
class NotDelegator < BasicObject
def initialize(obj)
@_object = obj
AndrewRadev / ordered_hash_wtf.rb
Created May 27, 2011
Odd behaviour for pp with ActiveSupport::OrderedHash
View ordered_hash_wtf.rb
# Ruby 1.8.7-p330
# ActiveSupport 3.0.7
require 'rubygems'
require 'active_support/ordered_hash'
require 'pp'
test =
test[:one] = 1
AndrewRadev / inconsistency.rb
Created May 27, 2011
ActiveSupport::OrderedHash inconsistency
View inconsistency.rb
# Ruby 1.8.7
# ActiveSupport 3.0.7
require 'rubygems'
require 'active_support/ordered_hash'
require 'pp'
ordered =
standard =
You can’t perform that action at this time.