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
140
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
77
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
サーバーゆる勉強会 DBMS の仕組み編
kj455
1
360
自分ひとりから始められる生産性向上の取り組み #でぃーぷらすオオサカ
irof
8
2.2k
富山発の個人開発サービスで日本中の学校の業務を改善した話
krpk1900
3
310
振り返れば奴(Cline)がいる
keiyagi
0
130
Swiftコンパイラ超入門+async関数の仕組み
shiz
0
190
社内フレームワークとその依存性解決 / in-house framework and its dependency management
vvakame
1
500
Kanzawa.rbのLT大会を支える技術の裏側を変更する Ruby on Rails + Litestream 編
muryoimpl
0
120
バックエンドのためのアプリ内課金入門 (サブスク編)
qnighy
7
1.5k
[Fin-JAWS 第38回 ~re:Invent 2024 金融re:Cap~]FaultInjectionServiceアップデート@pre:Invent2024
shintaro_fukatsu
0
360
Package Traits
ikesyo
2
230
『改訂新版 良いコード/悪いコードで学ぶ設計入門』活用方法−爆速でスキルアップする!効果的な学習アプローチ / effective-learning-of-good-code
minodriven
29
4.8k
BEエンジニアがFEの業務をできるようになるまでにやったこと
yoshida_ryushin
0
260
Featured
See All Featured
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
192
16k
Adopting Sorbet at Scale
ufuk
74
9.2k
4 Signs Your Business is Dying
shpigford
182
22k
Faster Mobile Websites
deanohume
305
30k
jQuery: Nuts, Bolts and Bling
dougneiner
63
7.6k
Fireside Chat
paigeccino
34
3.2k
Six Lessons from altMBA
skipperchong
27
3.6k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
27
1.5k
KATA
mclloyd
29
14k
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
113
50k
Building Better People: How to give real-time feedback that sticks.
wjessup
366
19k
The Straight Up "How To Draw Better" Workshop
denniskardys
232
140k
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