Skip to content

Instantly share code, notes, and snippets.

public function buildResource($league, $event_key, $test = false) {
App::import('Vendor', 'utility');
$utility = new Utility();
$this->league = $utility->getKey($league);
// Get the season key, which we can parse from the event_key
// i.e l.nba.com-2008-e-11099
$tmp = split('-', $event_key);
$this->season_key = $tmp[1];
<?php
interface PackageException { }
class ConcretePackageException extends Exception implements PackageException { }
class MyException extends Exception { }
$total_looped = 10000;
echo "Throwing three different types of exceptions, ", number_format($total_looped), "\n";
$start = microtime(true);
class CustomModelManager(models.Manager):
_connection = None
def get_query_set(self):
return QuerySet(self.model, self.create_query())
def create_query(self):
return Query(self.model, self.get_connection())
def get_connection(self):
def feature_kwargs(self, feat):
"""
Given an OGR Feature, this will return a dictionary of keyword arguments
for constructing the mapped model.
Note: This is a reimplementation of GeoDjango's LayerMapping.feature_kwargs
because they do all of the work inside the method.
"""
# The keyword arguments for model construction.
kwargs = {}
Just some raw AB output from my quick and dirty Hello World benchmarks against Node.js.
I ran it against an /index.html file that only had Hello World in it, along with an
/index.php file that had an echo 'Hello World'; in it. Both of those tests were run
against Apache2 with mod_php5 using the default deb files from Ubuntu 9.04.
The node.js test was run using the example found on http://tinyclouds.org/node/ minus
the setTimeout() call.
! Last run on index.html
Document Path: /index.html
""" Place holder file so Django can load its tests.
Django assumes that every app that needs to be tested contains models,
so this class pacifies that's assumption by Django. We know that they
say about assumptions, however...
"""
dojo.provide('d51.data.TwitterReadStore');
dojo.require("dojo.data.util.simpleFetch");
dojo.require("dojo.io.script");
dojo.require('dijit._Widget');
dojo.require('dojox.encoding.base64');
dojo.declare('d51.data.TwitterReadStore',
[dijit._Widget], {
#!/bin/bash
set -e
toplevel_directory="$(git rev-parse --show-cdup)"
[ -n "$toplevel_directory" ] && { echo "please run from the toplevel directory"; exit 1; }
function call()
{
@tswicegood
tswicegood / sync_things.rb
Created October 1, 2009 20:13
Simple Ruby script to sync Basecamp and Things to-dos.
#!/usr/bin/env ruby
#
# Biggest problem with this is that it checks everything. Needs
# to be adjusted to only check N days and/or N tasks on Basecamp.
#
# Also has a problem in that Completed always wins. If you have a
# task marked at completed, then mark it as open again on just one
# side, it'll mark the other as completed if you run the sync again.
#
# All that said, it provides a basic, very rudimentary sync.
$ ping google.com
PING google.com (74.125.127.100): 56 data bytes
64 bytes from 74.125.127.100: icmp_seq=0 ttl=50 time=3126.577 ms
64 bytes from 74.125.127.100: icmp_seq=1 ttl=50 time=3276.712 ms
64 bytes from 74.125.127.100: icmp_seq=2 ttl=50 time=3433.196 ms
64 bytes from 74.125.127.100: icmp_seq=3 ttl=50 time=3402.663 ms
64 bytes from 74.125.127.100: icmp_seq=4 ttl=50 time=3355.678 ms
64 bytes from 74.125.127.100: icmp_seq=5 ttl=50 time=3587.272 ms
64 bytes from 74.125.127.100: icmp_seq=6 ttl=50 time=3547.825 ms
64 bytes from 74.125.127.100: icmp_seq=7 ttl=50 time=3506.732 ms