Skip to content

Instantly share code, notes, and snippets.

View donhenton's full-sized avatar

Don Henton donhenton

View GitHub Profile
@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 / 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 / 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 / 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 / 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 / gulpfile for tomcat update
Last active April 27, 2017 14:31
gulpfile to update tomcat when changes take place
/**
*
* @type Module gulp|Module gulp
* gulp file that will monitor files in the src tree and then move them
* to the tomcat instance. In effect a poor-man's JRebel
*
* Your tomcat server needs to be running and to see the changes
* This script will also refresh one page of your choice specified in the
* refresh page. Refreshing the page requires installation of the chrome
* live reload plugin
@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();