Skip to content

Instantly share code, notes, and snippets.

@mattwoodco
mattwoodco / README.md
Created September 19, 2023 09:29 — forked from kfox/README.md
TCP echo server for Node.js

TCP echo server for Node.js

Usage

  1. Make sure you have a modern-ish version of Node.js installed.
  2. Type npx https://gist.github.com/kfox/1280c2f0ee8324067dba15300e0f2fd3
  3. Connect to it from a client, e.g. netcat or similar: nc localhost 9000
@mattwoodco
mattwoodco / complex.md
Last active February 21, 2023 21:32
Form Schema examples
# Injection Molding Quality Control Form

## Defect Type

- Defect Type: `select` (required, options: "Short Shot", "Flash", "Sink Mark", "Weld Line")
- Short Shot
  - Material Type: `select` (required, options: "Polyethylene", "Polypropylene", "Polystyrene")
  - Short Shot Weight: `number` (required, minimum 0, validation: "Short Shot Weight must be greater than 0")
  - Short Shot Volume: `number` (required, minimum 0, validation: "Short Shot Volume must be greater than 0")
@mattwoodco
mattwoodco / getDerivedStateFromProps.js
Created September 18, 2018 17:37
Update state based on props change
...
static getDerivedStateFromProps(nextProps, prevState) {
// Store prevId in state so we can compare when props change.
// Clear out previously-loaded data (so we don't render stale stuff).
if (nextProps.id !== prevState.prevId) {
return {
externalData: null,
prevId: nextProps.id
};
@mattwoodco
mattwoodco / settings.json
Last active May 12, 2024 17:18
VSCode Windows User Settings
{
"breadcrumbs.enabled": false,
"css.validate": false,
"debug.console.fontFamily": "Menlo, Monaco, 'Courier New', monospace",
"editor.fontFamily": "Roboto Mono, Menlo, Monaco, 'Courier New', monospace",
"editor.codeActionsOnSave": ["source.addMissingImports"],
"[prisma]": {
"editor.defaultFormatter": "Prisma.prisma"
},
"editor.copyWithSyntaxHighlighting": true,
code --install-extension 2gua.rainbow-brackets
code --install-extension CoenraadS.bracket-pair-colorizer
code --install-extension DavidAnson.vscode-markdownlint
code --install-extension EQuimper.react-native-react-redux
code --install-extension EditorConfig.EditorConfig
code --install-extension Equinusocio.vsc-material-theme
code --install-extension IBM.output-colorizer
code --install-extension PKief.material-icon-theme
code --install-extension PeterJausovec.vscode-docker
code --install-extension Shan.code-settings-sync
@mattwoodco
mattwoodco / .gitconfig
Last active June 4, 2024 03:42
Git Config
[user]
name = Clark Kent
email = [email protected]
[alias]
# Shortcut for commit with all and message
c = commit -am
# Update your repo based on current changes
up = !git pull --rebase --autostash
# Push changes
@mattwoodco
mattwoodco / user.settings.json
Last active April 1, 2018 18:15
VSCode Settings
{
"window.zoomLevel": 1,
"workbench.startupEditor": "newUntitledFile",
"emmet.triggerExpansionOnTab": true,
"emmet.includeLanguages": {
"javascript": "javascriptreact"
},
"prettier.jsxBracketSameLine": true,
"editor.formatOnSave": true,
"editor.minimap.enabled": false,
@mattwoodco
mattwoodco / init.coffee
Created January 26, 2016 15:00 — forked from Zequez/init.coffee
Comment out JSX code on Atom
# If you worked with React and JSX you probably noticed that you can't use JS comments when inside JSX sections
# Add this to your Atom init script
# Then add 'ctrl-cmd-/': 'comment-jsx' to your keymap.cson
# Then when you are on a JS/JSX file, just press cmd+ctrl+/ to use JSX-style comments that work with JSX elements
# Is not the most efficient way, but it's the cleanest and reliable one
atom.commands.add 'atom-workspace', 'comment-jsx', ->
atom.config.set('editor.commentStart', '{/*', {scopeSelector: '.source.js.jsx'})
atom.config.set('editor.commentEnd', '*/}', {scopeSelector: '.source.js.jsx'})
for selection in atom.workspace.getActiveTextEditor().selections
[user]
name = YOUR_USERNAME
email = YOUR_GITHUB_ACCOUNT_EMAIL
[alias]
c = commit -am
up = pull
p = push
pu = push origin HEAD
s = status
@mattwoodco
mattwoodco / trello-css-guide.md
Created November 16, 2015 20:33 — forked from bobbygrace/trello-css-guide.md
Trello CSS Guide

Trello CSS Guide

“I perfectly understand our CSS. I never have any issues with cascading rules. I never have to use !important or inline styles. Even though somebody else wrote this bit of CSS, I know exactly how it works and how to extend it. Fixes are easy! I have a hard time breaking our CSS. I know exactly where to put new CSS. We use all of our CSS and it’s pretty small overall. When I delete a template, I know the exact corresponding CSS file and I can delete it all at once. Nothing gets left behind.”

You often hear updog saying stuff like this. Who’s updog? Not much, who is up with you?

This is where any fun you might have been having ends. Now it’s time to get serious and talk about rules.

Writing CSS is hard. Even if you know all the intricacies of position and float and overflow and z-index, it’s easy to end up with spaghetti code where you need inline styles, !important rules, unused cruft, and general confusion. This guide provides some architecture for writing CSS so it stays clean and ma