Skip to content

Instantly share code, notes, and snippets.

@stephentcannon
stephentcannon / gist:8981744
Created February 13, 2014 19:11
when is meteor collection find firing?
var wrappedFind = Meteor.Collection.prototype.find;
Meteor.Collection.prototype.find = function () {
var cursor = wrappedFind.apply(this, arguments);
var collectionName = this._name;
cursor.observeChanges({
added: function (id, fields) {
console.log(collectionName, 'added', id, fields);
},
// default desktop view
#signInPage{
border: 1px solid gray;
}
// landscape orientation view for tablets
@media only screen and (min-width: 768px) {
#signInPage{
padding: 20px;
}
}
@stephentcannon
stephentcannon / gist:8982924
Created February 13, 2014 20:13
CSS3 supports the following media types
media_type: all | aural | braille | handheld | print |
projection | screen | tty | tv | embossed
media_feature: width | min-width | max-width
| height | min-height | max-height
| device-width | min-device-width | max-device-width
| device-height | min-device-height | max-device-height
| aspect-ratio | min-aspect-ratio | max-aspect-ratio
| device-aspect-ratio | min-device-aspect-ratio | max-device-aspect-ratio
| color | min-color | max-color
| color-index | min-color-index | max-color-index
Session.set("resize", null);
Meteor.startup(function () {
$(window).resize(function(evt) {
Session.set("resize", new Date());
});
});
Template.homePage.resized = function(){
var width = $(window).width();
var height = $(window).height();
@stephentcannon
stephentcannon / gist:8982954
Created February 13, 2014 20:14
Cordova Phonegap Deviceready
document.addEventListener('deviceready', function(){
Session.set('deviceready', true);
}, false);
https://groups.google.com/forum/#!topic/meteor-talk/ku7kvNJp8ek
Now then, Morten, Alan, and I have been discussing Chrome Apps as a target compilation point for mobile apps. And Google recently announced that they're bringing Chrome Apps to Cordova (thanks Alan, for that heads up!). So, if you're looking for some really interesting possibilities, check out these links:
Run Chrome Apps on Mobile Using Apache Cordova/Phonegap
Google Brings Chrome Apps to Google Play and Apple App Stores
Chrome Apps on Mobile Toolchain
What Are Chrome Apps?
Create Your First Chrome App
cd /path/to/project/
mrt install
meteor
@stephentcannon
stephentcannon / gist:9042875
Created February 17, 2014 00:52
a meteor pattern for a generic event handler
<body>
{{> eventhandler}}
</body>
<template name="eventhandler">
{{> template1 }}
{{> template2 }}
{{> template3 }}
@stephentcannon
stephentcannon / gist:9042903
Created February 17, 2014 00:55
meteor content router
Router.map(function() {
this.route('blog', {
path: '/blog/:slug',
template: 'blog'
});
});
Template.blog.content = function() {
var slug = Router.current().params.slug;
var templateFunc = Template[slug];
@stephentcannon
stephentcannon / meteor-nginx.conf
Created March 8, 2014 02:44
Meteor nginx conf
server {
listen 80 default_server;
server_name _;
# could be 301 if you want
return 302 https://$host$request_uri;
}
server {
listen 80;
server_name *.yourdomain.com;