This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE TABLE user_account ( | |
user_id VARCHAR(10) PRIMARY KEY NOT NULL, | |
user_name VARCHAR(20) NOT NULL, | |
password VARCHAR(10) NOT NULL, | |
postcode VARCHAR(10), | |
address VARCHAR(50), | |
email VARCHAR(50), | |
job VARCHAR(30), | |
birthday DATE | |
); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def recursive_dir(path) | |
Dir::foreach(path) do |v| | |
next if v == "." or v == ".." | |
if path =~ /\/$/ | |
v = path + v | |
else | |
v = path + "/" + v | |
end | |
p v if v=~/.js$/ | |
if FileTest::directory?(v) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# coding utf-8 | |
#こんな感じでも追加出来る | |
require "stringio" | |
f = StringIO.new | |
f.puts "config" | |
f.printf "mem=%d\n", 1024 | |
p f.string |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# coding: utf-8 | |
#Ruby1.9の場合 | |
#文字⇒文字コード | |
"あ".ord | |
#文字コード⇒文字 | |
97.chr |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# coding utf-8 | |
p Regexp.quote("*.txt?") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#TDDでやった方がロジックが難しかった気がする、でもTDDじゃないと仕様は確かにこれで良いのか迷いながら進むかも。 | |
# enoode: utf-8 | |
def nabeatu(num) | |
num = "hoge" if num % 3 == 0 | |
num = "hoge" if num.to_s =~ /3/ | |
num = num | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#メソッドの内側から自分のスコープの外にある変数を処理出来る | |
def hoge x | |
x + yield | |
end | |
x = 2 | |
p hoge(1){x += 2 } #=> 5 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#succまたはnextは文字列の一番右側を次のものにする、zの次はa | |
str = 'a' | |
20.times do |i| | |
p str.succ! | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#dll内のメソッド呼ぶ方法、これ自体に特に意味はない | |
require "Win32API" | |
MessageBox = Win32API.new("user32", "MessageBoxA", %w(P P P I), "I"); | |
MessageBox.call(0, "Hello Windows!", "dlhello", 0); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#適当 | |
require "httpclient" | |
#proxy対応 | |
#client = HTTPClient.new(PROXY_PATH) | |
client = HTTPClient.new | |
body = {'msg' => "test"} |
OlderNewer