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
//Problem: | |
//languages like tcl can simply switch between the String representation of a map or list and the | |
//object itself. In Groovy, this could theoretically work, but it doesn't: | |
def list1 = [1,2,3] | |
def list2 = ["1, 2, 3"] | |
assert list1 != list2 | |
assert list1.toString() == list2.toString() | |
assert Eval.me(list1.toString()) instanceof List | |
assert Eval.me(list2.toString()) instanceof List | |
assert Eval.me(list1.toString()) == Eval.me(list2.toString()) |
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
// simple script which shows how to read and write YAML with Groovy | |
@Grab("org.yaml:snakeyaml:1.16") | |
import org.yaml.snakeyaml.Yaml | |
def yamlData = """ | |
Time: 2001-11-23 15:01:42 -5 | |
User: a Test | |
# Multiline String | |
Warning: | |
This is an error message |
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(group='org.codehaus.groovy.modules.http-builder', module='http-builder', version='0.6' ) | |
import groovyx.net.http.RESTClient | |
import groovyx.net.http.EncoderRegistry | |
def github = new RESTClient( 'https://api.github.com/' ) | |
github.encoderRegistry = new EncoderRegistry( charset: 'utf-8' ) | |
def headers = [ | |
'Content-Type':'application/json; charset=utf-8', | |
'User-Agent':'rdmueller' // replace with your github user name | |
] |
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
// Copyright 2015 | |
// Licensed under the Apache License, Version 2.0 (the "License") | |
// original source https://gist.github.com/rdmueller/acee3a5db5ea3273652b | |
import org.codehaus.groovy.grails.commons.DefaultGrailsDomainClass | |
import grails.util.GrailsNameUtils | |
//includeTargets << grailsScript("_Init") | |
includeTargets << grailsScript("_GrailsPackage") | |
includeTargets << grailsScript("_GrailsBootstrap") |
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
GRAILS GROOVY SOURCE | |
3.0.1 | |
3.0.0 2.4 https://grails.github.io/grails-doc/3.0.x/guide/introduction.html | |
2.5.0 2.4 http://grails.1312388.n4.nabble.com/ANN-Grails-2-4-5-and-Grails-2-5-0-released-td4658938.html | |
2.4.5 | |
2.4.4 | |
2.4.3 | |
2.4.2 |
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 grails.converters.JSON | |
class AuthController { | |
def login = { | |
//let's fetch everything which depends on the provider from the config | |
def config = grailsApplication.config.oauth.providers[params.provider] | |
def appKey = config.appKey | |
def secret = config.secret | |
def scope = config.scope |
NewerOlder