Skip to content

Instantly share code, notes, and snippets.

View ayonliu's full-sized avatar

Lyon Liu ayonliu

View GitHub Profile
@ayonliu
ayonliu / APNS Entrust ssl certificate.md
Created July 4, 2014 11:18
To establish a TLS session with APNs, an Entrust Secure CA root certificate must be installed on the provider’s server. If the server is running Mac OS X, this root certificate is already in the keychain. On other systems, the certificate might not be available. You can download this certificate from the Entrust SSL Certificates website.
@ayonliu
ayonliu / function.php
Created June 27, 2014 09:44
Laravel 4 – Get Path to App, Public, Storage and Base Install Directories
<?php
/**
* Path to the 'app' folder
*/
echo app_path();
/**
* Path to the project's root folder
*/
echo base_path();
/**
@ayonliu
ayonliu / add-ftp-user.sh
Last active August 29, 2015 14:02
Add ftp user
# assume vsftpd installed
# add a user called `ftpuser`, home dir is "/var/www/html/example.com"
useradd -d /var/www/html/example.com -s /usr/sbin/nologin ftpuser
# add passowrd for ftpuser
passwd ftpuser
#
chown -R ftpuser:ftpuser /var/www/html/example.com
@ayonliu
ayonliu / var.go
Last active August 29, 2015 14:02
Golang variable define
Go语言里面定义变量有多种方式。
使用var关键字是Go最基本的定义变量方式,与C语言不同的是Go把变量类型放在变量名后面:
//定义一个名称为“variableName”,类型为"type"的变量
var variableName type
定义多个变量
//定义三个类型都是“type”的三个变量
var vname1, vname2, vname3 type
@ayonliu
ayonliu / godoc.md
Created June 17, 2014 06:37
Golang docs

查看某一个buildin包里面的函数:godoc buildin,例如查看http包文档,那么执行: godoc net/http 执行 godoc fmt Printf, 可以查看相应的代码 执行 godoc -src fmt Printf, 可以查看相应的代码

通过命令在命令行执行 godoc -http=:端口号 比如godoc -http=:8080。然后在浏览器中打开127.0.0.1:8080,你将会看到一个golang.org的本地copy版本

@ayonliu
ayonliu / ln.sh
Last active August 29, 2015 14:02
Add virtual host for nginx under Ubuntu
# build soft link between files under sites-available and sites-enabled
ln -s /etc/nginx/sites-available/test.com /etc/nginx/sites-enabled/test.com
service nginx restart
@ayonliu
ayonliu / NewCommand.php
Created June 17, 2014 02:28
Create command in Laravel
<?php
// app/commands/NewCommand.php
use Illuminate\Console\Command;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Input\InputArgument;
class NewCommand extends Command {
/**
@ayonliu
ayonliu / HomeController.php
Created June 12, 2014 11:25
How to use hessian in laravel
<?php
// app/controllers/HomeController.php
class HomeController extends BaseController {
// method for client to call
function getFile($file)
{
return $file . ' hessian';
//return $file;