Skip to content

Instantly share code, notes, and snippets.

View bluepnume's full-sized avatar

Daniel Brain bluepnume

  • OneText
  • San Jose
View GitHub Profile
export type TransactionType = {|
sender : string,
receiver : string,
amount : number,
fee : number
|};
export type BlockType = {|
miner : string,
parentid : string,
/* @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>;
/* @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 />
const email = '[email protected]';
const match = email.match(
/^\w+(\.\w+)?@(?<provider>paypal|google|\$mail)\.(?<tld>com|org|net)$/)
/*
[ ['A', 'B'], ['B', 'C'], ['C', 'D'], ['D'] ]
[ 'A', 'B', 'C', 'D' ]
->
{ id: 'A', next: { id: 'B', next: { id: 'C', next: { id: 'D', next: null } } } }
*/
// 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
const useSetup = (setup, plan) => {
const ref = useRef(plan);
useEffect(() => {
ref.current = plan;
}, [ plan ]);
useEffect(() => {
const data = {};
const actions = {
// Number of nodes
let NUM_NODES = 10;
// Connections between nodes
let CONNECTIONS = {
0: [ 1, 3 ],
1: [ 2, 3, 4 ],
2: [ 5 ],
3: [ 6 ],
<head>
</head>
<body>
<script src="https://www.paypal.com/sdk/js?client-id=sb"></script>
<div id="paypal-button-container"></div>
<script>paypal.Buttons().render('#paypal-button-container');</script>
</body>
<!DOCTYPE html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta charset="UTF-8">
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/16.0.0/umd/react.production.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react-dom/16.0.0/umd/react-dom.production.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/babel-core/5.8.38/browser.js"></script>