This is just a little doodle for me to get a feel for how the HTML5 canvas element can be used. The canvas is a pixel-based sort of thing, and so maybe not well suited to applications that want scalable elements or independent moving parts; there SVG might be a better choice. But for uses where you want to fiddle with a lot of pixels, where it'd be undesirable to make a new object for every point you manipulate, canvas fits the bill.
This file contains hidden or 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
# test case using fudge 0.9.x for fakes. | |
class TestUploadList(TestCase): | |
@with_fakes | |
def test_upload(self): | |
"""Upload is converted and JSON returned. | |
""" | |
self.req = Fake("Request").has_attr(variables={}) | |
content = "UPLOADED STUFF" |
This file contains hidden or 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 xmlns:ng="http://angularjs.org"> | |
<head> | |
<title>all plans</title> | |
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> | |
<link rel="icon" href="/s/plans/images/plans-icon.png?68f34ebf0f" /> | |
<link rel="stylesheet" href="/s/jquery-ui-css/jquery-ui-1.8.9.css?9f6e6ea563" type="text/css" charset="utf-8"/> | |
<link rel="stylesheet" href="/s/jquery-ui-css/jquery-ui-1.8.9.custom.css?7ea76fa98c" type="text/css" charset="utf-8"/> | |
<link rel="stylesheet" type="text/css" href="/s/plans/css/plans.css?9fbd065898"> | |
<link rel="stylesheet" type="text/css" href="/s/plans/css/datatables.css?396b174e7a" /> |
This file contains hidden or 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
#!/bin/bash | |
# | |
# Add latency to all outgoing traffic on $DEV on tcp/udp $PORT, | |
# in the amount of $DELAY. | |
# | |
# This is matching on both source port and destination port, which | |
# may hit you twice if you're accessing a local resource. | |
# | |
# To see what's currently in effect, | |
# tc -s qdisc show dev lo |
This file contains hidden or 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
#!/bin/bash | |
java -jar ~/src/closure-compiler/compiler.jar ${@/#/--js } |
This file contains hidden or 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
def getAjaxResult(self, func, *args): | |
sel = self.selenium | |
self.js('''\ | |
ajaxSeleniumResult = (function (func, args) { | |
var result = [], funcArgs; | |
function storeSeleniumResult() { | |
result.push(window.jQuery.makeArray(arguments)); | |
} | |
// assume function's last argument is a callback | |
args.push(storeSeleniumResult); |
This file contains hidden or 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/env python | |
"""Make the X cursor wrap-around. | |
Adapted from http://appdb.winehq.org/objectManager.php?sClass=version&iId=12599 | |
to work around lack of relative mouse movement http://wiki.winehq.org/Bug6971 | |
for Thief: Dark Shadows (and possibly others) | |
This version is a little kinder to your CPU than the shell script with | |
the busy-loop that starts a new process for every pointer query. | |
""" |
This file contains hidden or 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
class A(object): | |
# method | |
def foo(self, x): | |
print self, x | |
# function -- defined after A is closed. | |
def bar(self, y): | |
print self, y | |
A.bar = bar |
This file contains hidden or 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 django.db import models | |
class Top(models.Model): | |
_counter = 0 | |
def __init__(self, arg): | |
Top._counter += 1 | |
print "Top(%s)#__init__(<%x>, %s) called %d times" % ( | |
self.__class__.__name__, id(self), arg, Top._counter) | |
This file contains hidden or 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
at http://openidenabled.com/python-openid/trunk/examples/consumer/finish/: | |
openid <http://specs.openid.net/auth/2.0> | |
mode = id_res | |
identity = http://keturn.myopenid.com/ | |
claimed_id = http://keturn.net/ | |
assoc_handle = {HMAC-SHA1}{4b9852bd}{CDlRdQ==} | |
op_endpoint = http://www.myopenid.com/server | |
response_nonce = 2010-03-11T02:32:02ZUpcemj | |
return_to = http://openidenabled.com/python-openid/trunk/examples/consumer/finish/?janrain_nonce=2010-03-11T02%3A27%3A41ZbQoFal | |
sig = dJMjI3wsbpnhvgfCIl2J2dBCaNY= |