Skip to content

Instantly share code, notes, and snippets.

View donhenton's full-sized avatar

Don Henton donhenton

View GitHub Profile
@donhenton
donhenton / docker-compose.yml
Last active August 9, 2023 11:52
Redis/Redis-commander Docker Compose with Persistence
version: '3'
services:
redis:
container_name: redis
hostname: redis
image: redis
command: ["redis-server", "--appendonly", "yes"]
volumes:
- ~/redis/data:/data
ports:
@donhenton
donhenton / isAtScrollBottom.js
Created December 12, 2018 01:48
detect if a browser hits bottom
isAtScrollBottom() {
//https://gist.github.com/nathansmith/8939548
//https://www.quora.com/How-do-you-detect-in-JavaScript-when-a-user-has-scrolled-to-the-bottom-of-the-page
//https://stackoverflow.com/questions/1145850/how-to-get-height-of-entire-document-with-javascript
//https://techstacker.com/posts/gGyGTHysrPuuJnNBk/vanilla-javascript-detect-when-user-scrolled-to-the-bottom
let body = document.body;
let html = document.documentElement;
var height = Math.max(body.scrollHeight, body.offsetHeight,
html.clientHeight, html.scrollHeight, html.offsetHeight);
@donhenton
donhenton / gulpfile.js
Created January 17, 2019 13:47 — forked from danharper/gulpfile.js
New ES6 project with Babel, Browserify & Gulp
var gulp = require('gulp');
var sourcemaps = require('gulp-sourcemaps');
var source = require('vinyl-source-stream');
var buffer = require('vinyl-buffer');
var browserify = require('browserify');
var watchify = require('watchify');
var babel = require('babelify');
function compile(watch) {
var bundler = watchify(browserify('./src/index.js', { debug: true }).transform(babel));
@donhenton
donhenton / gulpfile.js
Created January 17, 2019 15:04
Updated Browserify/Babel for Babel7
var gulp = require('gulp');
var targetLocation = './public_html/'
var appDependencies = require('./package.json').dependencies;
var SASS_FILES = ['./src/sass/*.scss', './src/sass/components/*.scss'];
var sourcemaps = require('gulp-sourcemaps');
var autoprefixer = require('gulp-autoprefixer');
var fs = require('fs');
var del = require('del');
@donhenton
donhenton / easing.js
Created March 28, 2019 16:18 — forked from gre/easing.js
Simple Easing Functions in Javascript - see https://github.com/gre/bezier-easing
/*
* Easing Functions - inspired from http://gizma.com/easing/
* only considering the t value for the range [0, 1] => [0, 1]
*/
EasingFunctions = {
// no easing, no acceleration
linear: function (t) { return t },
// accelerating from zero velocity
easeInQuad: function (t) { return t*t },
// decelerating to zero velocity
@donhenton
donhenton / aws kms decrypt-encrypt.md
Last active July 29, 2019 15:37
Decrypt/Encrypt Using AWS and CLI

Encryption

aws kms encrypt --key-id <kms-id> \
--profile default \
--plaintext fileb://input_file.txt \
--query CiphertextBlob \
--output text \
	| base64 --decode > output.enc

@donhenton
donhenton / simple_load_balancer.yaml
Created August 26, 2019 14:48
AWS CloudFormation YAML for Simple LoadBalancer
---
AWSTemplateFormatVersion: '2010-09-09'
Description: 'AWS CloudFormation Sample Template ELBStickinessSample: Create a load
balanced sample web site with ELB stickiness enabled. The AI is chosen based on
the region in which the stack is run. This example creates 2 EC2 instances behind
a load balancer with a simple health check. The ec2 instnces are untargeted and
may be deployed in one or more availaiblity zones. The web site is available on
port 80, however, the instances can be configured to listen on any port (8888 by
default). **WARNING** This template creates one or more Amazon EC2 instances and
an Application Load Balancer. You will be billed for the AWS resources used if you
/* sample Jenkins file for angular4-snippets project
doesn't work completely as it chokes on webpack
illustrates using docker image for building
problem is most likely the node version
attempting angular 4/6 build environment
*/
pipeline {
environment {
registry = "my-registry:5000"
@donhenton
donhenton / Jenkinsfile
Created September 26, 2019 14:23
another jenkins file
pipeline {
environment {
registry = "my-registry:5000"
GIT_SSL_NO_VERIFY = 1
NODE_TLS_REJECT_UNAUTHORIZED=0
dockerImage = ''
}
agent {
docker {
@donhenton
donhenton / buildspec.yml
Created January 7, 2020 14:53
CodeBuild buildspec for pushing to ECR
version: 0.2
phases:
pre_build:
commands:
- echo Logging in to Amazon ECR...
- aws --version
- $(aws ecr get-login --region $AWS_DEFAULT_REGION --no-include-email)
- REPOSITORY_URI=<repository uri>