View xxx.sh
#!/bin/bash | |
cat << EOS >> ~/hoge | |
line: 1 | |
line: 2 | |
line: 3 | |
EOS |
View xxx.sh
#!/bin/bash | |
# このスクリプトが保存されているディレクトリに移動する | |
cd `dirname $0` |
View installed_command.sh
function installed_command() { | |
which $1 > /dev/null 2>&1 | |
} |
View 0_reuse_code.js
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
View unittest-template.xml
<?xml version="1.0" encoding="UTF-8" standalone="no"?><templates><template autoinsert="true" context="java-members" deleted="false" description="" enabled="true" name="test_abnormal">@${testType:newType(org.junit.Test)} | |
public void 異常系_${testName}() throws Exception { | |
${staticImport:importStatic('org.junit.Assert.*')}${cursor}// setup | |
// exercise | |
// verify | |
}</template><template autoinsert="true" context="java-members" deleted="false" description="" enabled="true" name="test_normal">@${testType:newType(org.junit.Test)} | |
public void 正常系_${testName}() throws Exception { | |
${staticImport:importStatic('org.junit.Assert.*')}${cursor}// setup | |
// exercise | |
// verify |
View countup.sh
#!/bin/sh | |
COUNT=1 | |
MAX_COUNT=256 | |
while [ $COUNT -lt $MAX_COUNT ] | |
do | |
echo "$COUNT" | |
COUNT=`expr $COUNT + 1` | |
done |
View showxhrerrormessage.js
/** | |
* Ajax 通信処理で失敗した responseText をログ出力する。 | |
* | |
* responseText には次の形式の JSON が設定されている想定。 | |
* | |
* { | |
* "errors" : [ | |
* エラーメッセージ1, | |
* エラーメッセージ2, | |
* エラーメッセージ3 |
View toggleclass.js
/** | |
* タグに定義されている class を切り替える。 | |
* | |
* to が定義されていない、もしくはブランクの場合は from の class を取り除く。 | |
* | |
* @param {String} id 切り替える class が定義されているタグの ID 属性 | |
* @param {String} from 切り替え対象の class | |
* @param {String} to 切り替える class | |
* @returns {} | |
*/ |
View isnullorempty.js
/** | |
* 文字列が Null かブランクであるかを問い合わせる。 | |
* | |
* @param {String} value 検査する文字列 | |
* @returns {Boolean} 条件を満たしている場合 true | |
*/ | |
function isNullOrEmpty(value) { | |
return typeof value === "undefined" || value.length === 0; | |
} |
View lf2br.js
/** | |
* 改行コードを <br /> タグに置き換える。 | |
* | |
* @param {String} str 改行コードを含んだ文字列 | |
* @returns {String} 置き換えた文字列 | |
*/ | |
function lf2br(str) { | |
return str.replace(/\r?\n/g, "<br />"); | |
} |
NewerOlder