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
| def monte | |
| x = rand(); y = rand() | |
| if (x * x + y * y) < 1 | |
| return 1 | |
| else | |
| return 0 | |
| end | |
| end |
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
| List = Array | |
| class Env < Hash | |
| attr_accessor :outer | |
| def initialize(keys=[], vals=[], outer=nil) | |
| alist = [keys, vals].transpose | |
| self.update(Hash[*alist.flatten(1)]) | |
| @outer = outer | |
| end | |
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
| <!DOCTYPE HTML> | |
| <html> | |
| <head> | |
| </head> | |
| <body> | |
| <script src='life.js'></script> | |
| </body> | |
| </html> |
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
| <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" | |
| "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | |
| <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> | |
| <head> | |
| <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> | |
| <title>chat</title> | |
| <script src='https://ajax.googleapis.com/ajax/libs/jquery/1.6.3/jquery.min.js'></script> |
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/local/bin/ruby | |
| # encoding: UTF-8 | |
| unless ARGV[0] =~ /\.tex/ | |
| puts 'texちゃうやん' | |
| return | |
| end | |
| file_name = ARGV[0].gsub(/(.*)\.tex/, '\1') | |
| `platex #{file_name}.tex && dvipdfmx #{file_name}.dvi && open #{file_name}.pdf` |
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
| -- Merge Sort | |
| msort :: (Ord a) => [a] -> [a] | |
| msort [] = [] | |
| msort [x] = [x] | |
| msort xs = merge (msort f) (msort s) | |
| where | |
| (f,s) = split xs | |
| split :: (Ord a) => [a] -> ([a],[a]) | |
| split xs = splitAt center xs |
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
| -- プログラミングHaskellのパーサコンビネータの実装をMaybeモナドを使うようにしてみた | |
| -- Programming in Haskell : 8 Chapter | |
| module Parsing where | |
| import Char | |
| import Monad | |
| infixr 5 +++ | |
| newtype Parser a = Parser {getParser :: String -> Maybe (a,String)} |
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
| sed -e "s/<!-- SavedCachesDirectory>/<SavedCachesDirectory>/g" config/storage-conf.xml | sed -e "s/<\/SavedCachesDirectory -->/<\/SavedCachesD irectory>/g" > /var/cassandra/conf/storage-conf.xml |
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
| class Cluster | |
| attr_accessor :left, :right, :vec, :id, :distance | |
| def initialize(args) | |
| @vec = args[:vec] | |
| @left = args[:left] | |
| @right = args[:right] | |
| @id = args[:id] | |
| @distance = args[:distance] | |
| end |
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
| ;; Standard frame | |
| (define frm1 (make-frame (make-vect 0.0 0.0) | |
| (make-vect 1.0 0.0) | |
| (make-vect 0.0 1.0))) | |
| ;; Shearing frame | |
| (define frm2 (make-frame (make-vect 0.0 0.0) | |
| (make-vect 0.66 0.33) | |
| (make-vect 0.33 0.66))) |
OlderNewer