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
// | |
// This has evolved into a fully-fledged project called DateDreamer. | |
// Please check the project's page for releases and more information. | |
// https://github.com/bahmanm/datedreamer | |
// | |
@Grab(group='com.github.yannrichet', module='JMathPlot', version='1.0.1') | |
@Grab(group='org.apache.commons', module='commons-math3', version='3.6.1') | |
import static java.lang.Math.* | |
import org.apache.commons.math3.complex.Complex |
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
#!/usr/bin/env bash | |
### | |
# Initialises a Gradle project with Groovy and Spock. | |
# | |
# How To Use? | |
# | |
# 1. Save the file, e.g. `gradle-init.sh` | |
# 2. Make it executable: `$ chmod +x gradle-init.sh` | |
# 3. Initialise the project: `$ ./gradle-init.sh YOUR_PROJECT_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
;; to save an object into a json file | |
(with-temp-buffer | |
(json-insert '(:foo "bar")) | |
(write-file "~/tmp/my.json")) | |
;; load a json file as hash table | |
(with-temp-buffer | |
(insert-file-contents "~/tmp/my.json") | |
(json-parse-buffer)) |
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
/** | |
* Using nested try-catch blocks. | |
* | |
* @param str a string representing an integer | |
* @return smallest integer type or null | |
*/ | |
Number atoi_NestedTryCatch(String str) { | |
try { | |
return Integer.valueOf(str); | |
} catch (NumberFormatException ignore1) { |
OlderNewer