Skip to content

Instantly share code, notes, and snippets.

View dcb9's full-sized avatar

Du, Chengbin dcb9

View GitHub Profile
<?php
$model = Model::find()
->where(['count' => ['$gt' => $count]])
->one();
@dcb9
dcb9 / mac-vm-hostonly-port-forward.sh
Created September 8, 2015 13:05
Mac 映射HostOnly 虚拟机到局域网
sudo ssh -L `ifconfig en0 | grep 'inet 192.168' | awk '{print $2}'`:80:`docker-machine ip playground`:80 -N `whoami`@`ifconfig en0 | grep 'inet 192.168' | awk '{print $2}'`
@dcb9
dcb9 / Readme.md
Created October 28, 2015 14:58 — forked from jaymecd/Readme.md
ngrok self-hosting
export XDEBUG_CONFIG="idekey=PHPSTORM remote_enable=1 remote_host=192.168.99.1 remote_port=9001 profiler_enable=1"
Calculate MD5 checksum:
md5 /tmp/1.iso
Calculate SHA-1 checksum:
shasum -a 1 /tmp/1.iso
Calculate SHA-256 checksum:
shasum -a 256 /tmp/1.iso
@dcb9
dcb9 / zsh.md
Created January 29, 2016 06:45 — forked from tsabat/zsh.md
Getting oh-my-zsh to work in Ubuntu
sudo su -
# Kernels older than 3.10 lack some of the features required to run Docker containers.
uname -r
3.11.0-15-generic
apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
echo deb https://apt.dockerproject.org/repo ubuntu-trusty main > /etc/apt/sources.list.d/docker.list
@dcb9
dcb9 / README.md
Created March 14, 2016 23:20 — forked from cornernote/README.md
How to use PsySH with a Yii2 application

Using PsySH (GitHub) as the Yii2 shell

  • Issue the following commands from the command line in your Yii application directory:
    • chmod +x psyii
    • mkdir extensions/yiishell
    • wget -O extensions/yiishell/psysh psysh.org/psysh
    • chmod +x extensions/yiishell/psysh
  • Copy the file init.php below to psysh/init.php and update any paths to work with your application configuration
  • Copy the file config.php below to psysh/config.php. Change or add to the config array with the options you'd like to use (available options)
  • Now you can start PsySH with the command ./psyii psysh/init.php --config psysh/config.php
@dcb9
dcb9 / changed.diff
Last active March 25, 2016 03:29
add comment function in column builder in yii2 2.0.7
diff --git a/ColumnSchemaBuilder.php b/ColumnSchemaBuilder.php
index bfa26bd..45ca8f5 100644
--- a/ColumnSchemaBuilder.php
+++ b/ColumnSchemaBuilder.php
@@ -51,6 +51,7 @@ class ColumnSchemaBuilder extends Object
* @since 2.0.7
*/
protected $isUnsigned = false;
+ protected $comment;
@dcb9
dcb9 / ColumnSchemaBuilder.php
Created March 25, 2016 03:59
add comment function for MySQL ColumnSchemaBuilder in yii2 2.0.7
<?php
namespace common\components;
class ColumnSchemaBuilder extends \yii\db\ColumnSchemaBuilder
{
protected $comment;
/**
* @inheritdoc