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
import os, re, sys | |
RE =re.compile(ur'r(\d+)\s\|\s(\S+)\s\|\s(\S+\s\S+)') | |
SVN_LOG="svn log" | |
def backtrack(file): | |
fh = os.popen("%s -q %s" % (SVN_LOG, file), "r") | |
for line in fh: | |
line = line.strip() | |
if line != "------------------------------------------------------------------------": |
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 | |
/** | |
* 排序算法 | |
* 插入排序、快速排序、选择排序、冒泡排序 | |
* | |
*/ | |
class SortAlgorithm{ | |
/** |
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 | |
function ismain(){ | |
$debug = debug_backtrace(); | |
if(PHP_SAPI === 'cli' && count($debug)==1 && $debug[0]["function"]==__FUNCTION__){ | |
return true; | |
} | |
return false; | |
} |
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
安装zsh | |
brew install zsh | |
设置zsh为默认shell | |
mate /etc/shells | |
在文末增加: | |
/usr/local/bin/zsh | |
将zsh设置为默认的Shell: |
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
[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 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 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 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 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 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": "*" | |
} | |
} |
OlderNewer