Skip to content

Instantly share code, notes, and snippets.

@zsup
zsup / ddd.md
Last active April 17, 2024 14:35
Documentation-Driven Development (DDD)

Documentation-Driven Development

The philosophy behind Documentation-Driven Development is a simple: from the perspective of a user, if a feature is not documented, then it doesn't exist, and if a feature is documented incorrectly, then it's broken.

  • Document the feature first. Figure out how you're going to describe the feature to users; if it's not documented, it doesn't exist. Documentation is the best way to define a feature in a user's eyes.
  • Whenever possible, documentation should be reviewed by users (community or Spark Elite) before any development begins.
  • Once documentation has been written, development should commence, and test-driven development is preferred.
  • Unit tests should be written that test the features as described by the documentation. If the functionality ever comes out of alignment with the documentation, tests should fail.
  • When a feature is being modified, it should be modified documentation-first.
  • When documentation is modified, so should be the tests.
npm install serialport
-
> serialport@1.5.0 install /Users/zsupalla/Dropbox (Spark)/Software/Code/spark-cli/node_modules/serialport
> node-pre-gyp install --fallback-to-build
child_process: customFds option is deprecated, use stdio instead.
CXX(target) Release/obj.target/serialport/src/serialport.o
CXX(target) Release/obj.target/serialport/src/serialport_unix.o
../src/serialport_unix.cpp:663:20: warning: comparison of array 'device.locationId' not equal to a null pointer is always true [-Wtautological-pointer-compare]
if (device.locationId != NULL) {
@zsup
zsup / warsting.ino
Last active March 17, 2019 17:44
A snippet of firmware for WarSting, a wardriving sword for Hobbits
/**
* Slay and pillage an unprotected network! ...oh, we can't do that?
* Ok, let's publish an event instead, to a backdrop of flashing lights and
* clashing of metal on metal.
*/
void vanquishOpenNetwork() {
if (!openNetworkCount || !strongest.rssi)
return;
RGB.control(false); // allow the system to control the LED so we can see cloud connection progress
makeSound();
@zsup
zsup / motion.cpp
Last active September 27, 2017 19:35
Spark.publish() + PIR motion sensor
/*
* Connected sensor
* Spark.publish() + PIR motion sensor = awesome
* Thanks to Adafruit for the reference and inspiration
*/
int inputPin = D0; // choose the input pin (for PIR sensor)
int pirState = LOW; // we start, assuming no motion detected
int val = 0; // variable for reading the pin status
int calibrateTime = 10000; // wait for the thingy to calibrate
TCPClient client;
void setup() {
Serial.begin(9600);
Spark.function("connect", connect_to_my_server);
for (int pin = D0; pin <= D7; ++pin) {
pinMode(pin, OUTPUT);
}
TCPClient client;
void setup() {
Serial.begin(9600);
Spark.function("connect", connect_to_my_server);
for (int pin = D0; pin <= D7; ++pin) {
pinMode(pin, OUTPUT);
}
TCPClient client;
void setup() {
Serial.begin(9600);
Spark.function("connect", connect_to_my_server);
for (int pin = D0; pin <= D7; ++pin) {
pinMode(pin, OUTPUT);
}
@zsup
zsup / gist:7843623
Last active December 30, 2015 14:39
Spark Servo, first commit
/**
******************************************************************************
* @file spark_wiring_servo.h
* @author Zach Supalla
* @version V1.0.0
* @date 06-December-2013
* @brief Header for spark_wiring_servo.h module
******************************************************************************
Copyright (c) 2013 Spark Labs, Inc. All rights reserved.
Copyright (c) 2010 LeafLabs, LLC.
@zsup
zsup / spark-motion.c
Last active December 20, 2015 14:09
A Gist describing the code on a Spark-powered security system (motion detector and buzzer).
int motion = 0;
int buzzer = 1;
void setup() {
pinMode(motion, INPUT);
pinMode(buzzer, OUTPUT);
Spark.variable(motion);
Spark.function(buzz);
}
@zsup
zsup / test gist
Created May 27, 2013 22:29
This is a test gist
test