Skip to content

Instantly share code, notes, and snippets.

View kyanagi's full-sized avatar

Kouhei Yanagita kyanagi

View GitHub Profile
if type growlnotify > /dev/null 2>&1
then
GROWL_REPORTTIME=5
COMMAND=
COMMAND_START_TIME=0
function reset_command_start_time {
COMMAND="${1}"
COMMAND_START_TIME=`date +%s`
echo $COMMAND
}
--- session.el.orig 2012-02-18 12:58:20.000000000 +0900
+++ session.el 2012-02-18 13:07:47.000000000 +0900
@@ -409,6 +409,11 @@
:group 'session-globals
:type 'regexp)
+(defcustom session-globals-exclude-regexp "\\`anything-"
+ "Regexp matching global variables NOT to be saved between sessions."
+ :group 'session-globals
+ :type 'regexp)
% make test-all
./miniruby -I./lib -I. -I.ext/common ./tool/runruby.rb --extout=.ext -- --disable-gems "./test/runner.rb" --ruby="./miniruby -I./lib -I. -I.ext/common ./tool/runruby.rb --extout=.ext -- --disable-gems"
Run options: "--ruby=./miniruby -I./lib -I. -I.ext/common ./tool/runruby.rb --extout=.ext -- --disable-gems"
# Running tests:
...............................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................
;;; anything
(setq anything-command-map-prefix-key "C-x C-a")
(require 'anything)
;; C-z は C-; で実行できるようにする
(define-key anything-map (kbd "C-;") 'anything-execute-persistent-action)
(define-key anything-map (kbd "M-;") 'anything-execute-persistent-action)
(require 'anything-startup)
(dolist (map (list
anything-map
anything-c-buffer-map
@kyanagi
kyanagi / skk2migemo.rb
Created February 11, 2012 08:53
Convert a skk dictionary to migemo's.
#!/usr/bin/env ruby
# usage: skk2migemo.rb SKK-JISYO.JIS3_4 > migemo-dict.jis3_4
require 'iconv'
dict = Hash.new{[]}
ARGF.each_line do |line|
line.chomp!
line = Iconv.conv('UTF-8', 'EUC-JISX0213', line)
next if line =~ /\A;/
if line =~ /\A([^ ]+) +(.*)\z/
key, value = $1, $2
s
k
t
h
ka
m
sh
n
z
ko
function f {
local s='old'
echo -n "${(r:15:: :)1}${(e)1}"
s=''
echo -n "\t${(e)1}"
unset s
echo -n "\t${(e)1}"
echo
}
a='VWXYZ'
${(l:3::abcdefg::1234567890:)a} # => XYZ
${(l:10::abcdefg::1234567890:)a} # => 67890VWXYZ
${(l:20::abcdefg::1234567890:)a} # => cdefg1234567890VWXYZ
${(r:3::abcdefg::1234567890:)a} # => VWX
${(r:10::abcdefg::1234567890:)a} # => VWXYZ12345
${(r:20::abcdefg::1234567890:)a} # => VWXYZ1234567890abcde
@kyanagi
kyanagi / gist:1640254
Created January 19, 2012 14:24
optimize vcs_info on Cygwin
--- /usr/share/zsh/4.3.12/functions/VCS_INFO_bydir_detect 2011-08-08 04:59:41.001000000 +0900
+++ VCS_INFO_bydir_detect 2012-01-19 21:52:35.293434600 +0900
@@ -6,7 +6,7 @@
local dirname=$1
local basedir="." realbasedir file
-realbasedir="$(VCS_INFO_realpath ${basedir})"
+realbasedir="${basedir:A}"
while [[ ${realbasedir} != '/' ]]; do
[[ -r ${realbasedir} ]] || return 1
@kyanagi
kyanagi / gist:1582637
Created January 9, 2012 11:52
find-fileで*Completions*バッファに`../'と`./'を出さない
;; find-fileで*Completions*バッファに`../'と`./'を出さない
(defun find-file-read-args (prompt mustmatch)
(list (read-file-name prompt nil default-directory mustmatch nil
(lambda (name)
(and (file-exists-p name)
(not (member name '("../" "./"))))
))
t))