Skip to content

Instantly share code, notes, and snippets.

@s-osa
s-osa / payment.md
Last active June 3, 2019 02:28
payment.md

銀行振込

住信SBIネット銀行 ブドウ支店 102 普通 4821329 オサ シュンスケ

Kyash

https://kyash.co/

@s-osa
s-osa / sample_jan.svg
Last active April 18, 2019 04:37
sample jan
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
(function() {
// Config
var weeks = 52;
var beginningOfWeek = 1; // 0:Sun, 1:Mon, 2:Tue, 3:Wed, 4:Thu, 5:Fri, 6:Sat
// Functions
function formatDate(date) {
return [date.getFullYear().toString(), ('0' + (date.getMonth() + 1)).slice(-2), ('0' + date.getDate()).slice(-2)].join("-");
@s-osa
s-osa / gist:1c3d2eccbf82390c8009
Created May 31, 2015 16:29
debug Hash#deep_find
class Hash
def deep_find(key)
key?(key) ? self[key] : self.values.first{|v| v.deep_find(key) if v.respond_to?(:deep_find) }.deep_find(key)
end
end
@s-osa
s-osa / etc_init.d_unicorn
Last active August 29, 2015 14:15
/etc/init.d/unicorn
#!/bin/sh
#chkconfig: 2345 95 5
#description: unicorn shell
NAME="unicorn"
ENV=production
RAILS_ROOT="/home/connect/production/current"
LOCK=/var/lock/subsys/$NAME
PID="${RAILS_ROOT}/tmp/pids/unicorn.pid"
@s-osa
s-osa / gist:77704dae28ab96bcb536
Created September 15, 2014 07:40
Amazon Linux
sudo yum install git gcc openssl-devel nginx postgresql-devel gcc-c++
git clone https://github.com/sstephenson/rbenv.git ~/.rbenv
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bash_profile
echo 'eval "$(rbenv init -)"' >> ~/.bash_profile
source ~/.bash_profile
git clone https://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build
rbenv install 2.1.2
res=0
n=1
while [ $res -eq 0 ]
do
bundle exec rake spec
res=$?
echo $n
n=$((n + 1))
done
require 'benchmark'
require 'securerandom'
require 'random_bell'
REPEAT = 10 ** 6
Benchmark.bmbm do |b|
b.report("Random "){ rand = Random.new ; REPEAT.times{ rand.rand } }
def count_by_word(string)
hash = Hash.new(0)
string.split(' ').each{|word| hash[word] += 1}
hash
end
describe "count by word" do
it "counts by word" do
expect(count_by_word("no ruby no life")).to eq("no" => 2, "life" => 1, "ruby" => 1)
end