Skip to content

Instantly share code, notes, and snippets.

class UrlEncodedPairParser < StringScanner #:nodoc:
attr_reader :top, :parent, :result
def initialize(pairs = [])
super('')
@result = {}
pairs.each { |key, value| parse(key, value) }
end
KEY_REGEXP = %r{([^\[\]=&]+)}
@mrjjwright
mrjjwright / nosqlite_blueprint.txt
Created April 29, 2010 20:35
The blueprint for a radically new version of my project NoSQLite
Topic
- NoSQLite
- Consider 3 useful things:
- SQLite - SQLite is itself a great datastore because it is a
fast and powerful SQL database in one file and is widely
deployed and supported.
- JSON - JSON is a simple and cruft free way to describe and
transport objects. That is why programmers love it. There is
good support for it in virtually every language.
- HTTP - HTTP allows things to connect and talk to each other.
@isaacs
isaacs / node-and-npm-in-30-seconds.sh
Last active July 21, 2024 01:20
Use one of these techniques to install node and npm without having to sudo. Discussed in more detail at http://joyeur.com/2010/12/10/installing-node-and-npm/ Note: npm >=0.3 is *safer* when using sudo.
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
. ~/.bashrc
mkdir ~/local
mkdir ~/node-latest-install
cd ~/node-latest-install
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1
./configure --prefix=~/local
make install # ok, fine, this step probably takes more than 30 seconds...
curl https://www.npmjs.org/install.sh | sh
@iragsdale
iragsdale / async_resolver.rb
Created November 4, 2010 22:07
Asynchronous DNS resolver based on EventMachine and net-dns
require 'eventmachine'
require 'net/dns'
require 'net/dns/resolver'
module EM # :nodoc:
module Protocols
include Logger::Severity
class AsyncResolver < Net::DNS::Resolver
@bradclawsie
bradclawsie / imapbiff.pl
Created December 5, 2010 06:35
imap biff in perl
#!/usr/bin/env perl
use Net::IMAP::Simple::SSL;
$| = 1;
my $server = 'imap.gmail.com';
my $user = 'YOU@gmail.com';
my $pass = 'PASSWORD';
my $imap = Net::IMAP::Simple::SSL->new($server);
$imap->login($user => $pass) || die "cannot connect";
my $messages = $imap->select('Inbox');
my $count = 0;
We couldn’t find that file to show.
@carsonmcdonald
carsonmcdonald / gist:911761
Created April 9, 2011 20:48
node.js SPDY proxy
var tls = require('tls');
var fs = require('fs');
var Buffer = require('buffer').Buffer;
var zlib = require('zlib');
var BufferList = require('bufferlist');
var Binary = require('bufferlist/binary');
var Put = require('put');
var http = require('http');
var options =
@tdreyno
tdreyno / isoTransform.js
Created May 6, 2011 21:51
Isotope CSS3 jQuery cssHooks
// ========================= getStyleProperty by kangax ===============================
// http://perfectionkills.com/feature-testing-css-properties/
var getStyleProperty = (function(){
var prefixes = ['Moz', 'Webkit', 'Khtml', 'O', 'Ms'];
var _cache = { };
function getStyleProperty(propName, element) {
@jed
jed / LICENSE.txt
Created May 10, 2011 16:04 — forked from 140bytes/LICENSE.txt
write contextual templates
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 Jed Schmidt <http://jed.is>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@tdreyno
tdreyno / widget.coffee
Created May 13, 2011 06:11
Work in Progress CoffeeScript Widget Factory
# Base widget class
class Widget
@widgetClass: 'widget_base'
@defaults: {}
# Apply options and data() options to defaults hash
constructor: (@$element, options={}) ->
# The descendent constructor
actualConstructor = @__proto__.constructor