Skip to content

Instantly share code, notes, and snippets.


Jeff Sheets jeffsheets

View GitHub Profile
jeffsheets / AjaxlayoutController.groovy
Last active Aug 29, 2015
Grails Controller Unit Test to verify layout and template specified in render call
View AjaxlayoutController.groovy
/* action that renders a template back to browser,
* and uses custom simple 'ajax' layout */
def ajaxResults() {
def results = workService.querySomeWork()
render (template: "ajaxResults", model:[results:results as JSON], layout:'ajax')
jeffsheets /
Created Aug 1, 2014
Hibernate Custom Type to use @Version optimistic locking for SQLServer datetime fields that are limited by 1/300th of a second precision
public class SqlServerTimestampType extends TimestampType {
private static final int SQLSERVER_PRECISION = 10;
public SqlServerTimestampType() {
* SQLServer datetime fields are accurate to 1/300th of a second.
* We floor to the nearest 1/100th of a second for simplicity.
jeffsheets /
Last active Aug 29, 2015
Spring Profile specific properties files, similar to Spring Boot (or Grails) properties. This registers application-*.properties for all Active (or Default) spring profiles.
* Register this with the DispatcherServlet in a ServletInitializer class like:
* dispatcherServlet.setContextInitializers(new PropertiesInitializer());
public class PropertiesInitializer implements ApplicationContextInitializer<ConfigurableApplicationContext> {
private static final Logger log = LoggerFactory.getLogger(PropertiesInitializer.class);
* Runs as appInitializer so properties are wired before spring beans
jeffsheets /
Created Apr 2, 2015
Super Simple Spring Log4j Configuration using different files per environment
public class SpringLog4jConfig {
* Just a property from the normal Spring property sources, like:
String log4jLocation;
jeffsheets / protractorFieldSelectionTest.spec.js
Created Apr 8, 2015
Protractor spec showing how to test for text selection inside a form input field
View protractorFieldSelectionTest.spec.js
* Initially written as a test for IE/Chrome for a bug in ui-mask.
* The test verifies that all of the text is selected in an input field when the field is tabbed into
describe('field selection test', function () {
beforeEach (function () {
View CrazyDoodlePrivacyPolicy.txt
The Crazy Doodle app available on the Amazon Kindle and Google Play stores does NOT collect any information.
jeffsheets / sinonKarma.spec.js
Created Sep 1, 2015
Simple Karma spec using Sinon to mock a backend service for AngularJS testing
View sinonKarma.spec.js
var someService;
beforeEach(inject(function (_someService_) {
someService = sinon.mock(_someService_);
afterEach(function () {
jeffsheets / datepicker-focus.js
Created Jun 5, 2012
jquery ui datepicker IE focus fix
View datepicker-focus.js
After jquery ui datepicker selection, blur and change
events fire before focus is returned to the input field,
handling a quirk from IE browsers
changeMonth: true,
changeYear: true,
showAnim: "fadeIn",
jeffsheets / jquery.disableMSLync.js
Created Jun 26, 2012
jQuery Plugin to disable MS Lync Phone Number detection
View jquery.disableMSLync.js
The IE Microsoft Lync Plugin puts an icon next to all phone numbers in the html markup.
This causes page layouts to break, especially with scrolling table plugins.
The icon is also included in printouts.
This disableMSLync plugin hides phone numbers from MS Lync by replacing the normal hyphen
with the non-breaking hyphen character code.
jeffsheets / module-ex.js
Created Aug 23, 2012
JS Module Pattern
View module-ex.js
var module = (function () {
// private variables and functions
var foo = 'bar';
// constructor
var module = function () {
You can’t perform that action at this time.