Skip to content

Instantly share code, notes, and snippets.

View chsh's full-sized avatar
👍
Love your code.

CHIKURA Shinsaku chsh

👍
Love your code.
View GitHub Profile
@chsh
chsh / install-ruby.sh
Created May 9, 2014 03:03
Install specific version of ruby using rbenv + ruby_build.
ruby_version=2.1.2
git --git-dir=$HOME/.rbenv/plugins/ruby-build/.git pull
rbenv install $ruby_version
rbenv shell $ruby_version
gem install bundler
@chsh
chsh / hall.cap
Created June 3, 2014 01:41
Capistrano deployment notification using Hall.
require 'hall'
namespace :hall_notify do
task :environment do
set :capistrano_thumb_url,
'https://raw.github.com/smashingboxes/capistrano-haller/master/resources/capistrano-logo.png'
end
def send_hall_notification(action)
hall_room_key = fetch(:hall_room_key)
@chsh
chsh / Vagrantfile.rb
Created June 10, 2014 14:17
Install PostgreSQL(PGDG) to Amazon Linux.
Vagrant.configure(2) do |config|
config.vm.provision :chef_solo do |chef|
chef.cookbooks_path = %w(site-cookbooks cookbooks)
chef.add_recipe 'postgresql'
chef.json = {
postgresql: {
version: '9.3',
enable_pgdg_yum: true,
client: { packages: %w(postgresql93-devel) },
@chsh
chsh / valid_date.html
Created July 2, 2014 15:48
Valid date pattern for 2010-2029.
<input type="text" pattern="(201[26]|202[048])/0?2/(0?[1-9]|[12]\d)|(201[^26]|202[^048])/0?2/(0?[1-9]|1\d|2[0-8])|20[12]\d/(0?[469]|11)/(0?[1-9]|[12]\d|30)|20[12]\d/(0?[13578]|1[02])/(0?[1-9]|[12]\d|3[01])"/>
@chsh
chsh / userscript.js
Created July 9, 2014 06:35
Show unread badges for ChatWork.
window.fluid.dockBadge = '';
setTimeout(updateDockBadge, 1000);
setTimeout(updateDockBadge, 3000);
setInterval(updateDockBadge, 5000);
$('.promotionArea').css('display', 'none');
function updateDockBadge() {
var newBadge = '';
var totalCount = 0;
@chsh
chsh / check_phone_validity.rb
Last active August 29, 2015 14:05
Simple phone number validator.
def phone_valid?(value)
# value should have only digits and hyphens.
return false unless value =~ /^0\d[\d\-]+\d$/
# value should have 10 or 11 size digits.
return false unless [10,11].include?(value.gsub(/\-/, '').length)
true
end
@chsh
chsh / git-release
Created October 16, 2014 10:12
git release command for git-flow.
#!/bin/sh
pfx='rel'
d=`date +%Y%m%d%H%M%S`
git flow release start $pfx-$d
git flow release finish -m"Release:$d" $pfx-$d
@chsh
chsh / path.rb
Created October 24, 2014 03:00
simple deep hash scanner
# hash = { a: { b: 1 } }
# path hash, :a, :b -> 1
def path(source, *keys)
return nil unless source
return nil unless source.respond_to? :[]
keys.each do |key|
return nil unless source.respond_to? :[]
source = source[key]
@chsh
chsh / item-list.md
Created October 31, 2014 15:18
持ち物リスト

河村さん

  • 地藏さん名刺
  • バーコードリーダ × 2
  • 付箋 (カフェで使っているやつ)
  • Mac x 1

チクラ

  • バーコードリーダー x 1
  • Mac x 1