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 / 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() {
@AlphaWong
AlphaWong / Multiple PHP versions on Archlinux.md
Created August 12, 2017 02:28
Multiple PHP versions on Archlinux

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 / 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.

@AlphaWong
AlphaWong / gist:30b5bed1370e49518e541729037e8e00
Created December 22, 2017 03:46 — forked from digitaljhelms/gist:3099010
Squash the first two commits in a git repository's history

The scenario

Your repository has two commits:

$ git log --oneline
957fbfb No, I am your father.
9bb71ff A long time ago in a galaxy far, far away....
package main
import (
"fmt"
"net/http"
"github.com/gorilla/websocket"
)
func echo(w http.ResponseWriter, r *http.Request) {
@AlphaWong
AlphaWong / index.html
Created January 3, 2018 15:47 — forked from tmichel/index.html
simple websocket example with golang
<html>
<head>
<title>WebSocket demo</title>
</head>
<body>
<div>
<form>
<label for="numberfield">Number</label>
<input type="text" id="numberfield" placeholder="12"/><br />
@AlphaWong
AlphaWong / result.txt
Created March 14, 2018 03:10 — forked from knsh14/result.txt
golang 1.10 strings builder test
$ go test -bench . -benchmem
goos: linux
goarch: amd64
pkg: github.com/knsh14/sample
BenchmarkBytesBuffer-2 10 103512777 ns/op 438779214 B/op 23 allocs/op
BenchmarkStringBuilder-2 10 138950789 ns/op 661977072 B/op 54 allocs/op
BenchmarkBytesBufferString-2 5000000 353 ns/op 1280 B/op 1 allocs/op
BenchmarkStringBuilderString-2 2000000000 0.33 ns/op 0 B/op 0 allocs/op
PASS
ok github.com/knsh14/sample 5.699s