This file contains hidden or 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
| (defvar *replace-count-base* 0) | |
| (defvar *replace-count-format* "%d") | |
| (defadvice query-replace-compile-replacement | |
| (after replace-count-format) | |
| "Change \\# format of (query-)replace-regexp" | |
| (when (consp ad-return-value) | |
| (let ((oldexp '(number-to-string replace-count)) | |
| (newexp '(format *replace-count-format* | |
| (+ replace-count *replace-count-base*) ))) |
This file contains hidden or 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
| --- ruby-1.9.2-p136/ruby.c 2010-12-23 19:49:13.000000000 +0900 | |
| +++ ruby-1.9.2-p136.filter/ruby.c 2011-01-15 19:18:26.878913570 +0900 | |
| @@ -1618,7 +1618,16 @@ | |
| return (VALUE)rb_parser_compile_string(parser, fname, f, line_start); | |
| } | |
| rb_funcall(f, set_encoding, 2, rb_enc_from_encoding(enc), rb_str_new_cstr("-")); | |
| - tree = rb_parser_compile_file(parser, fname, f, line_start); | |
| + { | |
| + VALUE source_filter = rb_intern("source_filter"); | |
| + if (rb_respond_to(rb_mKernel, source_filter)) { |
This file contains hidden or 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/env perl | |
| use strict; | |
| use warnings; | |
| use HTTP::Daemon; | |
| use Getopt::Long; | |
| use Linux::Inotify2; | |
| use File::Slurp; | |
| my $DEFAULT_PORT = 4000; | |
| my $POLLING_PATH = '/polling'; |
This file contains hidden or 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
| #!/bin/bash | |
| gcd() { | |
| local m=$1 n=$2 tmp r | |
| ((m < n)) && tmp=$m m=$n n=$tmp | |
| while (((r = m % n) > 0)); do | |
| m=$n n=$r | |
| done | |
| echo $n | |
| } |
This file contains hidden or 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
| (define (traverse-tree tree func) | |
| (define (spin cns prev) | |
| (let ((next (car cns))) | |
| (set-car! cns (cdr cns)) | |
| (set-cdr! cns prev) | |
| next )) | |
| (let ((marker (gensym))) | |
| (let loop ((cns tree) (prev marker)) | |
| (let ((next (spin cns prev))) | |
| (cond ((pair? next) |
This file contains hidden or 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
| (define (traverse-tree tree func) | |
| (if (pair? tree) | |
| (begin | |
| (traverse-tree (car tree) func) | |
| (traverse-tree (cdr tree) func) ) | |
| (or (null? tree) (func tree)) )) | |
| (define sample-list '((3 (5 (7)) 11))) | |
| (traverse-tree sample-list print) |
This file contains hidden or 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/env ruby | |
| # works on Ruby 1.9.2 (maybe on Ruby 1.9.1, too) | |
| class Loc | |
| def initialize(x, y) | |
| @x = x | |
| @y = y | |
| end | |
| attr_reader :x, :y |
This file contains hidden or 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/env perl | |
| use strict; | |
| use warnings; | |
| use utf8; | |
| use feature qw( say ); | |
| use Encode; | |
| use List::Util; | |
| use List::MoreUtils qw( uniq firstidx ); | |
| use WWW::Mechanize; | |
| use HTML::TreeBuilder::XPath; |
This file contains hidden or 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 | |
| # -*- coding: utf-8 -*- | |
| import curses | |
| import locale | |
| import signal | |
| import unicodedata | |
| HATO = ( | |
| u" _,,_", |
This file contains hidden or 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
| /* | |
| Based on: | |
| http://lastoneofthezodiac.blog38.fc2.com/blog-entry-5613.html | |
| Needs sha_256.js <http://point-at-infinity.org/jssha256/> like following: | |
| <script type="text/javascript" src="./jssha256.js"></script> | |
| */ | |
| function pad0(n, len, radix) { | |
| radix = radix || 10; |