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
igrigorik / ruby-1.9-tips.rb
Created Feb 3, 2011
Ruby 1.9 features, tips & tricks you may not know about...
View ruby-1.9-tips.rb
def tip(msg); puts; puts msg; puts "-"*100; end
# 30 Ruby 1.9 Tips, Tricks & Features:
tip "Upgrading to Ruby 1.9 is simple: rvm install 1.9.2 && rvm --default 1.9.2"
tip "Ruby 1.9 supports named captures in regular expressions!"
igrigorik / json-bq-schema-generator.rb
Last active Aug 26, 2019
BigQuery JSON schema generator
View json-bq-schema-generator.rb
require 'open-uri'
require 'zlib'
require 'yajl'
# References
# -
# -
def type(t)
igrigorik / github.bash
Last active Aug 15, 2019
Open GitHub URL for current directory/repo...
View github.bash
alias gh="open \`git remote -v | grep | grep fetch | head -1 | cut -f2 | cut -d' ' -f1 | sed -e's/:/\//' -e 's/git@/http:\/\//'\`"
igrigorik / vimgolf.vimrc
Last active Aug 7, 2019
Basic vimrc to level the playing field...
View vimgolf.vimrc
set nocompatible " use vim defaults
set scrolloff=3 " keep 3 lines when scrolling
set ai " set auto-indenting on for programming
set showcmd " display incomplete commands
set nobackup " do not keep a backup file
set number " show line numbers
set ruler " show the current row and column
igrigorik / domtokenlist_feature_detection.js
Last active Jul 29, 2019 — forked from yoavweiss/domtokenlist_feature_detection.js
DOMTokenList supports() example for Preload
View domtokenlist_feature_detection.js
var DOMTokenListSupports = function(tokenList, token) {
if (!tokenList || !tokenList.supports) {
try {
return tokenList.supports(token);
} catch (e) {
if (e instanceof TypeError) {
console.log("The DOMTokenList doesn't have a supported tokens list");
} else {
igrigorik / mobile-first.html
Created Jun 15, 2012
mobile first css loading
View mobile-first.html
<!DOCTYPE html>
<meta name="description" content="test for paint vs onload css behavior" />
<meta charset="utf-8" />
<title>Awesome mobile-first site</title>
Base stylesheet across all devices, loads first, and *needs* to be blocking to avoid
showing unstyled content.
igrigorik / index.html
Created Jun 8, 2013
XHR streaming example
View index.html
var xhr = new XMLHttpRequest();'GET', '/stream');
xhr.seenBytes = 0;
xhr.onreadystatechange = function() {
console.log("state change.. state: "+ xhr.readyState);
igrigorik /
Last active May 31, 2019
ADB script for remote chrome://tracing debugging!
import subprocess
import re
import os
import sys
import optparse
import time
def call_checked(*args):
r =
igrigorik /
Created Aug 28, 2012
HAR Show links & resources
igrigorik / compare.rb
Created Nov 27, 2013
Testing various Deflate compression parameters...
View compare.rb
# Quick comparison of Deflate performance with respec to varios
# LZ77 window and memLevel settings. E.g...
# $> curl -o timeline.json
# $> ruby compare.rb timeline.json
require "zlib"
unless file = ARGV[0]
You can’t perform that action at this time.