Skip to content

Instantly share code, notes, and snippets.

Ilya Grigorik igrigorik

Block or report user

Report or block igrigorik

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
@lelandbatey
lelandbatey / whiteboardCleaner.md
Last active Oct 15, 2019
Whiteboard Picture Cleaner - Shell one-liner/script to clean up and beautify photos of whiteboards!
View whiteboardCleaner.md

Description

This simple script will take a picture of a whiteboard and use parts of the ImageMagick library with sane defaults to clean it up tremendously.

The script is here:

#!/bin/bash
convert "$1" -morphology Convolve DoG:15,100,0 -negate -normalize -blur 0x1 -channel RBG -level 60%,91%,0.1 "$2"

Results

@mstepien
mstepien / drive-appscript.js
Last active Jan 1, 2016 — forked from igrigorik/drive-appscript.js
BigQuery queries for the HTTP Archive dataset with some Google BigQuery API code updates: - use of class QueryRequest - http://googleappsdeveloper.blogspot.com/2013/11/code-updates-required-for-apps-script.html
View drive-appscript.js
function onOpen() {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var menuEntries = [ {name: "Run Query", functionName: "runQuery"} ];
ss.addMenu("HTTP Archive + BigQuery", menuEntries);
}
function runQuery() {
var projectNumber = 'httparchive';
var sheet = SpreadsheetApp.getActiveSheet();
@hemanth
hemanth / devtool.bash
Created Nov 23, 2013
Hacking Chrome DevTools Setup
View devtool.bash
#!/usr/bin/env bash
# Setup script for hacking chrome devtools
# Source -> https://medium.com/p/8c8896f5cef3
echo "Creating folder and initialize a git repo"
mkdir devtools-frontend && cd devtools-frontend
git init
echo "Adding chromium remote and initialize sparse checkout"
git remote add upstream https://chromium.googlesource.com/chromium/blink
View cr_cssproperties.json
{"2":"color","3":"direction","4":"display","5":"font","6":"font-family","7":"font-size","8":"font-style","9":"font-variant","10":"font-weight","11":"text-rendering","12":"webkit-font-feature-settings","13":"webkit-font-kerning","14":"webkit-font-smoothing","15":"webkit-font-variant-ligatures","16":"webkit-locale","17":"webkit-text-orientation","18":"webkit-writing-mode","19":"zoom","20":"line-height","21":"background","22":"background-attachment","23":"background-clip","24":"background-color","25":"background-image","26":"background-origin","27":"background-position","28":"background-position-x","29":"background-position-y","30":"background-repeat","31":"background-repeat-x","32":"background-repeat-y","33":"background-size","34":"border","35":"border-bottom","36":"border-bottom-color","37":"border-bottom-left-radius","38":"border-bottom-right-radius","39":"border-bottom-style","40":"border-bottom-width","41":"border-collapse","42":"border-color","43":"border-image","44":"border-image-outset","45":"border-imag
@stevesouders
stevesouders / activetable.js
Last active Jul 4, 2019
ActiveTable is a bookmarklet that makes any table sortable. It also allows you to remove columns, and it remembers the removed columns for next time. Use alt+click to UNhide all columns (and clear memory). To use it, create a bookmark called "ActiveTable" that has this URL: javascript:(function(){ var jselem=document.createElement('SCRIPT'); jse…
View activetable.js
// ActiveTable - a bookmarklet to make tables sortable and editable
function init() {
var aHrows = getHrows();
var numHrows = aHrows.length;
var aHidden = getHiddenColumns();
ATpopup = document.createElement("div");
ATpopup.style.cssText = "position: absolute; visibility: hidden; padding: 0; font-family: Arial; background-color: rgba(255, 255, 255, 0.9); border-radius: .5em; text-align: center; box-shadow: .05em .05em .5em #00C;";
ATpopup.innerHTML = "<a href='sort' title='sort' onclick='sortColumn(); return false'><img border=0 src='http://stevesouders.com/images/sort_up_down.png' style='padding-top: 0.2em;'></a><br><a href='hide' style='color: #C00; font-family: monospace; font-size: 1.5em; text-decoration: none;' title='hide' onclick='hideColumn(); return false'>x</a>"; // TODO - use protocol-less URL for img
@pmeenan
pmeenan / user-timing-rum.js
Last active Jul 8, 2019
Support routine for adding W3C user timing events to a site. Includes some basic polyfill support for browsers that don't support user timing or navigation timing (though the start time for non-navigation timing support could be improved with IE < 9 to use IE's custom start event).
View user-timing-rum.js
// Support routines for automatically reporting user timing for common analytics platforms
// Currently supports Google Analytics, Boomerang and SOASTA mPulse
// In the case of boomerang, you will need to map the event names you want reported
// to timer names (for mPulse these need to be custom0, custom1, etc) using a global variable:
// rumMapping = {'aft': 'custom0'};
(function() {
var wtt = function(n, t, b) {
t = Math.round(t);
if (t >= 0 && t < 3600000) {
// Google Analytics
@marcelduran
marcelduran / kbps.sql
Last active Dec 18, 2015
I always wondered what could be a good "page speed" metric. Since most pages have a few kbytes of payload and take a few seconds to load kbps (kilobytes per second) could be a good metric. The following httparchive bigquery shows the "page speed" in kbps quantiles as well as min, max, avg and count for both desktop and mobile pages.Check it out h…
View kbps.sql
SELECT client + ' (' + STRING(volume) + ')' AS client, mean, q_10th, q_25th, median, q_75th, q_90th, q_95th, q_99th
FROM
(SELECT
'desktop' AS client,
COUNT(0) AS volume,
AVG((bytesTotal / 1024) / (fullyLoaded / 1000)) as mean,
NTH(101, QUANTILES((bytesTotal / 1024) / (fullyLoaded / 1000), 1001)) AS q_10th,
NTH(251, QUANTILES((bytesTotal / 1024) / (fullyLoaded / 1000), 1001)) AS q_25th,
NTH(501, QUANTILES((bytesTotal / 1024) / (fullyLoaded / 1000), 1001)) AS median,
NTH(751, QUANTILES((bytesTotal / 1024) / (fullyLoaded / 1000), 1001)) AS q_75th,
View nike-export.py
import json
import urllib
import urllib2
import time
""" Nike plus activity log
https://developer.nike.com
Output:
-- May --
@sergejmueller
sergejmueller / .htaccess
Last active Apr 5, 2017
Apache: Detecting WebP support with Header Vary Accept
View .htaccess
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_ACCEPT} image/webp
RewriteCond %{DOCUMENT_ROOT}/$1.webp -f
RewriteRule (.+)\.(jpe?g|png)$ $1.webp [T=image/webp,E=accept:1]
</IfModule>
<IfModule mod_headers.c>
Header append Vary Accept env=REDIRECT_accept
</IfModule>
@louismullie
louismullie / textrank-sentence.rb
Last active Dec 14, 2015
An implementation of the TextRank algorithm for extractive summarization using Treat + GraphRank. Uses the number of non-stop-words with a common stem as a similarity metric between sentences.
View textrank-sentence.rb
require 'graph-rank'
require 'treat'
# Implements the PageRank algorithm for
# unsupervised extractive summarization.
#
# Reference: R. Mihalcea and P. Tarau, “TextRank:
# Bringing Order into Texts,” in Proceedings of
# EMNLP 2004. Association for Computational
# Linguistics, 2004, pp. 404–411.
You can’t perform that action at this time.