Skip to content

Instantly share code, notes, and snippets.

View jyeary's full-sized avatar
🐝
in the hive mind

John Yeary jyeary

🐝
in the hive mind
View GitHub Profile
@jyeary
jyeary / OracleConnectionValidation.java
Last active February 10, 2017 20:42
Oracle Database Connection Validation
/*
* Copyright 2017 John Yeary <jyeary@bluelotussoftware.com>.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@jyeary
jyeary / Utils.java
Created April 25, 2016 13:08
Determines the calling Class within a method, and returns the name of the Class.
public class Utils {
/**
* Default Constructor
*/
public Utils() {
}
/**
* Determines the caller class. This method should be invoked within a
@jyeary
jyeary / TreeSelectionChangeListenerImpl.java
Last active March 25, 2016 22:21
An implementation of TreeSelectionChangeListener for RichFaces 4.x
/*
* Copyright 2016 John Yeary <jyeary@bluelotussoftware.com>.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
/*
* Copyright 2016 Blue Lotus Software, LLC.
* Copyright 2015 John Yeary <jyeary@bluelotussoftware.com>.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
@jyeary
jyeary / HostIPValidation.java
Last active November 21, 2019 23:57
An example of how to use Guava to validate hostnames, and IP addresses.
/*
* Copyright 2015-2016 Blue Lotus Software, LLC.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@jyeary
jyeary / search.html
Created January 12, 2016 19:32
An example HTML page with a search input with an icon using just HTML and JS.
<!DOCTYPE html>
<html>
<head>
<title>Example Search</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style type="text/css">
#input1 {
background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAgAAAAIACAYAAAD0eNT6AABwGklEQVR42u2dB3gU5dbHg0lICCFW1KsowqUoMjObBBA7il69FhAVQVqyM5PQRMXuFcWC9eq193Lxs117Q0WkWei9C4iIdAKk7Ya0mfPNu5mJQ0h2N8ns7Mzuf5/nfSiZ/W32nfec/5m3nJOQgBdeeDn6RfnZyepI4UQ1j8tSZf4SVeIHqZIwUpWFOxVZeFSRhJe19oEiCl9rbYYi83O1tlyRuA3av7dqf9+ryFyh9vdS7f/KtPdUaP+uJlkg1tjfA//HfsauYdey97D3MgZjMSZjs89gn8U+U/ts9jsEfhf2O7HfTeQz2e/KfmfcObzwivHXRRf1aaG1w0ytBXjggReaRwkJLVSvp22NsHv6a0J6gya0jzOBJYmfrf19rSay+wyhZk2tp1EzWiR51drvXh34DtwsLXB4n3039h2179uPBQpakHAM6wOMF/DAcwavsR+eWLeBBx54f/EmX3FZy/1eT6cyMfOSCpEfWy0JTyki/4UicqvZE3djxFWppzVHrJ3A02ckVgX6RBaeVGV+lCp5LtYChw7vXXl5S4w/8MCzh9fYqCNJa8mmltTU6AM88NzOo4EDEzXx6qI9+Q7QnuDvKfcKH1RI/IpKr1CuiT6x1hxxNRjmFuu8Skk4UOHllpdL/Adam6CIwlXqSE9n1tcYf+CBZw2vKR/OPrC
@jyeary
jyeary / CheckEncoding.java
Last active January 6, 2016 16:37
Check the encoding (default) of the current Java implementation on the system.
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.nio.charset.Charset;
public class CheckEncoding {
public static void main(String[] args) {
System.out.println("Default Charset = " + getDefaultCharset());
@jyeary
jyeary / DateUtils.java
Last active August 29, 2015 14:24
ISO8601 DateFormat
/*
* Copyright 2015 Blue Lotus Software, LLC.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@jyeary
jyeary / utils.js
Last active September 25, 2015 09:19
Javascript for reading a cookie
//<![CDATA[
/**
* This function returns the named cookie if it exists.
* @param {type} cname The name of the cookie.
* @returns {String} The cookie value.
*/
function getCookie(cname) {
var name = cname + "=";
var ca = document.cookie.split(';');
for (var i = 0; i < ca.length; i++) {
@jyeary
jyeary / CustomMenuRenderer.java
Last active August 29, 2015 14:23
Customized SelectItem with additional attributes from HTML specification that are not present in JSF 2.2 RI.
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved.
*
* The contents of this file are subject to the terms of either the GNU
* General Public License Version 2 only ("GPL") or the Common Development
* and Distribution License("CDDL") (collectively, the "License"). You
* may not use this file except in compliance with the License. You can
* obtain a copy of the License at