Skip to content

Instantly share code, notes, and snippets.

View marcpalmer's full-sized avatar
💭
Busy working on Concepts app, and Captionista

Marc Palmer marcpalmer

💭
Busy working on Concepts app, and Captionista
View GitHub Profile
@marcpalmer
marcpalmer / resources_article_1_snippet_15.gsp
Created September 12, 2011 16:10
Resources Article 1 snippet 15
<r:require module="theme-${session.themeName}"/>
@marcpalmer
marcpalmer / gist:1261483
Created October 4, 2011 12:12
Can't install local plugin snapshots
marcmacbook:github-weceem-app marc$ grails install-plugin ../github-weceem/grails-weceem-1.1.BUILD-SNAPSHOT.zip
| Configuring classpath
:: problems summary ::
:::: WARNINGS
module not found: org.grails.plugins#weceem;1.1.BUILD-SNAPSHOT
==== grailsPlugins: tried
-- artifact org.grails.plugins#weceem;1.1.BUILD-SNAPSHOT!weceem.zip:
/Users/marc/Projects/checkout/github-weceem-app/lib/weceem-1.1.BUILD-SNAPSHOT.zip
/Users/marc/.grails/2.0.0.BUILD-SNAPSHOT/projects/weceem/plugins/bean-fields-1.0-RC3/lib/weceem-1.1.BUILD-SNAPSHOT.zip
/Users/marc/.grails/2.0.0.BUILD-SNAPSHOT/projects/weceem/plugins/blueprint-0.9.1.1/lib/weceem-1.1.BUILD-SNAPSHOT.zip
@marcpalmer
marcpalmer / gist:1626042
Created January 17, 2012 10:04
Arduino Sketch to send animated diagonal spectrum to Rainbowduino and 8x8 RGB LED matrix
#include <Rainbowduino.h>
byte display[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
@marcpalmer
marcpalmer / gist:1626085
Created January 17, 2012 10:14
Rainbowduino LED 8x8 Matrix Grails Cup
#include <Rainbowduino.h>
byte display[] = {
0, 1, 1, 1, 1, 1, 1, 0,
0, 1, 1, 1, 1, 1, 1, 0,
0, 1, 1, 1, 1, 1, 1, 0,
0, 0, 1, 1, 1, 1, 0, 0,
0, 0, 0, 1, 1, 0, 0, 0,
0, 0, 0, 1, 1, 0, 0, 0,
0, 0, 1, 1, 1, 1, 0, 0,
@marcpalmer
marcpalmer / gist:1723179
Created February 2, 2012 12:05
Idea for a way to easily create dynamic JS data blocks in Grails
<%--
Set up the custom wrapper to automatically lay out before "head"
Resources would have a new "init" disposition added that always renders just before "head" disposition
--%>
<%--
This script would be lazy-evaluated only at time of rendering. "stash" would be the
accumulated data for this stash "name"
--%>
<r:script stash="globalJSData" disposition="init">
@marcpalmer
marcpalmer / gist:1868855
Created February 20, 2012 11:26
Authentication Plugin Example
class YourController {
def authenticationService
def onlyLoggedInUsers = {
if (!authenticationService.isLoggedIn(request)) {
// Redirect or return Forbidden
response.sendError(403)
} else {
… do something
}
}
@marcpalmer
marcpalmer / gist:1868866
Created February 20, 2012 11:29
Bean Fields Plugin Example
<bean:withBean beanName="form">
<bean:field property="firstName"/>
<bean:field property="lastName"/>
<bean:field property="company"/>
<bean:field property="email"/>
</bean:withBean>
@marcpalmer
marcpalmer / gist:1868903
Created February 20, 2012 11:47
Cache Headers Plugin Example
class ContentController {
def show = {
cache shared:true, validFor: 3600 // 1hr on content
render(....)
}
def todaysNewItems = {
cache shared: true, validUntil: new Date()+1
render(....)
}
@marcpalmer
marcpalmer / gist:1870968
Created February 20, 2012 19:44
Email Confirmation Plugin Example
class YourController {
def emailConfirmationService
def checkEmail = {
// Only do this if not confirmed already!
emailConfirmationService.sendConfirmation(params.emailAddress,
"Please confirm", [from:"[email protected]"])
}
}
@marcpalmer
marcpalmer / gist:1870981
Created February 20, 2012 19:46
Email Confirmation Plugin Example
class YourController {
def feed = {
render(feedType:"rss", feedVersion:"2.0") {
title = "My test feed"
link = "http://your.test.server/yourController/feed"
description = "The funky Grails news feed"
Article.list().each() { article ->
entry(article.title) {
link = "http://your.test.server/article/${article.id}"
article.content // return the content