Skip to content

Instantly share code, notes, and snippets.

module ExpiryCheck
ExpiryMins=15
def self.included(target)
target.alias_method_chain :get_rate, :expiry_check
end
def get_rate_with_expiry_check(from, to)
check_for_rate_expiry
get_rate_without_expiry_check(from, to)
@scrooloose
scrooloose / hax0r.vim
Created January 10, 2012 10:03 — forked from asgeo1/hax0r.vim
NERDTree custom mappings to make i and s reuse existing windows
let g:NERDTreeCustomReuseWindows = '1'
call NERDTreeAddKeyMap({
\ 'key': 'w',
\ 'scope': 'all',
\ 'callback': 'NERDTreeCustomToggleReuse',
\ 'quickhelpText': 'Toggle use existing windows' })
function! NERDTreeCustomToggleReuse()
let g:NERDTreeCustomReuseWindows = g:NERDTreeCustomReuseWindows ? 0 : 1
@scrooloose
scrooloose / hax0r.vim
Created January 5, 2012 20:23
NERDTree custom mappings to make i and s reuse existing windows
call NERDTreeAddKeyMap({
\ 'key': 'i',
\ 'scope': 'FileNode',
\ 'callback': "NERDTreeCustomOpenSplit",
\ 'quickhelpText': 'open split reusing if able' })
function! NERDTreeCustomOpenSplit(node)
call a:node.open({'split': 'h', 'reuse': 1})
function! s:Path._strForEdit()
let p = escape(self.str({'format': 'UI'}), s:escape_chars)
let cwd = getcwd() . s:Path.Slash()
"return a relative path if we can
let isRelative = 0
if s:running_windows
let isRelative = stridx(tolower(p), tolower(cwd)) == 0
else
let isRelative = stridx(p, cwd) == 0
@scrooloose
scrooloose / custom_maps.vim
Created December 28, 2011 10:33
Couple of custom key maps for nerdtree
if exists("g:loaded_nerdtree_custom_maps")
finish
endif
let g:loaded_nerdtree_custom_maps = 1
"adds a keymapping on 'o' that overrides the standard nerdtree 'o' mapping and
"to open the file node and close the tree
call NERDTreeAddKeyMap({
\ 'key': 'o',
" /etc/vimrc (configuration file for vim only)
" author: Klaus Franken <kfr@suse.de>
" author: Werner Fink <werner@suse.de>
" author: Florian La Roche <florian@suse.de>
" version: 00/01/20
" commented lines start with `"'
" enable syntax highlighting
syntax on
"==============================================================================
" FileName: applescript.vim
" Desc: Syntax checking plugin for syntastic.vim
" Author: Zhao Cai
" Email: caizhaoff@gmail.com
" Version: 0.1
" Date Created: Thu 09 Sep 2011 10:30:09 AM EST
" Last Modified: Fri 09 Dec 2011 10:32:04 AM EST
"
" History: 0.1 - working, but it will run the script everytime to check
"============================================================================
"File: c.vim
"Description: Syntax checking plugin for syntastic.vim
"Maintainer: Gregor Uhlenheuer <kongo2002 at gmail dot com>
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"
global !p
def underscore(s):
"""Convert FooBarBaz into foo_bar_baz"""
s1 = re.sub('(.)([A-Z][a-z]+)', r'\1_\2', s)
return re.sub('([a-z0-9])([A-Z])', r'\1_\2', s1).lower()
def camelcase(s):
"""Convert foo_bar_baz into FooBarBaz"""
it = iter(s.split('_'))
rv = ""
function s:GetLineEnding()
let rv = "\n"
if s:Random() % 10 == 0
for i in range(0,5)
if s:Random() % 2 == 1
let rv = "\<c-v>\<tab>" . rv
else
let rv = " " . rv
endif