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
| Template.someModal.rendered = function() { | |
| $(this.find('#modal')).hide().fadeIn(); | |
| }; |
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
| Deps.autorun(function() { | |
| Meteor.subscribe('messages', Session.get('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
| client.addListener('PING', function() { | |
| Fiber(function() { | |
| client.send('PONG'); | |
| }).run(); | |
| }); |
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
| Client---- | |
| Deps.autorun(function() { | |
| Meteor.subscribe('messages', Session.get('room')); | |
| }); | |
| Server---- | |
| Meteor.publish('messages', function(room) { | |
| return Messages.find({room_id: room}); | |
| }); |
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
| 1. Place files in /meteor-project-root/packages/x/ replace x with package name | |
| 2. meteor add x | |
| ------- x.js -------- | |
| X = Npm.require('x'); | |
| ------- package.js -------- | |
| Package.describe({ | |
| summary: "Meteor smart package for x node.js package" | |
| }); |
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
| client.js ------ | |
| Template.message.rendered = function() { | |
| $(this.find('div')).hide().fadeIn(); | |
| }; |
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
| Meteor.subscribe('messages', function() { | |
| return Messages.find().observe({ | |
| added: function() { | |
| scrollToBottom(); | |
| } | |
| }); | |
| }); |
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
| client.js ------ | |
| if (navigator.geolocation) { | |
| navigator.geolocation.getCurrentPosition(function(position) { | |
| Session.set('lat', position.coords.latitude); | |
| Session.set('lon', position.coords.longitude); | |
| }, function(error) { | |
| }, { enableHighAccuracy: true }); | |
| } | |
| Template.userLayout.location = function () { |
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 response = Meteor.http.get('http://ws.audioscrobbler.com/2.0/?method=tasteometer.compare&type1=user&type2=user&value1='+query[0]+'&value2='+query[1]+'&api_key='+config.lastfmClientId+'&format=json'); | |
| if (response.statusCode === 200) { | |
| var data = response.data; | |
| if(data.comparison) { | |
| return " score: "+ data.comparison.result.score; | |
| } | |
| } |
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
| #!/bin/bash | |
| # IP or URL of the server you want to deploy to | |
| export APP_HOST=IP_ADDRESS_HERE | |
| export APP_ROOT=root | |
| export APP_NAME=YOUR_APP_NAME | |
| export APP_PORT=3000 | |
| export ROOT_URL=http://$APP_HOST:$APP_PORT | |
| export APP_DIR=/srv/www/$APP_HOST/$APP_NAME | |
| export MONGO_URL=mongodb://localhost:27017/$APP_NAME | |
| export SSH_HOST="$APP_ROOT@$APP_HOST" |