This file contains 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
#~/.gitconfig | |
[alias] | |
co = checkout | |
ci = commit | |
st = status | |
br = branch | |
hist = log --pretty=format:\\\"%h %ad | %s%d [%an]\\\" --graph --date=short | |
ad = add | |
di = diff |
This file contains 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
#~/.bash_profile | |
#エイリアスの設定 | |
alias r="rails" | |
alias c="clear" | |
alias g="git" | |
alias vw="view" | |
alias v="vim" | |
alias l="ls" |
This file contains 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
function Sleep(T){ | |
var d1 = new Date().getTime(); | |
var d2 = new Date().getTime(); | |
while( d2 < d1 + 1000*T ){ | |
d2=new Date().getTime(); | |
} | |
return; | |
} |
This file contains 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
chars = ("a".."z").to_a + ("A".."Z").to_a + (0..9).to_a | |
result = "" | |
8.times do | |
result << chars[rand(chars.length)] | |
end | |
result | |
This file contains 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
//テキストエリア | |
<textarea id="text_area"></textarea> | |
//残りの文字数の表示 | |
<p>残りの文字数 <span="count"></p> | |
//送信ボタン | |
<input type="submit" value="送信" id="submit"> | |
<script> |
This file contains 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
// view/member/index.html.erb | |
<%= form_for @member,:remote => true,:html => {:id => 'form'} do |form| %> | |
//フォーム | |
<%= form.submit "送信" %> | |
<% end %> | |
This file contains 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
#親のArticleモデル | |
def class Article < ActiveRecord::Base | |
has_many :comments | |
end | |
#子のCommentモデル | |
class Comment < ActiveRecord::Base |
This file contains 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>javascriptでパラメーターを取得。</title> | |
</head> | |
<body> | |
<p>"index.html?key=1&name=taro"でアクセスする。</p> |
This file contains 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
//getParameterメソッドを定義する。 | |
function getParameter(key) { | |
//パラメーターを配列で取得する。 | |
var str = location.search.split("?"); | |
if (str.length < 2) { | |
return ""; | |
} |
This file contains 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
<!-- リンク要素のdata-ajax属性を"false"にする。 --> | |
<a href="page2.html" data-ajax="false">page2へ</a> | |
<!-- リンク要素のrel要素で、"external"を指定する。 --> | |
<a href="page2.html" rel="external">page2へ</a> |
NewerOlder