Skip to content

Instantly share code, notes, and snippets.

View jacksontong's full-sized avatar
🏠
Working from home

Jackson Tong jacksontong

🏠
Working from home
  • Snapfrozen
  • Viet Nam
View GitHub Profile
@jacksontong
jacksontong / install_vagrant_sudoers.sh
Last active August 29, 2015 14:24 — forked from joemaller/install_vagrant_sudoers.sh
Vagrant NFS Shares without a password
#!/bin/bash
# Add Vagrant's NFS setup commands to sudoers, for `vagrant up` without a password
# Updated to work with Vagrant 1.3.x
# Stage updated sudoers in a temporary file for syntax checking
TMP=$(mktemp -t vagrant_sudoers)
cat /etc/sudoers > $TMP
cat >> $TMP <<EOF
# Allow passwordless startup of Vagrant when using NFS.
@jacksontong
jacksontong / create_swap.sh
Last active August 26, 2015 12:46 — forked from garystafford/create_swap.sh
From my blog post, Scripting Linux Swap Space: Scripting Linux Swap Space
#!/bin/sh
# size of swapfile in megabytes
swapsize=512
# does the swap file already exist?
grep -q "swapfile" /etc/fstab
# if not then create it
if [ $? -ne 0 ]; then
@jacksontong
jacksontong / server.ini
Last active August 26, 2015 17:15
HHVM server.ini for Ubuntu FastCGI
; php options
pid = /var/run/hhvm/pid
; hhvm specific
hhvm.server.port = 9000
hhvm.server.type = fastcgi
hhvm.server.default_document = index.php
hhvm.log.use_log_file = true
@jacksontong
jacksontong / remote.sql
Created September 5, 2015 05:19
grant access permission mysql
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'password';
FLUSH PRIVILEGES;
@jacksontong
jacksontong / php.ini
Created March 10, 2016 05:29
php config
[
'PHP' => [
'engine' => '1'
'short_open_tag' => ''
'precision' => '14'
'output_buffering' => '4096'
'zlib.output_compression' => ''
'implicit_flush' => ''
'unserialize_callback_func' => ''
'serialize_precision' => '17'
@jacksontong
jacksontong / main.php
Created March 10, 2016 05:45
yii2 config
return [
'basePath' => dirname(__DIR__),
'bootstrap' => ['log'],
'controllerNamespace' => 'frontend\controllers',
'language' => 'en-AU',
'vendorPath' => dirname(dirname(__DIR__)) . '/vendor',
'extensions' => require(__DIR__ . '/../../vendor/yiisoft/extensions.php'),
'defaultRoute' => 'site/dashboard',
'components' => [
'assetManager' => [
@jacksontong
jacksontong / content.php
Created April 14, 2016 07:29
inline-help content for cp is_scaled
[
0 => [
'field_id' => '25'
'header' => 'Consumption Scaling'
'content' => '<p>Choose whether or not to scale the consumption profile of your customer.</p>
'
'created_at' => '2015-08-19 03:44:37'
'updated_at' => '2015-08-19 03:44:37'
]
1 => [
@jacksontong
jacksontong / index.php
Created August 6, 2017 02:01
Customers gridview page
<?php
use yii\helpers\Html;
use yii\grid\GridView;
/* @var $this yii\web\View */
/* @var $searchModel app\models\search\CustomerSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->title = 'Customers';
@jacksontong
jacksontong / CustomerSearch.php
Created August 6, 2017 03:50
Yii2 Search model
<?php
namespace app\models\search;
use Yii;
use yii\base\Model;
use yii\data\ActiveDataProvider;
use app\models\Customer;
use yii\db\Expression;
@jacksontong
jacksontong / ClientSearch.php
Created August 6, 2017 07:18
Client Search model
<?php
namespace app\models\search;
use Yii;
use yii\base\Model;
use yii\data\ActiveDataProvider;
use app\models\Client;
use yii\db\Expression;