unicornに食わせた設定ファイルの preload_app が false なら、application codeのあらゆる変化を読み込んだ上でworkerをリスタートする。preload_appがtrueならばapplication codeが変化しててもそれを反映しない。その場合USR2 + QUIT使わないとだめ
reloadするときに Gem.refresh が呼ばれるので、Gemfileに新しいライブラリ書いてあればそれ読み込むよ
function akari(){ | |
echo "わぁい$1 あかり$1大好き" | |
} |
# -*- coding: utf-8 -*- | |
Y = lambda { |f| | |
lambda{|proc| | |
f.call(lambda{|args| proc.call(proc).call(args)}) | |
}.call( | |
lambda{|proc| | |
f.call(lambda{|args| proc.call(proc).call(args) }) | |
} | |
) | |
} |
#!/usr/bin/env ruby | |
require 'thor' | |
class NginxConf < Thor | |
desc 'register PORT', 'install new config file' | |
option :prefix, type: :string, default: "/usr/local" | |
def register(port) | |
root = Dir::pwd | |
project = root.split(/\//).last |
# -*- coding: utf-8 -*- | |
class PersonValidator < Validator | |
validates :name, { | |
:presence => true, | |
:format => { :with => /\A[a-zA-Z]+\z/, :message => "お名前に使えるのはアルファベットだけだよ!" } | |
} | |
validates :sex, { | |
:inclusion => ["male", "female", "other"], | |
:messages => "unknown parameter", | |
} |
# -*- coding: utf-8 -*- | |
class Nyan | |
def nyan | |
return "にゃーん" | |
end | |
end | |
# 別のところで 上書きしたい classを openする |
(\ (\ | |
(,, 0 ω 0) < Github | |
(/ (/ \) \) |
#include <stdio.h> | |
int main(int argc, char *argv[]){ | |
char chars[] = "TeX"; | |
chars[0]--; | |
printf("%s",chars); | |
return 0; | |
} |
# -*- coding: utf-8 -*- | |
class C季節 | |
def next | |
next_season.new | |
end | |
end | |
class C春 < C季節 | |
def next_season | |
C夏 |
def expect_block(&block) | |
p block.class # => Proc | |
p block_given? # => true | |
yield # => this is block | |
deep_method(&block)# => this is block | |
deep_method(block) # error | |
end | |
def deep_method |