I hereby claim:
- I am kousen on github.
- I am kenkousen (https://keybase.io/kenkousen) on keybase.
- I have a public key whose fingerprint is 803D 8209 EE54 9E6B 716A D409 17B0 B54A 9BF8 18DD
To claim this, I am signing this object:
| // Gradle build file for the book "Mockito Made Clear" by Ken Kousen | |
| plugins { | |
| id 'java' | |
| } | |
| // depedency versions are in versions.gradle | |
| apply from: 'versions.gradle' | |
| group 'com.kousenit' | |
| version '1.0' |
| import groovy.transform.CompileStatic | |
| @CompileStatic | |
| class Jumble { | |
| // dictionary words avail on Mac (or any Un*x system based on BSD) | |
| private List wordList = | |
| new File('/usr/share/dict/words').readLines() | |
| .findAll { it.size() == 5 || it.size() == 6 } | |
| String solve(String clue) { |
| import groovy.json.* | |
| String jsonTxt = 'http://api.open-notify.org/astros.json'.toURL().text | |
| def json = new JsonSlurper().parseText(jsonTxt) | |
| println "There are ${json.number} people in space" |
| assert sql.rows('select * from ASTRONAUTS').size() == 6 | |
| sql.eachRow('select * from ASTRONAUTS') { row -> | |
| println "${row.name.padRight(20)} aboard ${row.craft}" | |
| } |
| @GrabConfig(systemClassLoader=true) | |
| @Grab('com.h2database:h2:1.4.200') | |
| Sql sql = Sql.newInstance(url: 'jdbc:h2:~/astro', driver: 'org.h2.Driver') | |
| sql.execute ''' | |
| create table if not exists ASTRONAUTS( | |
| id int auto_increment primary key, | |
| name varchar(50), | |
| craft varchar(50) | |
| ) |
| import groovy.json.* | |
| import groovy.transform.* | |
| import com.google.gson.Gson | |
| @Grab('com.google.code.gson:gson:2.8.6') | |
| @Canonical | |
| class Assignment { String name; String craft } | |
| @Canonical |
| import java.time.LocalDate; | |
| import java.time.Month; | |
| import static java.time.temporal.ChronoUnit.DAYS; | |
| import static java.time.temporal.ChronoUnit.MONTHS; | |
| import static java.time.temporal.ChronoUnit.YEARS; | |
| public class DaysToElection { | |
| private static String pluralize(long num) { | |
| return num == 1 ? "" : "s"; |
| #!/usr/bin/env groovy | |
| import java.time.LocalDate | |
| import java.time.Month | |
| import static java.time.temporal.ChronoUnit.* | |
| LocalDate electionDay = LocalDate.of(2020, Month.NOVEMBER, 3) | |
| LocalDate now = LocalDate.now() |
I hereby claim:
To claim this, I am signing this object:
| apply plugin: 'groovy' | |
| apply plugin: 'idea' | |
| sourceSets { | |
| src { | |
| main { | |
| groovy { | |
| srcDirs 'src' | |
| } | |
| } |