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
Backbone.easyXDMxhr = new easyXDM.Rpc({ | |
remote: 'http://foo.bar/cors/', | |
}, { | |
remote: { | |
request: {} | |
} | |
}); | |
Backbone.ajax = function() { | |
var options = arguments[0]; |
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
// | |
// TBKeychainCounter.h | |
// | |
// Created by Tal Bereznitskey on 5/11/13. | |
// Copyright (c) 2013 Tal Bereznitskey. All rights reserved. | |
// | |
#import <Foundation/Foundation.h> | |
@interface TBKeychainCounter : NSObject |
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
- (void)viewDidLoad | |
{ | |
[super viewDidLoad]; | |
[self observeModel] | |
[self render]; | |
} | |
- (void)observeModel | |
{ | |
// KVO is used to observe model changes |
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
initialize: function() { | |
// Observe changes to the model and call the render function when they happen | |
this.model.on('change', this.render, this); | |
// Render the view for the first time | |
render(); | |
} | |
userMarkedObjectAsFavorite: function() { | |
// We're changing the mode, not the UI |
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 compiledTemplate = Handlebars.getTemplate('hello'); | |
var html = compiledTemplate({ name : 'World' }); |
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
Handlebars.getTemplate = function(name) { | |
if (Handlebars.templates === undefined || Handlebars.templates[name] === undefined) { | |
$.ajax({ | |
url : 'templatesfolder/' + name + '.handlebars', | |
success : function(data) { | |
if (Handlebars.templates === undefined) { | |
Handlebars.templates = {}; | |
} | |
Handlebars.templates[name] = Handlebars.compile(data); | |
}, |
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 compiledTemplate = Handlebars.templates['hello']; | |
var html = compiledTemplate({ name : 'World' }); |
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 rawTemplate = '<p>Hello {{name}}</p>'; // (step 1) | |
var compiledTemplate = Handlebars.compile(rawTemplate); // (step 2) | |
var html = compiledTemplate({ name : 'World' }); // (step 3) | |
// html content will now be: <p>Hello World</p> |
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
BOOL viewAcontainsViewB = (viewA.origin.y < viewB.origin.y) && (viewB.origin.y + viewB.size.height < viewA.origin.y + viewA.size.height); | |
if (viewAcontainsViewB) { | |
[self doSomething]; | |
} |
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
if ((viewA.origin.y < viewB.origin.y) && (viewB.origin.y + viewB.size.height < viewA.origin.y + viewA.size.height)) { | |
[self doSomething]; | |
} |