Skip to content

Instantly share code, notes, and snippets.

View harrylove's full-sized avatar

Harry Love harrylove

View GitHub Profile
@harrylove
harrylove / README.md
Last active December 17, 2015 14:09
Demonstration of reactive views in Meteor

You already know about reactive data sources. Views can be made reactive as well. Technically speaking, we make the view a reactive data source by storing it in the database and observing changes.

  1. Create a new app.
  2. Delete the default html, js, and css.
  3. Put the code below into a js file and run meteor.
  4. Then use the console to change either the View "html" property or the Number "val" property. (see code for examples)
  5. Try inserting and updating your own views and numbers.

N.B. The code is not an example of best practice, just a proof of concept. It relies on functions that are included in the Meteor Handlebars package. These functions could change or be removed in the future.

@harrylove
harrylove / README
Last active August 30, 2016 07:58 — forked from fightingtheboss/deploy.rb
Capistrano deploy script for Meteor on AWS running RedHat
This assumes you've already set up your instance with node, npm, forever, mongodb, configured ports, and have optionally added a web server like nginx to proxy access to meteor.
Local
1. Install Ruby
2. gem install capistrano
3. cd /your/meteor/project
4. capify .
5. edit config/deploy.rb as needed with below
AWS
@harrylove
harrylove / nginx.conf
Last active December 23, 2015 00:59
nginx conf file for Meteor on EC2
user nginx;
worker_processes 1;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
max, vol, memo = 0, 0, 0
[2, 5, 1, 3, 1, 2, 1, 7, 7, 6].each do |n|
if n > max
max = n
vol += memo
memo = 0
else
memo += max - n
end
end