Skip to content

Instantly share code, notes, and snippets.

@paulcuth
paulcuth / init.lua
Last active August 29, 2015 14:10
Creates a web server that controls a shift register on an ESP8266.
gpio.write(8,0) --> Input
gpio.write(9,0) --> Clock
current = 8;
function set (val)
local zeros = 0
local ones = 0
if (val < current) then
@paulcuth
paulcuth / shim-global.lua
Last active December 9, 2017 09:44
A choice of quick cheats for those that don't have time to keep referring to the ESP8266 GPIO pin -> IO index map.
-- You could setup global vars:
for k,v in ipairs{3,10,4,9,2,1,nil,nil,nil,11,12,nil,6,7,5,8,0} do _G['GPIO'..k-1]=v end
-- and use them like this:
gpio.mode(GPIO2, gpio.OUTPUT)
gpio.write(GPIO2, gpio.WRITE)
@paulcuth
paulcuth / deploying-sailor-to-heroku.md
Created July 22, 2015 20:46
Deploying Sailor to Heroku

Deploying Sailor to Heroku

Getting set up

Heroku basics

You will need to create an Heroku account if you don't have one already. You'll also need to install the Heroku Toolbelt, which includes the Heroku CLI that we'll be using shortly.

Sailor basics

Follow the installation instructions for your platform in the Sailor docs, but essentially all you need is the sailor CLI.

Running ES6 in Node

The latest versions of Node do support most of the ES6 syntax. However, notably, they still do not support import and export expressions. In order to use these espressions we can turn to Babel.

Babel provides a wrapper around Node that automatically translates a given source file before running it in the normal Node application installed on your machine. This wrapper application is called babel-node and is provided in the babel-cli package.

However, import and export translators are not in the core Babel functionality, we'll need to add a preset. The translators needed here are in the es2015 Babel preset.