This file contains 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 Meal = mongoose.model() | |
class MealService{ | |
changeCalories(id, calories){ | |
Meal.update(id, { | |
$set: {calories} | |
}) | |
} | |
} |
This file contains 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Hello World DApp</title> | |
<link href='https://fonts.googleapis.com/css?family=Open+Sans:400,700' rel='stylesheet' type='text/css'> | |
<link href='https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css' rel='stylesheet' type='text/css'> | |
</head> | |
<body class="container"> | |
<h1>A Simple Message Board</h1> | |
<div id="login-area"> |
This file contains 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
pragma solidity ^0.4.18; | |
//Contract is just like classes | |
contract MessageBoard { | |
//Defining User structure. address is a variable type from solidity | |
struct User { | |
address _address; | |
string name; | |
bool isValue; | |
} |
This file contains 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
//THIS SMART CONTRACT IS CONSUMING A LOT OF GAS | |
//THIS IS DEMONSTRATION OF RANDOM NUMBER GENERATOR | |
//DO NOT USE IT FOR PRODUCTION | |
pragma solidity ^0.4.8; | |
contract Lottery { | |
mapping (uint8 => address[]) playersByNumber ; | |
This file contains 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
//THIS CONTRACT IS CONSUMING A LOT OF GAS | |
//THIS CONTRACT IS ONLY FOR DEMONSTRATING HOW RANDOM NUMBER CAN BE GENERATED | |
//DO NOT USE THIS FOR PRODUCTION | |
pragma solidity ^0.4.8; | |
contract Lottery { | |
mapping (uint8 => address[]) playersByNumber ; |