Skip to content

Instantly share code, notes, and snippets.

@ore-public
ore-public / deploy.rb
Created September 27, 2012 07:01
capistranoのunicorn再起動のところ
namespace :deploy do
task :start, :roles => :app, :except => { :no_release => true } do
run "cd #{current_path} && bundle exec unicorn -c #{current_path}/config/unicorn.rb -E production -D"
end
task :stop, :roles => :app, :except => { :no_release => true } do
run "kill -KILL -s QUIT `cat #{shared_path}/pids/unicorn.pid`"
end
task :restart, :roles => :app, :except => { :no_release => true } do
@ore-public
ore-public / fizzbuzz.rb
Created June 13, 2013 06:15
metaprogramming fizzbuzz
class Fixnum
def fizzbuzz
return :fizzbuzz if self % 15 == 0
return :buzz if self % 5 == 0
return :fizz if self % 3 == 0
self
end
end
@ore-public
ore-public / Rakefile
Created February 13, 2014 16:06
sinatra + ActiveRecord rake task db:xxx の場合のみdatabase.ymlを読みに行くように設定する
task :before_db do
require './db_initialize'
end
namespace :db do |ns|
ns.tasks.each do |db_task|
db_task.enhance([:before_db])
end
end
syntax on
set nocompatible
filetype off
"""" neobundle.vimの設定
if has('vim_starting')
set runtimepath+=~/.vim/bundle/neobundle.vim/
endif
call neobundle#rc(expand('~/.vim/bundle'))
NeoBundleFetch 'Shougo/neobundle.vim'
#include<stdio.h>
#include<stdlib.h>
#define MAX_N 10000000
void set_bit(char *sort_bit, int value, int bit);
int get_bit(char *sort_bit, int value);
int main(void) {
FILE *fp;
@ore-public
ore-public / gist:8d75517d56e684fc0e2a
Last active August 29, 2015 14:22
method_missingの挙動
class Hoge
def mmtest
hoge #method_missing が呼ばれる => :hoge
hoge = 10 #mmtestメソッド内のローカル変数が定義される
self.hoge=10 #method_missing が呼ばれる => :hoge=
end
def method_missing(method_name, *args)
p method_name
@ore-public
ore-public / check.html
Last active May 19, 2016 08:12
checkboxをcssで、パネルのオン・オフみたいにする
<html>
<head>
<title>test</title>
</head>
<style>
input[type=checkbox] {
display: none;
}
label {
display: inline-block;
git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm
pg94:
restart: always
image: postgres:9.4.9
ports:
- "5432:5432"
environment:
- POSTGRES_USER=xxxxx
volumes:
- /Users/xxxxx/docker-dev/pg94/data:/var/lib/postgresql/data
@ore-public
ore-public / custom.cnf
Created March 10, 2017 23:10
MySQL Docker Compose
[mysqld]
character-set-server=utf8