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
export type TransactionType = {| | |
sender : string, | |
receiver : string, | |
amount : number, | |
fee : number | |
|}; | |
export type BlockType = {| | |
miner : string, | |
parentid : string, |
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
/* @jsx regex.node */ | |
import { regex, Regex, RegexGroup as Group, RegexText as Text, RegexWord as Word } from 'jsx-pragmatic'; | |
const Dot = () => { | |
return <Text>.</Text>; | |
}; | |
const At = () => { | |
return <Text>@</Text>; |
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
/* @jsx regex.node */ | |
import { regex, Regex, RegexGroup as Group, RegexText as Text, RegexWord as Word } from 'jsx-pragmatic'; | |
const email = '[email protected]'; | |
const match = email.match( | |
<Regex> | |
<Word /> | |
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
const email = '[email protected]'; | |
const match = email.match( | |
/^\w+(\.\w+)?@(?<provider>paypal|google|\$mail)\.(?<tld>com|org|net)$/) |
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
/* | |
[ ['A', 'B'], ['B', 'C'], ['C', 'D'], ['D'] ] | |
[ 'A', 'B', 'C', 'D' ] | |
-> | |
{ id: 'A', next: { id: 'B', next: { id: 'C', next: { id: 'D', next: null } } } } | |
*/ |
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
// Create a simple checkout flow | |
// | |
// - Googling is encouraged! | |
// - Use whatever environment/editor works best for you | |
// - Use whatever technologies, libraries or frameworks you're most comfortable with | |
// - Focus on getting it working first, then add any polish if you have spare time at the end | |
// | |
// 0. Buyer opens a merchant page (e.g. /merchant-cart.html) | |
// 1. Buyer sees a 'Checkout' button | |
// 2. Buyer clicks the 'Checkout' button |
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
const useSetup = (setup, plan) => { | |
const ref = useRef(plan); | |
useEffect(() => { | |
ref.current = plan; | |
}, [ plan ]); | |
useEffect(() => { | |
const data = {}; | |
const actions = { |
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
// Number of nodes | |
let NUM_NODES = 10; | |
// Connections between nodes | |
let CONNECTIONS = { | |
0: [ 1, 3 ], | |
1: [ 2, 3, 4 ], | |
2: [ 5 ], | |
3: [ 6 ], |