Skip to content

Instantly share code, notes, and snippets.

@onyxfish
onyxfish / elections.chicagotribune.com.vcl
Created November 3, 2010 18:55
Elections Center Varnish Configuration File
backend app1 {
.host = "1.1.1.1";
.port = "80";
}
backend app2 {
.host = "2.2.2.2";
.port = "80";
}
@cowboy
cowboy / HEY-YOU.md
Last active April 9, 2024 15:54
jQuery Tiny Pub/Sub: A really, really, REALLY tiny pub/sub implementation for jQuery.
@jeremi
jeremi / fabfile.py
Created November 4, 2010 21:00
A fabfile to manage git+appengine deployement
from __future__ import with_statement
import functools
import os
import sys
from fabric.api import *
from fabric.colors import green, red, green
import datetime
import re
@iadvize
iadvize / strophe.xdomainrequest.js
Created January 6, 2011 11:15
A Strophe plugin by iAdvize that use the XdomainRequest if found (Internet Explorer)
Strophe.addConnectionPlugin("xdomainrequest", {
init: function () {
if (window.XDomainRequest) {
Strophe.debug("using XdomainRequest for IE");
// override thee send method to fire readystate 2
XDomainRequest.prototype.oldsend = XDomainRequest.prototype.send;
XDomainRequest.prototype.send = function() {
XDomainRequest.prototype.oldsend.apply(this, arguments);
this.readyState = 2;
@benjchristensen
benjchristensen / index.html
Created August 16, 2011 03:21
Animated Line Graphs / Sparklines using SVG Path and d3.js
<html>
<head>
<title>Animated Sparkline using SVG Path and d3.js</title>
<script src="http://mbostock.github.com/d3/d3.v2.js"></script>
<style>
/* tell the SVG path to be a thin blue line without any area fill */
path {
stroke: steelblue;
stroke-width: 1;
fill: none;
@jasondavies
jasondavies / README.md
Created October 13, 2011 11:49
Zoom/Pan Map Example

Demonstrates using d3.behavior.zoom with a geographic projection. Based on an example by Iain Dillingham.

@pvinis
pvinis / face_detector.rb
Created December 7, 2011 12:06
run with "macruby face_detector.rb" or "macruby face_detector.rb https://fbcdn-sphotos-a.akamaihd.net/hphotos-ak-snc7/304055_10150415385415891_522505890_10347873_1682210515_n.jpg?dl=1" for a photo of me with woody and buzz lightyear :p
framework 'Cocoa'
class NSColor
def toCGColor
color_RGB = colorUsingColorSpaceName(NSCalibratedRGBColorSpace)
## approach #1
# components = Array.new(4){Pointer.new(:double)}
# color_RGB.getRed(components[0],
# green: components[1],
# blue: components[2],
@syntagmatic
syntagmatic / Heatmap
Created March 21, 2012 07:16
heatmap.js
var defaults = {
dotsize: 5,
gutsize: 1,
totsize: 6
}
function heatmap(id, data, options) {
var self = {};
var options = _.extend(defaults, options);
self.data = data || [];
@SebastianHGonzalez
SebastianHGonzalez / useQueryState.ts
Last active April 1, 2024 09:10
useQueryState - query string synchronized use state hook for next.js
import { useState, useEffect } from "react";
import { useRouter } from "next/router";
type IParam = string;
type IValue = string | string[] | number | number[] | null | undefined;
type IState = { [k: string]: IValue };
type IQuery = IState;
type IRoute = string;
function isEmpty(value: IValue): boolean {
@peterbrinck
peterbrinck / cookier_banner.html
Created April 3, 2020 06:55
Simple cookie-banner with AlpineJS - original by @lepikhinb
<div x-data="{ show: !localStorage.getItem('hide-banner')}">
<div x-show="show">
<button type="button" @click="localStorage.setItem('hide-banner', true); show = false;">
OK!
</button>
</div>
</div>