Skip to content

Instantly share code, notes, and snippets.

View williamli's full-sized avatar

Willi#m ⬣ williamli

View GitHub Profile
@williamli
williamli / index.html
Created July 18, 2013 18:23
A CodePen by Wm. Li. Multi Mini Countdown Rings with Unix Timestamps
<div id="container">
<div id="receipt_1" class="receipt">
<div class="parameters">
<div class="processed_time"></div>
<div class="eta_time"></div>
</div>
<canvas class="counter active" width="100" height="100">
</canvas>
</div>
@williamli
williamli / sublime.desktop
Created July 28, 2013 02:09
Ubuntu application icon for Sublime Text 2
[Desktop Entry]
Version=1.0
Name=Sublime Text 2
Comment=The best IDE in the world
GenericName=Text Editor
Keywords=IDE;Editor;TextEditor;Development
Exec=/usr/bin/Sublime\ Text\ 2/sublime_text %U
Terminal=false
Type=Application
Icon=/usr/bin/Sublime Text 2/Icon/256x256/sublime_text.png
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_URI} !^/landingpage/.$
RewriteCond %{HTTP_USER_AGENT} android|avantgo|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge\ |maemo|midp|mmp|opera\ m(ob|in)i|palm(\ os)?|phone|p(ixi|re)\/|plucker|pocket|psp|symbian|treo|up\.(browser|link)|vodafone|wap|windows\ (ce|phone)|xda|xiino [NC,OR]
RewriteCond %{HTTP_USER_AGENT} ^(1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a\ wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r\ |s\ )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1\ u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp(\ i|ip)|hs\-c|ht(c(\-|\ |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac(\ |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|
@williamli
williamli / .htaccess
Created September 3, 2013 11:12
HTTPS Enforcer for Apache .htaccess in 3 Lines
RewriteEngine on
RewriteCond %{HTTPS} !=on
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
@williamli
williamli / .htaccess
Last active December 22, 2015 07:39
device (mobile vs desktop) based smart website redirecting with htaccess and cookies
# Instruction
# mobile site: m.example.com
# desktop site: example.com
# use query string target=mobile to enforce a mobile view on mobile site on desktop (set once and store in cookie)
# use query string target=desktop to enforce a desktop view on desktop site on mobile (set once and store in cookie)
# use query string target=default to reset view preference to default
RewriteEngine On
# Checks query string for target, sets cookie and refresh
@williamli
williamli / easings.scss
Created August 3, 2017 11:07
Easings variables for SCSS
// taken from http://easings.net/
$ease-in-out-back: cubic-bezier(0.680, -0.550, 0.265, 1.550);
$ease-in-out-circ: cubic-bezier(0.785, 0.135, 0.150, 0.860);
$ease-in-out-expo: cubic-bezier(1.000, 0.000, 0.000, 1.000);
$ease-in-out-sine: cubic-bezier(0.445, 0.050, 0.550, 0.950);
$ease-in-out-quint: cubic-bezier(0.860, 0.000, 0.070, 1.000);
$ease-in-out-quart: cubic-bezier(0.770, 0.000, 0.175, 1.000);
$ease-in-out-cubic: cubic-bezier(0.645, 0.045, 0.355, 1.000);
$ease-in-out-quad: cubic-bezier(0.455, 0.030, 0.515, 0.955);
@williamli
williamli / ssh-key-generation.md
Created December 5, 2018 01:51 — forked from cybersamx/ssh-key-generation.md
Generate a new SSH key pair

Mac and Linux

  • Open Terminal

  • Check if you already have a SSH keypair generated. Do the following:

    $ ls -la ~/.ssh/id_rsa*
    

If the files exist, you already have SSH installed. IMPORTANT: But if you wish to regenerate the SSH key pair, at least back up your old SSH keys.

@williamli
williamli / cloudbuild-deploy.yaml
Created February 16, 2019 02:46
Google Cloud Build with GitHub plugin
steps:
# Decrypt the file containing the key
- name: 'gcr.io/cloud-builders/gcloud'
args: ...
@williamli
williamli / colorize.js
Created April 9, 2019 15:49
colorize.js
// https://30secondsofcode.org/node
module.exports = (...args) => ({
black: `\x1b[30m${args.join(' ')}`,
red: `\x1b[31m${args.join(' ')}`,
green: `\x1b[32m${args.join(' ')}`,
yellow: `\x1b[33m${args.join(' ')}`,
blue: `\x1b[34m${args.join(' ')}`,
magenta: `\x1b[35m${args.join(' ')}`,