View github1.groovy
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
@Grab('com.github.groovy-wslite:groovy-wslite:1.1.0') | |
import wslite.rest.* | |
import wslite.http.auth.* | |
def client = new RESTClient("https://api.github.com") | |
def response = client.get( | |
path: '/repos/restlet/restlet-framework-java/events', | |
query: [page: 11]) // <== page 11 and beyond yield 422 |
View Api_Bunny_Maze.groovy
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
@Grab('com.github.groovy-wslite:groovy-wslite:1.1.0') | |
import wslite.rest.* | |
import wslite.http.auth.* | |
import groovy.json.* | |
def j = new JsonSlurper() | |
def base = 'http://apibunny.com' | |
def client = new RESTClient(base) |
View Result from the Github API
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
[ | |
{ | |
"login": "rsutphin", | |
"id": 2503, | |
"avatar_url": "https://avatars.githubusercontent.com/u/2503?v=3", | |
"gravatar_id": "", | |
"url": "https://api.github.com/users/rsutphin", | |
"html_url": "https://github.com/rsutphin", | |
"followers_url": "https://api.github.com/users/rsutphin/followers", | |
"following_url": "https://api.github.com/users/rsutphin/following{/other_user}", |
View gist:1f481e0f0d043260aa9a
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 groovy.transform.Immutable | |
@Immutable | |
class Point { | |
double x, y | |
} | |
Point p1 = [1.23, 5.67] | |
assert p1.x == 1.23 && p1.y == 5.67 |
View groovyCoffee.groovy
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
@Grab('com.netopyr.coffee4java:coffee4java:1.0.0') | |
import javax.script.ScriptEngineManager | |
def coffeescript = new ScriptEngineManager().getEngineByName('coffeescript').factory.scriptEngine | |
assert coffeescript.eval('''\ | |
square = (x) -> x * x | |
return square 3''') == 9 |
View gist:d0c13fd995abaf4f7a4b
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
### Keybase proof | |
I hereby claim: | |
* I am glaforge on github. | |
* I am glaforge (https://keybase.io/glaforge) on keybase. | |
* I have a public key whose fingerprint is C85A BAF0 7611 7C9D ACAD 94D1 5534 CABE 8D9C 5BD2 | |
To claim this, I am signing this object: |
View gist:e1d88601c053611678ae
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
http://jobs.netflix.com/jobs.php?id=NFX01044 | |
http://jobs.netflix.com/jobs.php?id=NFX00979 | |
http://jobs.netflix.com/jobs.php?id=NFX01209 | |
http://jobs.netflix.com/jobs.php?id=NFX01033 | |
http://jobs.netflix.com/jobs.php?id=NFX01176 | |
http://jobs.netflix.com/jobs.php?id=NFX01123 | |
http://jobs.netflix.com/jobs.php?id=NFX01428 | |
http://jobs.netflix.com/jobs.php?id=NFX00586 | |
http://jobs.netflix.com/jobs.php?id=NFX01393 |
View gist:c44f439974b631a384e9
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
@Grab("com.h2database:h2:1.3.173") | |
import grails.persistence.* | |
@Entity | |
@Resource(uri='/books') | |
class Book { | |
String title | |
} |
View LongAdderTest.groovy
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 java.util.Random | |
import java.util.concurrent.ConcurrentHashMap | |
import java.util.concurrent.atomic.LongAdder | |
import java.util.stream.IntStream | |
def frequencyMap = new ConcurrentHashMap<>() | |
def rnd = new Random() | |
IntStream.range( 0, 10000 ) | |
.parallel() |
View piapprox.groovy
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 groovy.transform.* | |
import groovyx.gpars.actor.* | |
import groovyx.gpars.group.* | |
@Immutable class Calculate {} | |
@Immutable class Work { int start, nrOfElements } | |
@Immutable class Result { double value } | |
@Immutable class PiApproximation { double pi ; long duration } | |
double calculatePiFor( int start, int nrOfElements ) { |