Skip to content

Instantly share code, notes, and snippets.

View mcgray's full-sized avatar

Oleksiy Rezchykov mcgray

  • Mountain View, CA
View GitHub Profile
@mcgray
mcgray / gist:4989993
Created February 19, 2013 21:15
ZT Magical Java Puzzle: “Pat The Unicorns” solution
public class Unicorn {
private static String line;
public static boolean pat() {
StackTraceElement[] stackTrace = Thread.currentThread().getStackTrace();
if (line == null) {
line = stackTrace[2].toString().split(":")[1];
return true;
} else if (!line.equals(stackTrace[2].toString().split(":")[1])) {