Skip to content

Instantly share code, notes, and snippets.

View filipenevola's full-sized avatar

Filipe Névola filipenevola

View GitHub Profile
Meteor.publishComposite("commentsAndUsersByPost", (postId) => {
return {
find() {
return Comments.findByPostId(postId);
},
children: [
{
find(comment) {
return Users.findBasicDataByIds([comment.userId]);
}
Meteor.methods({
likePost(postId) {
check(postId, String);
Posts.like(postId, this.userId);
},
like(postId) { //deprecated, remove after MM/DD/YYYY
this.likePost(postId);
}
});
Meteor.methods({
like(postId) {
check(postId, String);
Posts.like(postId, this.userId);
}
});
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta charset="UTF-8">
<title>Template Cavadinha</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="https://fonts.googleapis.com/css?family=Fugaz+One" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Roboto:300,400,700" rel="stylesheet">
</head>
FlowRouter.route('/post/:_id', {
name: 'post',
action() {
BlazeLayout.render('layout', {
main: 'post',
panel: 'menu',
});
}
});
Router.route('/post/:_id', function () {
this.render('Post', {
data: function () {
return Posts.findOne({_id: this.params._id});
}
});
});
Template.startTimer.onCreated(function () {
this.timer = new ReactiveVar(0);
});
Template.startTimer.events({
'click button'(event, instance) {
setInterval(() => {
instance.timer.set(instance.timer.get() + 1);
}, 1000);
},
@filipenevola
filipenevola / startTimer.js
Created July 12, 2017 13:29
timer without template scope
const timer = new ReactiveVar(0);
Template.startTimer.events({
'click button'(event, instance) {
setInterval(() => {
timer.set(timer.get() + 1);
}, 1000);
},
});
2017-06-15 13:28:21-04:00Building version 60.
v060
2017-06-15 13:28:21-04:00Step 1 : FROM meteor/galaxy-app@sha256:2f134abf5589b24b9ea36154da584f68e19f0708a2a3117939d1f71b4a2e6b75
v060
2017-06-15 13:28:21-04:00 ---> d92c89073edf
v060
2017-06-15 13:28:21-04:00Step 2 : RUN /bin/bash -x /app/setup.sh https://prod-galaxy-bundles.s3.amazonaws.com/bundles/atMjg8G2oAGxA48jy/20170615-172029/bundle.dr8CEsbE7uxJxMQea.tgz?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAJ4JU4KHU7CAVLZ3Q%2F20170615%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20170615T172821Z&X-Amz-Expires=900&X-Amz-SignedHeaders=host&X-Amz-Signature=40ef86eaa0cd7671d84e7920c55e44d1f113005f75994e058625fbb61bc44798
v060
2017-06-15 13:28:21-04:00 ---> [Warning] Your kernel does not support swap limit capabilities, memory limited without swap.
v060
@filipenevola
filipenevola / monitoring.js
Last active June 13, 2017 20:57
Google Script to Monitor Websites (like pingdom) and maybe restart the server
// spreadsheet attached as csv just for example
var sheet = SpreadsheetApp.getActiveSheet(),
startRow = 2, // skips header line
lastRow = sheet.getLastRow() -1, // get last line with data
dataRange = sheet.getRange(startRow, 1, lastRow, 6), // first value is the row, second is the column in number
data = dataRange.getValues(); // get data of every cell within the range
var FOOTER = "<br/><br/><a href=\"https://script.google.com/macros/d/MlurQVKrLcdi-mMWhhh3KoQL0bBO3PCUx/edit?uiv=2&mid=ACjPJvGlhxliD17ZP1feshkqGxfbplgytbuk6ZUR4bCV3Wt2ChtUk_rI3XArfC1JTrz4lhUmJpwICfja09S1tR1YRkS03LIgjPNmk7d7sjI1PUibdnPY_BNZr6E5Z_mJ1LWVam3p0lX9xps\">editar script</a>";
function checkAllSites() {
var nao = "NÃO";