Skip to content

Instantly share code, notes, and snippets.

// Step 1. global definition
function Map(config) {
this._init(config);
}
Map.prototype = {
_container: null,
_init: function (config) {
this._container = document.getElementById(config.container);

Nick's bash prompt code

Example

[13:14:19][~/Projects/ruby/redmine (master) {jruby-head@redmine}]
$ false
[exited with 1]

Features

@mnot
mnot / test_http_conns.py
Created September 8, 2010 05:17
test_http_conns.py - Tests for how clients handle HTTP pconns and pipelining
#!/usr/bin/env python
"""
test_http_conns.py - Tests for how HTTP persistent connections are handled,
including pipelining.
This script will set up a server which summarises how a browser connecting
to it behaves. For example, FireFox with pipelining turned on will give:
--->8---
@fcalderan
fcalderan / inception-javascript.js
Created November 2, 2010 09:42
inception explained as a 4 nested javascript closures
/*
* Fabrizio Calderan, twitter @fcalderan, 2010.11.02
* I had an idea: could Inception movie be explained by a few javascript closures
* and variable resolution scope (just for fun)?
*
* Activate javascript console =)
*/
<script>
console.group("inception movie");
@jordansissel
jordansissel / Better Usage.md
Created December 20, 2010 12:07
Strip package scripts from .deb packages (postinst, postrm, preinst, prerm)

The best way to use this tool is to hook apt's use of dpkg to run it before doing any package installs.

In your apt.conf, put this:

DPkg::Pre-Install-Pkgs {"xargs -rL1 bash /path/to/stripdeb.sh 2>&1 | logger -t stripdeb"}

Then, a demo:

% sudo apt-get install mysql-server-5.1

@jabley
jabley / gist:748880
Created December 20, 2010 19:40 — forked from tfheen/gist:748877
server {
listen 443; ## listen for ipv4
listen [::]:443 default ssl ipv6only=on; ## listen for ipv6
ssl on;
ssl_certificate /etc/ssl/certs/www.varnish-cache.org-http.pem;
ssl_certificate_key /etc/ssl/private/www.varnish-cache.org-http.pem;
server_name www.varnish-cache.org;
access_log /var/log/nginx/localhost.access.log;

From us ("the wishors") to you ("hereinafter called the wishee"):

Please accept without obligation, explicit or implicit, our best wishes for an environmentally conscious, socially responsible, politically correct, low stress, non-addictive, gender neutral, celebration of the winter solstice holiday, practiced within the most enjoyable traditions of the religious persuasion or secular practice of your choice, with respect for the religious/secular persuasions and/or traditions of others, or their choice not to practice religious or secular traditions.

Please also accept, under aforesaid waiver of obligation on your part, our best wishes for a financially successful, personally fulfilling and medically uncomplicated recognition of the onset of this calendar year of the Common Era, but with due respect for the calendars of all cultures or sects, and for the race, creed, colour, age, physical ability, religious faith, choice of computer platform or dietary preference of the wishee.

By accepting this greeting

@sstephenson
sstephenson / gist:771090
Created January 8, 2011 19:41
Automatic *.test host resolution in OS X
$ sudo su -
# mkdir /etc/resolver
# cat > /etc/resolver/test
nameserver 127.0.0.1
port 2155
^D
^D
$ brew install dnsmasq
$ dnsmasq --port=2155 --no-resolv --address=/.test/127.0.0.1
$ ping foo.test
@bruntonspall
bruntonspall / runtest.sh
Created January 20, 2011 15:43
How I run perf tests repeatably with records of what I did
#!/bin/bash
#Set Defaults
requests=${requests:=10}
threads=${threads:=1}
url=${url:=http://testserver/}
while getopts "r:t:u:h" Option
do
case $Option in
package com.banksimple.util
private[util] final class Effectful[T](val origin: T) {
/**
* A special case of doto, andAlso is useful for
* quick logging or output tasks. Similar in use
* to doto, but only takes one function.
* */
def andAlso(x: T => Unit): T = { x(origin) ; origin }