Skip to content

Instantly share code, notes, and snippets.

View gmoothart's full-sized avatar

Gabe Moothart gmoothart

  • Google
  • Portland, OR
View GitHub Profile
His machine was exceptionally manueverable and he appeared to take flying liberties
with impunity... I put my nose down to give him a burst, perhaps too soon; to my
amazement he kicked on full rudder without bank, pulled his nose up slightly, gave me
a burst while he was skidding sideways, and then kicked on opposite rudder before the
results of this amazing stunt appeared to have any effect on the manueverability of
his machine.
--type for the "collapsed" fibonacci matrices
type Fiblist = (Integer, Integer, Integer)
-- This data type wraps the double-return value needed by fibSum'
data PowerSum = PowerSum {
curr_pow :: Fiblist,
curr_sum :: Fiblist
}
i = (1,0,1)
Y.on("domready", function(ev) {
//
// submit batch order
//
Y.on('click', function(ev) {
var cfg = {
method: 'POST',
form: { upload: true, id: 'batchForm' },
YUI().use('event', 'io', function(Y) {
...
Y.on('click', function(ev) {
// lazy-load admin stuffz
YUI().use('anim', 'admin-module', function(Y2) {
});
YUI().use('event', 'io', function(Y) {
...
Y.on('click', function(ev) {
// lazy-load admin stuffz
Y.OhYeahUseTheseToo('anim', 'admin-module', function() {
// anim and admin-module are now available on the existing Y instance
});
using System;
using System.Collections.Generic;
using FluentNHibernate.Cfg;
using FluentNHibernate.Cfg.Db;
using FluentNHibernate.Mapping;
using NHibernate;
using NHibernate.Tool.hbm2ddl;
namespace nhib_test
{
sealed class Dumper
{
static public string Dump(Node root) {
return Dump(root, new List<bool>{});
}
// isLastPath - for every node in the current path, is it the last child?
static internal string Dump(Node n, List<bool> isLastPath) {
string bar = "¦";
string junction = "+";
@gmoothart
gmoothart / .vimrc
Created July 29, 2011 17:36 — forked from jeresig/.vimrc
VIM Config
au BufRead,BufNewFile jquery.*.js set ft=javascript syntax=jquery
set nocompatible
set autoindent
set tabstop=2
set showmatch
set vb t_vb=
set ruler
set nohls
set incsearch
syntax on
@gmoothart
gmoothart / gist:1265744
Created October 5, 2011 21:09
MassTransit WorkerSelectionStrategy
class FairnessWorkerSelectionStrategy: IWorkerSelectionStrategy<ProcessOrderMessage>
{
const int availabilityThreshold = 3;
const int ordersPerCompanyAtOnce = 5;
/// <summary>
/// Map company id to number of recent orders placed for it
/// </summary>
Dictionary<long, int> companyRecentOrdersCount = new Dictionary<long,int>();
@gmoothart
gmoothart / gist:3744225
Created September 18, 2012 16:46
json-rpc client
"""
A command-line client. Run `twistd -ny jsonrpc_dev.py` first before running this.
"""
# TODO:
# 1) pretty-print json
# 2) take hostname and port as optional parameters
import sys
from twisted.internet import reactor, protocol