Skip to content

Instantly share code, notes, and snippets.

View bangarharshit's full-sized avatar

Harshit Bangar bangarharshit

  • Twitter
View GitHub Profile
@bangarharshit
bangarharshit / SealedClasses.java
Last active November 18, 2017 02:04 — forked from rjrjr/java-sealed-class
Poor Man's Sealed Classes (visitor pattern)
/**
* For Java developers all excited by and jealous of Kotlin's sealed classes.
* Do this when you wish you could put parameters on an enum.
*/
public class PoorMan {
private interface Event {
<T> T dispatch(EventHandler<T> handler);
}
interface EventHandler<T> {
@bangarharshit
bangarharshit / build-erlang-17.0.sh
Created November 20, 2015 12:31 — forked from bryanhunter/build-erlang-17.0.sh
Build Erlang 17.0 on a fresh Ubuntu box (tested on 12.04 and 14.04)
#!/bin/bash
# Pull this file down, make it executable and run it with sudo
# wget https://gist.githubusercontent.com/bryanhunter/10380945/raw/build-erlang-17.0.sh
# chmod u+x build-erlang-17.0.sh
# sudo ./build-erlang-17.0.sh
if [ $(id -u) != "0" ]; then
echo "You must be the superuser to run this script" >&2
exit 1
fi