git clone https://gist.github.com/6780d7cc0cabb1b4d6c8.git
$ npm install # maybe npm start will take care of it but just in case
$ npm start && open out.png
> [email protected] start /Users/bsergean/src/offscreen_sample
git clone https://gist.github.com/6780d7cc0cabb1b4d6c8.git
$ npm install # maybe npm start will take care of it but just in case
$ npm start && open out.png
> [email protected] start /Users/bsergean/src/offscreen_sample
| var budo = require('budo') | |
| var server = budo('src/client.js') | |
| .on('connect', function (ev) { | |
| mainWindow.loadUrl(ev.uri) | |
| mainWindow.once('close', function () { | |
| server.close() | |
| }) | |
| }) | |
| .on('update', function(file, contents) { |
| # !/usr/bin/env python | |
| import os, re, argparse, json | |
| parser = argparse.ArgumentParser( | |
| description='Extract code from ShaderToy json.') | |
| parser.add_argument('input') | |
| parser.add_argument('output') | |
| args = parser.parse_args() |
First experiments with NodeMCU to publish the current settings of my adjustable height working desk to MQTT.
NodeMCU can be found here: https://github.com/nodemcu/nodemcu-firmware
Note that you'll need a current version with support for floats (which the ultrasonic sensor library utilizes), I'm using 0.9.5 2015-03-18 with float support myself.
Support for the HC-SR04 sensor in NodeMCU can be found here: https://github.com/sza2/node_hcsr04
I provided my slightly adjusted version which makes measuring a non-blocking afair, allowing for callbacks when the measurement completes.
| import ParentStream from "workerstream/parent"; | |
| global.stream = ParentStream(); |
| var Bar1 = base => class extends base { | |
| componentWillMount(){ | |
| super.componentWillMount(); | |
| console.log('Bar1'); | |
| } | |
| }; | |
| var Bar2 = base => class extends base { | |
| componentWillMount(){ | |
| super.componentWillMount(); |
While this gist has been shared and followed for years, I regret not giving more background. It was originally a gist for the engineering org I was in, not a "general suggestion" for any React app.
Typically I avoid folders altogether. Heck, I even avoid new files. If I can build an app with one 2000 line file I will. New files and folders are a pain.
This is a set up for projects which want to check in only their source files, but have their gh-pages branch automatically updated with some compiled output every time they push.
A file below this one contains the steps for doing this with Travis CI. However, these days I recommend GitHub Actions, for the following reasons:
These macros are designed to provide a literal notation for [immutable-js][1] using [sweetjs][2].
The most interesting being the Map literal
var map = im{"foo": "bar", "baz": "quux"};This compiles to the 2d array version of Immutable.Map.
| var mqtt = require('mqtt') | |
| // Make sure to change this to the IP address of your MQTT server | |
| , host = '192.168.128.204' // or localhost | |
| client = mqtt.createClient(1883, host, {keepalive: 10000}); | |
| // Subscribe to the temperature topic | |
| client.subscribe('temperature'); | |
| // When a temperature is published, it will show up here | |
| client.on('message', function (topic, message) { |