Skip to content

Instantly share code, notes, and snippets.

View Raywire's full-sized avatar
๐ŸŽฏ
Focusing

Ryan Wire Raywire

๐ŸŽฏ
Focusing
View GitHub Profile
@Raywire
Raywire / node_nginx_ssl.md
Created September 24, 2019 16:35 — forked from bradtraversy/node_nginx_ssl.md
Node app deploy with nginx & SSL

Node.js Deployment

Steps to deploy a Node.js app to Digital Ocean using PM2, NGINX as a reverse proxy and an SSL from LetsEncrypt

1. Sign up for Digital Ocean

If you use the referal link below, you get $10 free (1 or 2 months) https://m.do.co/c/5424d440c63a

2. Create a droplet and log in via ssh

I will be using the root user, but would suggest creating a new user

@Raywire
Raywire / axios-catch-error.js
Created February 27, 2020 18:45 — forked from fgilio/axios-catch-error.js
Catch request errors with Axios
/*
* Handling Errors using async/await
* Has to be used inside an async function
*/
try {
const response = await axios.get('https://your.site/api/v1/bla/ble/bli');
// Success ๐ŸŽ‰
console.log(response);
} catch (error) {
// Error ๐Ÿ˜จ
@Raywire
Raywire / array_dupplicate_counter.js
Created March 12, 2020 23:53 — forked from ralphcrisostomo/array_dupplicate_counter.js
Javascript: Count duplicates in an array
/**
Problem:
You have a javascript array that likely has some duplicate values and you would like a count of those values.
Solution:
Try this schnippet out.
*/
@Raywire
Raywire / reduce-example.js
Created March 13, 2020 01:28 — forked from benwells/reduce-example.js
Using Array.reduce to sum a property in an array of objects
var accounts = [
{ name: 'James Brown', msgCount: 123 },
{ name: 'Stevie Wonder', msgCount: 22 },
{ name: 'Sly Stone', msgCount: 16 },
{ name: 'Otis Redding', msgCount: 300 } // Otis has the most messages
];
// get sum of msgCount prop across all objects in array
var msgTotal = accounts.reduce(function(prev, cur) {
return prev + cur.msgCount;
@Raywire
Raywire / service-worker.js
Created December 22, 2020 16:44 — forked from jeffposnick/service-worker.js
Example of InjectManifest in Workbox v5
// Add any other logic here as needed.
import { CacheableResponsePlugin } from 'workbox-cacheable-response/CacheableResponsePlugin';
import { CacheFirst } from 'workbox-strategies/CacheFirst';
import { createHandlerForURL } from 'workbox-precaching/createHandlerForURL';
import { ExpirationPlugin } from 'workbox-expiration/ExpirationPlugin';
import { NavigationRoute } from 'workbox-routing/NavigationRoute';
import { precacheAndRoute } from 'workbox-precaching/precacheAndRoute';
import { registerRoute } from 'workbox-routing/registerRoute';
@Raywire
Raywire / gitbranches.md
Created November 27, 2023 13:13 — forked from nicholashoule/gitbranches.md
Git prune and delete merged local branches

Git prune and delete merged local branches

Prune
git remote prune origin --dry-run
git remote prune origin
@Raywire
Raywire / RenewExpiredGPGkey.md
Created March 18, 2025 18:08 — forked from TheSherlockHomie/RenewExpiredGPGkey.md
Updating expired GPG keys and backing them up ๐Ÿ”‘๐Ÿ”๐Ÿ’ป

Updating expired GPG keys and their backup ๐Ÿ”‘๐Ÿ”๐Ÿ’ป

I use a GPG key to sign my git commits.

An error like this one might be a sign of an expired GPG key.

error: gpg failed to sign the data fatal: failed to write commit object