Skip to content

Instantly share code, notes, and snippets.

@donthorp
donthorp / gist:138972
Created July 1, 2009 18:53
HTTP Server That Pretty Prints JSON
import os
import cgi
import sys
import pprint
import simplejson
from BaseHTTPServer import HTTPServer, BaseHTTPRequestHandler
class customHTTPServer(BaseHTTPRequestHandler):
pp = pprint.PrettyPrinter(indent=2)
def do_GET(self):
// Determine Activity Size
layout = new ViewAnimator(this){
@Override
protected void onSizeChanged(int w, int h, int oldw, int oldh) {
super.onSizeChanged(w, h, oldw, oldh);
Log.i(LCAT, "Width: " + w + " Height: " + h);
}
@donthorp
donthorp / dev-build
Created December 2, 2009 23:56 — forked from davglass/gist:247623
dev-build for titanium mobile
#!/bin/bash
#
# This file will help you build Titanium Mobile on Unix from source
#
# Follow the HOWTO's here:
# http://www.codestrong.com/timobile/howto/
#
# Once you have your dependencies working,
# Put this file in your path somewhere then cd into the titanium_mobile directory
# then exec: builti
@donthorp
donthorp / async-example.js
Created December 8, 2009 15:48
An example that shows how to process a list asynchronously
<script>
var items = [
{ id : 1, value : 'item 1' },
{ id : 2, value : 'item 2' },
{ id : 3, value : 'item 3' },
{ id : 4, value : 'item 4' },
{ id : 5, value : 'item 5' }
];
function log(m) {
@donthorp
donthorp / cloud.py
Created January 20, 2010 19:16 — forked from tschaub/cloud.py
#!/usr/bin/env python
#
# Copyright (c) 2010 The Open Planning Project
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation
# files (the "Software"), to deal in the Software without
# restriction, including without limitation the rights to use,
# copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the
@donthorp
donthorp / gist:373911
Created April 21, 2010 14:55 — forked from kwhinnery/gist:372692
Kevin's Module Pattern for JS
var myApplication = function(){
var name = 'Chris';
var age = '34';
var status = 'single';
function createMember(){
// [...]
}
function getMemberDetails(){
// [...]
}
@donthorp
donthorp / Organize Monitors.scpt
Created November 21, 2010 19:38
For use on my laptop when I'm switching between displays. It currently doesn't move the window to the correct coordinates, but it does put it in the spaces like I want.
tell application "System Events"
tell expose preferences
tell spaces preferences
set apps to application bindings
tell application "Finder"
set displayBounds to bounds of window of desktop
if (item 3 of displayBounds > 1680) then
set tweetDeckScreen to 65544
else
set tweetDeckScreen to 4
#!/bin/bash
# Add this to your ~/.bash_profile
for a in `ls $HOME/.bash_profile.d/*.sh`; do
source $a
done
Android Emulator usage: emulator [options] [-qemu args]
options:
-sysdir <dir> search for system disk images in <dir>
-system <file> read initial system image from <file>
-datadir <dir> write user data into <dir>
-kernel <file> use specific emulated kernel
-ramdisk <file> ramdisk image (default <system>/ramdisk.img
-image <file> obsolete, use -system <file> instead
-init-data <file> initial data image (default <system>/userdata.img
-initdata <file> same as '-init-data <file>'
@donthorp
donthorp / FilingIssues.md
Created December 22, 2010 16:45
Guidelines for Filing Lighthouse Tickets

Lighthouse Ticket Guidelines

  1. Please provide a detailed description of the problem and the expectation.

  2. Reproduction sequence including any working sample code or simplified project required to duplicate the problem.

  3. If there is a Q&A or Helpdesk item involved please put a link to the thread in the ticket. Hyperlink it please.

  4. Set the "Who's responsible?" field. See the platform sections below for the appropriate platform responsible party.