Skip to content

Instantly share code, notes, and snippets.

@ianpetzer
ianpetzer / gist:5706115
Created June 4, 2013 13:56
ExternalHosts required iOS PhoneGap wrapper app
*.google.com
*.googleapis.com
*.gstatic.com
@ianpetzer
ianpetzer / gist:5724178
Created June 6, 2013 19:24
proc for Assetfile to ensure Ember templates get the correct name
ember_template_name_proc = proc { |input|
dir = File.dirname(input.path)
dir = dir.sub!('templates/', '')
template_name = File.basename(input.path, File.extname(input.path))
template_name = dir + '/' + template_name if !dir.nil?
template_name
}
@ianpetzer
ianpetzer / gist:5724161
Created June 6, 2013 19:22
Rake Pipeline instruction to match Ember templates, precompile them and ensure they have the correct name
match "templates/**/*.hbs" do
handlebars wrapper_proc: Barber::Ember::FilePrecompiler, :key_name_proc => ember_template_name_proc
end
App.CategoriesRoute = Ember.Route.extend({
model: function() {
return App.Category.find();
}
});
{{#each model}}
//List all categories here
{{/each}}
{{#each filteredCategories}}
//List filtered categories here
{{/each}}
App.CategoriesController = Ember.Array.extend({
filteredCategories: function() {
var filter = 'String value to compare lower case name to. ';
return this.get('model').filterProperty('nameLowerCase', filter);
}.property('model.@each.nameLowerCase')
});
App.Category = Ember.Object.extend({
name: '',
nameLowerCase: function() {
return this.get('name').toLowerCase();
}.property('name')
});
IN .h
@property (nonatomic, readonly) CLLocationCoordinate2D coordinate;
// This is an optional property from MKAnnotation
@property (nonatomic, copy) NSString *title;
IN .m
@synthesize coordinate, title;
rails g qunit:install
module("Ember.js Library", {
setup: function() {
Ember.run(App, App.advanceReadiness);
},
teardown: function() {
App.reset();
}
});
test("Check HTML is returned", function() {