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 BASE64_MARKER = ';base64,'; | |
function convertDataURIToBinary(dataURI) { | |
var base64Index = dataURI.indexOf(BASE64_MARKER) + BASE64_MARKER.length; | |
var base64 = dataURI.substring(base64Index); | |
var raw = window.atob(base64); | |
var rawLength = raw.length; | |
var array = new Uint8Array(new ArrayBuffer(rawLength)); | |
for(i = 0; i < rawLength; i++) { |
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
function(config) { | |
// JSHint error on next line: "Line breaking error 'return'. Following line: "Bad escapement." | |
return 'https://accounts.google.com/o/oauth2/auth?\ | |
client_id={{CLIENT_ID}}&\ | |
redirect_uri={{REDIRECT_URI}}&\ | |
scope={{API_SCOPE}}&\ | |
response_type=code' | |
.replace('{{CLIENT_ID}}', config.clientId) | |
.replace('{{REDIRECT_URI}}', this.redirectURL(config)) | |
.replace('{{API_SCOPE}}', config.apiScope); |
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
load in node: | |
require('../common/module.js'); | |
load in browser: | |
<script src="../common/module.js"></script> | |
module.js: | |
(function(exports) { | |
var MyClass = function() { /* ... */ }; |
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/env bash | |
# Example usage: | |
# ./argify '/Applications/Google Chrome Stable.app/Contents/MacOS/Google Chrome' \ | |
# '--user-data-dir=$HOME/.chrome-stable' | |
if [ $# -ne 2 ] | |
then | |
echo "Usage: `basename $0` '/Applications/Google Chrome Stable.app/Contents/MacOS/Google Chrome' '--argument=value'" | |
exit 1 | |
fi |
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 twisted.internet import reactor | |
from autobahn.websocket import WebSocketServerFactory, WebSocketServerProtocol | |
from threading import Thread | |
class KeySocketProtocol(WebSocketServerProtocol): | |
def __init__(self, factory): | |
self.factory = factory | |
def onOpen(self): | |
self.factory.clients.append(self) |
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/env python | |
import boto | |
AWS_ACCESS_KEY_ID = 'foo' | |
AWS_SECRET_ACCESS_KEY = 'bar' | |
bucket_name = 'baz' | |
conn = boto.connect_s3(AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY) | |
bucket = conn.create_bucket(bucket_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
p { | |
font-size: 110%; | |
} |
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
positionView: function() { | |
console.log('positioning'); | |
// TODO: Fix this nonsense. | |
// Check for the existence of this.element because when the transition | |
// value initially changes, the element doesn't actually exist! | |
if (this.get('element')) { | |
this.get('element').style.webkitTransform = | |
'translate(0, ' + this.get('transition') + 'px)'; | |
} |
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
/static/sass/: | |
screen.scss: (common stylesheet) | |
phone.scss, tablet.scss, desktop.scss: (form factor-specific styles) | |
/static/js/: | |
libs/: (external libraries - DO NOT MODIFY) | |
ember-and-friends.js | |
jquery.js | |
formfactor.js | |
views/: (form-factor specific views) |
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
/* | |
* Loads a handlebars.js template at a given URL. Takes an optional name, in which case, | |
* the template is added and is reference-able via templateName. | |
*/ | |
function loadTemplate(url, name, callback) { | |
var contents = $.get(url, function(templateText) { | |
var compiledTemplate = Ember.Handlebars.compile(templateText); | |
if (name) { | |
Ember.TEMPLATES[name] = compiledTemplate | |
} else { |
OlderNewer