This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* handles application/json content type requests | |
*/ | |
component { | |
void function configure(){} | |
void function preProcess(event,struct interceptData){ | |
var rc = event.getCollection(); | |
if(isJSONRequest()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
># 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/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// saving from url to a file (append) | |
new File("output.xml") << new URL ("http://some.url/some/path.xml").getText() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
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 */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) { |
OlderNewer