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 / 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 {
View connectionchange.js
class ConnectionInfo {
classId=0) { = media;
this.className = className;
this.classId = classId;
igrigorik /
Created Mar 31, 2012 — forked from erikh/
OSX For Hackers
#!/usr/bin/env sh
# This is script with usefull tips taken from:
# install it:
# curl -sL | sh
View Bench
# ruby getimage.rb -e production -c config/getimage.rb
View em-proxy-http.rb
require 'em-proxy'
require 'http/parser'
require 'uuid'
# > ruby em-proxy-http.rb
# > curl --proxy localhost:9889
host = ""
port = 9889
puts "listening on #{host}:#{port}..."
#!/usr/bin/env python
# encoding: utf-8
First download your bookmarks and restrict to specific tags if desired:
$ curl --user 'username':'password' -o delicious.xml ''
Extract and count most common domains:
View gist:489622
require "date"
require "time"
# converts base10 integers into NewBase60
def num_to_sxg(num=nil)
sxg = ""
vocabulary = "0123456789ABCDEFGHJKLMNPQRSTUVWXYZ_abcdefghijkmnopqrstuvwxyz"
return 0 if num.nil? ||
View vuvuzelr_proxy.rb
# minimal async sinatra app
# requires ruby 1.9.x
require 'sinatra'
require 'em-http'
require 'em-synchrony'
require 'em-synchrony/em-http'
require 'rack/fiber_pool'
use Rack::FiberPool
View gist:368003
This example shows how to setup an environment running Rails 3 beta under 1.9.2-head with a 'rails3' gem set.
∴ rvm update --head
# ((Open a new shell)) or do 'rvm reload'
# If you do not already have the ruby interpreter installed, install it:
∴ rvm install 1.9.2-head
# Switch to 1.9.2-head and gemset rails3, create if it doesn't exist.
∴ rvm --create use 1.9.2-head@rails3
View gist:365249
class FiberedMutex
# Creates a new FiberedMutex
def initialize
@waiting = []
@locked = false
You can’t perform that action at this time.