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
//this | |
"editions":{ | |
"4":{ | |
"id":"4", | |
"name":"My First edition", | |
"date_created":"2011-07-10 21:31:12", | |
"date_last_updated":"2011-07-10 21:31:12" | |
} | |
} |
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
//this | |
{ | |
"magazines":{ | |
"4":{ | |
"id":"4", | |
"name":"Young Olmos", | |
"description":"The latest from San Diego's most original dirigible", | |
"creator":{ | |
"id":"4", | |
"name":"James Womack" |
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
"subscriptions":[ | |
{ | |
"id":"1", | |
"name":"Mag 1", | |
"description":"Description for Magazine: 1", | |
"creator":{ | |
"id":"1", | |
"name":"Chris Bull" | |
}, | |
"date_created":"2011-07-16 15:12:38", |
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
/* | |
This is an example of sending a POST request to a server that returns a JSON object containing a user ID, API key, etc. isSnagazineReachable is a method for checking if the server is available first. The main work is done by creating an NSDictionary with the data you want to post, passing that to the CCWebUtils class method postToUrl:params: which returns an NSString of the server response. | |
*/ | |
- (BOOL)authWithEmail:(NSString *)theEmail andPassword:(NSString *)thePassword; { | |
if (![[CCSnagazineDataSource sharedData] isSnagazineReachable]) { | |
Alert(0,nil,kNetworkDown,@"Ok",nil); | |
return FALSE; | |
} | |
if (![self userId] || ![self apiKey]) { |
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
window.__defineGetter__('events',function(){ | |
var _events = []; | |
for (var k in window) { | |
if(k.match(/^on/)){ | |
_events.push(k) | |
} | |
}; | |
return _events; | |
}); |
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
act: (context, f, keyPaths...) -> | |
ok = true | |
for k in keyPaths | |
if !context.get(k)? | |
ok = false | |
context.observe k, (newValue, oldValue, keyPath) => | |
ok = true | |
for k in keyPaths | |
ok = context.get(k)? | |
return unless ok |
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.prototype.runOnBackgroundThread = function (aCallback) { | |
var _blob = new Blob(['onmessage = '+this.toString()],{"type":"text/javascript"}); | |
var _worker = new Worker((webkitURL.createObjectURL || URL.createObjectURL)(_blob)); | |
_worker.onmessage = aCallback; | |
_worker.postMessage(); | |
} | |
var _test = function () { | |
postMessage((1+1).toString()); | |
} |
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 InlineWorker = function (theWorkerFunction,aCallback) { | |
var _blob = new Blob(['onmessage = '+theWorkerFunction.toString()],{"type":"text/javascript"}); | |
var _worker = new Worker((webkitURL.createObjectURL || URL.createObjectURL)(_blob)); | |
_worker.onmessage = aCallback; | |
this.postMessage = function(){_worker.postMessage.apply(_worker,Array.prototype.slice.call(arguments))}; | |
return this; | |
} | |
var _inlineWorkerCode = function(e) { | |
//put anything that doesn't use window or document here |
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
<audio controls="controls"> | |
<source src="http://machine.local:8976/px/ttt/cry-bla.mp3" type="audio/mpeg"> | |
</audio> |
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
Batman.Object::actOnListeners = (context, f, objectEventPairs...) -> | |
_satisfiedObjects = [] | |
for objectEventPair in objectEventPairs | |
objectEventPair[0].on objectEventPair[1], -> | |
_satisfiedObjects.add objectEventPair | |
f.apply theContext if objectEventPairs.exclude(_satisfiedObjects...).length is 0 | |
@actOnListeners @, @showArticle, [[Brilliant,'ready'],[@get('currentArticleView'),'ready']] |
OlderNewer