This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function foo() { | |
alert("Hello"); | |
} | |
var foo = function() { | |
alert("Hello"); | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var constructor = function(spec, my) { | |
var that = {}, | |
/* private instance variables */ | |
foo; | |
/* shared objects */ | |
my = my || {}; | |
/** accessible method */ | |
that.hoge = function() { | |
huga(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" ***** mattn/gist-vim ***** | |
" --- gist setting --- | |
" let g:github_user = 'kaneshin' | |
" let g:github_token = '<api token>' | |
" let g:gist_privates = 1 | |
" --- key map --- | |
" post to gist | |
nnoremap ,gs :<C-u>Gist<CR> | |
" update gist | |
nnoremap ,ge :<C-u>Gist -e<CR> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" How to use 's:' or '<SID>' | |
"-------------------- | |
" s: | |
" :autocmd, :command, :function/:endfunction | |
command! -nargs=1 Foo :call s:foo(<f-args>) | |
function! s:foo(bar) | |
let l:baz = 0 | |
" ... | |
return s:foo(l:baz) | |
endfunction |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" Fibonacci number - vim | |
command! -nargs=1 Fibonacci :echo s:fibonacci(<f-args>) | |
function! s:fibonacci(n) | |
if a:n < 1 | |
return 1 " F_0 | |
elseif a:n == 1 | |
return 1 " F_1 | |
endif | |
return s:fibonacci(a:n - 1) + s:fibonacci(a:n - 2) | |
endfunction |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" Factorial - vim | |
command! -nargs=1 Factorial :echo s:factorial(<f-args>) | |
function! s:factorial(n) | |
if a:n <= 1 | |
return 1 | |
else | |
return a:n * s:factorial(a:n - 1) | |
endif | |
endfunction |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" Greatest Common Divisor - vim | |
command! -nargs=+ GreatestCommonDivisor :echo s:gdb(<f-args>) | |
function! s:gdb(a, b) | |
let l:r = a:a % a:b | |
if l:r | |
return s:gdb(a:b, l:r) | |
else | |
return a:b | |
endif | |
endfunction |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var foo = { | |
bar: 10, | |
baz: function(num, callback) { | |
callback(num * num); | |
}, | |
qux: function(num, callback) { | |
var self = this; | |
this.baz(num, function(res) { | |
callback(res + self.bar); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$.each(section, function(i, line) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# vim:set ts=8 sts=2 sw=2 tw=0: | |
#=========================================================================== | |
# File: .screenrc | |
# Last Change: 19-Oct-2011. | |
# Maintainer: Shintaro Kaneko <[email protected]> | |
#=========================================================================== | |
############################## | |
# encoding setting | |
############################## |
OlderNewer