数字
① ② ③ ④ ⑤ ⑥ ⑦ ⑧ ⑨ ⑩
⑪ ⑫ ⑬ ⑭ ⑮ ⑯ ⑰ ⑱ ⑲ ⑳
英文字
Ⓐ Ⓑ Ⓒ Ⓓ Ⓔ Ⓕ Ⓖ Ⓗ Ⓘ Ⓙ Ⓚ Ⓛ Ⓜ Ⓝ
Ⓞ Ⓟ Ⓠ Ⓡ Ⓢ Ⓣ Ⓤ Ⓥ Ⓦ Ⓧ Ⓨ Ⓩ
カタカナ
㋐ ㋑ ㋒ ㋓ ㋔ ㋕ ㋖ ㋗ ㋘ ㋙ ㋚ ㋛ ㋜ ㋝ ㋞ ㋟ ㋠ ㋡ ㋢ ㋣ ㋤ ㋥ ㋦ ㋧ ㋨
㋩ ㋪ ㋫ ㋬ ㋭ ㋮ ㋯ ㋰ ㋱ ㋲ ㋳ ㋴ ㋵ ㋶ ㋷ ㋸ ㋹ ㋺ ㋻ ㋼ ㋽ ㋾
① ② ③ ④ ⑤ ⑥ ⑦ ⑧ ⑨ ⑩
⑪ ⑫ ⑬ ⑭ ⑮ ⑯ ⑰ ⑱ ⑲ ⑳
Ⓐ Ⓑ Ⓒ Ⓓ Ⓔ Ⓕ Ⓖ Ⓗ Ⓘ Ⓙ Ⓚ Ⓛ Ⓜ Ⓝ
Ⓞ Ⓟ Ⓠ Ⓡ Ⓢ Ⓣ Ⓤ Ⓥ Ⓦ Ⓧ Ⓨ Ⓩ
㋐ ㋑ ㋒ ㋓ ㋔ ㋕ ㋖ ㋗ ㋘ ㋙ ㋚ ㋛ ㋜ ㋝ ㋞ ㋟ ㋠ ㋡ ㋢ ㋣ ㋤ ㋥ ㋦ ㋧ ㋨
㋩ ㋪ ㋫ ㋬ ㋭ ㋮ ㋯ ㋰ ㋱ ㋲ ㋳ ㋴ ㋵ ㋶ ㋷ ㋸ ㋹ ㋺ ㋻ ㋼ ㋽ ㋾
ファイルもしくはディレクトリの検索 実行すると検索結果が出力される
$ find {検索するパス} {検索条件} {オプション}
$ find ../../ -name '*.txt'
$ find Desktop/ -type f -name "*2019*"
$ find /Desktop -name "*sample*" -type f
$ find /Desktop -name "*sample*" -type d
$ find /Desktop -name "*sample*" -perm 644
$ find Desktop/ -mtime 1
0:今日
1:昨日
-3:三日以内に更新されたファイル
+10:10日よりも前に更新されたファイル
$ find Desktop/ -empty
$ find Desktop/ -name "*sample*" -and -name "*.png"
$ find Desktop/ -name "*sample*" -or -name "*.png"
ファイルの中の文字列を検索する
$ grep {検索正規表現} {パス/ファイル名}
$ grep aaa Desktop/sample.txt
$ grep aaa Desktop/sample.txt -n
$ grep aaa Desktop/sample.txt -i
$ grep aaa Desktop/sample.txt -C2
$ grep aaa Desktop/ -r
open -a {アプリを指定} {パスとファイル名}
$ open .
$ open -a "Google Chrome" Desktop/sample.jpeg
アプリ名にスペースがある場合はダブルクォートで囲う
$ open ../*.png
$ screencapture {保存場所とファイル名}
$ screencapture ../Destop/sample.png
書いてないのもあるので修正が必要
assertFalse(bool $condition[, string $msg = ''])
$condition
がfalseかどうかassertNotFalse()
はこの逆
assertTrue(bool $condition[, string $msg = ''])
$condition
がtrueかどうかassertNotTrue()
はこれの逆
assertIsBool($actual[, string = ''])
$actual
がboolかどうかassertIsNotBool()
はこの逆
assertEmpty(mixed $actual[, string $msg = '’])
$actual
が空かどうかassertNotEmpty()
はこれの逆
assertNull(mixed $variable[, string $msg = ''])
$variable
がNULL
かどうか
assertEquals(mixed $expect, mixed $actual[, string $msg = ''])
$expect
と$actual
が等しいかどうか
等しくない時に$msg
を返すassetNotEquals()
はこの逆
assertEquals(float $expect, float $actual[, string $msg = '', float $delta = 0])
$expect
と$actual
の差分が$delta
以下かどうか
以上の時に$msg
を返す
assertSame(mixed $expect, mixed $actual[, string $msg = ''])
2つの変数$expect
と$actual
が同じ型・同じ値かどうかassertNotSame()
はこれの逆
assertGreaterThan(mixed $expect, mixed $actual[, string $msg = ''])
$actual
の値が$expect
の値より大きいかどうか$expect
< $actual
大きくない時に$msg
を返す
assertGreaterThanOrEqual(mixed $expect, mixed $actual[,string $msg =''])
$actual
の値が$expect
の値を含み大きいかどうか$expect
<= $actual
以下の時に$msg
を返す
assertLessThan(mixed $expect, mixed $actual[, string $msg = ''])
$actual
の値が$expect
より小さいかどうか$expect
> $actual
小さくない時に$msg
を返す
assertLessThanOrEqual(mixed $expect, mixed $actual[, string $msg = ''])
$actual
の値が$expect
の値を含み小さいかどうか$expect
>= $actual
以上の時に$msg
を返す
assertIsArray($acutual[,string $msg = ''])
$actual
が配列かどうかassertIsNotArray()
はこの逆
assertArrayHasKey(mixed $key, array $array [, string $msg = ‘'])
$array
配列に$key
キーが存在するかどうか
存在しないときにエラー$msg
を返すasserArrayNotHasKey()
はこれの逆
assertArraySubset(array $subset, array $array [, bool $strict = false, string $msg = '']);
$array
が$subset
を含んでいるかどうか
含まない場合に$msg
を返す$strict
をtrue
にすると型の比較まで行う
エラーログが$subset
をダンプするだけで、どこが違うかを教えてくれないのでわかりづらい
assertContains(mixed $needle, iterable $haystack[, string $msg])
$needle
が$haystack
に存在するかどうか
objectも検証可能
存在しない場合に$msg
を返すassertNotContains()
はこれの逆
assertContainsOnly(string $type, itrable $haystack[, bool $isNativeType = null, strig $msg = '’])
$haystack
の中身の型が$type
だけかどうか$type
だけじゃない時に$msg
を返す$isNaviteType
クラスは$type
がネイティブなPHPの型であるかどうかを表すassertNotContainsOnly()
はこれの逆
assertObjectHasAttribute(string $attrName, object $obj[, string $msg = ''])
$obj->attrName
が存在するかどうかassertObjectNotHasAttribute()
はこれの逆
assertContains(string $needle, string $haystack[, string $msg], bool $ignoreCase = false])
$needle
が$haystack
の文字列に含まれるかどうか$ignoreCase
がtrue
の時に大文字小文字を区別しない
assertIsString($actual[, $msg = ''])
$actual
の型がstringかどうかassertIsNotString()
はこれの逆
assertStringMatchsFormat(string $format, string $string[, string $msg = ''])
$string
が書式文字列$format
に一致しているかどうか
assertRegExp(string $pattern, string $string[, string $msg = ''])
$string
が$pattern
に一致しているかどうかassertNotRegExp()
はこれの逆
assertStringEndsWith(string $suffix, string $string[, string $msg = ''])
$string
が$suffix
で終わっているかどうかassertStringEndsNotWith()
はこれの逆
assertStringStartsWith(string $prefix, string $string[, string $msg = ''])
$string
が$prefix
で始まっているかどうかassertStringStartsNotWith()
はこれの逆
assertCount($expect, $haystack[, string $msg = ''])
$haystack
の要素数が$expect
と一致しているかどうかassertNotCount()
はこれの逆
assertClassHasAttribute(string $attrName, string $className, string $msg = ‘')
$className
にプロパティ変数attrName
が存在するかどうか
存在しない場合に$msgを返すassertClassNotHasAttribute()
はこれの逆
assertClassHasStaticAttribute(string $attrName, string $className [, string $msg = ''])
$className
に静的プロパティ$attrName
が存在するかどうか
存在しない場合に$msg
を返す
assertContainsOnlyInstancesOf(string $className, Traversable|array $haystack[, string $msg = ''])
$haystack
が$className
クラスの唯一のインスタンスを含むかどうか
含まない時に$msg
を返す
assertIsFloat($actual[, string $msg =''])
$actual
の型がfloatかどうかassertIsNotFloat()
はこれの逆
assertIsInt($actual[, string $msg = ''])
$actual
の型がintかどうかassertIsNotInt()
はこれの逆
assertIsInterable($actual[, string $msg])
$actual
の型がintertableかどうかassertIsNotInterable()
はこれの逆
assertIsNumeric($actual[, string $msg = ''])
$actual
の型がnumericかどうかassertIsNotNumeric()
はこれの逆
assertIsObject($actual[, string $msg = ''])
$actual
の型がobjectかどうかassetIsNotObject()
はこれの逆
assertIsResource($actual[, string $msg = ''])
$actual
の型がresouceかどうかassertIsNotResouce()
はこれの逆
assertIsScalar($actual[, string $msg = ''])
$actual
の型がscalar値かどうかassertIsNotScalar()
はこれの逆
assertIsCallable($actual[, string $msg])
$actual
の型がcallableかどうかassertIsNotCallable()
はこの逆
assertInfinite(mixed $variable[,string $msg])
$variable
がINFかどうかassertFinite()
はこの逆
assertNan(mixed $valiable[, string $msg= ''])
$valiable
がNANかどうか
assertInstanceOf($expect $actual[, string $msg= ''])
$actual
が$expect
のインスタンスかどうかassertNotInstanceOf()
はこの逆
assertEqualXMLStructure(DOMElement $expect, DOMElement $actual[, bool $checkAttr = false, $msg = ''])
$actual
のDOMElementのXML構造が$expect
のDOMElementのXML構造と等しいかどうか
assertIsReadable($actual[, string $msg = ''])
$actual
に指定したファイルもしくはディレクトリが読み込み可能かどうか
読み込み不可の場合は$msgを返すassertNotIsReadable()
はこれの逆
assertIsWritable($actual[, string $msg = ''])
$actual
に指定したファイルもしくはディレクトリが書き込み可能かどうか
書き込み不可の場合は$msgを返すassertNotIsWritable()
はこれの逆
assertDirectoryExsits(string $dir[, string $msg = ''])
$dir
で指定したディレクトリが存在するかどうか
存在しない時に$msg
を返すassertDirectoryNotExists()
はこれの逆
assertDirectoryIsReadable(string $dir[, string $msg = ''])
$dir
で指定したディレクトリが読み込み可能かどうか
読み込み不可の時に$msg
を返すassertDirectoryNotIsReadable()
はこれの逆
assertDirectoryIsWritable(string $dir[, string $msg = ''])
$dir
で指定したディレクトリが書き込み可能かどうか
書き込み不可の時に$msg
を返すassertDirectoryNotIsWritable()
はこれの逆
assertFileEquals(string $expect, string $actual[, string $msg = ''])
$expect
で指定したファイルと$actual
で指定したファイルの内容が等しいかどうか
異なる場合に$msg
を返すassertFileNotEquals()
はこの逆
assertFileExists(string $fileName[, string $msg = ''])
ファイル$fileName
が存在するかどうか
存在しない時は$msg
を返すassertFileNotExists()
はこの逆
assertFilesReadable(string $fileName[, string $msg = ''])
$fileName
で指定したファイルが読み込み可能かどうか
読み込み不可の場合は$msg
を返すassertFilesNotReadable()
はこの逆
assertFilesWritable(string $fileName[, string $msg = ''])
$fileName
で指定したファイルが書き込み可能かどうか
書き込み不可の時には$msg
を返すassertFilesNotWritable()
はこの逆
assertJsonFileEqualsJsonFile(mixed $expectFile, mixed $actualFile[, srtring $msg])
$actualFile
と$expectFile
の内容がJSONとして等しいかどうか
assertJsonStringEqualsJsonFile(mixed $expectFile, mixed $actualJson[, string $msg = ''])
$actualJson
の値が$expectFile
の値と等しいかどうか
assertJsonStringEqualJsonString(mixed $expectJson, mixed $actualJson[, string $msg =''])
$actualJson
の値が$expectJson
の値と等しいかどうか
参考にしたサイト
続き
途中だけど忘れそうなのでとりあえずアップだけしておく...
後々追加するかも
もしかしたら間違ってる部分あるかも
$("#children").on("click",function(){ $(this).children("p").css("background-color","red"); });
p
pspan
p
$("#find").on("click",function(){ $("#findTarget").find("span").css("background-color","red"); });
$("#closest").on("click",function(){ $("#closestTarget ul li:last-of-type").closest("ul").css("background-color","red"); });
$("#contents").on("click",function(){ console.log($(".contentsTarget").contents());//要素の中のテキストも取得 console.log($(".contentsTarget").children());//要素を取得 $(".contentsTarget").contents().wrap('<p style="background-color: red;" />'); });
$("#next").on("click",function(){ $(this).next().css("background-color","red"); });
$("#nextAll").on("click",function(){ $(this).nextAll("[id^='nextAllTarget']").css("background-color","red"); });
$("#nextUntil").on("click",function(){ $(this).nextUntil("#nextUntilTarget3","button").css("background-color","red");//第二引数でフィルタリングできる });
$("#prev").on("click",function(){ $(this).prev().css("background-color","red"); });
$("#prevAll").on("click",function(){ $(this).prevAll("[id^='prevAllTarget']").css("background-color","red"); });
$("#prevUntil").on("click",function(){ $(this).prevUntil("#prevUntilTarget2","button").css("background-color","red");//第二引数でフィルタリングできる });
$("#first").on("click",function(){ $("#firstTarget li").first().css("background-color","red"); });
$("#last").on("click",function(){ $("#lastTarget li").last().css("background-color","red"); });
$("#not").on("click",function(){ $("#notTarget").children("li").not(":nth-of-type(2)").css("background-color","red"); });
$("#each").on("click",function(){ $("#eachTarget li").each(function(key,value){ $(this).text($(this).text() + key); }); });
$("#is").on("click",function(){ var $true = $(this).is(":visible"); var $false = $(this).is(":hidden"); console.log($true); console.log($false); });
hasTarget1
$("#has").on("click",function(){ $("[id^='hasTarget']").has("p").css("background-color","red"); $("[id^='hasTarget']:has(span)").css("background-color","blue"); });
var $css = { "background-color":"red", "color":"white" }; $("[id^=siblingsTarget]").css($css); $("#siblings").on("click",function(){ $(this).siblings("div[id^=siblingsTarget]").css("background-color","blue"); });
$("#slice").on("click",function(){ $("#sliceTarget li").slice(2,4).css("background-color","red");//第二引数がなければ2番目以降〜最後まで });
$("#filter").on("click",function(){ $("#filterTarget li").filter(":nth-of-type(3)").css("background-color","red"); $("#filterTarget li").filter("#last").css("background-color","blue"); });
$("#eq").on("click",function(){ $("#eqTarget li").eq(3).css("background-color","red"); $("#eqTarget li").eq(-1).css("background-color","blue");//-1で最後の要素を取得する -2の場合はlist3を取得する });
$("#add").on("click",function(){ var $style = $("#addTarget li:nth-of-type(2)").next().add().css("background-color","red");//3番目のliにcssが適用される console.log($style);//2番目のli });
$("#addBack").on("click",function(){ var $style2 = $("#addBackTarget li:nth-of-type(2)").next().addBack().css("background-color","red"); console.log($style2);//2,3番目のli });
$("#end").on("click",function(){ $("#endTarget").find("li:first-of-type").css("background-color","red").end().find("li:nth-of-type(2)").css("background-color","blue"); });
余計な余白
<button type="button" id="scroll">scroll()</button> <ul id="scrollTarget"> <li style="height: 500px;">list</li> </ul> <div style="height: 300px;"> <p>余計な余白</p> </div>
<script> var $scrollTarget = $("#scrollTarget"); //開閉メニューのボタン var $scroll = $("#scroll"); //topからの位置を取得 var $scrollInt = $("#scroll").offset().top; //初期設定 $scrollTarget.hide(); $scroll.on("click",function(){ $scrollTarget.slideToggle("normal",function(){ //表示状態であれば、topからの位置分スクロールトップに移動 if($scrollTarget.is(":visible")) { $("body,html").animate({scrollTop: $scrollInt},"fast"); } }); }); </script>
記号 | 意味 | 数字 | 権限 | 使用例 |
---|---|---|---|---|
r | read | 4 | 読み出し | 読むだけのHTML,CSS,画像ファイルなど |
w | write | 2 | 書き込み | データの書き込みや書き換えが必要なファイル |
x | exec | 1 | 実行 | サーバー上で実行が必要なファイル touch,rmなどはできない |
記述例
数字 | 記号 | 意味 |
---|---|---|
644 | rw-r--r-- | 所有者読み書き可能/所有者以外読み出しのみ (ファイルのデフォルトの権限) |
755 | rwxr-xr-x | 所有者以外書き込み不可 (ディレクトリのデフォルトの権限) |
700 | rwx------ | 所有者のみ読み書き実行可能 |
666 | rw-rw-rw- | 読み書きのみ |
777 (rwxrwxrwx) はセキュリティ上良くない
$ ls -l
は隠しファイルが表示されないので
$ ls -all {パス}
で指定パスのパーミッションを確認する
例:
drwxr-xr-x 18 user staff 96 12 1 19:48 directory_name
1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 |
---|---|---|---|---|---|---|---|---|---|---|---|
d | rwx | r-x | r-x | 18 | user | staff | 96 | 12 | 1 | 19:48 | directory_name |
所有者の権限
グループの権限
その他のアクセス権限
所有者名
グループ名
ファイルサイズ
作成日時もしくは変更日時の月
作成日時もしくは変更日時の日
作成日時もしくは変更日時の時間
ファイルもしくはディレクトリ名
変更するときはchmod(change mode)で変更可能
$ chmod {変更したい権限} {パス}
※過去ブログの転記
記号 | 意味 | 数字 | 権限 | 使用例 |
---|---|---|---|---|
r | read | 4 | 読み出し | 読むだけのHTML,CSS,画像ファイルなど |
w | write | 2 | 書き込み | データの書き込みや書き換えが必要なファイル |
x | exec | 1 | 実行 | サーバー上で実行が必要なファイル touch,rmなどはできない |
記述例
数字 | 記号 | 意味 |
---|---|---|
644 | rw-r--r-- | 所有者読み書き可能/所有者以外読み出しのみ (ファイルのデフォルトの権限) |
755 | rwxr-xr-x | 所有者以外書き込み不可 (ディレクトリのデフォルトの権限) |
700 | rwx------ | 所有者のみ読み書き実行可能 |
666 | rw-rw-rw- | 読み書きのみ |
例:
drwxr-xr-x 18 user staff 96 12 1 19:48 directory_name
1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 |
---|---|---|---|---|---|---|---|---|---|---|---|
d | rwx | r-x | r-x | 18 | user | staff | 96 | 12 | 1 | 19:48 | directory_name |
所有者の権限
グループの権限
その他のアクセス権限
所有者名
グループ名
ファイルサイズ
作成日時もしくは変更日時の月
作成日時もしくは変更日時の日
作成日時もしくは変更日時の時間
ファイルもしくはディレクトリ名
変更するときはchmod(change mode)で変更可能
$ chmod {変更したい権限} {パス}
個人的によく使うやつ
またあれば追加して行く予定
操作 | 内容 |
---|---|
:wq | 保存して終了 |
:q! もしくは :q | 保存せずに終了 |
:w | 上書き保存 |
:w <file name> |
<file name> で保存 |
A | 行の末尾で挿入モードへ |
a | カーソル位置の次の文字からinsertモードになる |
I | カーソル位置の行の先頭へ移動してからinsertモード |
o | カーソル位置の下に1行追加してinsertモード |
cc | 1行を削除してinserモード |
V | カーソルの行を選択してinsertモード |
/文字列 |
文字列を検索 |
n | マッチした検索文字列の次の文字列に |
N | マッチした検索文字列の前の文字列に |
ctrl + v | 矩形選択モード |
gv | 直前の選択範囲を再選択 |
:%d | 全削除 |
dd | カーソル位置の行を削除する |
D | カーソルから後ろを削除する |
yy | カーソル行をコピー |
3yy | カーソル行から3行コピー |
p | ペースト |
u | undo |
ctrl + r | undoをundo |
/ |
|
n | 検索結果の次へ |
N | 検索結果の前へ |
操作 | 内容 |
---|---|
h | カーソルを左に |
l (エル) | カーソルを右に |
k | カーソルを上に |
j | カーソルを下に |
w | 次の単語へ |
b | 前の単語へ |
ctrl + u | 半画面上に進む |
ctrl + f | 1画面上に進む |
ctrl + d | 半画面上に戻る |
ctrl + b | 1画面上に戻る |
0 | 行頭へ |
$ | 行末へ |
8G | 8行目へ |
gg | 最初の行へ |
G | 最終行へ |
操作 | 内容 |
---|---|
:vsplit | 画面を左右に分割する |
$("#after").on("click",function(){ $(this).after($(this).clone()); });
$("#insertAfter").on("click",function(){ $(this).clone().insertAfter($(this)); });
$("#append").on("click",function(){ $(this).append($(this).clone()); console.log(this); });
$("#appendTo").on("click",function(){ console.log(this); });
$("#before").on("click",function(){ $(this).before($(this).clone()); });
$("#insertBefore").on("click",function(){ $(this).clone().insertBefore($(this)); });
$("#prepend").on("click",function(){ $(this).prepend($(this).clone()); });
$("#prependTo").on("click",function(){ $(this).clone().prependTo($(this)); });
記述済みなので省略
削除後もjQueryから参照可能
var detachTarget = $("#detachTarget"); $("#detach").on("click",function(){ var isDetachClass = $(this).toggleClass("detach"); if(isDetachClass.hasClass("detach")) { detachTarget.detach(); }else { $(this).after(detachTarget); } });
$("#remove").on("click",function(){ $(this).remove(); });
親を残して削除
$("#empty").on("click",function(){ $(this).empty(); });
$("#html").on("click",function(){ console.log($(this).html());//指定セレクタを除いたhtmlを返す $(this).html($(this).clone()); });
$("#replaceAll").on("click",function(){ $("<p>入れ替え</p>").replaceAll($(this)); });
$("#replaceWith").on("click",function(){ $(this).replaceWith($("<p>入れ替え</p>")); });
$("#text").on("click",function(){ alert($(this).text());//テキストの取得 $(this).text("差し替え");//差し替え });
$("#wrap").on("click",function(){ $(this).wrap("<div style='padding: 10px; background-color: red;' />"); });
$("#unwrap").on("click",function(){ $(this).children("p").unwrap(); });
$("#wrapInner").on("click",function(){ $(this).wrapInner("<p style='padding: 10px; background-color: red;' />"); });
$("#wrapAll").on("click",function(){ $("button").wrapAll("<div style='padding: 10px; background-color: red;' />"); });
$("#fadeOut").on("click",function(){ $(this).next(".fadeOutTarget").fadeOut("fast",function(){ console.log(this);//アニメーション完了後にしたい処理 }); });
$("#fadeIn").on("click",function(){ $(this).next(".fadeInTarget").fadeIn("slow",function(){ console.log(this);//アニメーション完了後にしたい処理 }); });
$("#fadeToggle").on("click",function(){ $(this).next(".fadeToggleTarget").fadeToggle("normal",function(){ console.log(this);//アニメーション完了後にしたい処理 }); });
$("#fadeTo").on("click",function(){ $(this).next(".fadeToTarget").fadeTo(1000,0.3,function(){ console.log(this);//アニメーション完了後にしたい処理 }); });
$("#toggle").on("click",function(){ $(this).next(".toggleTarget").toggle(1000,function(){ console.log(this);//アニメーション完了後にしたい処理 }); });
$("#slideDown").on("click",function(){ $(this).next(".slideDownTarget").slideDown(1000,function(){ console.log(this);//アニメーション完了後にしたい処理 }); });
$("#slideUp").on("click",function(){ $(this).next(".slideUpTarget").slideUp(1000,function(){ console.log(this);//アニメーション完了後にしたい処理 }); });
$("#slideToggle").on("click",function(){ $(this).next(".slideToggleTarget").slideToggle(1000,function(){ console.log(this);//アニメーション完了後にしたい処理 }); });
$("#animate").on("click",function(){ var animeteData = ({ "background-color":"red", "color":"black", "height":"100px" }); $(this).next(".animateTarget").animate(animeteData,"normal","linear",function(){ console.log(this);//アニメーション完了後にしたい処理 }); });
jQueryのDOM操作系のメソッドについてまとめておく
追加していく予定
$("#addClass").on("click",function(){ $(this).addClass("add"); $(this).addClass("add2 add3");//複数指定 });
$("#attr").on("click",function(){ alert($(this).attr("id")); $(this).attr("id","attr2");//第二引数に変更したい値を指定できる });
$("#hasClass").on("click",function(){ console.log($(this).hasClass("btn"));//true console.log($(this).hasClass("btn2"));//false });
$("#prop").on("click",function(){ console.log($("input[name='checked']").prop("checked"));//true console.log($("input[name='unchecked']").prop("checked"));//false $("input[name='unchecked']").prop("checked",true);//trueに変更 });
$("#removeAttr").on("click",function(){ $(this).removeAttr("id"); });
$("#removeClass").on("click",function(){ $(this).removeClass("btn");//複数指定で全部消したい場合はからで良い });
プロパティの削除
$("#removeProp").on("click",function(){ $("input[name='removePropTarget']").removeProp("disabled"); });
$("#toggleClass").on("click",function(){ $(this).toggleClass("btn");//複数指定で全部消したい場合はからで良い $(this).toggleClass("btn",false);//第二引数にboolでtrueの場合は追加してfalseの場合は削除する $(this).toggleClass(false);//第一引数にboolを指定すると追加もしくは削除する });
toggleClass
が一番使えそう
おわり
※過去ブログの転記
NULLを含むカラムでORDER BY
する
SELECT num FROM tbl ORDER BY num ASC
↓
num |
---|
NULL |
NULL |
NULL |
1 |
2 |
4 |
6 |
9 |
普通に昇順指定するとNULLが最初に来てしまうのて下記のように修正
SELECT num FROM tbl ORDER BY num IS NULL ASC , num ASC
↓
num |
---|
1 |
2 |
4 |
6 |
9 |
NULL |
NULL |
NULL |
使用したことはないけどせっかく覚えたので、一応メモ
SELECT (CASE flag WHEN 1 THEN "フラグ1" WHEN 2 THEN "フラグ2" ELSE "その他" END) AS flag FROM users
下記もOK
SELECT (CASE WHEN flag = 1 THEN "フラグ1" ELSE "その他" END ) AS flag, (CASE WHEN email LIKE '%.jp' THEN "jpn" END) AS tlb FROM users