Skip to content

Instantly share code, notes, and snippets.

View AlphaWong's full-sized avatar
🇭🇰
I go to work by MTR

Alpha AlphaWong

🇭🇰
I go to work by MTR
View GitHub Profile
@AlphaWong
AlphaWong / .gitconfig
Created June 18, 2017 12:40 — forked from pksunkara/config
Sample of git config file (Example .gitconfig)
[user]
name = Pavan Kumar Sunkara
email = pavan.sss1991@gmail.com
[core]
editor = vim
whitespace = fix,-indent-with-non-tab,trailing-space,cr-at-eol
excludesfile = ~/.gitignore
[sendemail]
smtpencryption = tls
smtpserver = smtp.gmail.com
@AlphaWong
AlphaWong / UNION.sql
Created July 26, 2017 07:55
sql leaning
# OR statment
SELECT * FROM TABLE 1 WHERE col1 = 1 OR col1 = 2
# UNION ALL
SELECT * FROM TABLE 1 WHERE col1 = 1
UNION ALL
SELECT * FROM TABLE 1 WHERE col1 = 2
# Reference
# https://www.w3schools.com/sql/sql_union.asp
@AlphaWong
AlphaWong / explain.md
Last active July 26, 2017 09:26
sql leaning 2

Sql

explain select * from vanrating_latest_backup where rating=3 or rating=4;

Result

+------+-------------+-------------------------+------+---------------+------+---------+------+------+-------------+
| id   | select_type | table                   | type | possible_keys | key  | key_len | ref  | rows | Extra       |
+------+-------------+-------------------------+------+---------------+------+---------+------+------+-------------+
|    1 | SIMPLE      | vanrating_latest_backup | ALL  | NULL          | NULL | NULL    | NULL |   12 | Using where |
+------+-------------+-------------------------+------+---------------+------+---------+------+------+-------------+
@AlphaWong
AlphaWong / join.sql
Created July 27, 2017 08:11
join.sql
SELECT * FROM vanorderspecialrequest as a right join th_vanlookupspecialrequests as b on a.idvanspecialrequest = b.id where b.enable = 1;
SELECT * FROM vanorderspecialrequest as a left join th_vanlookupspecialrequests as b on a.idvanspecialrequest = b.id where b.enable = 1;
# A table (Master) vs B table (non-master)
# A table (1,2,3,4,5)
# b table ({orderId:1,user:'alpha'},{order:2,user:'beta'})
# if A join B will not deduct the total result
# if B join A will deduct total result
@AlphaWong
AlphaWong / log_request.go
Created July 28, 2017 04:06 — forked from hoitomt/log_request.go
Golang: Log HTTP Requests in Go
package main
import (
"fmt"
"log"
"net/http"
"os"
)
func main() {

This describes the steps required to configure multiple PHP versions on your development system, if you have issue using the AUR package. Normally one may install the AUR package on a custom path, .e.g, /usr/local/php, but if you are like me having some issues with that you might want to try a custom compile.

Pay attention to step 6) as this is where any required extensions are enabled. For this setup we generally need pdo and mysql extensions.


  1. Download PHP version 5.3.13 (or any version that you are interested in) from http://php.net/releases/

  2. Download the php53 AUR package from https://aur.archlinux.org/packages/php53/

@AlphaWong
AlphaWong / README.md
Last active September 18, 2017 04:20
The Ten Commandments of Egoless Programming

The Ten Commandments of Egoless Programming

The Ten Commandments of Egoless Programming, as originally established in Jerry Weinberg's book The Psychology of Computer Programming:

1. Understand and accept that you will make mistakes.

The point is to find them early, before they make it into production. Fortunately, except for the few of us developing rocket guidance software at JPL, mistakes are rarely fatal in our industry, so we can, and should, learn, laugh, and move on.

2. You are not your code.

@AlphaWong
AlphaWong / gitprint.js
Created October 9, 2017 12:32 — forked from beevelop/gitprint.js
Print GitHub markdown files
document.querySelector('#readme').setAttribute('style', 'position: absolute; top: 0; left: 0; right: 0; bottom: 0; z-index: 100; background-color: white')
document.querySelector('body').appendChild(document.querySelector('#readme'))
window.print()

Set the url with ?XDEBUG_SESSION_START=PHPSTORM and set a header Cookie: XDEBUG_SESSION=PHPSTORM

@AlphaWong
AlphaWong / shadow-dom.md
Created November 23, 2017 04:43 — forked from praveenpuglia/shadow-dom.md
Everything you need to know about Shadow DOM

Shadow DOM

Heads Up! It's all about the V1 Spec.

In a nutshell, Shadow DOM enables local scoping for HTML & CSS.

Shadow DOM fixes CSS and DOM. It introduces scoped styles to the web platform. Without tools or naming conventions, you can bundle CSS with markup, hide implementation details, and author self-contained components in vanilla JavaScript. - https://developers.google.com/web/fundamentals/getting-started/primers/shadowdom

It's like it's own little world which hardly affects or gets affected by the outside world.