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
getWindowPID :: Window -> X (Maybe Int) | |
getWindowPID w = withDisplay $ \dpy -> do | |
atom <- getAtom "_NET_WM_PID" | |
ret <- io $ getWindowProperty32 dpy atom w | |
case ret of | |
Just (pid:_) -> return $ Just $ fromIntegral pid | |
_ -> return Nothing | |
spawnTerminalInCWD :: X () | |
spawnTerminalInCWD = do |
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
<?php | |
function mro($class) { | |
$classes = class_parents($class); | |
array_unshift($classes, $class); | |
return $classes; | |
} | |
function get_parent($class) { |
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
<?php | |
class Type extends Object { | |
public $__name__; | |
public $__base__; | |
public $__bases__; | |
public $__mro__; | |
function __construct() { | |
// FIXME: construct with Type class itself |
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
_U_NYA_STATE=1 | |
_U_NYA_PATTERN=( | |
'(」・ω・)」うー! ' | |
'(/・ω・)/にゃー!' | |
'(」・ω・)」うー! ' | |
'(/・ω・)/にゃー!' | |
'(」・ω・)」うー! ' | |
'(/・ω・)/にゃー!' | |
"Let's\(・ω・)/にゃー!" | |
) |
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
# pass-as-is | |
# | |
# introduce '$' to zsh command line, which make rest of buffer as a single argument "as-is" | |
# | |
# ex.) | |
# $ python -c $ print "I'm fine!" | |
# I'm fine! | |
# | |
# NOTE: real command line will remain in command history until you execute other command |
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 myif(b, then_block, else_block) | |
h = Hash.new(then_block) | |
h[false] = else_block | |
h[nil] = else_block | |
return h[b].call() | |
end | |
def mythen(&block) | |
return block |
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
#!/usr/bin/python | |
# vim: fileencoding=utf-8 | |
'''ここまで読んだ | |
標準入力を読み出し、標準出力に書き込む。 | |
エンターが押されたら、マーカーを表示する。 | |
''' | |
import os | |
import sys | |
import tty |
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
python <<EOPython | |
import vim | |
class InstantReST(object): | |
from multiprocessing import Queue | |
queue = Queue() | |
process = None | |
last_rst = None |
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
python << EOP | |
from twisted.internet.error import ReactorAlreadyInstalledError | |
try: | |
from twisted.internet.gtk2reactor import install | |
install() | |
except ReactorAlreadyInstalledError: | |
pass | |
from twisted.internet import reactor | |
reactor.run() |
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
import functools | |
import inspect | |
def self(): | |
return inspect.currentframe().f_back.f_back.f_locals['self'] | |
class AutoSelfMeta(type): | |
def __new__(cls, names, bases, attrs): |
OlderNewer