Skip to content

Instantly share code, notes, and snippets.

@mojodna
mojodna / gist:21466
Created November 1, 2008 02:48
OAuth::RequestProxy for Hashes to facilitate simpler signature creation.
module OAuth
module RequestProxy
# RequestProxy for Hashes to facilitate simpler signature creation.
# Usage:
# request = OAuth::RequestProxy.proxy \
# "method" => "iq",
# "uri" => [from, to] * "&",
# "parameters" => {
# "oauth_consumer_key" => oauth_consumer_key,
# "oauth_token" => oauth_token,
@mojodna
mojodna / gist:22224
Created November 4, 2008 21:40 — forked from mattb/gist:22223
#!/usr/bin/env ruby
require '/Users/mattb/Work/Dopplr/code/dopplr/config/environment'
require 'fire_hydrant'
config = YAML.load(File.read("fire_hydrant.yml"))
hydrant = FireHydrant.new(config, false)
hydrant.jack!(OAuthPubSubJack)
hydrant.on_startup do
defer :subscribed, 0 do
<html>
<head>
<title>Flickr WOE ID Alpha Shape viewer</title>
</head>
<body>
<style type="text/css">
#ymap{
width:100%;
height:100%;
left:0px:
#!/usr/bin/env ruby
require 'rexml/document'
require 'open-uri'
def load_results(url = "http://d.yimg.com/b/data/us/news/xml/elections/2008a/pres.xml")
doc = REXML::Document.new(open(url))
nodes = doc.elements.collect("//state") { |node| [node.attributes["name"].downcase, node.elements.collect("cand") { |cand| [cand.attributes["name"].downcase, cand.attributes["PopPct"].to_f, cand.attributes["PopVote"].to_i] }] }
votes = {}
@mojodna
mojodna / pless.sh
Created November 16, 2008 22:23 — forked from defunkt/pless.sh
# even simpler colorization for everything (assuming you're not using a lesspipe.sh already)
# (add to your .bashrc)
export LESS="-r"
export LESSOPEN="|pygmentize %s"
require 'sinatra'
require 'RMagick'
get "/" do
content_type "image/png"
status 200
body RMagick::Image.read("something.png").to_blob
end
<?xml version="1.0" encoding="utf-8"?>
<rsp stat="fail">
<err code="11" msg="Something bad happened" />
</rsp>
#!/usr/bin/php -q
<?php
/**
* Cron job to update the comics plan.
*/
/* includes */
$_base = dirname(__FILE__) . '/../';
require_once($_base . 'config.php');
require_once($_base . 'lib/Planworld.php');
#!/usr/bin/env ruby
require "oauth"
require 'oauth/helper'
require 'oauth/client/helper'
require 'oauth/request_proxy/net_http'
require "yaml"
require 'oauth_monkey_patches'
url = "http://query.yahooapis.com/v1/yql?q=show%20tables&format=xml"
#!/bin/bash
#
# git-svn-diff originally by (http://mojodna.net/2009/02/24/my-work-git-workflow.html)
# modified by [email protected]
# modified by aconway@[redacted] - handle diffs that introduce new files
#
# Generate an SVN-compatible diff against the tip of the tracking branch
# Get the tracking branch (if we're on a branch)
TRACKING_BRANCH=`git svn info | grep URL | sed -e 's/.*\/branches\///'`