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
{ | |
"require": { | |
"fabpot/goutte": "dev-master" | |
} | |
} |
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
<?php | |
// strict error bailout | |
set_error_handler(function ($errno, $errstr, $errfile, $errline){ | |
error_log("STRICT: {$errno} {$errstr} {$errfile} {$errline} "); | |
die("get error on: errno:{$errno} file:{$errfile}:{$errline}"); | |
}); | |
echo $a; // undefined value | |
echo "I will die"; |
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
<?php | |
// いらんものを画面にだされては困るので | |
ini_set("display_errors", 0); | |
ini_set("display_startup_errors", 0); | |
// NoticeやDeprecated含めて全部のエラーがほしい | |
error_reporting(E_ALL); | |
// ログファイル設定はmod_phpやBuiltin Serverなどでは設定不要、 | |
// 設定しないとSTDERRに出力される | |
// ini_set("log_errors", 1); |
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
class MarkovController < ApplicationController | |
def keychoice(target) #targetはhash | |
# ハッシュ(target)のキー群の中からの一つのキーStringをランダムに返す | |
puts target.keys.to_s + ">" + target.keys[ rand( target.size ) ].to_s | |
return target.keys[ rand( target.size ) ].to_s | |
end | |
def text | |
@source = ( params[:text].nil? ? nil : params[:text] ) |
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
# Yanchaに最短で投稿する手順 | |
# Tokenを取得 | |
# profile_image_urlはオプション | |
curl 'http://yancha.hachiojipm.org/login?nick=fkmt&token_only=1&profile_image_url=http://pyazo.hachiojipm.org/image/OFV5WawlHin4Y80t138408431866687.png' | |
# 返値がTokenになる | |
curl 'http://yancha.hachiojipm.org/api/post?token=取得したtokenをいれる&text=倒壊!!!' | |
# tokenは有効期限があるので、適当に再取得すること。 |
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
>|| | |
Caller level 0: | |
{ | |
Bitmask => 'UUUUUUUUUUUUUU', | |
Evaltext => undef, | |
Filename => '/home/yancha/yancha/lib/Yancha/DataStorage/DBI.pm', | |
Hasargs => 1, | |
Hints => 2018, | |
'Line-No' => 284, | |
Package => 'Yancha::DataStorage::DBI', |
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
### | |
CFEWebDb | |
idがPkey | |
updated_at | |
created_atは必須 | |
トランザクションには非対応 | |
Ver 1.0 20111206 | |
とりあえずできた。 |
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
class myChain | |
func_queue: [] | |
index: -1 | |
chain: (func) -> | |
@func_queue.push(func) | |
return @ | |
chainExec: () -> | |
@index++ |
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
<?php | |
/* | |
mysql_data_setup.php | |
https://gist.github.com/uzulla/6028743 | |
HOW TO USE | |
========== | |
``` | |
cd ~/mysql-temp # create some dir. | |
php mysql_data_setup.php # make data_dir, create some script and my.cnf |
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
package CFE::Image::SimpleGlitch; | |
use Mouse; | |
use File::Slurp; | |
has raw => ( | |
is => "rw", | |
); | |
sub load { | |
my ($self, $filename) = @_; |