An FAQ for common objections to Soylent.
Reference: Nutritional details PDF
Table of Contents
import Web3 from 'web3' | |
const resolveWeb3 = (resolve) => { | |
let { web3 } = window | |
const alreadyInjected = typeof web3 !== 'undefined' // i.e. Mist/Metamask | |
const localProvider = `http://localhost:9545` | |
if (alreadyInjected) { | |
console.log(`Injected web3 detected.`) | |
web3 = new Web3(web3.currentProvider) |
import React from 'react' | |
import getWeb3 from './getWeb3' | |
const withWeb3 = PassedComponent => class extends React.Component { | |
state = { web3: null } | |
async componentDidMount () { | |
try { | |
const web3 = await getWeb3() | |
this.setState({ web3 }) |
import Web3 from 'web3' | |
const resolveWeb3 = (resolve) => { | |
let { web3 } = window | |
const alreadyInjected = typeof web3 !== 'undefined' // i.e. Mist/Metamask | |
if (alreadyInjected) { | |
web3 = new Web3(web3.currentProvider) | |
console.log(`Injected web3 detected.`) | |
resolve(web3) |
import React from 'react' | |
import withWeb3 from '../lib/withWeb3' | |
// Demonstration of a basic dapp with the withWeb3 higher-order component | |
class Dapp extends React.Component { | |
state = { balance: null } | |
storeValue = async () => { | |
const { accounts, contract } = this.props | |
const response = await contract.set(5, { from: accounts[0] }) |
import React from 'react' | |
import withWeb3 from '../lib/withWeb3' | |
// Our `withWeb3` HOC actually injects web3, accounts, and contract into | |
// the props, but we are only using the accounts prop. | |
const Accounts = ({ accounts }) => | |
<div> | |
<h1>My Accounts</h1> | |
<pre>{JSON.stringify(accounts, null, 4)}</pre> | |
</div> |
An FAQ for common objections to Soylent.
Reference: Nutritional details PDF
Table of Contents
export default (show, venueType) => { | |
const tiers = show.tierPrices.map((price, index) => ({ | |
title: venueType[`tier${index + 1}Title`], | |
description: venueType[`tier${index + 1}Description`], | |
price, | |
})); | |
return { | |
name: show.name, | |
venueType: venueType.name, | |
tiers, |
"""Softmax.""" | |
scores = [3.0, 1.0, 0.2] | |
import numpy as np | |
from math import e | |
def softmax(scores): | |
denominator = sum([e ** x for x in scores]) | |
result = [e ** x / denominator for x in scores] |