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 | |
ob_end_clean(); | |
if((int)ini_get('session.auto_start') > 0) | |
{ | |
ini_set('session.auto_start',0); | |
} | |
class MySqlSessionHandler implements SessionHandlerInterface | |
{ | |
private $_db; |
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 SplDoublyLinkedListTest extends PHPUnit_Framework_TestCase | |
{ | |
public function testSplDoublyLinkedListPart1() | |
{ | |
$obj = new SplDoublyLinkedList(); | |
// Pushes value at the end of the doubly linked list. | |
$obj->push(0); | |
$obj->push(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
{ | |
"require": { | |
"nette/neon": "*" | |
} | |
} |
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 | |
# filepath src/ | |
class MyArray | |
{ | |
public static function sumCountByIdentity($items, $identityKey, $countKey){ | |
$tmp = $newItems = []; | |
foreach($items as $row){ |
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
$news_id = 1; | |
$existValidator = Yii::createObject([ | |
'class' => '\yii\validators\ExistValidator', | |
'targetClass' => '\common\models\News', | |
'targetAttribute' => 'id', | |
]); | |
if( ! $existValidator->validate($news_id, $error)){ | |
var_dump($error); |
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
~/ ssh -vT [email protected] | |
OpenSSH_6.2p2, OSSLShim 0.9.8r 8 Dec 2011 | |
debug1: Reading configuration data /Users/bob/.ssh/config | |
debug1: /Users/bob/.ssh/config line 1: Applying options for * | |
debug1: Reading configuration data /etc/ssh_config | |
debug1: /etc/ssh_config line 20: Applying options for * | |
debug1: Connecting to github.com [192.30.252.129] port 22. | |
debug1: Connection established. | |
debug1: identity file /Users/bob/.ssh/id_rsa type 1 | |
debug1: identity file /Users/bob/.ssh/id_rsa-cert type -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
use common\models\User; | |
$user = User::findOne($user_id); | |
$user->setPassword($your_password); | |
$user->generateAuthKey(); | |
$user->save(); |
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
[launcher] Error: Could not find chromedriver at /Users/bob/Documents/github/angular-phonecat/node_modules/protractor/selenium/chromedriver.exe | |
npm ERR! [email protected] protractor: `protractor test/protractor-conf.js` | |
npm ERR! Exit status 1 | |
# 本人是Mac OS X 的解决办法: | |
1. 首先去拿到 chromedriver 的下载URL:https://code.google.com/p/chromedriver/downloads/list | |
2. 打开txt 中的路径,下载最新的 chromedriver,并解压。 | |
3. 把解压出来的 chromedriver 命令复制到相应目录下并重命名 chromedriver.exe | |
$ cp -a ~/Downloads/chromedriver ~/Documents/github/angular-phonecat/node_modules/protractor/selenium/chromedriver.exe |
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
安装zsh | |
brew install zsh | |
设置zsh为默认shell | |
mate /etc/shells | |
在文末增加: | |
/usr/local/bin/zsh | |
将zsh设置为默认的Shell: |