Skip to content

Instantly share code, notes, and snippets.


Steve Mao stevemao

Block or report user

Report or block stevemao

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
stevemao / index.html
Last active Dec 15, 2018 — forked from vasturiano/index.html
Newton's Cradle
View index.html
<script src="//"></script>
<script src="//"></script>
<script src="//"></script>
<link rel="stylesheet" href="style.css">
<svg id="canvas">
stevemao / index.html
Created Dec 15, 2018 — forked from rsk2327/index.html
collisionForce (forceCollide)
View index.html
<script type="text/javascript" src = ""></script>
<style type = "text/css">
.active {
stroke: #000;
stroke-width: 2px;
stevemao /
Last active Nov 17, 2017
Search for a command that you are tempted to do with GUI
# dependency:
# pip install mdv
# replace `'copy a file'` with whatever you are searching for
curl | mdv - | grep 'copy a file' -A 10
stevemao /
Created Nov 9, 2017 — forked from yyx990803/
npm list only top level modules.
alias ng="npm list -g --depth=0 2>/dev/null"
alias nl="npm list --depth=0 2>/dev/null"
View watch-value
console = console || {}; // just in case = function(oObj, sProp) {
sPrivateProp = "$_"+sProp+"_$"; // to minimize the name clash risk
oObj[sPrivateProp] = oObj[sProp];
// overwrite with accessor
Object.defineProperty(oObj, sProp, {
get: function () {
return oObj[sPrivateProp];
stevemao /
Created Jan 12, 2016 — forked from m14t/
Convert HTTPS github clones to use SSH
#-- Script to automate
REPO_URL=`git remote -v | grep -m1 '^origin' | sed -Ene's#.*(https://[^[:space:]]*).*#\1#p'`
if [ -z "$REPO_URL" ]; then
echo "-- ERROR: Could not identify Repo url."
echo " It is possible this repo is already using SSH instead of HTTPS."
View simple-server-for-index-html.js
var fs = require('fs');
var html;
fs.readFile('./index.html', function (err, data) {
html = data;
require('http').createServer(function (request, response) {
View gist:5fa37328581a749238f8
# copied from
module () {
cd ~/Code
mkdir $1
cd $1
git init
hub create
travis enable --no-interactive &
yo bd
View post-merge
#/usr/bin/env bash
# MIT © Sindre Sorhus -
# git hook to run a command after `git pull` if a specified file was changed
# Run `chmod +x post-merge` to make it executable then put it into `.git/hooks/`.
changed_files="$(git diff-tree -r --name-only --no-commit-id ORIG_HEAD HEAD)"
check_run() {
echo "$changed_files" | grep --quiet "$1" && eval "$2"
View gist:754c2928fa7ea21a4e9a
// ----------------------------------------------------------
// A short snippet for detecting versions of IE in JavaScript
// without resorting to user-agent sniffing
// ----------------------------------------------------------
// If you're not in IE (or IE version is less than 5) then:
// ie === undefined
// If you're in IE (>=5) then you can determine which version:
// ie === 7; // IE7
// Thus, to detect IE:
// if (ie) {}
You can’t perform that action at this time.