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
// ### TableView | |
// TableView provides an efficient mechanism for progressively | |
// rendering from a data source provided by the owner object. | |
// Cells are queued for reuse when they go offscreen and then | |
// translated back into position with updated content as they | |
// are reused. | |
var TableView = exports.TableView = core.createClass({ | |
name: 'TableView', | |
extend: View, |
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
// implement the table delegate protocol | |
var tableDelegate = (function() { | |
return { | |
sectionHeaderAtIndex: function() { | |
return null; | |
}, | |
heightForSectionHeader: function(section) { | |
return 0; |
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
// we have a thing model with a property of name | |
Model.install('ThingModel', { | |
properties: { | |
name: 'a' | |
} | |
}); | |
// we have a thing collection that maintains our things | |
Collection.install('ThingCollection', { | |
extend: 'Collection', |
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
// declare a model with some properties | |
Model.install('Thing', { | |
properties: { | |
color:'#000000', | |
background:'#00FFFF' | |
} | |
}); | |
// declare a view with some properties | |
// and create appropriate setters that respond to changes |
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 node | |
var fs = require('fs'); | |
var exec = require('child_process').exec; | |
// handle args | |
var continuous = process.argv.indexOf('--watch') !== -1 ? true : false; | |
var minify = process.argv.indexOf('--minify') !== -1 ? true : false; | |
var releaseTarget = __dirname + '/release/'; | |
var jsTarget = releaseTarget + 'bolt.js'; | |
var cssTarget = releaseTarget + 'bolt.css'; |
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 fs = require('fs'); | |
var listFiles = function(path, match) { | |
var files = []; | |
var paths = fs.readdirSync(path); | |
paths.forEach(function(file) { | |
var stats = fs.statSync(path + '/' + file); | |
if (stats.isDirectory()) { | |
files = files.concat(listFiles(path + '/' + file, match)); | |
} else { |
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
commit 2111cdc41fbd683e43b33a38a7f4b60670b3013b | |
Author: wbailey <wi11.bai1ey@facebook.com> | |
Date: Fri Feb 25 09:50:40 2011 -0800 | |
model change event is now just "changed" | |
diff --git a/src/binding.js b/src/binding.js | |
index 668c9a9..dafbee1 100644 | |
--- a/src/binding.js | |
+++ b/src/binding.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
require "open-uri" | |
def bet(bet) | |
win = false; winnings = 0 | |
until win | |
win = open("http://roulette.engineyard.com").read.match(/13/) | |
winnings += (win ? bet * 35 : -bet) | |
end | |
winnings | |
end |
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
- (UIImage*)tintedImageWithColor:(UIColor*)tint { | |
CGSize size = self.size; | |
CGRect imageBounds; | |
if ([[UIScreen mainScreen] respondsToSelector:@selector(scale)] && | |
[[UIScreen mainScreen] scale] == 2) { | |
imageBounds = CGRectMake(0, 0, size.width * 2, size.height * 2); | |
} else { | |
imageBounds = CGRectMake(0, 0, size.width, size.height); | |
} | |
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 jsonToXMLString = function(data){ | |
var carrier = DOM.create('carrier'); | |
var convert = function(data, currentNode) { | |
keys(data).each(function(k) { | |
var v = data[k]; | |
if (is_scalar(v)) { | |
currentNode.setAttribute(k, v); | |
} else if (hasArrayNature(v)) { | |
v.each(function(vv){ | |
var node = DOM.create(k); |