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 | |
# -*- coding: utf-8 -*- | |
# Makes a "Hello, world!" program that has no literals. | |
class HelloWorldGenerator1 | |
def initialize(s = "Hello, world!") | |
@message = s.chomp + "\n" | |
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
#!/usr/bin/env ruby | |
# ruby magicsquare.rb | |
# ruby magicsquare.rb -c | |
# ruby magicsquare.rb 2 | |
# ruby magicsquare.rb 3 | |
module MagicSquare | |
class Table | |
def initialize(t = nil) |
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
# kukuplot.R - Kuku (a.k.a. multiplication table) Answer Accuracy | |
# by takehikom | |
# http://berd.benesse.jp/berd/center/open/report/keisanryoku/2013/pdf/keisanryoku_2013_data_all.pdf#page=15 | |
# http://i.imgur.com/tE4ncBy.gif | |
# http://qiita.com/wakuteka/items/c5910a54273d05577c5d | |
library(lattice) | |
kuku.acc <- c( |
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 | |
# -*- coding: utf-8 -*- | |
# TrianglePuzzleSolver.rb | |
# by takehikom | |
# inspired by: | |
# http://www.huffingtonpost.jp/satoshi-kagimoto/triangle-puzzle_b_5590269.html | |
module TrianglePuzzle |
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 | |
# -*- coding: utf-8 -*- | |
# TrianglePuzzleSolver5x5.rb | |
# by takehikom | |
# inspired by: | |
# http://www.ksproj.com/PDF/chirashi201405.pdf | |
# NOTE: Since we get 4354560 patterns (whereas TrianglePuzzleSolver.rb |
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 | |
# -*- coding: utf-8 -*- | |
# trips.rb - Triangle Puzzle Solver | |
# by takehikom | |
# inspired by: | |
# http://www.huffingtonpost.jp/satoshi-kagimoto/triangle-puzzle_b_5590269.html | |
# ruby trips.rb |
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 | |
# -*- coding: utf-8 -*- | |
# trips5.rb - Trinagle Puzzle Solver (5 numbers on a side) | |
# by takehikom | |
# inspired by: | |
# http://www.ksproj.com/PDF/chirashi201405.pdf | |
# see also: | |
# https://gist.github.com/takehiko/65dc59fb984e60bafb24 (trips.rb) |
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
#include <stdio.h> | |
/* | |
constant.c - compare "const int", "#define", and "enum". | |
inspired by: | |
http://stackoverflow.com/questions/1674032/static-const-vs-define-in-c | |
*/ | |
/* gcc constant.c -o constant */ | |
/* gcc -std=c89 -pedantic -DOPTION_1 constant.c -o constant */ |
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 | |
# im-text-region.rb - Region calculator using ImageMagick's convert command | |
# by takehikom | |
# ruby $S/priv/rb/im-text-region.rb | |
# ruby $S/priv/rb/im-text-region.rb '和歌山' Meiryo-UI-Regular | |
class TextRegion | |
def initialize(opt = {}) |
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 | |
# auto_gdb_kuku.rb | |
# How many times the value of inner loop's variable is changed | |
# by takehikom | |
# ruby auto_gdb_kuku.rb | |
# ruby auto_gdb_kuku.rb | grep 'New value' | |
# ruby auto_gdb_kuku.rb | grep 'New value' | wc -l |