I hereby claim:
- I am ytkhs on github.
- I am ytkhs (https://keybase.io/ytkhs) on keybase.
- I have a public key whose fingerprint is 9BAF 6EEF DBD6 6336 47EC ACC1 6416 6A09 1572 E0EC
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
var resultFiles = []; | |
// 再帰的にファイルを探す | |
function getAllFiles(folder, path) { | |
// まずこの階層のファイル | |
var files = folder.getFiles(); | |
while(files.hasNext()){ | |
var file = files.next(); |
$arr = ['a' => 'Alice', 'b' => 'Bob']; | |
# 今まで(ポインタが移動しちゃう) | |
end($arr); | |
# => "Bob" | |
# 存在チェックが必要なのでこれはこれで長い。いい方法あるかな? | |
$lastkey = array_key_last($arr); | |
array_key_exists($lastkey, $arr) ? $arr[$lastkey] : null | |
# => "Bob" |
package main | |
import ( | |
"fmt" | |
"time" | |
) | |
func main() { | |
fmt.Println(IsPremiumFriday("2017-02-24")) // true | |
fmt.Println(IsPremiumFriday("2017-02-25")) // false |
<?php | |
function is_premium_friday(Datetime $date) { | |
return $date->diff(new DateTime(sprintf('last Fri of %s', $date->format('Y-m'))))->format('%d') == 0; | |
} | |
var_dump(is_premium_friday(new Datetime('2017-02-23'))); // false | |
var_dump(is_premium_friday(new Datetime('2017-02-24'))); // true | |
var_dump(is_premium_friday(new Datetime('2017-02-25'))); // false | |
var_dump(is_premium_friday(new Datetime('2017-03-31'))); // true |
RemoteIPHeader X-Forwarded-For | |
#RemoteIPTrustedProxy 172.16.0.0/16 | |
RemoteIPInternalProxy 172.16.0.0/16 | |
<Directory "/var/www/html"> | |
AllowOverride All | |
Options ExecCGI FollowSymlinks MultiViews | |
<RequireAny> | |
Require ip xx.xx.xx.xx |
select | |
table_name, | |
engine, | |
table_rows, | |
avg_row_length, | |
floor((data_length+index_length)/1024/1024) AS MB | |
from | |
information_schema.tables | |
where | |
table_schema = 'DATABASE_NAME' |
-- 読み取り専用にする | |
FLUSH TABLES WITH READ LOCK; | |
SET GLOBAL read_only = ON; | |
-- バックアップとかDBサーバの移設作業とか -- | |
-- 元に戻す | |
SET GLOBAL read_only = OFF; | |
UNLOCK TABLES; |
go get github.com/labstack/echo/... |
// root user | |
show variables like '%general_log%'; | |
set global general_log='ON' | |
set global general_log='OFF' |