Skip to content

Instantly share code, notes, and snippets.

Jeff Sheets jeffsheets

Block or report user

Report or block jeffsheets

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
jeffsheets / 1-websyncConfig.js
Last active Aug 13, 2019
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 / GroovySqlWithOutputsAndResultSetRows.groovy
Last active Jun 5, 2019
Extend Groovy Sql with callWithRows method to call a Stored Procedure and process both Output Parameters and Rows from the ResultSet in the closure handler.Could be replaced if is ever completed
View GroovySqlWithOutputsAndResultSetRows.groovy
SqlHelper sql = new SqlHelper(dataSource)
List results = sql.callWithRows("{call ABC.FINDBYLAST($lastName, ${Sql.INTEGER}, ${Sql.VARCHAR})}") {
List<GroovyRowResult> rows, int status, String errorMessage ->
if (status != 0) {
throw new RuntimeException("Error received from stored proc $status : $errorMessage")
return rows
jeffsheets /
Last active Apr 23, 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 / AccountControllerTest.groovy
Created Jun 20, 2014
Spock test with Mocks of Spring MVC Rest Controller using standaloneSetup and mockMvc
View AccountControllerTest.groovy
import groovy.json.JsonSlurper
import org.springframework.test.web.servlet.MockMvc
import static org.springframework.test.web.servlet.setup.MockMvcBuilders.*
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*;
import static org.springframework.http.HttpStatus.*
import spock.lang.Specification
* A Spock Spring MVC Rest unit test that doesn't require a full spring context
jeffsheets /
Created Aug 14, 2014
Spring 4 Properties Java Configuration with Database-backed Properties along with File properties too
* Example of Spring 4 Properties Java Configuration,
* with a Database Properties table to store most values
* and a small file too.
* The Database table will take precedence over the properties file with this setup
@PropertySource(value = { "" }, ignoreResourceNotFound=true)
public class SpringPropertiesConfig {
private static final Logger log = LoggerFactory.getLogger(SpringPropertiesConfig.class);
jeffsheets / ClientJWTService.groovy
Last active Oct 23, 2018
JWT creation in Spring Boot Groovy or Java with RSA 512 or 256 algorithm including steps to generate the keys stored as strings in yml properties file
View ClientJWTService.groovy
class ClientJWTService {
String publicKeyString
String privateKeyString
Algorithm buildJwtAlgorithm() {
KeyFactory kf = KeyFactory.getInstance('RSA')
jeffsheets / GroovySQLWithSpringDAO.groovy
Last active Oct 19, 2018
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',
jeffsheets / JsonDotNetLocalDateTimeDeserializer.groovy
Created Sep 26, 2018
Groovy Jackson Deserializer to convert a .NET style JSON dateTime to a Java LocalDateTime object
View JsonDotNetLocalDateTimeDeserializer.groovy
class JsonDotNetLocalDateTimeDeserializer extends JsonDeserializer<LocalDateTime> {
LocalDateTime deserialize(JsonParser parser, DeserializationContext ctxt) {
* Returns a Java LocalDateTime when given a .Net Date String
* /Date(1535491858840-0500)/
jeffsheets / ApiSecurityConfig.groovy
Created Sep 6, 2017
Spock Test for Spring Boot Security configuration - showing basic simple examples for unauthenticated users, role based access, and httpBasic logins
View ApiSecurityConfig.groovy
class ApiSecurityConfig extends WebSecurityConfigurerAdapter {
void configureGlobal(AuthenticationManagerBuilder auth) {
protected void configure(HttpSecurity http) {
You can’t perform that action at this time.