Skip to content

Instantly share code, notes, and snippets.

View skhatri's full-sized avatar

Suresh Khatri skhatri

  • Sydney, Australia
View GitHub Profile
@skhatri
skhatri / quality.gradle
Created February 24, 2012 00:45
Gradle Checkstyle HTML Reporting
apply plugin: 'checkstyle'
checkstyleMain {
ignoreFailures = false
reports {
include ( '**/*.java')
xml {
destination "${rootProject.buildDir}/reports/checkstyle/main.xml"
}
}
@skhatri
skhatri / DefaultServiceLayerDecorator
Created March 1, 2012 13:06
GWT Integration with Spring without Servlet
package com.app.web;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Service;
import com.google.web.bindery.requestfactory.server.ServiceLayerDecorator;
import com.google.web.bindery.requestfactory.shared.Locator;
import com.google.web.bindery.requestfactory.shared.RequestContext;
import com.google.web.bindery.requestfactory.shared.ServiceLocator;
Amadahl's Law => Nc * Uc * (1 + W/C)
Speed => 1 / (F + (1-F)/N)
@skhatri
skhatri / checkstyle-suppressions.gradle
Created April 13, 2012 04:26
mass suppress checkstyle violations
file("${theDir}").listFiles().each {
println """<suppress checks=".*" files="${it.getName()}"/>"""
}
@skhatri
skhatri / NamespaceTest.groovy
Created April 22, 2012 06:11
Using Groovy Namespace with slurper and builders
import org.junit.Test
public class NamespaceTest {
@Test
public void testMarkupBuilderUsingNamespace() throws Exception {
final investmentNS = 'urn:investment:facility'
def path = new XmlSlurper()
.parseText("""
@skhatri
skhatri / DevModeLauncher.java
Created April 22, 2012 14:34
Running GWT + Spring app in hosted mode
/**Step 2**/
public class DevModeLauncher {
public static void main(String[] args) throws Exception {
String[] devArg = new String[]{
"-war",
"src/main/webapp",
"-startupUrl",
"ApplicationScaffold.html",
"com.mycompany.ApplicationScaffold"
@skhatri
skhatri / compile.lib.properties
Created April 24, 2012 06:41
Loading Gradle dependencies from External Properties file
cglib:cglib-nodep:2.1_3
net.sourceforge.cssparser:cssparser:0.9.5
org.freemarker:freemarker:2.3.16
com.google.guava:guava:10.0.1
org.hamcrest:hamcrest-core:1.1
@skhatri
skhatri / dependencyexporter.gradle
Created April 24, 2012 06:45
Gradle to ivy install ANT xml stanza
f=file('ivy-install.xml')
[
'compile',
'spring'
].each {name ->
file("gradle/${name}.properties").eachLine {line->
library=line.split(':')
def depStr = """
@skhatri
skhatri / ChromeWithJBehaveConfig.java
Created April 27, 2012 04:41
Using Chrome with JBehave
static {
System.setProperty("browser", "chrome");
System.setProperty("webdriver.chrome.driver", "/Google/Chrome/Application/chrome.exe");
}
@skhatri
skhatri / MySQLRevEng.groovy
Created April 28, 2012 06:51
Reverse Engineer MySQL Dump to Grails Domain Class
/**
1. extract using
mysqldump -udev -p -d --xml movies > movies.xml
2. run this
*/
class DBRev {
private String res = 'movies.xml'
private String dir = 'grails-app/domain'