Skip to content

Instantly share code, notes, and snippets.

View donhenton's full-sized avatar

Don Henton donhenton

View GitHub Profile
@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 / 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 / duplicateProcess.java
Last active March 1, 2018 21:27
Find a duplicate in a list and create unique map keys
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.TreeMap;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import javafx.util.Pair;
@donhenton
donhenton / gulpfile.js
Created December 20, 2017 14:15
Gulp file using browser sync and sass
/*
package.json
{
"name": "survey-css",
"version": "1.0.0",
"main": "index.js",
"scripts": {
"start": "node get a job"
},
@donhenton
donhenton / FileSplitter.java
Last active December 14, 2017 14:37
Java 8 File Splitter Demonstrating Files and Path Usage
package com.dhenton9000.anttask;
import java.io.File;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException;
import java.nio.file.FileVisitOption;
import java.nio.file.Files;
import java.nio.file.LinkOption;
import java.nio.file.Path;
@donhenton
donhenton / install_nvm.sh
Created August 27, 2017 21:58
install script for nvm
#!/usr/bin/env bash
{ # this ensures the entire script is downloaded #
nvm_has() {
type "$1" > /dev/null 2>&1
}
nvm_install_dir() {
echo "${NVM_DIR:-"$HOME/.nvm"}"
@donhenton
donhenton / aws_start.sh
Last active September 15, 2017 16:22
Amazon AWS Provisioning Script
#bin/sh
# run this as the ec2-user
# java
# https://gist.github.com/rtfpessoa/17752cbf7156bdf32c59
wget --no-cookies --header "Cookie: gpw_e24=xxx; oraclelicense=accept-securebackup-cookie;" http://download.oracle.com/otn-pub/java/jdk/8u144-b01/090f390dda5b47b9b721c7dfaa008135/jdk-8u144-linux-x64.rpm
sudo rpm -i jdk-8u144-linux-x64.rpm
export JAVA_HOME=user/java/default
@donhenton
donhenton / react-watch.js
Created June 15, 2016 14:08
react and gulp for SPA development
var gulp = require('gulp');
var gutil = require('gulp-util');
var source = require('vinyl-source-stream');
var browserify = require('browserify');
var watchify = require('watchify');
var reactify = require('reactify');
var notifier = require('node-notifier');
var server = require('gulp-server-livereload');
var concat = require('gulp-concat');
var sass = require('gulp-sass');
@donhenton
donhenton / filedownloader.js
Created May 7, 2016 13:23 — forked from DavidMah/filedownloader.js
File Download requests using jquery/POST request with psuedo ajax
// Takes a URL, param name, and data string
// Sends to the server.. The server can respond with binary data to download
jQuery.download = function(url, key, data){
// Build a form
var form = $('<form></form>').attr('action', url).attr('method', 'post');
// Add the one key/value
form.append($("<input></input>").attr('type', 'hidden').attr('name', key).attr('value', data));
//send request
form.appendTo('body').submit().remove();
@donhenton
donhenton / gulpfile.js for dev
Last active May 3, 2016 18:35
Gulp file for single page development for bundling js, sass, and serve see https://github.com/donhenton/knockout-sandbox
var gulp = require('gulp');
var sass = require('gulp-sass');
var concat = require('gulp-concat');
var gulp = require('gulp');
var gutil = require('gulp-util');
var watch = require('gulp-watch');
var server = require('gulp-server-livereload');
var livereload = require('gulp-livereload');
var del = require('del');