Skip to content

Instantly share code, notes, and snippets.

View cgutwin's full-sized avatar

Chris Gutwin cgutwin

View GitHub Profile
@cgutwin
cgutwin / QuaggaScanner.jsx
Last active September 17, 2020 06:38
An implementation of the Quagga QR scanner as a React component.
// Copyright (c) 2020 Chris Gutwin. All rights reserved.
// This work is licensed under the terms of the MIT license.
// For a copy, see <https://choosealicense.com/licenses/mit/>.
//
// An implementation of the Quagga 1 QR scanner as a React component.
// Mitigates false positives by quickly taking multiple scans, and using the most detected of n = 40 scans.
// This isn't really needed anymore from my limited testing, Quagga 2 (@ericblade/quagga2) seems to have fewer false positives.
// Feel free to abstract away the non-React functions. They clutter up the component and make it feel non-component like.
import Quagga from 'quagga'
import React, { useEffect, useState } from 'react'
@tracker1
tracker1 / 01-directory-structure.md
Last active November 7, 2025 05:49
Anatomy of a JavaScript/Node project.

Directory structure for JavaScript/Node Projects

While the following structure is not an absolute requirement or enforced by the tools, it is a recommendation based on what the JavaScript and in particular Node community at large have been following by convention.

Beyond a suggested structure, no tooling recommendations, or sub-module structure is outlined here.

Directories

  • lib/ is intended for code that can run as-is
  • src/ is intended for code that needs to be manipulated before it can be used