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 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"
exit
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 chatwork_api.rb
# encoding: utf-8
#
# usage: ChatworkAPI.new.assign_task_to_all_members('room_id','task body')
#
require 'net/https'
require 'uri'
require 'json'
class ChatworkAPI
View insert_property_annotation.rb
# usage: ruby insert_property_annotation.rb < file
lines = STDIN.readlines
lines.each do |line|
if !(line =~ / class /) && line =~ /(\s+?)(public|private) (.+?) (.+?)[\s;]/
puts %W(#{$1}@property("#{$4.underscore}"))
puts line
else
puts line
end
@kota
kota / ai.rb
Created Dec 9, 2014
SamurAICoding2014
View ai.rb
class SamuraiAi
def read_game_info
@total_turns,@num_daimyos,@num_lords = self.read_integers
@military_strength = self.read_integers
end
def read_turn_info
@turn,@time = STDIN.gets.split(' ')
@turn = @turn.to_i
@ints = []
View gist:10652fec24611b52d225
https://github.com/kishikawakatsumi/BuildNumber
View .vimrc
if has('vim_starting')
set nocompatible " Be iMproved
" Required:
set runtimepath+=~/.vim/bundle/neobundle.vim/
endif
" Required:
call neobundle#begin(expand('~/.vim/bundle/'))
View sample.clj
;基本
(+ 1 1)
(mod 5 4)
(< 1 2 3 4)
;if
(if true (println "True it is."))
;リスト
(list 1 2 3)
@kota
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
end
def work
@delegate_programmer.work
end
end
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
You can’t perform that action at this time.