Skip to content

Instantly share code, notes, and snippets.

Avatar

Guillaume Laforge glaforge

View GitHub Profile
@glaforge
glaforge / package.json
Created May 4, 2017
Code for the Cloud Functions implementation of the demo from Cloud Next San Francisco on extending the Google Assistant with Actions on Google, API.AI and Cloud Functions
View package.json
https://www.youtube.com/watch?v=7e0RGIul8Kk
@glaforge
glaforge / package.json
Created May 4, 2017
Code for the Cloud Functions implementation of the demo from Cloud Next San Francisco on extending the Google Assistant with Actions on Google, API.AI and Cloud Functions
View package.json
https://www.youtube.com/watch?v=7e0RGIul8Kk
View transformerDSL.groovy
shadow {
transform {
canTransformResource { FileTreeElement element -> }
transform { TransformerContext context -> }
hasTransformedResource { }
modifyOutputStream { ZipOutputStream jos -> }
}
)
View dominoClock.html
<!DOCTYPE HTML>
<html>
<head>
<title>24h Domino Clock</title>
<meta http-equiv="refresh" content="60">
<script>
function drawDot(context, x, y) {
var lg1 = context.createLinearGradient(x - 10, y - 10, x + 20, y + 40);
lg1.addColorStop(0, 'black');
@glaforge
glaforge / GroovySparkPi.groovy
Created Jun 14, 2016
A groovyfied version of GroovySparkPi
View GroovySparkPi.groovy
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
@glaforge
glaforge / jdeferred_example_2.groovy
Created Apr 12, 2016
Another example combining JDeferred with Groovy
View jdeferred_example_2.groovy
@Grab('org.jdeferred:jdeferred-core:1.2.4')
import org.jdeferred.*
import org.jdeferred.impl.*
def d = new DeferredObject()
def p = d.promise()
// gotta be explicit and can't use Groovy closures:
// DoneCallback / DoneFilter / DonePite are ambiguous
// in terms of signature, for SAM type coercion
@glaforge
glaforge / jdeferred_ex1.groovy
Created Apr 12, 2016
Quick example of using JDeferred from Apache Groovy
View jdeferred_ex1.groovy
@Grab('org.jdeferred:jdeferred-core:1.2.4')
import org.jdeferred.*
import org.jdeferred.impl.*
def deferred = new DeferredObject()
def promise = deferred.promise()
promise.done { result ->
println "done: $result"
}.fail { rejection ->
@glaforge
glaforge / OAuth2-demo.json
Created Mar 19, 2016
Test your OAuth2 secured API using DHC
View OAuth2-demo.json
{
"version": 3,
"nodes": [
{
"id": "D410754A-AEB9-47BA-8C88-D018AF5BCCFC",
"lastModified": "2016-03-17T11:12:13.759+01:00",
"name": "OAuth2 demo",
"type": "Project"
},
{
@glaforge
glaforge / groovy-xmas.txt
Created Dec 29, 2015
Some Groovy Xmas poetry
View groovy-xmas.txt
So as we bring closure on twenty-15
@grab your maven by its j-bean
Swing those builders for a laugh
But only on their own classpath
Have you...
Met a class with a trait?
Got your binding way too late?
Seen Elvis looking like ?:
Or lost your way in recursion
@glaforge
glaforge / fluentHttp.groovy
Last active Aug 29, 2015 — forked from dgageot/fluentHttp.groovy
Fluent HTTP further groovyfied!
View fluentHttp.groovy
@Grab('net.code-story:http:2.98')
import net.codestory.http.WebServer
new WebServer()
.configure { routes -> routes.anyGet { ctx -> "Hello"} }
.start()