Skip to content

Instantly share code, notes, and snippets.

Step by Step CRUD

Understand the Domain

  1. Discuss the domain (with others or yourself).
  2. Write down the user stories (features that you plan to support).
  3. Develop an understand of how each noun (model/table) will relate to each other.

Schema

  1. Draw the schema. Don't name any join tables as the combination of two other tables, find a unique noun.
  2. Double check your schema for any columns that don't follow convention (e.g. foreign keys should end in _id).
@aamharris
aamharris / button_state.ino
Created January 31, 2020 04:25
Control LED in Arduino
const int buttonPin = 17;
const int ledPin = 21;
int buttonState = 0;
int lastButtonState = 0;
bool isLightOn = false;
void setup() {
pinMode(buttonPin, INPUT);
pinMode(ledPin, OUTPUT);
@aamharris
aamharris / light_mqtt_template.ino
Created March 26, 2020 03:41
ESP32 IoT Light Controller with CloudMqtt
#include <WiFi.h>
#include <PubSubClient.h>
//replace details with your wifi credentials
const char* ssid = "your-ssid";
const char* password = "your-password";
const int buttonPin = 17;
const int ledPin = 21;