Skip to content

Instantly share code, notes, and snippets.

View vvatikiotis's full-sized avatar

Bill Vatikiotis vvatikiotis

View GitHub Profile
# encoding: utf-8
require 'pry'
module Adhearsion
class Console
include Singleton
delegate :silence!, :unsilence!, :to => Adhearsion::Logging
@vvatikiotis
vvatikiotis / rbenv-install-system-wide.sh
Created August 7, 2016 23:24 — forked from JackNorris/rbenv-install-system-wide.sh
CentOS: rbenv install and system wide install
#!/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
@vvatikiotis
vvatikiotis / bootstrap-ruby.sh
Created August 7, 2016 23:24 — forked from dillera/bootstrap-ruby.sh
Install Ruby with rbenv/ruby-build on Centos6 with openssl
#!/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' },
// ]
//
@vvatikiotis
vvatikiotis / client.js
Last active August 23, 2017 12:24
WIP: Client-server PoC using gulf. Incomplete so far. Changes flow from server to client but not the opposite direction.
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
@vvatikiotis
vvatikiotis / *state-machine-component.md
Created September 7, 2017 07:22 — forked from developit/*state-machine-component.md
265b lib for building pure functional state machine components. https://npm.im/state-machine-component

state-machine-component

A tiny (265 byte) utility to create state machine components using two pure functions.

🔥 JSFiddle Demo

Usage

The API is a single function that accepts 2 pure functions as arguments:

@vvatikiotis
vvatikiotis / type.js
Created September 30, 2017 10:07 — forked from kirilloid/type.js
getType
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
@vvatikiotis
vvatikiotis / FlowTutorial.js
Created October 3, 2017 07:41 — forked from busypeoples/FlowTutorial.js
Flow Fundamentals For JavaScript Developers
// @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