Skip to content

Instantly share code, notes, and snippets.

View tchon's full-sized avatar

Timothy Chon tchon

View GitHub Profile
@tchon
tchon / findUids.js
Last active September 30, 2018 18:00
function findUids(node) {
let depth = 0;
const MAX_DEPTH = 10;
const uids = [];
const table = {};
(function traverse(node) {
if (typeof node !== "object") { return; } // only permit objects
if (depth > MAX_DEPTH) {
console.error(new Error(`Exception: Tree to Deep! depth: ${depth}`));
@tchon
tchon / hnpwa_com_normalized_resuts
Created September 19, 2018 13:34
Normalized Results for https://hnpwa.com/ as of 2018-09-19
HNPWA Firebase
Lighthouse: 98/100
Interactive (Emerging Markets): 1.3s
Interactive (Faster 3G): 0.7s
Framework/UI libraries: HTML/CSS
Scaffolding: Firebase CLI
Module bundling: N/A
Viper-news
Lighthouse: 91/100
@tchon
tchon / annoying.js
Created June 1, 2011 21:09 — forked from rwaldron/annoying.js
How to be an asshole
/**
* Annoying.js - How to be an asshole to your users
*
* DO NOT EVER, EVER USE THIS.
*
* Copyright (c) 2011 Kilian Valkhof (kilianvalkhof.com)
* Visit https://gist.github.com/767982 for more information and changelogs.
* Visit http://kilianvalkhof.com/2011/javascript/annoying-js-how-to-be-an-asshole/ for the introduction and weblog
* Check out https://gist.github.com/942745 if you want to annoy developer instead of visitors
*
@tchon
tchon / getscreenshot.py
Created May 11, 2011 18:07 — forked from bellbind/getscreenshot.py
[python][pywebkitgtk]Get web page screenshot
#
# Get web page screenshot
#
# usage:
# xvfb-run -s "-screen 0 1024x768x24" python getschreenshot.py test.html
#
# libs:
# - pygtk: http://www.pygtk.org/
# - pywebkitgtk(python-webkit): http://code.google.com/p/pywebkitgtk/
# - PIL: http://www.pythonware.com/products/pil/
@tchon
tchon / getscreenshot.py
Created May 11, 2011 18:07 — forked from bellbind/getscreenshot.py
[python][pywebkitgtk]Get web page screenshot
#
# Get web page screenshot
#
# usage:
# xvfb-run -s "-screen 0 1024x768x24" python getschreenshot.py test.html
#
# libs:
# - pygtk: http://www.pygtk.org/
# - pywebkitgtk(python-webkit): http://code.google.com/p/pywebkitgtk/
# - PIL: http://www.pythonware.com/products/pil/
@tchon
tchon / webkitscreenshot.py
Created May 11, 2011 18:07 — forked from bellbind/webkitscreenshot.py
[python][webkitgtk][PIL][X][tool] get web site thumbnail by webkit
#!/usr/bin/env python
"""
web page screenshot by webkit
command usage:
python webkitscreenshot.py test.html
library usage:
import webkitscreenshot
image = webkitscreenshot.screenshot_vfb("file://test.html")