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
defs = {}; | |
modules = {}; | |
function define(name, fn) { | |
defs[name] = fn; | |
} | |
function require(name) { | |
console.log("Loading " + name); | |
if (modules.hasOwnProperty(name)) return modules[name]; | |
if (defs.hasOwnProperty(name)) { | |
var fn = defs[name]; |
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
define.defs = {}; | |
define.modules = {}; | |
function define(name, fn) { | |
define.defs[name] = fn; | |
} | |
function require(name) { | |
if (define.modules.hasOwnProperty(name)) return define.modules[name]; | |
if (define.defs.hasOwnProperty(name)) { | |
var fn = define.defs[name]; | |
define.defs[name] = function () { throw new Error("Circular Dependency"); }; |
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
/** | |
* counter | |
* ======= | |
* Creates counter that will generate number, starting from `start` (default to 0) | |
* incrementing (or decrementing) by `step` (default to 1). Based on | |
* [Python's itertools.count](http://docs.python.org/library/itertools.html#itertools.count). | |
* | |
* cycle | |
* ===== | |
* Returns a function that will generate items in `iterable` for each call, |
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
<script type="text/javascript"> | |
window.RAILS_ENV = '<%= RAILS_ENV %>'; | |
window.SERVER_ROOT = '<%= DC.server_root %>'; | |
window.SERVER_ROOT_HTTP = '<%= DC.server_root(:ssl => false) %>'; | |
<% if workspace %> | |
Organizations.refresh(<%= @organizations.to_json %>); | |
<% if @current_account %> | |
<%= render :partial => 'accounts/current_account.js', :type => :js %> | |
Accounts.refresh(<%= @accounts.to_json %>); | |
Projects.refresh(<%= @projects.to_json({:account => @current_account, :include_collaborators => true}) %>); |
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
<html> | |
<head> | |
<script src='http://code.jquery.com/jquery-1.5.1.min.js'></script> | |
</head> | |
<body> | |
<h2>Naive canvas</h2> | |
<canvas id="naive" width="400" height="50"></canvas> | |
<h2>High-def Canvas</h2> |
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
/** | |
* We're going to create an infinite scrollable list. In this case, we're going to show a date. When you swipe left, | |
* you'll see yesterday. Then the day before yesterday, and so on. Swiping right shows you tomorrow, and so on. | |
*/ | |
var win = Ti.UI.createWindow({ backgroundColor: '#fff' }); | |
var isAndroid = Ti.Platform.osname === 'android'; | |
/** | |
* Track where we are in the infinite scrollable views, and define how large of a step goes between each view. | |
*/ | |
var currentDate = new Date(), msIntervalBetweenViews = 1000/*ms*/ * 60/*s*/ * 60/*m*/ * 24/*h*/; |
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
The Error: | |
element["insertAdjacent" + (html instanceof Element ? "Element" : "HTML")] is not a function | |
http://localhost:8080/scripts/zepto.js | |
Line 145 | |
the zepto.js is 5ecaa (HEAD of the zepto repo) | |
backbone.js is 261059 (HEAD of backbone's repo) | |
the stack looks like.. |
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
define (require, exports, module) -> | |
_ = require("underscore") | |
_.mixin require("underscore.string") | |
_.mixin | |
# Converts the arguments list to an Array | |
aToArr: (list) -> | |
if _.isArguments(list) | |
_.toArray(list).slice(0) | |
else |
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
var adjacencyOperators = { | |
append: 'beforeEnd', | |
prepend: 'afterBegin', | |
before: 'beforeBegin', | |
after: 'afterEnd' | |
}; | |
for (key in adjacencyOperators) | |
$.fn[key] = (function(operator) { | |
return function(html){ |