View TimeControl.sol
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.5.8; | |
contract TimeControl{ | |
address private owner; | |
mapping (address => uint[]) private employeeRecords; | |
constructor() public{ | |
owner = msg.sender; | |
} | |
function Register() public{ | |
employeeRecords[msg.sender].push(now); | |
} |
View call-smart-contract.js
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
async (error, transactionHash) => { | |
if (error) { | |
console.log(`error: ${error}`); | |
} | |
else { | |
console.log(`transaction hash: ${transactionHash}`); | |
let receipt = await web3.eth.getTransactionReceipt(transactionHash); | |
console.log('Contract address: ' + receipt.contractAddress); | |
let contractDeployed = new web3.eth.Contract(abi, receipt.contractAddress); | |
contractDeployed.methods.Register.send({ from: creatorAccount }, (err, data) => { |
View deploy-smart-contract-with-web3.js
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
const Web3 = require('web3'); | |
let web3 = new Web3(new Web3.providers.HttpProvider("HTTP://127.0.0.1:7545")); | |
web3.eth.getAccounts().then(accounts => { | |
//Get the account which create the contract | |
let creatorAccount = accounts[0]; | |
//Deploy contract | |
const contract = new web3.eth.Contract(abi); | |
contract.deploy({ | |
data: '0x' + bytecode |
View get-abi-and-bytecode.js
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
const path = require('path'); | |
const fs = require('fs'); | |
const solc = require('solc'); | |
const contractPath = path.resolve(__dirname, "..", 'TimeControl.sol'); | |
const source = fs.readFileSync(contractPath, 'utf8'); | |
let jsonContractSource = JSON.stringify({ | |
language: 'Solidity', | |
sources: { | |
'TimeControl': { |
View TimeControl.sol
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.5.8; | |
contract TimeControl{ | |
address private owner; | |
mapping (address => uint[]) private employeeRecords; | |
constructor() public{ | |
owner = msg.sender; | |
} | |
function Register() public{ | |
employeeRecords[msg.sender].push(now); | |
} |
View promise_es6.js
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
function calculateFibonacci(number) { | |
if (number == 0 || number == 1) | |
return number; | |
return (calculateFibonacci(number - 1) + calculateFibonacci(number - 2)); | |
} | |
function doStuff(serie) { | |
return new Promise((resolve, reject) => { | |
if (typeof serie === 'number') { | |
var results = []; |
View Index.cshtml
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
@using Microsoft.Extensions.Configuration | |
@inject IConfiguration Configuration | |
<style> | |
#home { | |
background-image: linear-gradient(rgba(0, 0, 0, 0.6), rgba(0, 0, 0, 0.6)), url(https://live.staticflickr.com/4544/27053562599_40e1815d95_k.jpg); | |
} | |
#about { | |
background-image: linear-gradient(rgba(0, 0, 0, 0.6), rgba(0, 0, 0, 0.6)), url(@Configuration["AppConfigurationDemo:Index:AboutImage"]); |
View Index.cshtml
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
@using Microsoft.Extensions.Configuration | |
@inject IConfiguration Configuration | |
@addTagHelper *, Microsoft.FeatureManagement.AspNetCore | |
<style> | |
#welcome { | |
background-image: linear-gradient(rgba(0, 0, 0, 0.6), rgba(0, 0, 0, 0.6)), url(https://live.staticflickr.com/1937/30715340707_d0696024c8_k.jpg); | |
} | |
#home { |
View Program.cs
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
using Microsoft.WindowsAzure.Storage; | |
using Microsoft.WindowsAzure.Storage.Blob; | |
using Microsoft.WindowsAzure.Storage.Core.Util; | |
using System; | |
using System.IO; | |
using System.Threading; | |
using System.Threading.Tasks; | |
namespace AzureBlobAsyncProgress | |
{ |
View using-destructuring-assignment-in-functions.js
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 tvShow = { | |
title: 'El Embarcadero', | |
seasons: 2, | |
watched: true | |
}; | |
function watching({ title, seasons }) { | |
console.log(`I am watching ${title}. ${seasons} seasons of entertainment!`); | |
} |
NewerOlder