Skip to content

Instantly share code, notes, and snippets.


Kenichi Takahashi kenchan

Block or report user

Report or block kenchan

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 gist:6b4a200f8d26f48794ea
/usr/share/mysql/scripts/mysql_install_db --basedir=/usr --user=mysql --datadir=/var/lib/mysql_tmpfs
/etc/init.d/mysql restart
/usr/bin/mysqladmin -u root password 'root'
View stap.rb {|y| loop { y << ('A'..'Z').to_a.sample } }.each_slice(4).take_while {|str| str.join != 'STAP'}.count
View gist:665d58958a2490dcebcf

RubyKaigi 2014 CFLT


Practical factory_girl


factory_girlを代表とするFixture Replacementライブラリによって、柔軟なテストデータの準備が容易にできるようになりました。

View gist:4abf8fddc560e86b3091
grep -rl "/^" **/*.rb | xargs gsed -i "s/\/\^/\/\\A/g"
grep -rl "$/" **/*.rb | xargs gsed -i "s/\$\//\\\\z\//g"
kenchan / converter.rb
Last active Aug 29, 2015
Rails Fixture YAML Converter
View converter.rb
#!/usr/bin/env ruby
require 'yaml'
# target YAML file
# - id:1
# name: 'fuga'
# age: 20
# - id:2
kenchan / benchmark.rb
Created Oct 16, 2014
imlib2 imagemagick benchamrk
View benchmark.rb
require 'mini_magick'
require 'imlib2'
require 'benchmark/ips'
require 'fileutils'
require 'tapp'
SRC_DIR = Pathname('/Users/kenchan/Dropbox/Camera Uploads')
DEST_DIR = Pathname.pwd.join('tmp')
View gist:ccf53ccc1ff0485e5e6d
"$schema": "",
"definitions": {
"account-feature": {
"description": "An account feature represents a Heroku labs capability that can be enabled or disabled for an account on Heroku.",
"$schema": "",
"stability": "production",
"strictProperties": true,
"title": "Heroku Platform API - Account Feature",
"type": [
View gist:d9119dc04ec457364508
[root@db0e92112086 build-screen]# git clone http://49d7d66ae6f5f1d250bb0cbfce3ed439205f8e26@<my-github-enterprise-host>/kenchan/<repo>.git
Initialized empty Git repository in /tmp/build-screen/<repo>/.git/
[root@db0e92112086 build-screen]# git --version
git version 1.7.1
View pool.diff
root@pool:/app# git diff
diff --git a/docker/pool/Dockerfile b/docker/pool/Dockerfile
index 18a1eea..7beaed3 100644
--- a/docker/pool/Dockerfile
+++ b/docker/pool/Dockerfile
@@ -10,6 +10,12 @@ RUN curl -s -o docker
RUN chmod +x docker
RUN cp docker /usr/bin/
+# Update git
View hoge.rb
[6] pry(main)> class Hoge
[6] pry(main)* def fuga
[6] pry(main)* if false
[6] pry(main)* user =nil
[6] pry(main)* end
[6] pry(main)* user
[6] pry(main)* end
[6] pry(main)* def piyo
[6] pry(main)* user
[6] pry(main)* end
You can’t perform that action at this time.