Skip to content

Instantly share code, notes, and snippets.

View xmlking's full-sized avatar
🌝
Write code that will last longer than You

Sumanth Chinthagunta xmlking

🌝
Write code that will last longer than You
View GitHub Profile
@xmlking
xmlking / test123
Created August 5, 2011 20:06
test
test 123456
@xmlking
xmlking / gist:1131066
Created August 8, 2011 01:46
Page Rendering API to send email with template
grails.gsp.PageRenderer groovyPageRenderer
void welcomeUser(User user) {
def contents = groovyPageRenderer.render(view:"/emails/welcomeLetter", model:[user: user])
sendEmail {
to user.email
body contents
}
----------------
@xmlking
xmlking / gist:1131291
Created August 8, 2011 06:18
It spring-security-core 1.2 depends of svn grails plugin?
Is spring-security-core depends of svn grails plugin?
burtbeckwith: Sorry about that, there are some issues with releasing plugins and using them in 2.0. I used the release plugin, which depends on the svn plugin, and unfortunately the svn plugin ended up in the pom file. This only affects Grails 2.0 apps since earlier versions don't use the poms.
@xmlking
xmlking / gist:1132797
Created August 8, 2011 21:26
Placeholder in html5
<form>
<code>
<input name="fieldname" placeholder="Enter any keyword">
<input type="submit" value="Search">
</code>
</form>
@xmlking
xmlking / gist:1163625
Created August 22, 2011 21:20
jQuery's AJAX polling
$.ajax({
url : "chatlog",
success : function(message) {
if (message && message.length) {
var messagesDiv = $('#messages');
messagesDiv.html(message);
messagesDiv.animate({ scrollTop: messagesDiv.attr("scrollHeight") - messagesDiv.height() }, 150);
}
timer = poll();
},
@xmlking
xmlking / gist:5172291
Created March 15, 2013 19:12
controlling war resources in BuildConfig.groovy
// Remove logback-test.xml from the production WAR, so that logback.xml is used instead
grails.war.resources = { stagingDir ->
delete(file:"${stagingDir}/WEB-INF/classes/logback-test.xml")
}
@xmlking
xmlking / gist:5543304
Created May 8, 2013 20:16
profile with StopWatch
import org.springframework.util.StopWatch;
@Around("methodsToBeProfiled()")
public Object profile(ProceedingJoinPoint pjp) throws Throwable {
StopWatch sw = new StopWatch(getClass().getSimpleName());
try {
sw.start(pjp.getSignature().getName());
return pjp.proceed();
} finally {
sw.stop();
System.out.println(sw.prettyPrint());
@xmlking
xmlking / app.js
Last active March 7, 2023 14:52
angular authentication with angular modules: http-auth-interceptor, angular-growl , angular-ui : UI-Router & UI-Bootstrap , restangular
angular.module('ConsoleUIApp', ['ui.router','ui.bootstrap','ngAnimate','angular-growl', 'restangular','http-auth-interceptor'])
.config(function ($stateProvider, $urlRouterProvider, growlProvider, RestangularProvider, $httpProvider) {
// For any unmatched url, redirect to /state1
$urlRouterProvider.otherwise("/home");
$stateProvider
.state('home', {
url: "/home",
templateUrl: "views/home.html",
@xmlking
xmlking / BarService.groovy
Last active August 29, 2015 13:56
Resilience Framework
import grails.transaction.Transactional
@Transactional(readOnly = true)
class BarService implements Greet{
static scope = "prototype"
@Override
public String greet() throws IOException{
if (new Random().nextInt(2) == 1) throw new IOException("dummy exception from BarService in...greet");
@xmlking
xmlking / bower.json
Last active August 29, 2015 14:00
Angular Gulp workflow with SASS and Traceur for ES6 -> ES5
{
"name": "MyApp",
"version": "0.0.1",
"private": true,
"main": "app/index.html",
"dependencies": {
"jquery": "jquery/jquery",
"angular": "1.3.0-beta.5",
"es6-shim": ">=0.8.0",
"bootstrap-sass-official": "~3.1.1",