Skip to content

Instantly share code, notes, and snippets.

View tucq88's full-sized avatar
🎯
Fake it till you make it. Confidence is more important than knowledge.

Tu Chu tucq88

🎯
Fake it till you make it. Confidence is more important than knowledge.
View GitHub Profile
@tucq88
tucq88 / bash-cheatsheet.sh
Created May 24, 2017 11:02 — forked from LeCoupa/bash-cheatsheet.sh
Bash CheatSheet for UNIX Systems
#!/bin/bash
#####################################################
# Name: Bash CheatSheet for Mac OSX
#
# A little overlook of the Bash basics
#
# Usage:
#
# Author: J. Le Coupanec
# Date: 2014/11/04
@tucq88
tucq88 / clingme-overview.md
Last active December 17, 2016 03:46
Quick Overview about Clingme
@tucq88
tucq88 / bootstrap-laravel.md
Last active December 2, 2016 04:21
Bootstrap new project with Laravel
@tucq88
tucq88 / pr.md
Created November 25, 2016 02:16 — forked from piscisaureus/pr.md
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@tucq88
tucq88 / gist:35a333912a2cc02527b5fc8a9e426df9
Last active September 30, 2016 06:13
UK Postcode Regex
^([A-PR-UWYZ0-9][A-HK-Y0-9][AEHMNPRTVXY0-9]?[ABEHMNPRVWXY0-9]? {1,2}[0-9][ABD-HJLN-UW-Z]{2}|GIR 0AA)$
@tucq88
tucq88 / gist:1179d101e441824e512ae142b6fbaf6f
Created August 17, 2016 05:52 — forked from prsws/gist:8162386
A Multi-Tenant Strategy using Yii and MySQL

Introduction

This article describes an implementation of multi-tenancy using Yii and MySQL. “Multi-tenancy” is but one (yet crucial) aspect of SaaS applications; refer to the IBM document Convert your web application to a multi-tenant SaaS solution for more information on what else makes a webapp a SaaS application.

Moreover, there are three main architectures for multi-tenant databases: separate database, separate schemas and a single database. Refer to the Microsoft document Multi-Tenant Data Architecture for more information.

As MySQL doesn’t have schemas (at least the same way MS SQL Server and Oracle do) the only choices are a separate database for each tenant and single database with “commingled” tenant data. SaaS applications with a relatively small number of tenants can be easily managed with a database for each one, but for large numbers of tenants its

@tucq88
tucq88 / get-current-term.php
Created August 8, 2016 09:20
WordPress | How to Display Taxonomy Term Name in Taxonomy Page
<?php
$taxonomy = get_queried_object();
echo $taxonomy->name;
//You could even get a custom field (using ACF)
//that belongs to the term
the_field('custom_field', $taxonomy);
// Source https://stanhub.com/display-wordpress-taxonomy-term-name-in-taxonomy-page/
@tucq88
tucq88 / Git branch bash autocomplete *with aliases*
Last active February 20, 2017 09:08 — forked from JuggoPop/Git branch bash autocomplete *with aliases*
Git branch bash autocomplete *with aliases* (add to .bash_profile)
# To Setup:
# 1) Save the .git-completion.bash file found here:
# https://github.com/git/git/blob/master/contrib/completion/git-completion.bash
# 2) Add the following lines to your .bash_profile, be sure to reload (for example: source ~/.bash_profile) for the changes to take effect:
#TODO Make bash dir and go to
mkdir ~/.bash && cd ~/.bash
#TODO CURL to get the file
curl -O https://raw.githubusercontent.com/git/git/master/contrib/completion/git-completion.bash