Skip to content

Instantly share code, notes, and snippets.

View sporkmonger's full-sized avatar

Bob Aman sporkmonger

View GitHub Profile
Usage: google-api (execute <rpcname> | [command]) [options] [-- <parameters>]
Available options:
--scope <scope> Set the OAuth scope
--client-key <key> Set the 2-legged OAuth key
--client-secret <secret> Set the 2-legged OAuth secret
-s, --service <name> Perform discovery on service
--service-version <id> Select service version
--content-type <format> Content-Type for request
-u, --uri <uri> Sets the URI to perform a request against
>> regexp = Regexp.new("ÀÈÌÒÙ".force_encoding Encoding::ISO8859_1)
=> /ÀÈÌÒÙ/
>> regexp.encoding
=> #<Encoding:ISO-8859-1>
var sys = require('sys'),
http = require('http');
var STATUS_CODES = {
100 : 'Continue',
101 : 'Switching Protocols',
200 : 'OK',
201 : 'Created',
202 : 'Accepted',
203 : 'Non-Authoritative Information',
#!/usr/bin/env ruby
# The program e is a command line utility that extracts lots of
# different archives. It is very simple and can be extended very easily.
#
# It is inspired by how firewall use their rulesets, and works like this:
#
# * For each file that has to be extracted, the rules are matched one after the other.
# * When a rule matches (either by the filetype or filename), the command is executed.
# * If the command does not return an error code the extraction is considered successful, otherwise the next rules are matched.
From 644a88293136c3c4aafecd217b340350cf1f9ca9 Mon Sep 17 00:00:00 2001
From: Bob Aman <[email protected]>
Date: Thu, 25 Jun 2009 09:39:59 -0400
Subject: [PATCH] Fixed Content-Encoding bug with explicit default.
* If the default Content-Encoding of 7bit was given, Mechanize would
error out needlessly.
---
lib/www/mechanize/chain/body_decoding_handler.rb | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
require "datamapper"
class CrawledURI
include DataMapper::Resource
STORAGE_NAME = "crawled_uris"
property :id, Integer, :serial => true
# Data
property :uri, String, :length => 1024
type expr =
Noop
| Int of int
| Float of float
| Seq of expr list
| Call of expr * string * expr (* * params *)
let print_ast ast =
let rec print_ast_internal = function
Noop -> "Noop"
let double x = 2 * x;;
let sum x y = x + y;;
(* How do you get a function 2(x + y) from this? *)
let foo = double sum;; (* Obviously doesn't work *)
package com.sporkmonger.util;
import java.net.URL;
import java.util.ArrayList;
public class HydraLoader extends ClassLoader {
private ArrayList<ClassLoader> childLoaders = new ArrayList<ClassLoader>();
public HydraLoader() {
super();
@sporkmonger
sporkmonger / ANSILineStyler.java
Created May 17, 2009 18:10
Use this to give any StyledText widget decent ANSI color support; could use optimization, please fork; WTFPL license
package com.sporkmonger.rmud.swt.custom;
import java.util.ArrayList;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.LineStyleEvent;
import org.eclipse.swt.custom.LineStyleListener;
import org.eclipse.swt.custom.StyleRange;