Skip to content

Instantly share code, notes, and snippets.

View brysonian's full-sized avatar

Chandler McWilliams brysonian

View GitHub Profile
@acdlite
acdlite / app.js
Last active April 20, 2026 19:56
Quick and dirty code splitting with React Router v4
// getComponent is a function that returns a promise for a component
// It will not be called until the first mount
function asyncComponent(getComponent) {
return class AsyncComponent extends React.Component {
static Component = null;
state = { Component: AsyncComponent.Component };
componentWillMount() {
if (!this.state.Component) {
getComponent().then(Component => {
@bluehat
bluehat / digital_freedom.markdown
Last active June 7, 2025 00:12
A Citizen's Guide to Digital Freedoms

A Citizen's Guide to Digital Freedoms

0: Background

0.0: What and Why

We're about to hand the architecture for a surveillance police state over to new leadership. Some of Trump's language around free speech and free press has been troubling, and a campaign advisor has already threatened a reporter. This seems like an excellent time for us to create nontechnical educational information on how technology can be used to protect citizen's civil liberties.

The goal of this guide is to create lesson plans which nontechnical people can then use to run classes for groups of nontechnical people. This guide will not make you safe. It will increase your chances of remaining safe for longer. If you are running Windows 10, or a Lenovo laptop, please skip to 4.0 for a discussion of your options before attempting to secure these machines.

0.1 Help Needed

@christianalfoni
christianalfoni / AppLoader.js
Last active March 28, 2017 18:40
Webpack code splitting
import Inferno from 'inferno'
import Component from 'inferno-component'
import {connect} from 'cerebral/inferno'
import {state} from 'cerebral/tags'
import InvalidRoute from './InvalidRoute'
export default connect({
media: state`useragent.media`,
invalidRoute: state`app.invalidRoute`
},
export const getImageWidthByUserContext = (width, MAX_WIDTH = 2880) => {
if (typeof(window) === 'undefined') return width;
// Pixel ratio
let qualityRatio = window.devicePixelRatio ? window.devicePixelRatio : 1;
// If bad connection, we downgrade
let type = null;
if (navigator && navigator.connection && navigator.connection.type) type = navigator.connection.type;
if (navigator && navigator.connection && navigator.connection.effectiveType) type = navigator.connection.effectiveType;
@swalkinshaw
swalkinshaw / tutorial.md
Last active January 5, 2026 14:33
Designing a GraphQL API
@guidoism
guidoism / gist:523fd22f5e306042e01e4a906e03999b
Created September 6, 2022 22:39
Ergogen footprints people have made that aren't in the main repo
https://github.com/50an6xy06r6n/ergogen/blob/master/src/footprints/promicro_rev_routed.js
https://github.com/50an6xy06r6n/ergogen/blob/master/src/footprints/trrs_rev.js
https://github.com/AndrewCloete/ergogen/blob/master/src/footprints/airwire.js
https://github.com/AndrewCloete/ergogen/blob/master/src/footprints/b3u1000p.js
https://github.com/AndrewCloete/ergogen/blob/master/src/footprints/bat.js
https://github.com/AndrewCloete/ergogen/blob/master/src/footprints/frankendiode.js
https://github.com/AndrewCloete/ergogen/blob/master/src/footprints/offsetfrankendiode.js
https://github.com/AndrewCloete/ergogen/blob/master/src/footprints/pcm12.js
https://github.com/AndrewCloete/ergogen/blob/master/src/footprints/promicro_pretty.js
https://github.com/AndrewCloete/ergogen/blob/master/src/footprints/thru.js
import matplotlib.pyplot as plt
import numpy as np
# Parameters (You can adjust these as needed)
roller_diameter = 5 # mm
rollers_num = 12
cycloid_outer_diameter = 60 # mm (will be ignored if lower then minimum)
input_shaft_diameter = 5 # mm
# Function to plot cycloidal points