Skip to content

Instantly share code, notes, and snippets.

View kana's full-sized avatar

Kana Natsuno kana

View GitHub Profile
file ',README.html' => 'README.html' do
sh 'sha1sum README.html >,README.html'
end
file 'README.html' => 'README.asciidoc' do
sh 'asciidoc -b xhtml11 README.asciidoc'
end
__END__
require 'rake'
require 'watchr'
file 'foo' => ['bar', 'baz'] do
sh 'cat bar baz >foo'
end
if self.instance_of? Watchr::Script::EvalContext then
watch /^(bar|baz)$/ do
sh 'rake -f rake_and_watchr.rb foo'
@kana
kana / a-snippet-from-my-keyboard.ini
Created April 29, 2011 04:23
N-stroke keyboard shortcuts that I've used since Opera 6
Platform Mac, w meta, c = Close page, 1
Platform Mac, w meta, c meta = Close page, 1
Platform Mac, w meta, j = Focus page
Platform Mac, w meta, j meta = Focus page
Platform Mac, w meta, k = Focus address field | Focus message list
Platform Mac, w meta, k meta = Focus address field | Focus message list
Platform Mac, w meta, n = New page, 1
Platform Mac, w meta, n meta = New page, 1
Platform Mac, w meta, s = Duplicate page
Platform Mac, w meta, s meta = Duplicate page
static class ComposingTest
{
static private bool Not(bool x)
{
return !x;
}
static private bool Even(int x)
{
return x % 2 == 0;
data ShellState = ShellState {
count :: Int
}
main = do
ls <- getContents
s <- return $ ShellState 0
@kana
kana / date.hs
Created February 6, 2011 12:06
Reviewing Haskell by writing Unix commands
import System.Time
import System.Locale
main = getClockTime >>=
toCalendarTime >>=
putStrLn . formatCalendarTime defaultTimeLocale "%c"
3,5c3,5
< Fuji
< Taka
< Nasubi
---
> 1 Fuji
> 2 Taka
> 3 Nasubi
7,9c7,9
< Sen
" perl: add 'use' statement for package name under the cursor
function! AddUse()
let line = line('.')
let col = col('.')
normal! yiw
let default = @0
let package = input('Package? ', default)
if (search('^use\s\+'.package, 'bnw') == 0)
call search('^use\s\+', 'b')
put ='use ' . package . ';'
Enumerable.Empty<string>();
@kana
kana / x.js
Created December 5, 2010 05:48
var rd = g_preferences.prafbe_right_dict();
var wd = g_preferences.prafbe_wrong_dict();
var td = {};
var ts = [];
for (var t in rd) {
if (!(td[t])) {
ts.push(t);
td[t] = true;
}
}