Skip to content

Instantly share code, notes, and snippets.

listeners: {
boxready: function (component, eOpts) {
Ext.each(Ext.query(".x-column-header-checkbox"), function(element) {
setStyle(element, {'width': '25px'});
});
Ext.each(Ext.query(".x-grid-header-row :first"), function(element) {
setStyle(element, {'width': '25px'});
})
}
@zachlendon
zachlendon / tincr.json
Created November 17, 2012 05:41
Tincr.json example
{
"toFile" : [
{"from": "/js/(.+\\.js)",
"to": "/js/$1"},
{"from": "/css/(.+\\.css)",
"to": "/css/$1"}
]
}
@zachlendon
zachlendon / gist:4063826
Created November 13, 2012 03:52
LocalStorageAppender append
LocalStorageAppender.prototype.append = function(loggingEvent) {
var appender = this;
var getFormattedMessage = function() {
var layout = appender.getLayout();
var formattedMessage = layout.format(loggingEvent);
if (layout.ignoresThrowable() && loggingEvent.exception) {
formattedMessage += loggingEvent.getThrowableStrRep();
}
return formattedMessage;
@zachlendon
zachlendon / gist:4063813
Created November 13, 2012 03:48
LocalStorageAppender setup
LocalStorageAppender.prototype = new log4javascript.Appender();
LocalStorageAppender.prototype.layout = new log4javascript.NullLayout();
LocalStorageAppender.prototype.threshold = log4javascript.Level.DEBUG;
@zachlendon
zachlendon / gist:3208794
Created July 30, 2012 18:12
Example for rendering command object error(s) as JSON in Grails (for mobile MVC consumption)
//replace com.company with your base package for errors
//can call via renderErrors(cmd) or renderErrors([cmd1, cmd2])
private void renderErrors(cmd) {
renderErrors([cmd])
}
private void renderErrors(List commands) {
render(contentType: "text/json") {
status = "fail"
class MobileSpec extends GebReportingSpec {
@Shared
def isMobile = false
def setupSpec() {
if (getBrowser().driver instanceof RemoteWebDriver) {
RemoteWebDriver remoteWebDriver = getBrowser().driver
DesiredCapabilities capabilities = remoteWebDriver.getCapabilities()
if (["android", "iPhone", "iPad"].contains(capabilities.browserName)) {
@zachlendon
zachlendon / gist:2707275
Created May 16, 2012 04:05
GebRemotePage
class GebRemotePage extends Page {
/**
* Returns the constant part of the url to this page.
* <p>
* This implementation returns the static url property of the class.
*/
@Override
driver = { new FirefoxDriver() }
environments {
// when system property 'geb.env' is set to 'win-ie' use a remote IE driver
'win-ie' {
driver = {
new RemoteWebDriver(new URL("http://windows.ci-server.local"), DesiredCapabilities.internetExplorer())
}
}
Runnning one of:
grails -Dgeb.env=local-iphone test-app functional:
grails -Dgeb.env=local-ipad test-app functional:
grails test-app functional:
at the command line, with the following files:
GebConfig.groovy
/*
@zachlendon
zachlendon / gist:1881657
Created February 22, 2012 05:21
backbone hashbang version
//document.ready() js function contains backbone.js instantiating code which:
$.mobile.pushStateEnabled = false;
new App.Routers.TodosRouter();
Backbone.history = Backbone.history || new Backbone.History({});
Backbone.history.start();
//Backbone Router
App.Routers.TodosRouter = Backbone.Router.extend({