A tiny (265 byte) utility to create state machine components using two pure functions.
The API is a single function that accepts 2 pure functions as arguments:
| # encoding: utf-8 | |
| require 'pry' | |
| module Adhearsion | |
| class Console | |
| include Singleton | |
| delegate :silence!, :unsilence!, :to => Adhearsion::Logging | 
| #!/bin/bash | |
| # CentOS rbenv system wide installation script | |
| # Forked from https://gist.github.com/1237417 | |
| # Installs rbenv system wide on CentOS 5/6, also allows single user installs. | |
| # Install pre-requirements | |
| yum install -y gcc-c++ patch readline readline-devel zlib zlib-devel libyaml-devel libffi-devel openssl-devel \ | |
| make bzip2 autoconf automake libtool bison iconv-devel git-core | 
| #!/bin/bash | |
| set -e # exit on error | |
| ### README | |
| # * installs your desired ruby versions using rbenv | |
| # ** including openssl (needed by bundler) | |
| # ** including sqlite (probably needed for rails apps) | |
| # | |
| # Before you start: | |
| # * put ssh-keys in place | 
| // npm i -S react-autosuggest autosuggest-highlight | |
| import Autosuggest from 'react-autosuggest' | |
| const match = require('autosuggest-highlight/match') | |
| const parse = require('autosuggest-highlight/parse') | |
| const onSuggestionsFetchRequested = curry((suggest, { value }) => { | |
| return suggest(value) | |
| .then((fsa) => { | |
| return { options: fsa.payload } | 
| // Takes an array of objects and turns it into an object where: | |
| // - keys are specified by the key argument | |
| // - values are the the initial object, minus the specified key | |
| // Example: | |
| // const arr = [ | |
| // { id: 1, name: 'blah', address: 'qwerqwer' }, | |
| // { id: 2, name: 'blah', address: 'qwerqwer' }, | |
| // { id: 6, name: 'blah', address: 'qwerqwer' }, | |
| // ] | |
| // | 
| const textOT = require('ot-text').type | |
| const gulf = require('gulf') | |
| const net = require('net') | |
| var doc = new gulf.EditableDocument({ | |
| storageAdapter: new gulf.MemoryAdapter, | |
| ottype: textOT, | |
| }) | |
| let content | 
A tiny (265 byte) utility to create state machine components using two pure functions.
The API is a single function that accepts 2 pure functions as arguments:
| function getType (value) { | |
| let type = typeof value; | |
| if (type === 'object') { | |
| return value ? Object.prototype.toString.call(value).slice(8, -1) : 'null'; | |
| } | |
| return type; | |
| } | |
| [NaN, 0, 1, Infinity, // numbers | |
| null, undefined, false, 'str', // other primitives | 
| // @flow | |
| // Flow Fundamentals For JavaScript Developers | |
| /* | |
| Tutorial for JavaScript Developers wanting to get started with FlowType. | |
| Thorough walkthrough of all the basic features. | |
| We will go through the basic features to gain a better understanding of the fundamentals. | |
| You can uncomment the features one by one and work through this tutorial. | 
| function downloadFiles(files /*: Array<string> */) { | |
| // Do not fetch more than 8 files at a time | |
| const PARALLEL_DOWNLOADS = Math.min(8, files.length); | |
| // Create an Iterator from the array, this is our download queue | |
| const queue = files[Symbol.iterator](); | |
| // Channels are our download workers. As soon as a channel finishes downloading a file, | |
| // it begins fetching another file from the queue. Best effort | |
| const channels = []; | |
| // Create only PARALLEL_DOWNLOADS number of channels |