Below outlines the general git workflow I find works well in most situations/teams/projects.
Make sure master is up to date before starting a feature branch.
import React, { Component } from "react"; | |
import logo from "./logo.svg"; | |
import "./App.css"; | |
import { BrowserRouter as Router, Route, Link } from "react-router-dom"; | |
const COMPANIES = [ | |
{ | |
id: 1, | |
name: "Foo", | |
accounts: [{ id: 4, name: "SubAccount", accounts: [] }] |
/** | |
* Control a USB relay board using USB. | |
* | |
* This code helped a lot in the understanding of what they boards | |
* expect for hex inputs: | |
* https://github.com/jaketeater/Very-Simple-USB-Relay/blob/master/relay.py | |
*/ | |
const HID = require('node-hid') | |
const ON = 0xfe |
/** | |
* Control a USB relay board using USB. | |
* | |
* This code helped a lot in the understanding of what they boards | |
* expect for hex inputs: | |
* https://github.com/jaketeater/Very-Simple-USB-Relay/blob/master/relay.py | |
*/ | |
const HID = require('node-hid') | |
const ALL_ON = 0xfe |
SUBSYSTEM=="input", GROUP="input", MODE="0666" | |
SUBSYSTEM=="usb", ATTRS{idVendor}=="16c0", ATTRS{idProduct}=="05df", MODE:="666", GROUP="plugdev" | |
KERNEL=="hidraw*", ATTRS{idVendor}=="16c0", ATTRS{idProduct}=="05df", MODE="0666", GROUP="plugdev" |
// Lots of examples here: | |
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array | |
const arr = [ 1, 2, 3 ] | |
// first item in array: | |
arr[0] | |
// last item: | |
arr[2] |
<script lang="ts"> | |
export let label: string | |
export let type: string = "text" | |
export let value: string = "" | |
export let disabled: boolean = false | |
export let validate: (val: string) => boolean | |
export let valid: boolean = false | |
let id = `field-${Math.floor(Math.random() * 1000)}` |
Using WebSockets, React and Reflux together can be a beautiful thing, but the intial setup can be a bit of a pain. The below examples attempt to offer one (arguably enjoyable) way to use these tools together.
This trifect works well if you think of things like so:
this.state
in react should instead live within stores. Stores can listen to other stores as well as to events being fired.var fs = require('fs'); | |
var PDFDocument = require('pdfkit'); | |
var pdf = new PDFDocument({ | |
size: 'LEGAL', // See other page sizes here: https://github.com/devongovett/pdfkit/blob/d95b826475dd325fb29ef007a9c1bf7a527e9808/lib/page.coffee#L69 | |
info: { | |
Title: 'Tile of File Here', | |
Author: 'Some Author', | |
} | |
}); |