Skip to content

Instantly share code, notes, and snippets.

View dotspencer's full-sized avatar

Spencer Smith dotspencer

View GitHub Profile
@dotspencer
dotspencer / javascript.json
Last active November 4, 2021 20:29
JavaScript User Snippets in VSCode (nlog, named log) vs code
{
"Named console log": {
"prefix": "nlog",
"body": [
"console.log('$1:', $1);",
],
"description": "Log output to console"
}
}
@dotspencer
dotspencer / google-wifi-setup-centurylink.md
Last active October 3, 2023 01:53
How to use Google WiFi with CenturyLink Internet (ZyXEL C3000Z, 80mbps, modem bridge)
@dotspencer
dotspencer / vs-code-dislike.md
Last active November 20, 2018 23:37
Things I dislike about VS Code

Copying text from the editor brings along a bunch of formatted crap (when pasting into wysiwyg editors) vs Atom's plain-text copy

FIX: editor setting → copy with syntax highlighting

No tab highlighting for modified/un-staged files when using git. Tab text color in Atom is changed to yellow to match sidebar

@dotspencer
dotspencer / debugging-nginx.md
Last active April 5, 2025 16:11
Debugging NGINX

Check to see if nginx is running:

ps aux | grep nginx

Find what process is bound to a port:

lsof -n -i:8003

tcp dump of all traffic on port

@dotspencer
dotspencer / app.js
Last active October 2, 2018 22:59
Sample api validation using yup
const express = require('express');
const yup = require('yup');
const app = express();
app.get('/api/user/new', async (req, res) => {
const valid = await validateParams(req, res, {
name: yup.string().required('Name is required'),
extern_id: yup.string().required('Please select a location'),
});
@dotspencer
dotspencer / nginx-setup-mac.md
Last active April 2, 2022 04:03
NGINX setup on Mac

Install NGINX:

brew install nginx

Start NGINX (as background service):

brew services start nginx
sudo nginx # to start for first time

Move to macOS config location and create symlink so it can be accessed like Ubuntu with cd /etc/nginx

@dotspencer
dotspencer / yarn-install.md
Created June 25, 2018 19:05
Install Yarn without messing up nvm

Yarn documentation now says that Yarn can be installed on a Mac, via Homebrew, without node, like this:

brew install yarn --without-node

@dotspencer
dotspencer / hours-worked.js
Last active May 11, 2018 15:47
Hours worked script
var hoursWorked = ["10:03", "9:01", "8:58", "7:40"];
var timePattern = /(\d+):(\d+)/;
var hours = hoursWorked.map(h => {
var match = h.match(timePattern);
var hours = parseInt(match[1]);
var min = parseInt(match[2]);
hours += (min / 60);
return hours;
});
@dotspencer
dotspencer / restricted.txt
Created May 8, 2018 01:17
Restricted Keywords in MySQL 5.7
ACCESSIBLE
ADD
ALL
ALTER
ANALYZE
AND
AS
ASC
ASENSITIVE
BEFORE
@dotspencer
dotspencer / tag.md
Last active May 4, 2018 21:36
Git tagging walkthrough

So to start you have a new feature implemented on a branch.

After code review and QA testing, you merge the branch into master.

# To create the release tag, checkout the master branch
git checkout master

git pull
git fetch --all