Skip to content

Instantly share code, notes, and snippets.


Jeff Sheets jeffsheets

View GitHub Profile
jeffsheets / timeZoneUtils.js
Last active May 11, 2021
Browser Javascript to get user timezone or offset that is IE11 safe when passed to a Java API, with Jest Test blogpost:
View timeZoneUtils.js
* Useful when passing the browser timezone to a backend Java API that reads a timezone in using ZoneId.of(tz),
* as both 'America/Chicago' and '-0600' are valid values when passed to the Java API.
* The Offset is used to handle IE11 and other older browsers.
export const getUserTimeZoneOrOffset = () => {
let timeZone;
try {
timeZone = new Intl.DateTimeFormat().resolvedOptions().timeZone;
} catch (error) {
jeffsheets / PapioMenuAlexaAppPrivacyPolicy.txt
Last active Feb 19, 2021
Papio Menu Alexa App Privacy Policy
View PapioMenuAlexaAppPrivacyPolicy.txt
The Papio Menu Alexa app available on Amazon Alexa does NOT collect any information.
The app is free for anyone to use on Alexa
jeffsheets /
Last active Jan 25, 2021
Use Spring JdbcTemplate to easily read data, without Spring Data JPA, and map columns using Column DTO mappings, using a secondary database connection
/** Based nearly completely on this same code from */
public class ColumnRowMapper<T> extends BeanPropertyRowMapper<T> {
private ColumnRowMapper(final Class<T> mappedClass) { super(mappedClass); }
protected String underscoreName(final String name) {
final Column annotation;
final String columnName;
jeffsheets /
Last active Dec 31, 2020
Spring Boot Initialize Local Test Data on Startup
/** Shows how to use code to init data instead of using data.sql or import.sql with Spring Boot */
@Profile({"local", "test"})
@RequiredArgsConstructor //Lombok magic to autowire the final fields (optional)
public class LocalDataSetup implements ApplicationRunner {
private final MyObjectRepository myObjectRepository;
public void run(ApplicationArguments args) {
jeffsheets / Jenkinsfile
Created Dec 8, 2020
Minimal Gradle Jenkinsfile
View Jenkinsfile
//Inspired by
pipeline {
agent any
triggers {
//Needed by Bitbucket to see the builds on PRs
stages {
jeffsheets / email.html
Last active Oct 2, 2019
HTML Email structure and CSS hacks
View email.html
* A collection of various HTML Email hacks
** Along with these, user an html boilerplate like
** Hacks are from many sources including:
<!-- 1) Fix image sizes in Outlook -->
jeffsheets / 1-websyncConfig.js
Last active Jan 25, 2021
AWS S3 Deploy sync w/ Cloudfront Invalidation and Cache-Control headers for Create-React-App
View 1-websyncConfig.js
//Config for s3 websync with cloudfront invalidation
// and Cache-Control headers for a Create-React-App application
module.exports = {
source: "build/",
target: `s3://yourcompany-us-east-1-${process.env.CI_ENVIRONMENT_NAME}-createreactapp/`,
invalidateDeletes: true,
modifiers: {
"static/**": { CacheControl: "max-age=31536000" },
jeffsheets / .env.development
Last active Jun 26, 2019
JS to read AWS SSM variables for use in Gitlab CI process
View .env.development
#This is used locally by Create-React-App during development
#Cognito Region
jeffsheets /
Last active Dec 30, 2019
Create React App CRA2 with react-intl i18n message extraction and translation

i18n Translations

To generate new translations:

  1. remove .messages folder
  2. Extract all messages into .messages dir with: yarn i18n:extract
  3. Add new messages into {lang}.json files with: yarn i18n:manageTranslations
  4. Translate any new entries in {lang}.json files and commit to repo (see Untranslated keys: output of previous command for list of keys needing translation)


jeffsheets / GroovySQLWithSpringDAO.groovy
Last active Oct 28, 2020
Using Groovy SQL with Spring configured Datasource to call complicated stored procedures with multiple ResultSets and multiple In and Out Params
View GroovySQLWithSpringDAO.groovy
class GroovySQLWithSpringDAO {
Sql groovySql
List<GroovyRowResult> findByFirstLast(String firstName, String lastName) {
GString statement = """{call FIND_BY_FIRST_LAST_SP (
${firstName}, ${lastName}, 'SYSUSER',