Skip to content

Instantly share code, notes, and snippets.

Kota Fujiwara kota

Block or report user

Report or block kota

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View summarize_test.rb
require 'rubygems'
require 'plist'
TEST_LOG_PATH = "./TestOutput/Logs/Test/"
module XCTestSummaryParser
class TestableSummary
attr_accessor :tests
def initialize(dict)
View lottery.rb
#MAX = 10000000
#n = 10
#m = rand(MAX)
#k = [rand(MAX)] * n
m = 10
k = [1,2,3,4,5,6,7,8,9]
k.combination(4) do |k1,k2,k3,k4|
if k1 + k2 + k3 + k4 == m
puts "YES"
View sample.clj
(+ 1 1)
(mod 5 4)
(< 1 2 3 4)
(if true (println "True it is."))
(list 1 2 3)
kota / lazy_programmer.rb
Created Feb 19, 2013
Ruby example of delegate design pattern.
View lazy_programmer.rb
class LazyProgrammer
attr_accessor :delegate_programmer
def initialize(programmer)
@delegate_programmer = programmer
def work
View gist:4059092
hardstatus alwayslastline "%{= wk} %-w%{=bu dr}%n %t%{-}%+w %= %{=b wb}%y/%m/%d %{=b wb}%c"
escape ^Tt
defscrollback 10000
multiuser on
acladd guest
kota /
Created Nov 8, 2012 — forked from esperlu/
MySQL to Sqlite converter
# Converts a mysqldump file into a Sqlite 3 compatible file. It also extracts the MySQL `KEY xxxxx` from the
# CREATE block and create them in separate commands _after_ all the INSERTs.
# Awk is choosen because it's fast and portable. You can use gawk, original awk or even the lightning fast mawk.
# The mysqldump file is traversed only once.
# Usage: $ ./mysql2sqlite mysqldump-opts db-name | sqlite3 database.sqlite
# Example: $ ./mysql2sqlite --no-data -u root -pMySecretPassWord myDbase | sqlite3 database.sqlite
View gist:3978882
kota / gist:3978464
Created Oct 30, 2012
metaclass is only a matz's implementation
View gist:3978464
View gist:3856189
There exist no 2 pairs of integers {a,b},{c,d} such that ab = cd(#1) ,a+b = c+d(#2), {a,b} != {c,d}, and a,b,c,d > 2
Suppose we have {a,b},{c,d} that satisfies all the conditions above.
We can suppose a,b,c,d are not all equal without losing generality,
since if a = b, a^2 = cd (from #1) and 2a = c+d (from #2)
=> 4a^2 = (c+d)^2
=> 1/4(c+d)^2 = cd
kota / gist:2498866
Created Apr 26, 2012
run editing rspec file with speficic line number.
View gist:2498866
function! RunSpecOnSpecificLine()
execute '! rake spec SPEC='.expand('%:p').':'.line(".")
command! LSpec :call RunSpecOnSpecificLine()
You can’t perform that action at this time.