Skip to content

Instantly share code, notes, and snippets.

jeffsheets / datepicker-focus.js
Created June 5, 2012 18:32
jquery ui datepicker IE focus fix
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 June 26, 2012 16:13
jQuery Plugin to disable MS Lync Phone Number detection
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 August 23, 2012 15:13
JS Module Pattern
var module = (function () {
// private variables and functions
var foo = 'bar';
// constructor
var module = function () {
jeffsheets / gist:4399922
Last active December 10, 2015 07:18
Jetty 8 JTA via JNDI lookup in Spring with Atomikos 3.8
<New id="tmjndi" class="">
<New class="com.atomikos.icatch.jta.UserTransactionManager"/>
<New id="tx" class="">
jeffsheets / gist:5292986
Last active July 20, 2018 14:39
Hibernate DetachedCriteria using subqueries exists clause, while eager fetching the lazy collection that is in the exists clause, and running via Spring HibernateTemplate findByCriteria, and limit results to max of 2000.
* HQL would look something like this:
* from Person p join fetch p.addresses address
* where exists (
* from Address addr left join addr.state st
* where addr.personId =
* and st.abbreviation = :abbreviation
* )
jeffsheets /
Last active February 12, 2022 14:44
Configuring Quartz 2.1.7 with Spring 3.1.3 in clustered mode
* Autowire Quartz Jobs with Spring context dependencies
* @see
public final class AutowiringSpringBeanJobFactory extends SpringBeanJobFactory implements ApplicationContextAware {
private transient AutowireCapableBeanFactory beanFactory;
public void setApplicationContext(final ApplicationContext context) {
beanFactory = context.getAutowireCapableBeanFactory();
jeffsheets / Datasources.groovy
Created August 6, 2013 20:23
Rollback transactions from multiple Datasource in Grails Integration Tests Prior to Grails 2.3.x, and with Grails 1.3.x on datasources plugin Fixed in 2.3.x
Sample Datasources.groovy file for datasources 0.5 plugin with grails 1.3.x
datasources = {
datasource(name: 'db2') {
domainClasses([com.sheetsj.domain.db2.MyObj, com.sheetsj.domain.db2.MyObj2])
jeffsheets / GroovySqlWithOutputsAndResultSetRows.groovy
Last active June 5, 2019 15:35
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
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 / AjaxlayoutController.groovy
Last active August 29, 2015 13:56
Grails Controller Unit Test to verify layout and template specified in render call
/* 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 / APoolHelper.groovy
Last active June 15, 2016 16:29
Grails setup for using Apache Commons Pool to pool JAX-WS Port Proxy WS Stub objects because creating the connections can be an expensive operation
import org.apache.commons.pool2.ObjectPool
import org.apache.log4j.Logger
class PoolHelper {
static Logger log = Logger.getLogger(PoolHelper)
* Executes a closure using the object from the passed
* in Commons Pool, invalidating the object if an error is returned,
* and always returning it to the pool. Similar to how Groovy Sql methods work.