Skip to content

Instantly share code, notes, and snippets.

@choongyouqi
choongyouqi / kotlin.md
Last active January 19, 2020 00:27
[Kotlin Cheatsheet] #Kotlin

Functions

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)}")
    }
}
@nielsutrecht
nielsutrecht / Car.java
Created April 26, 2017 12:25
Simple mockito example
public class Car {
private Engine engine;
private FuelTank fuelTank;
public Car(Engine engine, FuelTank fuelTank) {
this.engine = engine;
this.fuelTank = fuelTank;
}
public void start() {
@seltzer1717
seltzer1717 / calculator.clj
Last active February 24, 2020 17:00
Web Services with Clojure
;; 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
@moehammoud
moehammoud / Access-JSON-State-Array
Last active February 15, 2020 18:52
React JS Cheatsheet.
JSON.stringify(this.state.data)
@anvaka
anvaka / 00.Intro.md
Last active October 12, 2025 18:21
npm rank

npm rank

This gist is updated daily via cron job and lists stats for npm packages:

  1. Top 1,000 most depended-upon packages
  2. Top 1,000 packages with largest number of dependencies
  3. Top 1,000 packages with highest PageRank score
@mobilemind
mobilemind / git-tag-delete-local-and-remote.sh
Last active August 10, 2025 11:21
how to delete a git tag locally and remote
# 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
@dodyg
dodyg / gist:5823184
Last active July 13, 2025 08:51
Kotlin Programming Language Cheat Sheet Part 1

#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.

@corvax19
corvax19 / openssh-encrypt-decrypt.txt
Last active July 28, 2023 14:10
[/linux/openSSL] Simple text #encryption/#decryption with #openssl
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"