Skip to content

Instantly share code, notes, and snippets.

@cho45
cho45 / callcc.js
Created January 23, 2009 17:07
callcc on jsdeferred
// @require http://svn.coderepos.org/share/lang/javascript/jsdeferred/trunk/jsdeferred.js
function callcc (fun) {
var error = new Deferred();
return call(function () {
// JSDeferred は this に現在実行中の Deferred オブジェクトをいれてくる。
var ccdeferred = this;
// 継続 (Deferred) に値を注入する関数 (Scheme の継続みたいなの) を渡してやる。
return fun(function (a) { ccdeferred._next.call(a); throw error });
}).
/*
Render SVG Arc with canvas commands
Usage: solveArc(x, y, coords)
*/
function solveArc(x, y, coords) {
var rx = coords[0]
var ry = coords[1]
var rot = coords[2]
var large = coords[3]
set tabline=%!SetTabLine()
function! SetTabLine()
" NOTE: left/right padding of each tab was hard coded as 1 space.
" NOTE: require Vim 7.3 strwidth() to display fullwidth text correctly.
" settings
let tabMinWidth = 0
let tabMaxWidth = 40
let tabMinWidthResized = 15
@tyru
tyru / .vimrc
Created October 30, 2010 00:08
" Swap window without moving cursor {{{
nmap <Space>j <SID>(swap-window-down-no-cursor-move)
nmap <Space>k <SID>(swap-window-up-no-cursor-move)
nmap <Space>h <SID>(swap-window-left-no-cursor-move)
nmap <Space>l <SID>(swap-window-right-no-cursor-move)
nnoremap <SID>(swap-window-down-no-cursor-move) :<C-u>call <SID>swap_with_wincmd(v:count1, 'j')<CR>
nnoremap <SID>(swap-window-up-no-cursor-move) :<C-u>call <SID>swap_with_wincmd(v:count1, 'k')<CR>
nnoremap <SID>(swap-window-left-no-cursor-move) :<C-u>call <SID>swap_with_wincmd(v:count1, 'h')<CR>
nnoremap <SID>(swap-window-right-no-cursor-move) :<C-u>call <SID>swap_with_wincmd(v:count1, 'l')<CR>
@tsukkee
tsukkee / nerdtree_unite_filerec.vim
Created October 31, 2010 13:54
NERDTreeで選択したノードからUnite file_recする
if exists("g:loaded_nerdtree_unite_filerec")
finish
endif
let g:loaded_nerdtree_unite_filerec = 1
if !exists(':Unite')
echoerr 'This plugin requires unite.vim'
finish
endif
@pzol
pzol / install_ruby192_freebsd.sh
Created December 18, 2010 23:24
How to install rvm 1.9.2 under FreeBSD - this is work in progress and not complete. You have to su or sudo -i to run this
# this does not run as a complete script :(
pkg_add -r bash curl sudo
pkg_add -r git vim # can you live without it?
pkg_add -r libxml2 libxslt # for nokogiri later
pw usermod pzol -G wheel
bash # start bash and run the rest inside it
curl -# -L http://bit.ly/rvm-install-system-wide > rvm-install-system-wide
bash -l < rvm-install-system-wide
var e = new (require("events").EventEmitter)
e.on("newListener", function (ev, fn) {
console.error(e.listeners(ev))
console.error("During: listeners.length = %d", e.listeners(ev).length)
})
console.error("Before: listeners.length = %d", e.listeners("foo").length)
e.on("foo", function () {})
console.error(e.listeners("foo"))
@huyng
huyng / matplotlibrc
Created February 8, 2011 15:50
my default matplotlib settings
### MATPLOTLIBRC FORMAT
# This is a sample matplotlib configuration file - you can find a copy
# of it on your system in
# site-packages/matplotlib/mpl-data/matplotlibrc. If you edit it
# there, please note that it will be overridden in your next install.
# If you want to keep a permanent local copy that will not be
# over-written, place it in HOME/.matplotlib/matplotlibrc (unix/linux
# like systems) and C:\Documents and Settings\yourname\.matplotlib
# (win32 systems).
@balupton
balupton / README.md
Last active April 20, 2022 13:21
Ajaxify a Website with the HTML5 History API using History.js, jQuery and ScrollTo
@balupton
balupton / ajaxify-html4.js
Created March 7, 2011 04:58
Ajaxify a Website using the HTML4 HashChange Functionality
(function(window,undefined){
// Prepare our Variables
var
document = window.document,
$ = window.jQuery;
// Wait for Document
$(window).bind(function(){
// Prepare Variables