This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (komodo.view) { komodo.view.setFocus() }; | |
komodo.doCommand('cmd_save') | |
ko.run.output.kill(-1); | |
setTimeout(function(){ | |
ko.run.runEncodedCommand(window, '%(python) -i \"%F\" {\'cwd\': u\'%D\'}'); | |
}, 100); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
'''I run this with crontab using the line: | |
1 8-17 * * 1-5 /home/gb/bin/muteRadio | |
''' | |
import sys | |
import os | |
import time | |
import dbus |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from difflib import Differ | |
from pprint import pformat | |
def diff(o1, o2): | |
po1 = pformat(o1).splitlines() | |
po2 = pformat(o2).splitlines() | |
d = Differ() | |
r = [ line for line in d.compare(po1, po2) if line[0] in '+-' ] | |
return '\n'.join(r) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dojo.provide('uow.hitcher'); | |
/* | |
uow.hitcher: provide additional control over callbacks | |
usage: | |
my = uow.hitcher({ callPeriod: 500 }); // note this didn't hitch, it created a hitcher named my. | |
your = uow.hitcher(); // this one is independent of the first |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# monkey patch the python json module to handle undefined | |
import json | |
json.decoder._CONSTANTS['undefined'] = None | |
json.scanner.pattern('(-?Infinity|NaN|true|false|null|undefined)')(json.decoder.JSONConstant) | |
json.decoder.JSONScanner = json.decoder.Scanner(json.decoder.ANYTHING) | |
if __name__ == '__main__': | |
print json.loads('{ "foo": 1, "bar": undefined }') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
'''Yet another Montage experiment for desktop wallpaper | |
This version works with a variant on the "Pseudo-Poisson" dart throwing algorithms | |
that were popular in stochastic ray-tracing years ago. It throws darts at a rectangular | |
region ensuring that no darts are closer together than a minimum distance. It allows the | |
minimum distance to scale down so you can have some big pictues and some smaller pictures. | |
The help text was intended to be self explanatory... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8" /> | |
<title>Try Json Refs</title> | |
<style type="text/css"> | |
@import "http://ajax.googleapis.com/ajax/libs/dojo/1.5/dojo/resources/dojo.css"; | |
@import "http://ajax.googleapis.com/ajax/libs/dojo/1.5/dijit/themes/claro/claro.css"; | |
@import "http://ajax.googleapis.com/ajax/libs/dojo/1.5/dojox/grid/resources/Grid.css"; | |
@import "http://ajax.googleapis.com/ajax/libs/dojo/1.5/dojox/grid/resources/claroGrid.css"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* this is an attempt to use the new then and when functions in Dojo 1.5 to handle a chain of async | |
actions. The scenario is open 2 databases, get a record from the 2nd db, write a record to the 1st that uses data from that record. save it. This is 4 async steps. | |
*/ | |
// dfetch is a hack to get a database fetch method wrapped up as a deferred. We could add a | |
// method to the db class to make this a bit prettier | |
function dfetch(db, query) { | |
var def = new dojo.Deferred(); | |
db.fetch({ | |
query: query, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Configuration for local development for the unc open web. | |
server { | |
listen 80; | |
server_name localhost; | |
access_log /var/log/nginx/localhost.access.log; | |
location / { | |
root /var/www; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// A hack to insert simple line number tracing into javascript code included with dojo.require | |
// Add a URL parameter trace to invoke line-by-line printing on the console or | |
// trace=silent to collect the messages in an array, you can retrieve them with DbG() | |
DbG = | |
(function () { | |
// get the url parameters | |
var parms = dojo.queryToObject(window.location.search.substring(1)); | |
var flag = parms.trace; | |
if (typeof(flag) == 'undefined') { | |
// bail if not requested |