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
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Cédric Champeau
November 18, 2014
Programming
550
4
Share
Human Talks: N'ayez pas peur de faire du Groovy
Slides du lightning talk donné à HumanTalks Nantes.
Cédric Champeau
November 18, 2014
More Decks by Cédric Champeau
See All by Cédric Champeau
Integrating Python and Java easily using (Micronaut) GraalPy
melix
0
85
JSol'Ex : traitement d'images solaires en Java
melix
0
260
JSol'Ex : solar image processing in Java
melix
0
760
Ecrire un microservice Java natif avec Micronaut et GraalVM
melix
1
250
Micronaut Test Resources
melix
1
320
Micronaut Test Resources
melix
1
490
AlpesJUG: Micronaut Test Resources
melix
0
160
Micronaut_Test_Resources.pdf
melix
0
260
Consommation électrique du foyer
melix
0
310
Other Decks in Programming
See All in Programming
サーバーレスで作る、動画データ管理基盤
oyasumipants
0
340
JavaDoc 再入門
nagise
0
250
決定論的オーケストレーションの設計と実装 / Design and Implementation of Deterministic Orchestration
nrslib
2
310
Transactional Change Stream Processing With Debezium and Apache Flink
gunnarmorling
1
150
OSもどきOS
arkw
0
380
「AIで開発し、AIを届ける」をEvalでつなぐ 〜AIネイティブに始めるプロダクト開発の実践〜 / Connecting "Develop with AI, deliver AI" with Eval
rkaga
3
1.1k
Why Laravel apps break—Mastering the fundamentals to keep them maintainable
kentaroutakeda
1
330
Oxlintのカスタムルールの現況
syumai
5
970
ユニットテストの先へ:テスト技法で要求・仕様を整理するJava開発実践 / Beyond_Unit_Testing_Practical_Java_Development_Techniques_for_Organizing_Requirements_and_Specifications
shimashima35
0
330
気づいたらRubyで100作品 ー クリエイティブコーディングが生活の一部になるまで / 100 Ruby Sketches Later: How Creative Coding Became Part of My Life
chobishiba
3
530
LLM Plugin for Node-REDの利用方法と開発について
404background
0
150
メソッドのジェネリクスでGoの夢は広がるか? / Kyoto.go #65
utgwkk
2
400
Featured
See All Featured
A Tale of Four Properties
chriscoyier
163
24k
Design of three-dimensional binary manipulators for pick-and-place task avoiding obstacles (IECON2024)
konakalab
0
440
<Decoding/> the Language of Devs - We Love SEO 2024
nikkihalliwell
1
230
The SEO identity crisis: Don't let AI make you average
varn
0
480
Heart Work Chapter 1 - Part 1
lfama
PRO
7
36k
Why You Should Never Use an ORM
jnunemaker
PRO
61
9.9k
First, design no harm
axbom
PRO
2
1.2k
How To Speak Unicorn (iThemes Webinar)
marktimemedia
1
470
Breaking role norms: Why Content Design is so much more than writing copy - Taylor Woolridge
uxyall
0
310
The Language of Interfaces
destraynor
162
26k
Sam Torres - BigQuery for SEOs
techseoconnect
PRO
0
280
The Illustrated Children's Guide to Kubernetes
chrisshort
51
52k
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