If you'd like to experiment with Terraform on macOS locally, a great provider for doing so is the Docker provider. You can get set up in a few simple steps, like so:
Install Docker for Mac if you have not already.
| /* | |
| * credit to Dhrumil Shah (@wandcrafting) and Robert Haisfield (@RobertHaisfield) | |
| * for the original concept which was part of their RoamGames submission | |
| * and can be found at: https://www.figma.com/file/5shwLdUCHxSaPNEO7pazbe/ | |
| * | |
| */ | |
| /* ======= OPTIONS ======== */ | |
| /* note: if you change these, reload the page to see the effect */ |
| # install socat on CentOS 6.x | |
| rpm -ivh https://forensics.cert.org/cert-forensics-tools-release-el6.rpm | |
| yum install socat | |
| # tcp | |
| nohup socat TCP4-LISTEN:3306,reuseaddr,fork TCP4:192.168.1.2:3306 >> socat.log 2>&1 &! | |
| # udp | |
| nohup socat UDP4-LISTEN:1194,reuseaddr,fork UDP4:192.168.1.3:1194 >> socat.log 2>&1 &! |
| node_modules |
| import produce from 'immer'; | |
| import {createStore} from 'redux'; | |
| const handleActions = (actionsMap, defaultState) => ( | |
| state = defaultState, | |
| {type, payload} | |
| ) => | |
| produce(state, draft => { | |
| const action = actionsMap[type]; | |
| action && action(draft, payload); |
| // @flow | |
| import React from 'react'; | |
| import styled from 'styled-components'; | |
| type GlobalCssValues = 'initial' | 'inherit' | 'unset'; | |
| type WrapValue = 'nowrap' | 'wrap' | 'wrap-reverse' | GlobalCssValues; | |
| type JustifyValue = | |
| | 'center' |
| /** | |
| * Example to refresh tokens using https://github.com/auth0/node-jsonwebtoken | |
| * It was requested to be introduced at as part of the jsonwebtoken library, | |
| * since we feel it does not add too much value but it will add code to mantain | |
| * we won't include it. | |
| * | |
| * I create this gist just to help those who want to auto-refresh JWTs. | |
| */ | |
| const jwt = require('jsonwebtoken'); |
| // There's two ways to use Tachyons together with styled-components | |
| // Both are valid, which one you use depends if you want to always apply a tachyons class when a certain component | |
| // is rendered or if you want to apply it for specific instances. | |
| // 1. Use .attrs to define classNames that should always be applied to a styled component | |
| // Whenever you use <Component /> now it'll have both the styled-components as well as the Tachyons class | |
| // See the docs for more info: https://www.styled-components.com/docs/basics#attaching-additional-props | |
| const Component = styled.div.attrs({ | |
| className: 'bw0-l', | |
| })` |
If you'd like to experiment with Terraform on macOS locally, a great provider for doing so is the Docker provider. You can get set up in a few simple steps, like so:
Install Docker for Mac if you have not already.
https://gist.github.com/ljharb/58faf1cfcb4e6808f74aae4ef7944cff
While attempting to explain JavaScript's reduce method on arrays, conceptually, I came up with the following - hopefully it's helpful; happy to tweak it if anyone has suggestions.
JavaScript Arrays have lots of built in methods on their prototype. Some of them mutate - ie, they change the underlying array in-place. Luckily, most of them do not - they instead return an entirely distinct array. Since arrays are conceptually a contiguous list of items, it helps code clarity and maintainability a lot to be able to operate on them in a "functional" way. (I'll also insist on referring to an array as a "list" - although in some languages, List is a native data type, in JS and this post, I'm referring to the concept. Everywhere I use the word "list" you can assume I'm talking about a JS Array) This means, to perform a single operation on the list as a whole ("atomically"), and to return a new list - thus making it mu
| // Create a Promise that resolves after ms time | |
| var timer = function(ms) { | |
| return new Promise(resolve => { | |
| setTimeout(resolve, ms); | |
| }); | |
| }; | |
| // Repeatedly generate a number starting | |
| // from 0 after a random amount of time | |
| var source = async function*() { |