Skip to content

Instantly share code, notes, and snippets.

@igaiga
igaiga / gist:9225482
Last active August 29, 2015 13:56
MySQL5.6 build in Linux
$ tar xvzf mysql-5.6.12.tar.gz
$ cmake -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci
$ make
$ sudo make install
.bash_profile などでmysqlへパスを通す
```
# PATH
export PATH=$PATH:/usr/local/mysql/bin
class String
def true?
downcase == "true"
end
def false?
!true?
end
def to_boolean
true?
end
@igaiga
igaiga / highlight.rb
Created April 13, 2014 01:23
jekyll highlight
module Jekyll
module Tags
class HighlightBlock < Liquid::Block
def render_codehighlighter(context, code)
#The div is required because RDiscount blows ass
<<-HTML
<div>
<pre class='#{@lang}'><code class='#{@lang}'>#{h(code).strip}</code></pre>
</div>
HTML
@igaiga
igaiga / test.rb
Created April 23, 2014 08:05
module private
module Mod
private
def mod_a
p "mod_a!"
end
end
class Foo
include Mod
def public_a
@igaiga
igaiga / test.rb
Created April 25, 2014 05:55
test_unit
require "test/unit"
class TestFoo < Test::Unit::TestCase
def test_foo
@obj = [[1,2],[3,4]]
assert_equal([[1, 2, "a"], [3, 4, "a"]],
@obj.map {|x| x << "a" })
proc = Proc.new {|x| x << "b" }
assert_equal([[1, 2, "a", "b"], [3, 4, "a", "b"]],
@obj.map(&proc))
@igaiga
igaiga / gist:11360639
Last active August 29, 2015 14:00
factory.rb
class Account
def self.create(params, provider)
case provider
when "facebook"
Facebook.new(params)
when "google_oauth2"
Google.new(params)
end
end
end
@igaiga
igaiga / def_grep.rb
Created April 30, 2014 11:05
grep_test_line.rb
# ruby のテストからdef test_XXX のXXXを抽出
require "ap"
File.open("test_enum.rb") do |file|
include_def_lines = file.readlines.grep(/def/)
def_names = []
include_def_lines.each do |line|
line =~ /def test_+(.*)$/
match = $1
def_names << match if match
end
<div class="post">
{{ content }}
</div>

(仮) じぐそう x いがいが kceffect

概略

高専カンファレンスとお互いの節目のイベントを振り返り、それぞれの立場で何を考えてたかを対談的に話す。ざっくり過去、現在、未来の3部構成で、6:2:2くらいの割合。

節目のイベント

  • 003Tokyo - いがいが初の実行委員長的ポジション
  • 004Fukui - 初の高専開催。じぐそう:ust staff いがいが:客
@igaiga
igaiga / render_time_tag.rb
Created June 3, 2014 23:41
Jekyll template sample. placed in _plugins. see also http://jekyllrb.com/docs/plugins/.
module Jekyll
class RenderTimeTag < Liquid::Tag
def initialize(tag_name, text, tokens)
super
@text = text
end
def render(context)
"#{@text} #{Time.now}"
end
end