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
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 git@github.com | grep fetch | head -1 | cut -f2 | cut -d' ' -f1 | sed -e's/:/\//' -e 's/git@/http:\/\//'\`"
@igrigorik
igrigorik / vimgolf.vimrc
Last active Aug 7, 2019
Basic vimrc to level the playing field...
View vimgolf.vimrc
" http://vimdoc.sourceforge.net/htmldoc/starting.html#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
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) {
return;
}
try {
return tokenList.supports(token);
} catch (e) {
if (e instanceof TypeError) {
console.log("The DOMTokenList doesn't have a supported tokens list");
} else {
@igrigorik
igrigorik / mobile-first.html
Created Jun 15, 2012
mobile first css loading
View mobile-first.html
<!DOCTYPE html>
<html>
<head>
<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
igrigorik / index.html
Created Jun 8, 2013
XHR streaming example
View index.html
<p>Hello
<script>
var xhr = new XMLHttpRequest();
xhr.open('GET', '/stream');
xhr.seenBytes = 0;
xhr.onreadystatechange = function() {
console.log("state change.. state: "+ xhr.readyState);
@igrigorik
igrigorik / adb_trace.py
Last active May 31, 2019
ADB script for remote chrome://tracing debugging!
View adb_trace.py
#!/usr/bin/python
import subprocess
import re
import os
import sys
import optparse
import time
def call_checked(*args):
r = subprocess.call(args)
@igrigorik
igrigorik / links.md
Created Aug 28, 2012
HAR Show links & resources
View links.md
@igrigorik
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 https://github.com/timeline.json -o timeline.json
# $> ruby compare.rb timeline.json
#
require "zlib"
unless file = ARGV[0]
@igrigorik
igrigorik / igvita.har.json
Created Aug 28, 2012
Sample HAR capture of igvita.com homepage
View igvita.har.json
{
"log": {
"version": "1.2",
"creator": {
"name": "WebInspector",
"version": "537.1"
},
"pages": [
{
"startedDateTime": "2012-08-28T05:14:24.803Z",
@igrigorik
igrigorik / json-bq-schema-generator.rb
Last active Apr 18, 2019
BigQuery JSON schema generator
View json-bq-schema-generator.rb
require 'open-uri'
require 'zlib'
require 'yajl'
# References
# - https://developers.google.com/bigquery/preparing-data-for-bigquery#dataformats
# - https://developers.google.com/bigquery/docs/data#nested
#
def type(t)
You can’t perform that action at this time.