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
import datetime | |
import httplib2 | |
# to see in detail what's going on, uncomment | |
# httplib2.debuglevel = 4 | |
from apiclient.discovery import build | |
from oauth2client.client import OAuth2Credentials, OAuth2WebServerFlow | |
if __name__ == "__main__": |
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
/** | |
* Fancy ID generator that creates 20-character string identifiers with the following properties: | |
* | |
* 1. They're based on timestamp so that they sort *after* any existing ids. | |
* 2. They contain 72-bits of random data after the timestamp so that IDs won't collide with other clients' IDs. | |
* 3. They sort *lexicographically* (so the timestamp is converted to characters that will sort properly). | |
* 4. They're monotonically increasing. Even if you generate more than one in the same timestamp, the | |
* latter ones will sort after the former ones. We do this by using the previous random bits | |
* but "incrementing" them by 1 (only in the case of a timestamp collision). | |
*/ |
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
/* Card Numbers */ | |
// ====================================== | |
// | |
// DOM Manipulation | |
// | |
// ====================================== | |
// Fills in the card numbers on newly created cards |
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
173.12.5.73 - - [09/Dec/2010:15:18:46 --0500] [cs.stageshirts.com/sid#7fd84be131e0][rid#7fd84c23e748/initial] (2) init rewrite engin | |
e with requested uri /images/A1/15/A1154D-LG.jpg | |
173.12.5.73 - - [09/Dec/2010:15:18:46 --0500] [cs.stageshirts.com/sid#7fd84be131e0][rid#7fd84c23e748/initial] (3) applying pattern ' | |
/display_materials.aspx' to uri '/images/A1/15/A1154D-LG.jpg' | |
173.12.5.73 - - [09/Dec/2010:15:18:46 --0500] [cs.stageshirts.com/sid#7fd84be131e0][rid#7fd84c23e748/initial] (3) applying pattern ' | |
/default.aspx' to uri '/images/A1/15/A1154D-LG.jpg' | |
173.12.5.73 - - [09/Dec/2010:15:18:46 --0500] [cs.stageshirts.com/sid#7fd84be131e0][rid#7fd84c23e748/initial] (3) applying pattern ' | |
/default_plus_size_shirts.aspx' to uri '/images/A1/15/A1154D-LG.jpg' | |
173.12.5.73 - - [09/Dec/2010:15:18:46 --0500] [cs.stageshirts.com/sid#7fd84be131e0][rid#7fd84c23e748/initial] (3) applying pattern ' | |
/about_choice.aspx' to uri '/images/A1/15/A1154D-LG.jpg' |
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
var countdown = (function() { | |
var index; | |
function log(){ | |
console.log(index); | |
} | |
function iterate(){ | |
log(); | |
if(index>1) setTimeout(iterate, 1000); |
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
// Part 1. | |
// Implement a function prototype extension that caches function results for | |
// the same input arguments of a function with one parameter. | |
// | |
// For example: | |
// Make sin(1) have the result of Math.sin(1), but use a cached value | |
// for future calls. | |
// | |
// Part 2. | |
// Use this new function to refactor the code example. |
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
// 1. Write a class to support the following code: | |
// var thomas = new Person('Thomas'); | |
// var amy = new Person('Amy'); | |
// | |
// thomas.name // --> "Thomas" | |
// 2. Add a getName() method to all Person objects, that outputs | |
// the persons name. |
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
<div id="the_div"> | |
<ul id="the_list"> | |
<li id="the_item">Click me!</li> | |
</ul> | |
</div> | |
<p id="log"></p> | |
<!-- | |
1. Change the addEventListener calls so that the events occur in the following order. |
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
sprocketize -C /Users/dave/code/Python/django-sites/hae/content/js -I hae -I vendor hae.js > /Users/dave/code/Python/django-sites/hae/content/js/sprockets.js |
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
import os, subprocess, shlex | |
def start_kicker(): | |
''' | |
Kick off Kicker and pass it our | |
sprocketize command-line argument | |
''' | |
try: | |
js_path = os.path.abspath(os.path.join(os.getcwd(), '../content/js')) | |
sprocketize = "sprocketize -C %s -I hae -I vendor hae.js > %s/sprockets.js" % ( |
OlderNewer