Skip to content

Instantly share code, notes, and snippets.

@laser
laser / pip_output
Created December 15, 2011 17:31
output from pip
Downloading/unpacking oauth2==1.5.170 (from -r enee/requirements.txt (line 8))
Running setup.py egg_info for package oauth2
Downloading/unpacking uuid==1.30 (from -r enee/requirements.txt (line 10))
Running setup.py egg_info for package uuid
Requirement already satisfied (use --upgrade to upgrade): Flask==0.6.1 in /usr/local/lib/python2.6/dist-packages (from -r enee/requirements.txt (line 1))
Downloading/unpacking functools==0.5 (from -r enee/requirements.txt (line 6))
Running setup.py egg_info for package functools
Requirement already satisfied (use --upgrade to upgrade): wsgiref==0.1.2 in /usr/lib/python2.6 (from -r enee/requirements.txt (line 11))
Downloading/unpacking LEPL==5.0.0 (from -r enee/requirements.txt (line 3))
Running setup.py egg_info for package LEPL
@laser
laser / javascript_rules
Created January 9, 2012 06:01
an alternative to templating languages...
<html>
<head>
<script type="text/javascript">
function PodcastPage(podcasts) {
this.podcasts = podcasts;
this.build = function(root) {
var i,
len,
header,
text;
@laser
laser / tc_campaignMVC.js
Created January 10, 2012 16:32
TC_CampaignMVC
function CampaignOverviewViewGoldenPath() {
return new YAHOO.tool.TestCase({
name : "CampaignOverviewViewGoldenPath",
setUp : function () {
this.container = document.createElement("div");
this.modal = new MockGenericModalController();
this.resourceBundler = new MockResourceBundleUtil();
this.service = new MockCampaignService();
@laser
laser / mocks.js
Created January 10, 2012 16:35
mocks
function MockGenericModalController() {
this.root = document.createElement("div");
this.createAndAppendHeader = function() {};
this.createAndAppendTwoButtonFooter = function() {};
this.destroyContents = function() {};
this.displayContentView = function() {};
@laser
laser / tc_campaignMVC.html
Created January 10, 2012 16:38
test runner
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<script type="text/javascript" src="../../shared/js/yui/build_2_9_0/yuiloader/yuiloader-min.js"></script>
<script type="text/javascript">
window.onload = function() {
var loader;
loader = new YAHOO.util.YUILoader({
@laser
laser / Sample QUnit Test
Created March 24, 2012 00:37
Mocking behavior using Sinon not working properly w/jQuery delegate method
module("Event delegation test");
test("Keyup in view should trigger callback in controller", function() {
var Controller,
View,
$el,
c,
v,
mock;
@laser
laser / gist:2198227
Created March 25, 2012 16:52
Sinon.js mocked object not acknowledging calls to methods if invoked directly as callbacks of jQuery.delegate
test("Handler is invoked as callback from jQuery delegate method directly...", function() {
var Controller,
View,
$el,
c,
v,
mock;
Controller = function() {
var self = {};
@laser
laser / gist:2252674
Created March 30, 2012 16:34
Problem running tests with @testling - "curl: (52) Empty reply from server"
///////
// u.js
function isEmail (email) {
var regEx = /^[a-zA-Z0-9.!#$%&'*+-\/=?\^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/;
return regEx.test(email);
}
///////////
// test.js
RestResponse r;
if (d == null) {
r = new RestResponse(something_something);
}
if (!r) {
r = new RestResponse(something_else);
}
@laser
laser / derp.js
Created August 3, 2012 04:14
less than O(n+m)?
var all_items = [{
"name": "cat",
"id": 1
}, {
"name": "dog",
"id": 2
}, {
"name": "spoon",
"id": 3
}, {