Skip to content

Instantly share code, notes, and snippets.

👨‍💻
Full-time @ remote.it

Dana Woodman danawoodman

👨‍💻
Full-time @ remote.it
Block or report user

Report or block danawoodman

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View test.md

Hello world

This is a test.

  • Foo
  • Bar
  • Baz

Hello

@danawoodman
danawoodman / examples.js
Created Mar 11, 2019
Javascript array examples
View examples.js
// 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]
View doorlock.rules
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"
@danawoodman
danawoodman / relay-improved.js
Created Jul 19, 2018
Control a generic USB relay using node-hid. Handles up to 8 relays.
View relay-improved.js
/**
* 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
@danawoodman
danawoodman / relay.js
Last active Jul 19, 2018
Turn on a generic USB relay using node-hid, naive approach
View relay.js
/**
* 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
@danawoodman
danawoodman / react-router-basic.js
Last active Jul 3, 2018
Basic React Router setup with Async
View react-router-basic.js
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: [] }]
View aliases.bash
alias -='cd -'
alias ..='cd ..'
alias ..-='cd .. && cd -'
alias ...='cd ../..'
alias ....='cd ../../..'
alias .....='cd ../../../..'
alias be='bundle exec'
alias cl='clear'
alias cleanup='find . -name '\''*.DS_Store'\'' -type f -ls -delete'
alias d='docker'
View product-list.jsx
import React, { Component } from "react";
function ProductItem({ product }) {
return (
<li>
{product.name} {product.price}
</li>
);
}
@danawoodman
danawoodman / index.js
Last active Dec 22, 2016
Example of using WebPack to create frontend assets for a non-SPA (Single Page App) project where you selectively load React components within specific templates.
View index.js
import MyStuff from 'frontend/components/my-stuff'
module.exports = {
renderStuff(node, props) {
// Wrap in <Provider/> here too if using Redux
ReactDOM.render(<MyStuff {...props} />, node)
}
}
View webpack.config.js
const path = require('path')
const NODE_ENV = process.env.NODE_ENV || 'development'
const outputFile = 'pdfmake.js'
const libraryName = 'pdfmake'
const config = {
entry: './src/browser-extensions/pdfMake.js',
output: {
path: path.join(__dirname, './build'),
You can’t perform that action at this time.