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 ) { |
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() |
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 |
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: |
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 |
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 |
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}", |
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) |
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 |
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('net.code-story:http:2.98') | |
import net.codestory.http.WebServer | |
new WebServer() | |
.configure { routes -> routes.anyGet { ctx -> "Hello"} } | |
.start() |
OlderNewer