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
| import { createMeteorNetworkInterface, meteorClientConfig } from 'meteor/apollo'; | |
| import { ApolloClient } from 'react-apollo'; | |
| import { SubscriptionClient, addGraphQLSubscriptions } from 'subscriptions-transport-ws'; | |
| const wsClient = new SubscriptionClient('ws://localhost:5000/', { | |
| reconnect: true, | |
| }); | |
| // Create a normal network interface: |
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
| // some random collection | |
| Things = new Meteor.Collection('things'); | |
| // collection used to track users who are blocked from inserting | |
| Blocked = new Meteor.Collection('blocked'); | |
| if (Meteor.isServer) { | |
| Meteor.startup(function () { | |
| // remove all documents on startup for testing purposes | |
| Blocked.remove({}); |
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
| rcy@laird:~/tmp$ meteor --version | |
| Meteor 0.9.0 | |
| rcy@laird:~/tmp$ meteor create myapp | |
| myapp: created. | |
| To run your new app: | |
| cd myapp | |
| meteor | |
| rcy@laird:~/tmp$ cd myapp |
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
| Model = { | |
| create: function (collection, methods) { | |
| var model = function (doc) { | |
| _.extend(this, doc); | |
| }; | |
| _.extend(model.prototype, methods); | |
| collection._transform = function (doc) { | |
| return new model(doc); | |
| }; |
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
| "iron-router": { | |
| "git": "https://github.com/EventedMind/iron-router.git", | |
| "tag": "v0.6.4" | |
| } |
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
| settings.json: | |
| ``` | |
| {"foo": 99} | |
| ``` | |
| app.js | |
| ``` | |
| if (Meteor.isServer) | |
| console.log(Meteor.settings.foo); | |
| ``` |
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
| PROJECT=myapp | |
| BRANCH=$(shell git branch | sed -n '/\* /s///p') | |
| TAG=deploy-${BRANCH}-$(shell echo -n `date +%Y%m%d%H%M%S`) | |
| ifeq (${BRANCH}, master) | |
| TARGET=${PROJECT}.meteor.com | |
| else | |
| TARGET=${BRANCH}-${PROJECT}.meteor.com | |
| endif |
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
| chatStream = new Meteor.Stream('chat'); | |
| if(Meteor.isClient) { | |
| sendChat = function(message) { | |
| chatStream.emit('message', message); | |
| console.log('me: ' + message); | |
| }; | |
| chatStream.on('message', function(message) { | |
| console.log('user: ' + message); |
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
| function miniQuery(doc, query) { | |
| var collection = new Meteor.Collection(null); | |
| collection.insert(doc); | |
| return !! collection.findOne(query); | |
| } |
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
| <head> | |
| <title>keydown</title> | |
| </head> | |
| <body> | |
| {{> hello}} | |
| </body> | |
| <template name="hello"> | |
| <input type="text"> |