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 / Preferences.sublime-settings.txt
Created July 7, 2016 13:08
Sublime 3: User Preferences With Comments
{
// Always prompt before reloading a file, even if the file hasn't been
// modified. The default behavior is to automatically reload a file if it
// hasn't been edited. If a file has unsaved changes, a prompt will always
// be shown.
"always_prompt_for_file_reload": false,
// Always visualise the viewport on the minimap, as oppossed to only
// showing it on mouse over
"always_show_minimap_viewport": false,
@senderista
senderista / spotlight.sh
Last active November 17, 2017 02:38
Some ack-style Spotlight search functions
BOLD=`echo -e '\033[1m'`
BLACK=`echo -e '\033[30m'`
RED=`echo -e '\033[31m'`
GREEN=`echo -e '\033[32m'`
YELLOW=`echo -e '\033[33m'`
BLUE=`echo -e '\033[34m'`
MAGENTA=`echo -e '\033[35m'`
CYAN=`echo -e '\033[36m'`
WHITE=`echo -e '\033[37m'`
BG_BLACK=`echo -e '\033[40m'`
@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.

@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;