Skip to content

Instantly share code, notes, and snippets.

View telesoho's full-sized avatar
🏠
Working from home

WenHong.Tan telesoho

🏠
Working from home
View GitHub Profile
@telesoho
telesoho / nm_l2tp_ipsec_vpn.md
Created November 6, 2021 10:06 — forked from pastleo/nm_l2tp_ipsec_vpn.md
setup L2TP IPSEC VPN in archlinux using NetworkManager
@telesoho
telesoho / jstransposer
Created September 2, 2018 12:55 — forked from sunmer/jstransposer
A tiny JavaScript chord transposer
function t(orgKey, newKey, c) {
C = "C,C#,D,D#,E,F,F#,G,G#,A,A#,B".split(',');
C = C.concat(C);
var orgIndex = C.indexOf(orgKey);
var newIndex = C.indexOf(newKey);
newIndex = orgIndex > newIndex ? C.lastIndexOf(newKey) : newIndex;
for(i=c.length; i--;) {
var extension = c[i].indexOf('#') !== -1 ? c[i].slice(c[i].indexOf('#') + 1, c[i].length) : c[i].slice(1, c[i].length);
c[i] = c[i].replace(extension, "");
c[i] = C[C.indexOf(c[i]) + Math.abs(orgIndex - newIndex)] + extension;
@telesoho
telesoho / laravel_validation.php
Last active August 15, 2018 02:17 — forked from yeetuchou/laravel_validation.php
laravel validation 中文
<?php
return [
/*
|--------------------------------------------------------------------------
| Validation Language Lines
|--------------------------------------------------------------------------
|
| The following language lines contain the default error messages used by
@telesoho
telesoho / gist:9350e0ef6aa3fc8a23202089080655b9
Created May 28, 2018 11:35 — forked from callmephilip/gist:3626669
[JavaScript] Lock site in portrait mode in mobile Safari
// Kudos to Grumdrig
// http://stackoverflow.com/questions/1207008/how-do-i-lock-the-orientation-to-portrait-mode-in-a-iphone-web-application
$(document).ready(function () {
function reorient(e) {
var portrait = (window.orientation % 180 == 0);
$("body > div").css("-webkit-transform", !portrait ? "rotate(-90deg)" : "");
}
window.onorientationchange = reorient;
window.setTimeout(reorient, 0);