RiotControl seems an unnecessary dependency and has a critical issue whereby registering multiple stores causes any event to be triggered multiple times. I decided to create a minimal dispatcher.
import riot from 'riot'| <?php | |
| include('continuata.php'); | |
| $continuata = new Continuata(COMPANY_ID, COMPANY_PASSWORD); | |
| $email = $order->billing_email; | |
| $name = $order->billing_first_name.' '.$order->billing_last_name; | |
| $price = $order->get_total(); | |
| $items = $order->get_items(); | |
| $num_items = count($items); | |
| foreach ( $items as $line_item_data ) { |
RiotControl seems an unnecessary dependency and has a critical issue whereby registering multiple stores causes any event to be triggered multiple times. I decided to create a minimal dispatcher.
import riot from 'riot'| 'use strict' | |
| module.exports = { | |
| alphabetSize: 256, | |
| /* | |
| Returns the index of the first occurence of | |
| the `needle` buffer within the `haystack` buffer. | |
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <meta charset="utf-8"> | |
| <meta name="viewport" content="width=device-width"> | |
| <title>JS Bin</title> | |
| <script src="https://cdn.jsdelivr.net/g/lodash@4(lodash.min.js+lodash.fp.min.js)"></script> | |
| </head> | |
| <body> |
| /* demo on JSBIN https://jsbin.com/hunagoj/7/edit?js,console */ | |
| // jshint esnext: true | |
| const mapIndex = _.map.convert({ cap: false }) | |
| const units = ['', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten', 'eleven', 'twelve', 'thirteen', 'fourteen', 'fifteen', 'sixteen', 'seventeen', 'eighteen', 'nineteen'] | |
| const tens = ['', 'ten', 'twenty', 'thirty', 'forty', 'fifty', 'sixty', 'seventy', 'eighty', 'ninety'] | |
| const thous = ['', 'thousand', 'million', 'billion', 'trillion'] | |
| const mapTens = ([u='0', t='']) => | |
| Number(t + u) < 20 ? units[Number(t + u)] : u === '0' ? tens[t] : `${tens[t]}-${units[u]}` | |
| const mapSubBlocks = ([t, h='']) => [mapTens(t), !_.isEmpty(units[h]) ? `${units[h]} hundred` : ''] |
| // jshint esnext: true | |
| const curry = (f) => (...a) => (a.length < f.length) ? curry(f.bind(this, ...a)) : f(...a) | |
| const clone = (obj) => Object.assign({}, obj) | |
| const chain = (...fs) => (a) => fs.reduce((o, f) => f(o), a) | |
| const isEmpty = curry((a) => !a || a === null || a === '' || Object.values(a).length === 0) |
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <meta charset="utf-8"> | |
| <meta name="viewport" content="width=device-width"> | |
| <title>JS Bin</title> | |
| </head> | |
| <body> | |
| <script id="jsbin-javascript"> |
| /* eslint-disable no-console */ | |
| const { readdirSync } = require('fs') | |
| const packageJson = require('./package.json'); | |
| const fs = require('fs'); | |
| const { exec } = require('child_process'); | |
| require('colors'); | |
| const args = process.argv.slice(2); | |
| const getDirectories = source => |