Skip to content

Instantly share code, notes, and snippets.

View jacurtis's full-sized avatar

J. Alexander Curtis jacurtis

View GitHub Profile
@jacurtis
jacurtis / gist:fb19e36177c5cc575d9b006385ae64d1
Created August 26, 2022 00:29 — forked from AlexanderRD/gist:485f12395cc30f3444b7
Delete all git branches with prefix
git branch -D `git branch | grep 'ard_*'`
@jacurtis
jacurtis / aws_json.py
Last active December 1, 2021 12:42 — forked from jeffbrl/describe_instances.py
How to make boto3 responses with datetime.datetime json serializable - boto3 ec2 describe_instances or rds describe_db_instances
# The file that does the voodoo magic
# Inspired by:
# - https://stackoverflow.com/questions/35869985/datetime-datetime-is-not-json-serializable
# - https://gist.github.com/jeffbrl/67eed588f2d32afcaf3bf779bd91f7a7
import json
import datetime
def pretty_print(data):
print(json.dumps(data, default=__datetime_handler, indent=4))
@jacurtis
jacurtis / forge.sh
Created April 27, 2019 05:29
Laravel Forge Setup Script
#
# REQUIRES:
# - server (the forge server instance)
# - event (the forge event instance)
# - sudo_password (random password for sudo)
# - db_password (random password for database user)
# - callback (the callback URL)
#
@jacurtis
jacurtis / ServerNamingSchemes.md
Last active May 3, 2019 05:04
The techniques I use to name cloud servers.
environment-purpose-Name-Geography

Environment

  • dev - Development
  • tst - Testing
  • stg - Staging
  • prd - Production
@jacurtis
jacurtis / no-right-click-on-images.js
Last active November 25, 2019 18:08
Removes right-click on images
/*
* This script will look for all images on a page and prevent right clicking on an image.
*/
const images = document.getElementsByTagName('img');
for(var i = 0; i < images.length; i++) {
images[i].addEventListener('contextmenu', event => event.preventDefault());
}
// Note: I threw this script together as requested by a subscriber. I personally don't recommend doing
@jacurtis
jacurtis / _media-queries.scss
Last active January 30, 2023 15:08
This will generate media query mixins with SCSS.
$mobile: 768px !default;
$tablet: 769px !default;
$desktop: 1024px !default;
$widescreen: 1216px !default;
$fullhd: 1408px !default;
// Mobile Devices Only
// (0 - 768px)
@mixin mobile {
@media only screen and (max-width: $mobile) {
@jacurtis
jacurtis / Directus-Nginx.conf
Created January 28, 2019 21:58
Configuration file for Nginx Directus Site.
# FORGE CONFIG (DO NOT REMOVE!)
include forge-conf/cms.jacurtis.com/before/*;
server {
root /home/forge/cms.jacurtis.com/public;
index index.php index.html index.htm;
server_name cms.jacurtis.com;
# FORGE SSL (DO NOT REMOVE!)
# ssl_certificate;
@jacurtis
jacurtis / phpcs.xml
Created January 26, 2019 20:29
The PHP Code Sniffer configuration file I use for Laravel Applications. I had to remove PSR2 code just because it causes lots of problems with magic function in route files and models and stuff. But otherwise a good basic code sniffer config to use in Laravel projects.
<?xml version="1.0"?>
<ruleset name="Laravel Standards">
<description>Laravel Coding Standards</description>
<rule ref="Generic.Classes.DuplicateClassName"/>
<rule ref="Generic.CodeAnalysis.EmptyStatement"/>
<rule ref="Generic.CodeAnalysis.ForLoopShouldBeWhileLoop"/>
<rule ref="Generic.CodeAnalysis.JumbledIncrementer"/>
<rule ref="Generic.CodeAnalysis.UnconditionalIfStatement"/>
@jacurtis
jacurtis / mysql-cli.sql
Created January 26, 2019 02:04
This is the command I use to create all of my new MySQL databases in the CLI. Insert your own database name. This sets up new databases using the utf8mb4 character set in the most popular method.
CREATE DATABASE <database_name> CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
@jacurtis
jacurtis / atom-styles.less
Created December 12, 2018 17:57
This is the stylesheet I use in Atom to get the design I like. It requires Fira Code (mono font) and FlottFlott (ligature font). But you can swap out your own fonts by replacing them in the sheet.
/*
* Your Stylesheet
*
* This stylesheet is loaded when Atom starts up and is reloaded automatically
* when it is changed and saved.
*
* Add your own CSS or Less to fully customize Atom.
* If you are unfamiliar with Less, you can read more about it here:
* http://lesscss.org
*/