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
{
"entities": {
"snippets": {
"aJOTlE1K90k": {
"publishedAt": "2018-05-31T04:00:00.000Z",
"channelId": "UCN1hnUccO4FD5WfM7ithXaw",
"title": "Maroon 5 - Girls Like You ft. Cardi B",
"description": "\"Girls Like You” is out now. http://smarturl.it/GLY For more, visit: https://www.facebook.com/maroon5 https://twitter.com/maroon5 ...",
"thumbnails": {
"default": {
@jacksontong
jacksontong / youtube-api-response.json
Created August 12, 2018 12:21
youtube-api-response
[
{
"kind": "youtube#searchResult",
"etag": "\"XI7nbFXulYBIpL0ayR_gDh3eu1k/iecMlihzF4qEDkzXsB6TUt81Oqw\"",
"id": {
"kind": "youtube#video",
"videoId": "M4ZoCHID9GI"
},
"snippet": {
"publishedAt": "2018-04-12T16:00:04.000Z",
@jacksontong
jacksontong / guzzle.php
Last active June 8, 2018 03:03
Guzzle async example
<?php
require_once('vendor/autoload.php');
use GuzzleHttp\Client as GuzzleClient;
use GuzzleHttp\Promise as GuzzlePromise;
//https://stackoverflow.com/a/32751004/3787302
$start_time = microtime(TRUE);
$client = new GuzzleClient(['timeout' => 12.0]); // see how i set a timeout
$requestPromises = [];
$sitesArray = [
@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;
@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 / 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 / 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 / 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 / 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 / remote.sql
Created September 5, 2015 05:19
grant access permission mysql
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'password';
FLUSH PRIVILEGES;