This file contains hidden or 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
// Usage: phantomjs c.js | |
var page = require('webpage').create(); | |
var url = 'c.html'; | |
page.open(url, function(status){ | |
window.setTimeout(function () { | |
var height = page.evaluate(function(){ | |
return document.body.scrollHeight; |
This file contains hidden or 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 | |
class Meituan | |
{ | |
protected $testApiURL = 'http://test.waimaiopen.meituan.com/api/v1/'; | |
protected $apiURL = 'http://waimaiopen.meituan.com/api/v1/'; | |
protected $appid; | |
protected $secretKey; | |
public function __construct($appid, $secret) |
This file contains hidden or 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 | |
$a = "111"; | |
$b = &$a; | |
$f = "????"; | |
function test_global_ref() | |
{ | |
$c = "2222"; | |
global $b; // 这个 $b 与之前函数外的 $b 不是同一个,位于不同的 scope, 它是对函数外那个 $b 引用,此时值为 "111" | |
$b = &$c; // 重新绑定后这个 $b 变成了 $c 的引用, 修改的只是函数 scope 内的 $b |
This file contains hidden or 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 | |
define("DOKU_INC", __DIR__ . "/"); | |
require DOKU_INC . "inc/parser/lexer.php"; | |
$startTimeIndex = xdebug_time_index(); | |
//$startMemoryUsage = xdebug_memory_usage(); | |
$stack = new Doku_LexerStateStack("base"); | |
for ($i = 0; $i < 1000000; $i++) { | |
$stack->enter("test_mode_name"); |
This file contains hidden or 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 | |
$databaseUsername = "username"; | |
$databasePassword = "password"; | |
$databaseName = "pdo_bug_test"; | |
// 打印 PDO 版本 | |
$ext = new ReflectionExtension('pdo'); | |
echo "PDO 版本:" . $ext->getVersion() . PHP_EOL; | |
// Mysql 测试数据 |
This file contains hidden or 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
#!/usr/bin/env php | |
<?php | |
$terminal = new Terminal(); | |
$terminal->saveTTY(); | |
$terminal->initTTY(); | |
$player = new Player($terminal, array("x" =>10, "y" => 27)); | |
$valid = false; |
This file contains hidden or 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
#!/usr/bin/env php | |
<?php | |
// 保存当前 tty 设置 | |
$term = shell_exec("stty -g"); | |
// 关闭 tty 规范输入模式 | |
// link http://www.faqs.org/docs/Linux-HOWTO/Serial-Programming-HOWTO.html#AEN92 | |
system("stty -icanon"); | |
while ($c = fread(STDIN, 1)) { |
This file contains hidden or 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 | |
class Cipher | |
{ | |
public function __construct($key, $method, $iv, $op, $keyAsBytes = 0, $d = null, $salt = null, $i = 1, $padding = 1) | |
{ | |
$this->key = $key; | |
$this->method = $method; | |
$this->op = $op; | |
$this->iv = $iv; |