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
tell application "System Preferences" | |
reveal anchor "keyboardTab" of pane "com.apple.preference.keyboard" | |
tell application "System Events" | |
click checkbox 1 of tab group 1 of window 1 of application process "System Preferences" | |
end tell | |
end tell | |
if application "System Preferences" is running then | |
tell application "System Preferences" to quit | |
end if |
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
#!c:/python34/python.exe | |
import sass | |
import sys | |
def main(scss_filename, css_filename=None): | |
if css_filename is None: | |
css_filename = scss_filename.rsplit('.', 1)[0] + '.css' | |
with open(scss_filename, 'rb') as f: | |
d = f.read() |
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
func! ViewResource() | |
let f = input("Filename: ", expand("<cfile>:p")) | |
let f2=substitute(f, "/", "\\", "g") | |
" windows system. | |
" using irfanview | |
call system('"C:/Program Files/IrfanView/i_view32.exe" '.f2) | |
endfunc |
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
" To use, save this file and type ":so %" | |
" Optional: First enter ":let g:rgb_fg=1" to highlight foreground only. | |
" Restore normal highlighting by typing ":e" | |
setlocal nohlsearch | |
d search('^" BEGIN_COLOR_LIST', 'e') | |
while search('\w\+') > 0 | |
let w = expand('<cword>') | |
if w == 'END_COLOR_LIST' | |
break | |
endif |
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
" Color test: Save this file, then enter ':so %' | |
" Then enter one of following commands: | |
" :VimColorTest "(for console/terminal Vim) | |
" :GvimColorTest "(for GUI gvim) | |
function! VimColorTest(outfile, fgend, bgend) | |
let result = [] | |
for fg in range(a:fgend) | |
for bg in range(a:bgend) | |
let kw = printf('%-7s', printf('c_%d_%d', fg, bg)) | |
let h = printf('hi %s ctermfg=%d ctermbg=%d', kw, fg, bg) |
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
" .vimrc | |
" Author: Steve Losh <[email protected]> | |
" Source: http://bitbucket.org/sjl/dotfiles/src/tip/vim/ | |
" | |
" This file changes a lot. I'll try to document pieces of it whenever I have | |
" a few minutes to kill. | |
" Preamble ---------------------------------------------------------------- {{{ | |
" Dear /bin/bash: fuck you and your bullshit, arcane command-line behaviour. |
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
infix operator + { | |
associativity left | |
precedence 140 | |
} | |
infix operator ... { | |
associativity none | |
precedence 135 | |
} |
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
/* | |
모나드는 특정한 타입을 감싸는 타입이며, | |
raw한 값을 감싸는 함수와 | |
raw한 값을 모나드 값으로 바꾸는 어떤 함수에 바인딩된다. | |
이를 바탕으로 모나드 프로토콜을 정의하면 다음과 같다. | |
*/ | |
protocol Monad { |
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
def qsort(alist): | |
if len(alist) == 0: | |
return [] | |
pivot = alist[0] | |
less = filter(lambda x: x < pivot, alist[1:]) | |
greater = filter(lambda x: x >= pivot, alist[1:]) | |
return qsort(less) + [pivot] + qsort(greater) | |
a = [45, 53, 26, 93, 62, 20, 33, 17] |
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
// Bubble Sort | |
func bubbleSort<T:Comparable>(inout l:[T]) { | |
if l.count == 0 { return } | |
var changed = true | |
while changed { | |
changed = false | |
for i in 1..<l.count { | |
if l[i] < l[i-1] { |