Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Human Talks: N'ayez pas peur de faire du Groovy
Search
Cédric Champeau
November 18, 2014
Programming
4
480
Human Talks: N'ayez pas peur de faire du Groovy
Slides du lightning talk donné à HumanTalks Nantes.
Cédric Champeau
November 18, 2014
Tweet
Share
More Decks by Cédric Champeau
See All by Cédric Champeau
JSol'Ex : traitement d'images solaires en Java
melix
0
130
JSol'Ex : solar image processing in Java
melix
0
490
Ecrire un microservice Java natif avec Micronaut et GraalVM
melix
1
150
Micronaut Test Resources
melix
1
230
Micronaut Test Resources
melix
1
390
AlpesJUG: Micronaut Test Resources
melix
0
72
Micronaut_Test_Resources.pdf
melix
0
180
Consommation électrique du foyer
melix
0
250
Micronaut AOT: optimiser vos application pour le JIT et GraalVM
melix
0
200
Other Decks in Programming
See All in Programming
watsonx.ai Dojo #6 継続的なAIアプリ開発と展開
oniak3ibm
PRO
0
180
快速入門可觀測性
blueswen
0
500
CNCF Project の作者が考えている OSS の運営
utam0k
3
340
HTML/CSS超絶浅い説明
yuki0329
0
200
PHPで学ぶプログラミングの教訓 / Lessons in Programming Learned through PHP
nrslib
4
1.1k
ecspresso, ecschedule, lambroll を PipeCDプラグインとして動かしてみた (プロトタイプ) / Running ecspresso, ecschedule, and lambroll as PipeCD Plugins (prototype)
tkikuc
2
2k
Внедряем бюджетирование, или Как сделать хорошо?
lamodatech
0
950
最近のVS Codeで気になるニュース 2025/01
74th
1
200
AHC041解説
terryu16
0
430
ESLintプラグインを使用してCDKのセオリーを適用する
yamanashi_ren01
2
250
自分ひとりから始められる生産性向上の取り組み #でぃーぷらすオオサカ
irof
5
1.7k
GitHub CopilotでTypeScriptの コード生成するワザップ
starfish719
26
6k
Featured
See All Featured
Building Better People: How to give real-time feedback that sticks.
wjessup
366
19k
For a Future-Friendly Web
brad_frost
176
9.5k
Rebuilding a faster, lazier Slack
samanthasiow
79
8.8k
Building Flexible Design Systems
yeseniaperezcruz
328
38k
Side Projects
sachag
452
42k
A Tale of Four Properties
chriscoyier
157
23k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
174
51k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
127
18k
No one is an island. Learnings from fostering a developers community.
thoeni
19
3.1k
StorybookのUI Testing Handbookを読んだ
zakiyama
28
5.4k
How STYLIGHT went responsive
nonsquared
96
5.3k
GraphQLとの向き合い方2022年版
quramy
44
13k
Transcript
N'ayez pas peur de faire du @CedricChampeau
Made in Nantes
Scripting
log.message "Releasing Groovy $version with user: $user" def desc =
"Release of $version" def date = new Date().format("yyyy-MM-dd'T'HH:mm:ss.SSSZ") def remoteCall = { String url, List params, Closure onFailure -> def p = ['curl', "-m", "3600", "-u", "$user:$key", *params, url].execute() int code = p.waitFor() def resp = p.text log.message "${resp}" if (code!=0 || resp.toLowerCase().contains('error') ) { onFailure(code) System.exit(code) } }
DSLs
remoteSession { scp { from { localDir "$buildDir/application " }
into { remoteDir '/usr/local/myapp' } timeout 10.minutes } }
Java friendly
@Immutable @ToString class Person { String name int age String
greet(String them) { "Hello $them, my name is $name" } }
Dynamic
@ToString class Person { String name int age } def
storage = [new Person(name:'Cédric', age:35), new Person(name:'Hugues', age:44)] Person.metaClass.static.methodMissing = { String name, args -> if (name.startsWith('findBy')) { String prop = (name - 'findBy').toLowerCase() storage.findAll { it."$prop" == args[0]} } } println Person.findByAge(35)
Static
@ToString class Person { String name int age } @CompileStatic
void erreurDeCompil() { println Person.findByAge(35) }
Functional
new URL('http://beta.groovy-lang.org').text .split(' ') .findAll { it == 'Groovy' }
.size()
Microservices?
@Grab('com.h2database:h2:1.3.179') import grails.persistence.* @Entity @Resource(uri='books') class Book { String title
}
Builds
apply plugin: 'groovy' repositories { jcenter() } dependencies { compile
'org.codehaus.groovy:groovy:2.3.4-beta-3' }
Android
notify(NOTIFICATION_ID) { smallIcon = R.drawable.ic_action_alarms largeIcon = cachedBitmap contentTitle =
'Time left' contentText = "$timeLeft (Elapsed: ${rounded}%)" contentIntent = pendingActivityIntent(0, intent(WearPresentationActivity), FLAG_UPDATE_CURRENT) ongoing = true style = bigTextStyle { bigText """Time left for your presentation: $timeLeft Elapsed time: ${rounded}%) """ } }
Templating
layout 'layouts/main.groovy', true, pageTitle: 'The Groovy programming language - Mailing-lists',
mainContent: contents { div(id: 'content', class: 'page-1') { div(class: 'row') { div(class: 'row-fluid') { div(class: 'col-lg-3') { include template: 'includes/community-navbar.groovy' } div(class: 'col-lg-8 col-lg-pull-0') { include template: 'includes/contribute-button.groovy' h1 { i(class: 'fa fa-envelope-o') {} yield ' Mailing-lists' } ...
Et tant d'autres...
None
Merci ! @CedricChampeau