- 1940s : "In my day we wrote down our problems"
- 1950s : "In my day we plugged wires in manually"
- 1970s : "In my day we read punch cards not "key" boards"
- 1980s : "In my day we deserialized the baud connections manually"
- 1990s : "In my day we read a shared key state mask"
- 2000s : "In my day we listened for when buttons are pressed on the BIOS itself"
- 2010s : "In my day we read our chars from a buffer"
- 2020s : "In my day we waited for keys to be pressed"
- 2030s : "In my day we used to have movies about terminators"
| import { absolutizeRelativeSelectorList } from "http://dev.w3.org/csswg/selectors/#absolutizing"; | |
| // Assume JSIDL conversions have been applied already, | |
| // i.e. we don't do `selectors = String(selectors)` manually. | |
| class Elements extends Array { | |
| query(selectors) { | |
| return this.queryAll(selectors)[0]; // highly inefficient obviously, but clear semantics | |
| } | |
| queryAll(selectors) { |
| var five = require('johnny-five'); | |
| var board = new five.Board(); | |
| board.on("ready", function () { | |
| var leds = new Array(5); | |
| for (var i = 0; i < 5; i++) { | |
| leds[i] = new five.Led({pin: i + 5}); | |
| } |
| #include <stdio.h> | |
| int main() { | |
| int *p = 0; | |
| char line[1024]; | |
| printf("> "); | |
| fgets(line, 1024, stdin); | |
| *p = 12; |
| var five = require('../lib/johnny-five.js'), | |
| board, button; | |
| board = new five.Board(); | |
| board.on("ready", function() { | |
| this.firmata.sendI2CConfig(); | |
| var LSM303_CTRL_REG1_A = 0x20 | |
| , LSM303_CTRL_REG2_A = 0x21 |
| #include <Process.h> | |
| void setup() { | |
| Bridge.begin(); | |
| Serial.begin(9600); | |
| while (!Serial) | |
| ; | |
| Serial.println("Invoking patch script on Yun."); |
The following example uses the '::' operator which has a proposal already and a champion on the committee. Other than the bind operator, the example I give uses no new syntax (other than what is new to ES6), and could fairly easily be polyfilled - though I expect it could be optimized if implemented natively. If you haven't seen Clojure protocols, they allow for single dispatch polymorpism based on type, without the methods being defined as part of that type. In clojure, they use the first parameter, but for my proposal, it uses the receiver (this), and uses the bind operator to make the call look similar to a normal method call. While I haven't actually written an implementation of the Protocol class I demonstrate here, I've thought enough about it that I feel it could be done in a few different ways without too much complexity.
/**
- The following module is a sampling of underscore methods conver
This document will help you get started with controlling an Orbotix Sphero using Node.js.
There are several different libraries for controlling the Sphero. Currently, the best one seems to be spheron. This module provides a simple interface to the Sphero API.
There is also CylonJS, but this just uses the spheron module and exposes the same API, so unless you are already using Cylon to control different hardware it probably makes sense to just use spheron directly.
This simple script will take a picture of a whiteboard and use parts of the ImageMagick library with sane defaults to clean it up tremendously.
The script is here:
#!/bin/bash
convert "$1" -morphology Convolve DoG:15,100,0 -negate -normalize -blur 0x1 -channel RBG -level 60%,91%,0.1 "$2"
| var firmata = require('firmata'); | |
| var repl = require('repl'); | |
| var board = new firmata.Board('/dev/ttyAMA0',function(err){ | |
| //arduino is ready to communicate | |
| if (err) { | |
| console.log("err:" + err); | |
| return; | |
| } | |
| console.log("Firmata Firing LEDs"); |