fun makeMathFun(num1: Int): (Int) -> Int = { num2 -> num1 * num2 }
fun mathOnList(numList: Array<Int>, myFunc: (num1: Int) -> Int) {
numList.forEach {
println("it: $it: ${myFunc(it)}")
}
}
This file contains hidden or 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
| public class Car { | |
| private Engine engine; | |
| private FuelTank fuelTank; | |
| public Car(Engine engine, FuelTank fuelTank) { | |
| this.engine = engine; | |
| this.fuelTank = fuelTank; | |
| } | |
| public void start() { |
This file contains hidden or 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
| ;; Example use of Java annotations in Clojure. | |
| ;; | |
| ;; The example uses javax.jws package to build a simle web service. | |
| ;; | |
| ;; Make sure you have Clojure and Java. | |
| ;; This example uses Clojure 1.8.0 and JDK8. | |
| ;; | |
| ;; Create the following folder structure: | |
| ;; | |
| ;; | webCalculator |
This file contains hidden or 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
| JSON.stringify(this.state.data) |
This file contains hidden or 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
| # delete local tag '12345' | |
| git tag -d 12345 | |
| # delete remote tag '12345' (eg, GitHub version too) | |
| git push origin :refs/tags/12345 | |
| # alternative approach | |
| git push --delete origin tagName | |
| git tag -d tagName |
#Intro
Kotlin is a new programming language for the JVM. It produces Java bytecode, supports Android and generates JavaScript. The latest version of the language is Kotlin M5.3
Kotlin project website is at kotlin.jetbrains.org.
All the codes here can be copied and run on Kotlin online editor.
Let's get started.
This file contains hidden or 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
| echo -n "That's the text"|openssl enc -e -aes-256-cbc -a | |
| Encrypt with interactive password. Encrypted message is base64-encoded afterwards. | |
| echo -n "That's the text"|openssl enc -e -aes-256-cbc -a -k "MySuperPassword" | |
| Encrypt with specified password. Encrypted message is base64-encoded afterwards. | |
| echo "GVkYiq1b4M/8ZansBC3Jwx/UtGZzlxJPpygyC"|openssl base64 -d|openssl enc -d -aes-256-cbc | |
| Base-64 decode and decrypt message with interactive password. | |
| echo "GVkYiq1b4M/8ZansBC3Jwx/UtGZzlxJPpygyC"|openssl base64 -d|openssl enc -d -aes-256-cbc -k "MySuperPassword" |