Skip to content

Instantly share code, notes, and snippets.

View dcb9's full-sized avatar

Du, Chengbin dcb9

View GitHub Profile
@dcb9
dcb9 / sicp-1.7.sc
Created August 23, 2017 09:50
sicp-1.7 created by dcb9 - https://repl.it/KVr5/1
(define (average x) (/ x 2))
(define (square x) (* x x))
(define (abs x) (if (< x 0) (- 0 x) x))
; (define (good-enough? guess x)
; (if (< (abs (- (square guess) x)) 0.00000000001)
; #t
; #f))
(define (good-enough? guess x)
@dcb9
dcb9 / DependencyInjectionForFuncExample.php
Created September 6, 2016 08:51
Dependency Injection For Function Example
<?php
/*
* # installation
*
* $ cat composer.json
* {
* "require": {
* "pimple/pimple": "~3.0"
* }
@dcb9
dcb9 / ColumnSchemaBuilder.php
Created March 25, 2016 04:00
add comment function for MySQL ColumnSchemaBuilder in yii2 2.0.7
<?php
namespace common\components;
class ColumnSchemaBuilder extends \yii\db\ColumnSchemaBuilder
{
protected $comment;
/**
* @inheritdoc
@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
@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 / 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
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 / zsh.md
Created January 29, 2016 06:45 — forked from tsabat/zsh.md
Getting oh-my-zsh to work in Ubuntu
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
export XDEBUG_CONFIG="idekey=PHPSTORM remote_enable=1 remote_host=192.168.99.1 remote_port=9001 profiler_enable=1"