Skip to content

Instantly share code, notes, and snippets.

View igrigorik's full-sized avatar
:octocat:

Ilya Grigorik igrigorik

:octocat:
View GitHub Profile
{
"w": 67001,
"o": 94,
"u": "http://www.igvita.com/",
"r": 9,
"i": "ydefault",
"lt": 502,
"g": {
"ynumreq": {
"score": 100,
@igrigorik
igrigorik / battery.sh
Created August 6, 2012 04:29
OSX power management & information
# system wide assertions on OSX
$> pmset -g assertions
# power state log since boot
$> pmset -g log
# battery stats
$> pmset -g batt
Currently drawing from 'Battery Power'
@igrigorik
igrigorik / analytics.patch
Created July 21, 2012 22:33
Analytics patch to enable "time on slide" and "outbound click" tracking with Google Analytics, for http://code.google.com/p/io-2012-slides/
From 4a3bb99fe5eecd06e77f4fedb5729466df09750f Mon Sep 17 00:00:00 2001
From: Ilya Grigorik <ilya@igvita.com>
Date: Fri, 18 May 2012 06:41:34 +0800
Subject: [PATCH] add outbound click tracking + time on slide analytics
plugins for GA
---
js/analytics/outbound-clicks.js | 102 +++++++++++++++++++++++++++++++++++++++
js/analytics/time-on-slide.js | 25 ++++++++++
js/slide-deck.js | 5 ++
@igrigorik
igrigorik / gist:3148848
Created July 20, 2012 05:24
Convert any YouTube video into an audio file you can listen to on the go...
# Convert any YouTube video into an audio file you can listen to on the go, using:
# http://rg3.github.com/youtube-dl/
{ ~ } > brew install ffmpeg
{ ~ } > wget https://raw.github.com/rg3/youtube-dl/2012.02.27/youtube-dl
{ ~ } > chmod u+x youtube-dl
# Pick which video format you want to download.. (use any YT video link)
{ ~ } > ./youtube-dl -s -F http://www.youtube.com/watch?v=vT1KmTQ-1Os
@igrigorik
igrigorik / file.html
Created July 6, 2012 08:01
Example of early head flush on load time
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>Hello</title>
<link rel="stylesheet" href="styles.css">
</head>
<body>
Hello World
</body>
@igrigorik
igrigorik / auth.js
Created June 20, 2012 22:44
SPDY basic auth
var spdy = require('spdy'),
fs = require('fs');
var options = {
key: fs.readFileSync(__dirname + '/keys/mykey.pem'),
cert: fs.readFileSync(__dirname + '/keys/mycert.pem'),
ca: fs.readFileSync(__dirname + '/keys/mycsr.pem')
};
var server = spdy.createServer(options, function(req, res) {
@igrigorik
igrigorik / mobile-first.html
Created June 15, 2012 07:48
mobile first css loading
<!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.
{
"chrome":[
[
"chrome",
932
],
[
"file",
211
],
@igrigorik
igrigorik / pss.rb
Created May 28, 2012 18:18
pagespeed insights API ruby example
require 'net/https'
require 'json'
require 'uri'
#
# Use your project key to query the API
# 1) go to Google API Console: https://code.google.com/apis/console/
# 2) go to "Services" tab and enable "Page Speed Online API"
# 3) go to "API Key" tab and copy your "API Key"
#
@igrigorik
igrigorik / responsive.css
Created May 26, 2012 01:11
testing media queries + browser fetch behavior
body {
color: red;
}
#image {
width:200px;
height:100px;
background: gray;
background-image:url('http://localhost:9000/file0.css?delay=3');
}