Skip to content

Instantly share code, notes, and snippets.

k.bigwheel bigwheel

Block or report user

Report or block bigwheel

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
@bigwheel
bigwheel / lunch.rb
Created Aug 2, 2012
ランダムに2チームへ分けるスクリプト 超人パワー編
View lunch.rb
#!/usr/bin/env ruby
srand(Time.local(2012, 8, 2).to_i)
class Member
attr_reader :name, :power
def initialize(name)
@name = name
@power = rand
end
@bigwheel
bigwheel / gist:3300587
Created Aug 9, 2012
ランダムに2チームへ分けるスクリプト ジャンケン編
View gist:3300587
#!/usr/bin/env ruby
class Member
attr_reader :name
def initialize(name)
@name = name
end
def win?(opponent)
result_table = { gu: { gu: :even, choki: :win, pa: :lose },
@bigwheel
bigwheel / gist:3366148
Created Aug 16, 2012
ランダムに2チームへ分けるスクリプト ジャンケン編 - モジュールに機能を分離
View gist:3366148
#!/usr/bin/env ruby
class Member
attr_reader :name
def initialize(name)
@name = name
end
end
class Symbol
@bigwheel
bigwheel / gist:3431969
Created Aug 23, 2012
ランダムに2チームへ分けるスクリプト ハイアンドロー編
View gist:3431969
#!/usr/bin/env ruby
class Member
attr_reader :name
def initialize(name)
@name = name
end
def win?(opponent)
raise 'should be overrided'
end
@bigwheel
bigwheel / gist:3650445
Created Sep 6, 2012
ランダムに2チームへ分けるスクリプト グッパでホイ編
View gist:3650445
#!/usr/bin/env ruby
class Member
attr_reader :name
def initialize(name)
@name = name
end
def hand
@bigwheel
bigwheel / gist:3909586
Created Oct 18, 2012
ランダムに2チームへ分けるスクリプト scala編
View gist:3909586
import scala.util.Random
object lunch_script {
def main(args: Array[String]) : Unit = {
val splitMember = shuffleAndSplit(args.toList, 20121018)
println(splitMember._1)
println(splitMember._2)
}
def shuffleAndSplit(member: List[String], date: Long) : (List[String], List[String]) = {
@bigwheel
bigwheel / main.rb
Last active Dec 16, 2015
Magic: the Gatheringカードメージギャラリーから@wikiフォーマットでドラフト点数表のテンプレートを作る
View main.rb
#!/bin/env ruby
# -*- coding: utf-8 -*-
require 'open-uri'
require 'nokogiri'
require 'pry'
doc = Nokogiri::HTML(open('http://www.wizards.com/magic/tcg/article.aspx?' +
'x=mtg/tcg/dragonsmaze/cig',
'Accept-Language' => 'ja,en-US;q=0.8,en;q=0.6'))
@bigwheel
bigwheel / print_casual_stacktrace.php
Last active Dec 22, 2015
phpで任意の箇所でスタックトレース表示するコード
View print_casual_stacktrace.php
foreach (debug_backtrace() as $func)
{
\Log::warning($func['file'] . ' - ' . $func['class'] . $func['type']
. $func['function'] . '(' . $func['args'] . ')[L' . $func['line'] . ']');
}
View convert-playjson-to-hocon.sh
# play-jsonからhoconフォーマットへだいたい変換するスクリプト
# Seqだけはカッコが同一行へ存在しないと変換を失敗する
sed -i -e 's/Json.obj(/{/g' $1
sed -i -e 's/ -> /: /g' $1
sed -i -e 's/,$//g' $1
sed -i -e 's/Seq(\(.*\))/[\1]/g' $1
sed -i -e 's/L$//g' $1
sed -i -e 's/)/}/g' $1
sed -i -e 's/^\(\s*\)"\([^"]*\)"/\1\2/g' $1
@bigwheel
bigwheel / build.sbt
Created Oct 21, 2014
sbtでカスタムタスクを定義する方法
View build.sbt
val scoobiRun = taskKey[Int]("A sample int task.")
scoobiRun := {
(compile in Compile).value
println(1)
1
}
You can’t perform that action at this time.