Skip to content

Instantly share code, notes, and snippets.

View andrewfinnell's full-sized avatar

Andrew T. Finnell andrewfinnell

View GitHub Profile
@andrewfinnell
andrewfinnell / string-util.js
Last active March 16, 2018 11:45
Add trimQuotes to String.prototype
(function() {
"use strict";
Object.defineProperty(String.prototype, 'trimQuotes', {
get() {
return function () {
return this.replace(/^"(.+(?="$))"$/, '$1');
}
}
});
})();
@andrewfinnell
andrewfinnell / 01_setup_lets_encrypt.sh
Created January 8, 2018 18:09 — forked from gene1wood/01_setup_lets_encrypt.sh
Example of how to setup Let's Encrypt on RHEL / CentOS and automate certificate rewnewal
#!/bin/bash
[email protected]
DOMAINS=example.com,www.example.com,foo.example.com,example.org.example.net,www.example.org,www.example.net
git clone https://github.com/letsencrypt/letsencrypt
cd letsencrypt/
mkdir -p /var/lib/letsencrypt/global-webroot
# Setup the global alias
@andrewfinnell
andrewfinnell / gcloud-setup-ubuntu.sh
Created June 18, 2017 18:47
GCloud :: Ubuntu / Bash on Ubuntu for Windows :: Setup
# Create an environment variable for the correct distribution
export CLOUD_SDK_REPO="cloud-sdk-$(lsb_release -c -s)"
# Add the Cloud SDK distribution URI as a package source
echo "deb http://packages.cloud.google.com/apt $CLOUD_SDK_REPO main" | sudo tee -a /etc/apt/sources.list.d/google-cloud-sdk.list
# Import the Google Cloud Platform public key
curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -
# Update the package list and install the Cloud SDK
@andrewfinnell
andrewfinnell / gcloud-setup-centos.sh
Last active June 18, 2017 18:48
GCloud :: RedHat / CentOS :: Setup
#/bin/sh
# Update YUM with Cloud SDK repo information:
sudo tee -a /etc/yum.repos.d/google-cloud-sdk.repo << EOM
[google-cloud-sdk]
name=Google Cloud SDK
baseurl=https://packages.cloud.google.com/yum/repos/cloud-sdk-el7-x86_64
enabled=1
gpgcheck=1
repo_gpgcheck=1
@andrewfinnell
andrewfinnell / .gitconfig
Created June 18, 2017 18:20 — forked from shawndumas/.gitconfig
Using WinMerge as the git Diff/Merge Tool on Windows 64bit
[mergetool]
prompt = false
keepBackup = false
keepTemporaries = false
[merge]
tool = winmerge
[mergetool "winmerge"]
name = WinMerge
@andrewfinnell
andrewfinnell / faux-react-dom.js
Created May 9, 2017 21:00
A React UI Renderer that will create DOM elements immediately instead of going through the react engine. Useful for testing Web Component style widgets.
(function (global) {
var FauxElement = function (tagName) {
this.id = "";
this.tagName = tagName;
this.attributes = {};
this.children = [];
this.lastChild = null;
this.firstChild = null;
};
ActivationConfigProperty(propertyName="destinationType", propertyValue="javax.jms.Queue")
ActivationConfigProperty(propertyName="destination", propertyValue="/jms/queue/")
@andrewfinnell
andrewfinnell / credit-card-country-list-select
Created January 16, 2017 00:31
HTML country list select with 3 letter ISO country code values based on PayPal's 190 supported countries.
<select name="countries">
<option value="USA" selected>United States</option>
<option value="GBR">United Kingdom</option>
<option value="AUS">Australia</option>
<option value="CAN">Canada</option>
<option value="IND">India</option>
<option value="BRA">Brazil</option>
<option value="">-------------------------------</option>
<option value="ALB">Albania</option>
<option value="DZA">Algeria</option>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>GistRun</title>
<link rel="stylesheet" href="styles.css">
</head>
<body>
<h1>Hello world!</h1>
<script src="script.js"></script>
@andrewfinnell
andrewfinnell / generate_object_id.sql
Last active April 7, 2018 23:01
NoSQL-like Unique Identifiers in SQL
-- This file is released under the MIT License (MIT)
--
-- Copyright (c) 2013 Jamar Parris
-- Copyright (c) 2016 Andrew T. Finnell <[email protected]>
--
-- Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
-- documentation files (the "Software"), to deal in the Software without restriction, including without limitation
-- the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
-- and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
--