Skip to content

Instantly share code, notes, and snippets.

View gabu's full-sized avatar
Working from Sapporo

Shoya Tsukada gabu

Working from Sapporo
View GitHub Profile
@gabu
gabu / gist:8050406
Created December 20, 2013 04:26
RubyでJSONのencode/decodeの比較をしてみた結果、ArrayもHashも元に戻る。 さすがにHashのKeyのシンボルはシンボルには戻らなかった。そりゃそうだ感あるけど。
$ irb [~]
irb(main):001:0> require 'json'
=> true
irb(main):002:0> 1.to_json
=> "1"
irb(main):003:0> JSON.load(1.to_json)
=> 1
irb(main):004:0> 1 === JSON.load(1.to_json)
=> true
irb(main):005:0> "hoge" === JSON.load("hoge".to_json)
@gabu
gabu / gist:fa671ae685413baebab9
Created August 6, 2014 12:53
CMTimeMake vs CMTimeMakeWithSeconds
NSLog(@"%f", CMTimeGetSeconds(CMTimeMake(3.25, 1))); // 3.000000
NSLog(@"%f", CMTimeGetSeconds(CMTimeMake(3.25 * 100, 100))); // 3.250000
NSLog(@"%f", CMTimeGetSeconds(CMTimeMakeWithSeconds(3.25, 1))); // 3.000000
@gabu
gabu / gist:d31ab53ebd8022e7df6d16440aee43aa
Created July 20, 2016 02:41
Rename classes for Rails 5
# app/models
git grep -l ActiveRecord::Base -- app/models | xargs sed -i '' "s/ActiveRecord::Base/ApplicationRecord/g"
# test/controllers
git grep -l ActionController::TestCase -- test/controllers | xargs sed -i '' "s/ActionController::TestCase/ActionDispatch::IntegrationTest/g"
@gabu
gabu / cpuminer_setup.sh
Last active December 6, 2017 16:29 — forked from paulsheldrake/cpuminer_setup.sh
Install cpuminer on an AWS instance
sudo yum -y update
sudo yum -y groupinstall "Development Tools"
sudo yum -y install git libcurl-devel libcurl jansson-devel jansson
# install cpuminer
git clone --recursive https://github.com/pooler/cpuminer.git
cd cpuminer
git checkout v2.3.3
./autogen.sh
./configure CFLAGS="-O3"