Skip to content

Instantly share code, notes, and snippets.

View jewei's full-sized avatar

Jewei Mak jewei

View GitHub Profile
<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>
<?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 {
#!/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
@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 {} +
@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 / 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 / gist:dd8c8e15fb2bed54eaa1d50d7321d728
Created October 25, 2017 11:32
New Ubuntu Server Init
// Set timezone.
sudo dpkg-reconfigure tzdata
// Update.
sudo apt update
// Language fix.
sudo apt install -y language-pack-en-base
export LC_ALL=en_US.UTF-8
@jewei
jewei / keybase.md
Created February 9, 2018 04:43
keybase.md

Keybase proof

I hereby claim:

  • I am jewei on github.
  • I am jewei (https://keybase.io/jewei) on keybase.
  • I have a public key ASC2ykLyNwPS-jO8LiLFD2bbKN-k6XcdFZaGtLkJ0GgZFwo

To claim this, I am signing this object:

@jewei
jewei / NodeJS.md
Last active February 26, 2018 07:10
Ubuntu 17.10 Server Setup

Install NodeJS

curl -sL https://deb.nodesource.com/setup_9.x | sudo -E bash -
sudo apt-get install -y nodejs

curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
sudo apt-get install -y nodejs
@jewei
jewei / Laravel56.psalm.xml
Created May 21, 2018 10:39
psalm.xml for Laravel
<?xml version="1.0"?>
<psalm
totallyTyped="true"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="https://getpsalm.org/schema/config"
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
>
<projectFiles>
<directory name="app" />
</projectFiles>