Skip to content

Instantly share code, notes, and snippets.

/**
* handles application/json content type requests
*/
component {
void function configure(){}
void function preProcess(event,struct interceptData){
var rc = event.getCollection();
if(isJSONRequest())
// This module can be used to trigger the Google Adwords remarketing tag asynchronously, without loading unused ressources
// Mostly useful when the Google Remarketing tag is triggered only on specific conditions.
// Author : Vincent Hsu -> twitter.com/suisseo -> http://www.suisseo.ch
// Language : Javascript
// Usage : googremarketing.loadTag(conversionid, conversionlabel)
// Start Google Remarketing Module
var googremarketing = (function() {
var asyncload = 0;
// Load Async Google Adwords remarketing code
># java -ea:org.apache.lucene -cp /var/lib/chef/solr/solr-jetty/work/Jetty_0_0_0_0_8983_solr.war__solr__k1kf17/webapp/WEB-INF/lib/lucene-core-2.9-dev.jar org.apache.lucene.index.CheckIndex -fix /var/cache/chef/solr/data/index/
// PostgreSQL
@GrabConfig(systemClassLoader=true)
@Grab('postgresql:postgresql:9.0-801.jdbc4')
def sql = groovy.sql.Sql.newInstance(
"jdbc:postgresql://host.example.org/database",
"username", "password", "org.postgresql.Driver")
// MySQL
@GrabConfig(systemClassLoader=true)
// Converts an ArrayBuffer directly to base64, without any intermediate 'convert to string then
// use window.btoa' step. According to my tests, this appears to be a faster approach:
// http://jsperf.com/encoding-xhr-image-data/5
function base64ArrayBuffer(arrayBuffer) {
var base64 = ''
var encodings = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
var bytes = new Uint8Array(arrayBuffer)
var byteLength = bytes.byteLength
import static eu.appsatori.gdata.gsql.SSQL.*
// Groovy 1.7 syntax
select(all).from("Spreadsheet").sheet("Worksheet").limit(10).offset(5)
select(1, "test", 5, "it").from("Spreadsheet")
select(all).from("Spreadsheet").order(by).column("Column Name").sort(desc)
// fancy new 1.8 syntax
select all from "Spreadsheet" sheet "Worksheet" limit 10 offset 5
select 1, "test", 5, "it" from "Spreadsheet"
// saving from url to a file (append)
new File("output.xml") << new URL ("http://some.url/some/path.xml").getText()
/*
I'm converting an existing web-app to angular. We made extensive use of the
Google Visualization library in the past. It's a powerful, although
complicated API, so I was anxious to get it wrapped up in angular. This
populates a table with data returned from a custome service 'Account'
*/
'use strict';
/* Directives */
// PostgreSQL
@GrabConfig(systemClassLoader=true)
@Grab('postgresql:postgresql:9.0-801.jdbc4')
def sql = groovy.sql.Sql.newInstance(
"jdbc:postgresql://host.example.org/database",
"username", "password", "org.postgresql.Driver")
// MySQL
@GrabConfig(systemClassLoader=true)
@LCHCAPITALHUMAIN
LCHCAPITALHUMAIN / app.js
Last active August 29, 2015 14:23 — forked from auser/app.js
angular.module('myApp',
['ngRoute', 'myApp.services', 'myApp.directives']
)
.config(function(AWSServiceProvider) {
AWSServiceProvider.setArn('arn:aws:iam::<ACCOUNT_ID>:role/google-web-role');
})
.config(function(StripeServiceProvider) {
StripeServiceProvider.setPublishableKey('pk_test_YOURKEY');
})
.config(function($routeProvider) {