Skip to content

Instantly share code, notes, and snippets.

View JoeyBurzynski's full-sized avatar
💭
Hacking away on @EdgeSEO tools.

Joey Burzynski JoeyBurzynski

💭
Hacking away on @EdgeSEO tools.
View GitHub Profile
@JoeyBurzynski
JoeyBurzynski / npm-tips-and-tricks.md
Created February 20, 2018 08:29
NPM: Tips & Tricks (02.20.2018)

NPM Tips & Tricks (02.20.2018)

Basics

Installing a package:

Regular: npm install pkg, Shorthand: npm i pkg.

Installing a package globally:

Regular: npm i --global pkg, Shorthand: npm i -g pkg.

Enable macOS Server Performance Mode

Performance mode changes the system parameters of your Mac. These changes take better advantage of your hardware for demanding server applications.

A Mac with macOS Server that needs to run high-performance services can turn on performance mode to dedicate additional system resources for server applications. Note, however, that performance mode can be enabled even without macOS Server being installed to achieve similar benifits for other high-performance services.

sudo nvram boot-args="serverperfmode=1 $(nvram boot-args 2>/dev/null | cut -f 2-)"
sudo reboot

Reference: https://support.apple.com/en-us/HT202528.

@JoeyBurzynski
JoeyBurzynski / npm-config.md
Created January 22, 2019 12:19 — forked from AliMD/npm-config.md
Optimize NPM for faster installing packages

AliMd npm config

Optimize NPM for faster installing packages

Strong recommended

npm config set registry http://registry.npmjs.org/
npm config set loglevel info
npm config set fetch-retries 3
npm config set fetch-retry-mintimeout 15000
npm config set fetch-retry-maxtimeout 90000
@JoeyBurzynski
JoeyBurzynski / letsencrypt_2018.md
Created February 8, 2019 10:08 — forked from cecilemuller/letsencrypt_2020.md
How to setup Let's Encrypt for Nginx on Ubuntu 18.04 (including IPv6, HTTP/2 and A+ SSL rating)

How to setup Let's Encrypt for Nginx on Ubuntu 18.04 (including IPv6, HTTP/2 and A+ SLL rating)


Virtual hosts

Let's say you want to host domains first.com and second.com.

Create folders for their files:

@JoeyBurzynski
JoeyBurzynski / syncUbuntuInstance.sh
Created March 18, 2019 08:30
Sync Remote Ubuntu Instance with rsync via SSH (Remote to Local)
#!/usr/bin/env bash
# Synchronize content from remote Ubuntu instance to local file path with rsync via SSH
function syncUbuntuInstance () {
if [ -z "$1" ] || [ -z "$2" ]; then
echo
echo "What the hell am I trying to sync? Give me a user and hostname."
echo "Usage: $0 <ssh user> <hostname>"
echo
exit 0
@JoeyBurzynski
JoeyBurzynski / change-file-extensions.sh
Created March 25, 2019 13:22
Bash Script: Change File Extension of All Files in a Folder
#!/bin/bash
# Bash Script: Change All Files Extension in a Folder
# Usage: change-file-extensions <current file extension> <new file extension>
# Example: change-file-extensions xml json
function changeFileExtensions() {
if [[ -z $1 || -z $2 ]]; then
echo
echo "What file extensions am I working with? Please provide <current> and <new>."
@JoeyBurzynski
JoeyBurzynski / ruby-hash-value-string-match.rb
Created April 5, 2019 07:27
Ruby: Search an Object / Hash Values for Matching Strings with Regex
# Define words to search for "matching patterns"
PATTERN_TYPES = {
# %w is just short hand to create an array of strings
camouflage: %w[
a-tacs
bonz
camo
camoflage
camouflage
harvest moon
@JoeyBurzynski
JoeyBurzynski / mongodb-aggregation-pipeline-caltrend.js
Last active April 5, 2019 07:35
MongoDB Aggregation Pipeline: CalTrend
db.getCollection("caltrend").aggregate(
// Pipeline
[
// Stage 1
{
$project: {
_id : 1,
vendor_part_number: "$PartNumber",
vendor: "$BrandLabel",
# Change YOUR_TOKEN to your prerender token and uncomment that line if you want to cache urls and view crawl stats
# Change example.com (server_name) to your website url
# Change /path/to/your/root to the correct value
# Generate $prerender_ua bool value based on user agent
# indexation bots will get this as 1,
# prerender user agent will always get 0 (avoid loops)
map $http_user_agent $prerender_ua {
default 0;
@JoeyBurzynski
JoeyBurzynski / 55-bytes-of-css.md
Last active May 15, 2024 20:11
58 bytes of css to look great nearly everywhere

58 bytes of CSS to look great nearly everywhere

When making this website, i wanted a simple, reasonable way to make it look good on most displays. Not counting any minimization techniques, the following 58 bytes worked well for me:

main {
  max-width: 38rem;
  padding: 2rem;
  margin: auto;
}