Skip to content

Instantly share code, notes, and snippets.

View leolara's full-sized avatar

Leo Lara leolara

View GitHub Profile
@andr3
andr3 / Upgrading images smoothly
Created April 3, 2013 14:49
Sometimes I have to explain this logic, this gist makes it easier. ;)
// Quick implementation of ResponsiveEnhance by Josh Emerson
// Original implementation: https://github.com/joshje/Responsive-Enhance
// <img src="sd.jpg" data-hd="hd.jpg">
function quickUpgrade (obj) {
var tmp = new Image(); // prepare a loose image to make the request & cache it
var newsrc = obj.getAttribute('data-hd'); // grab the URL of hd version
if (newsrc) { // make sure it's there
@Yawning
Yawning / orhttp_example.go
Created April 29, 2015 14:41
How to dispatch HTTP requests via Tor in Go.
// To the extent possible under law, the Yawning Angel has waived all copyright
// and related or neighboring rights to orhttp_example, using the creative
// commons "cc0" public domain dedication. See LICENSE or
// <http://creativecommons.org/publicdomain/zero/1.0/> for full details.
package main
import (
// Things needed by the actual interface.
"golang.org/x/net/proxy"