Skip to content

Instantly share code, notes, and snippets.

View jewei's full-sized avatar

Jewei Mak jewei

View GitHub Profile
@jewei
jewei / my.cnf
Created April 10, 2017 08:44
Disable Mysql STRICT_TRANS_TABLES
# /usr/local/etc/my.cnf
[mysqld]
sql_mode=ONLY_FULL_GROUP_BY,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
@jewei
jewei / LoginController.php
Created July 29, 2016 08:23
Laravel 5.x. Login authentication with username or email.
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Http\Controllers\Auth\AuthController;
use Illuminate\Auth\CreatesUserProviders;
class LoginController extends AuthController
{
use CreatesUserProviders;
protected $app;
protected $provider;
@jewei
jewei / cli_snippets
Created July 22, 2016 07:27
Useful CLI commands
To recursively give directories read&execute privileges:
find /path/to/base/dir -type d -exec chmod 755 {} +
To recursively give files read privileges:
find /path/to/base/dir -type f -exec chmod 644 {} +
#!/bin/bash
# Written by Jewei Mak <jewei.mak@gmail.com> for Digital Ocean Ghost (one-click-install) to the latest version.
# Stop Ghost.
service ghost stop
# Goto working dir.
cd /var/www/ghost
<?php
/**
* An helper file for Laravel 5, to provide autocomplete information to your IDE
* Generated for Laravel 5.0.14 on 2015-03-23.
*
* @author Barry vd. Heuvel <barryvdh@gmail.com>
* @see https://github.com/barryvdh/laravel-ide-helper
*/
namespace {
<script src="http://cdnjs.cloudflare.com/ajax/libs/prettify/188.0.0/prettify.js" type="text/javascript"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/prettify/188.0.0/lang-css.js" type="text/javascript"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/prettify/188.0.0/lang-sql.js" type="text/javascript"></script>
<script type="text/javascript">prettyPrint()</script>