Skip to content

Instantly share code, notes, and snippets.

" quickrun - run a command and show its result quickly
" Author: ujihisa <http://ujihisa.nowa.jp/>
" ModifiedBy: kana <http://whileimautomaton.net/>
if exists('g:loaded_quickrun')
finish
endif
extern int main(int __unused__ argc, char **argv) {
cookedArgs *args;
[...]
args = cArgNewFromArgv (argv);
[...]
makeTags (args);
/* Clean up.
*/
@yoppi
yoppi / gist:870777
Created March 15, 2011 14:25
changelog.vim.patch
diff --git a/runtime/ftplugin/changelog.vim b/runtime/ftplugin/changelog.vim
--- a/runtime/ftplugin/changelog.vim
+++ b/runtime/ftplugin/changelog.vim
@@ -99,6 +99,8 @@
function! s:try_reading_file(path)
try
return readfile(a:path)
+ catch
+ " nop
endtry
@yoppi
yoppi / errormarker.vim.patch
Created March 19, 2011 15:43
fixed disorderd on CUI vim.
diff --git a/errormaker.vim b/errormaker.vim
index d1e1093..f45e698 100644
--- a/errormaker.vim
+++ b/errormaker.vim
@@ -142,6 +142,9 @@ function! s:SetErrorMarkers()
execute ":sign place " . l:key . " line=" . l:d.lnum . " name=" .
\ l:name . " buffer=" . l:d.bufnr
endfor
+ if !has('gui_running')
+ redraw!
if (companyRoot != null) {
addError("errors.csv.existCompany", lineNumber, importData.getCompanyName(), fileName);
}
@yoppi
yoppi / sleep_sort.rb
Created May 21, 2011 17:16
SleepSort
require 'thread'
def sleep_sort(xs)
queue = Queue.new
xs.map {|x|
# 1000 is precision limit
Thread.new(x) {|_x| sleep(_x / 1000.0); queue.push(_x) }
}.each(&:join)
ret = []
@yoppi
yoppi / gist:985269
Created May 22, 2011 08:01
load binfile for npm
if [ -d $HOME/.npm ]; then
for bin in $HOME/.npm/*/*/package/bin
do
export PATH=$bin:$PATH
done
fi
@yoppi
yoppi / list_comprehension.coffee
Created May 31, 2011 04:16
List Comprehension with CoffeeScript
# like list comprehension
list = (i for i in [0..10] when i % 2 is 0)
@yoppi
yoppi / recursive.vim
Created June 1, 2011 01:23
Recursive Function with Vim Script
function! Tree(lst, ret)
if empty(a:lst)
return a:ret
endif
let _ = a:ret + get(a:lst, 0)
return Tree(a:lst[1:-1], _)
endfunction
echo Tree(range(11), 0)
"=> 55
@yoppi
yoppi / cool.rb
Created June 2, 2011 11:15
map/compact/inject
puts_catalog(
conversion,
(1..3).map {|i|
catalog.fetch_hash["m_catalog_category_level3_id#{i}"]
}.compact.inject([]) {|ret, id|
ret << find_catalog_category_level(id)
}
)