Skip to content

Instantly share code, notes, and snippets.

View ericksli's full-sized avatar

Eric Li ericksli

View GitHub Profile
@ericksli
ericksli / private.xml
Created March 15, 2016 06:02
Map the mouse button 4 and 5 to browser's back and forward commands using Karabiner
<?xml version="1.0"?>
<root>
<devicevendordef>
<vendorname>DELUX</vendorname>
<vendorid>0x093a</vendorid>
</devicevendordef>
<deviceproductdef>
<productname>DELUX_M618</productname>
<productid>0x2521</productid>
@ericksli
ericksli / share.html
Created February 23, 2016 02:02
Social media share pop-up
<ul class="dropdown-menu dropdown-menu-right" role="menu" data-share-list="share" aria-labelledby="comment-dropup-menu-2929">
<li><a rel="nofollow" data-share="facebook" href="http://facebook.com/share.php?u=http%3A%2F%2Fcityuge.swiftzer.net%2Fcomments%2F2929"><i class="fa fa-fw fa-facebook"></i> Facebook</a></li>
<li><a rel="nofollow" data-share="twitter" href="https://twitter.com/intent/tweet?url=http%3A%2F%2Fcityuge.swiftzer.net%2Fcomments%2F2929"><i class="fa fa-fw fa-twitter"></i> Twitter</a></li>
<li><a rel="nofollow" data-share="googlePlus" href="http://plus.google.com/share?url=http%3A%2F%2Fcityuge.swiftzer.net%2Fcomments%2F2929"><i class="fa fa-fw fa-google-plus"></i> Google+</a></li>
<li><a rel="nofollow" data-share="renren" href="http://share.renren.com/share/buttonshare?link=http%3A%2F%2Fcityuge.swiftzer.net%2Fcomments%2F2929"><i class="fa fa-fw fa-renren"></i> 人人網</a></li>
<li><a rel="nofollow" data-share="sinaWeibo" href="http://v.t.sina.com.cn/share/share.php?url=http%3A%2F%2Fcityuge.
@ericksli
ericksli / align-box.html
Created December 3, 2014 04:48
Horizonal and vertical align middle
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Align Box</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style type="text/css">
html {
height: 100%;
@ericksli
ericksli / git-change-author.sh
Created December 1, 2014 08:31
Change the author of a Git commit using filter-branch, modified from GitHub's git-author-rewrite.sh
#!/bin/sh
git filter-branch --env-filter '
TARGET_COMMIT="b2e9c940f383c916d783d414ea8626c59922661a"
CORRECT_NAME="John Doe"
CORRECT_EMAIL="john.doe@gmail.com"
if [ "$GIT_COMMIT" = "$TARGET_COMMIT" ]
then
@ericksli
ericksli / file-hash.sh
Last active August 29, 2015 14:09
List all files with version hash in a Git repository
#!/bin/bash
# Usage: Git checkout to the commit you want, then run this script to print the files in the repository and its version hash.
files="`git ls-files`"
while read -r filename; do
hash="`git log -1 --pretty=%h ${filename}`"
echo -e "$filename\t$hash"
done <<< "$files"
@ericksli
ericksli / traffic-speed-map.kml
Created September 23, 2014 05:27
Data.One Traffic Speed Map KML
<?xml version='1.0' encoding='UTF-8'?>
<kml xmlns='http://www.opengis.net/kml/2.2'>
<Document>
<name>Traffic Speed Map</name>
<description><![CDATA[]]></description>
<Folder>
<name>Links</name>
<Placemark>
<styleUrl>#line-0BA9CC-5</styleUrl>
<name>722-50059</name>
@ericksli
ericksli / nodes.csv
Created September 23, 2014 05:26
Data.One Traffic Speed Map Nodes
Node Latitude Longitude
722 22.28599466 114.1552444
724 22.28514213 114.1563129
752 22.27957768 114.1655361
756 22.27963564 114.1679961
760 22.27927381 114.1704165
762 22.27953399 114.1745641
781 22.27525639 114.1799562
786 22.28155011 114.1819768
787 22.2806696 114.1806507