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
<!-- index.html --> | |
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8" /> | |
<title>React Tutorial</title> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/0.14.7/react.js"></script> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/0.14.7/react-dom.js"></script> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/babel-core/5.8.23/browser.min.js"></script> | |
</head> |
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 Dog() { | |
this.name = "Lassie"; | |
this.greeting = "woof"; | |
this.greet = function() { | |
console.log(this.name, "says", this.greeting); | |
}; | |
this.eat = function() { | |
console.log(this.name, "is eating"); |
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
Items = new Meteor.Collection('items'); | |
if(Meteor.isClient){ | |
Template.groceryList.events({ | |
'click li' : function(event, template){ | |
var listItem = event.currentTarget; // get the list item being clicked on | |
$('#'+listItem.id).hide(); // hide li with matching id | |
// update check attribute for the item in the database | |
Items.update(listItem.id, { $set : {checked:true} }, function(error){ |
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>Grocery List</title> | |
</head> | |
<body> | |
<!-- render template name groceryList --> | |
{{> groceryList}} | |
</body> | |
<!-- define template name groceryList --> |
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
Items = new Meteor.Collection('items'); | |
if(Meteor.isClient){ | |
Template.groceryList.events({ | |
'click li' : function(event, template){ | |
var listItem = event.currentTarget; // get the list item being clicked on | |
$('#'+listItem.id).hide(); // hide li with matching id | |
// update check attribute for the item in the database | |
Items.update(listItem.id, { $set : {checked:true} }, function(error){ |
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>Grocery List</title> | |
</head> | |
<body> | |
<!-- render template name groceryList --> | |
{{> groceryList}} | |
</body> | |
<!-- define template name groceryList --> |
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
Items = new Meteor.Collection('items'); | |
if(Meteor.isClient()){ | |
Template.groceryList.helpers({ | |
items: function() { | |
return Items.find(); | |
} | |
}); | |
} |
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>Grocery List</title> | |
</head> | |
<body> | |
{{> groceryList}} | |
</body> | |
<template name="groceryList"> |
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 weeklyRetention = new Array(); // For storing weekly retntion rate | |
// Unique user sessions grouped by week | |
var sessions = [{week: 1, ids: [1, 2, 19, 33]}, {week: 2, ids: [5, 2, 19, 33, 55, 88]},....] | |
// Loop until second to last element of the array | |
var i = 0; | |
while(i < sessions.length-1) { | |
var usersStartOfPeriod = sessions[i].ids; | |
var usersEndOfPeriod = sessions[i+1].ids; |
NewerOlder