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 / 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
@Raywire
Raywire / countries.json
Created May 15, 2024 13:46
A list of allowed countries to be used on order creation
[
{
"country":"Afghanistan",
"countryGerman":"Afghanistan",
"alpha2Code":"AF",
"alpha3Code":"AFG",
"numeric":4
},
{
"country":"Åland Islands",
@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 / package.json
Last active September 9, 2021 01:50
A service worker template for workbox
{
"scripts": {
"build": "vue-cli-service build && workbox injectManifest workbox-config.js",
},
"dependencies": {
},
"devDependencies": {
"workbox-cli": "^6.0.2"
}
@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 / 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 / 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 / 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 / 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 / tests.py
Last active March 12, 2019 07:43
A test to check if a blog post can be updated successfully
from django.test import TestCase, Client
from rest_framework import status
from django.urls import reverse
from .models import Blog
client = Client()
class ModelTestCase(TestCase):
"""A class that defines the test suite for the patient model."""
def setUp(self):