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
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 https://github.com/seanpowell/Email-Boilerplate
** Hacks are from many sources including:
** https://litmus.com/blog/a-guide-to-bulletproof-buttons-in-email-design
** https://litmus.com/community/discussions/1007-outlook-image-sizes
** https://www.emailonacid.com/blog/article/email-development/how-to-code-emails-for-outlook-2016/
-->
<!-- 1) Fix image sizes in Outlook -->
@jeffsheets
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
//https://www.npmjs.com/package/websync
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
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
REACT_APP_REGION=us-east-1
REACT_APP_USER_POOL_ID=us-east-1_youruserpoolid
REACT_APP_APP_CLIENT_ID=yourcognitoappclientidgoeshere
@jeffsheets
jeffsheets / _ReactIntl_CreatReactApp.md
Last active Apr 23, 2019
Create React App CRA2 with react-intl i18n message extraction and translation
View _ReactIntl_CreatReactApp.md

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)

Setup

@jeffsheets
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
@Slf4j
@Component
class GroovySQLWithSpringDAO {
@Autowired
Sql groovySql
List<GroovyRowResult> findByFirstLast(String firstName, String lastName) {
GString statement = """{call FIND_BY_FIRST_LAST_SP (
${firstName}, ${lastName}, 'SYSUSER',
${Sql.INTEGER}, ${Sql.VARCHAR}, ${Sql.VARCHAR}, ${Sql.VARCHAR}
@jeffsheets
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
@Service
class ClientJWTService {
@Value('${client.publicKey}')
String publicKeyString
@Value('${client.privateKey}')
String privateKeyString
Algorithm buildJwtAlgorithm() {
KeyFactory kf = KeyFactory.getInstance('RSA')
@jeffsheets
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> {
@Override
LocalDateTime deserialize(JsonParser parser, DeserializationContext ctxt) {
convertDotNetDateToJava(parser.text.trim())
}
/**
* Returns a Java LocalDateTime when given a .Net Date String
* /Date(1535491858840-0500)/
@jeffsheets
jeffsheets / SpringConsulRibbonContextPathConfig.groovy
Created Jun 14, 2018
Spring Config for RestTemplate to use contextPath from Consul
View SpringConsulRibbonContextPathConfig.groovy
/**
* Workaround to let RestTemplate use the contextPath from Consul when calling URLs
* (instead of only using the host and port)
* See https://github.com/spring-cloud/spring-cloud-consul/issues/376
*
* Put this in any spring config class
*/
@Bean
LoadBalancerRequestTransformer consulContextPathTransformer() {
@jeffsheets
jeffsheets / PersonControllerIntProxiedSpec.groovy
Last active May 31, 2018
Spock 1.2 Spring Integration Test annotations SpringBean, SpringSpy, UnwrapAopProxy
View PersonControllerIntProxiedSpec.groovy
import org.springframework.test.util.AopTestUtils
/** Showing how to unwrap the AOP proxy manually to reuse the cached Spring context config */
@Import([IntegrationTestMockingConfig])
class PersonControllerIntProxiedTest extends Specification {
@Autowired MockMvc mvc
/** A simple mock can just be autowired */
@Autowired ExternalRankingService externalRankingServiceMock
@jeffsheets
jeffsheets / photoBackup.md
Last active May 31, 2018
Personal photo backup process
View photoBackup.md

Personal Photo Backup Process

Just some notes so I can remember how I setup my phones to sync to my Crashplan backup on my PC

Requirements

  • Backup pics from multiple iPhones
  • The backup should be wireless and automatic (or close)
  • Backup all files on PC to Crashplan
  • Extra points for backing up new photos to the same place as existing old photos and camera photos
You can’t perform that action at this time.