TIL Inheritance is weird

abstract class Foo {
  private class Bar {}
}
abstract class Bar extends Foo {
  abstract Bar self();
}
class Baz extends Bar {
  Baz self() { return this; }
}

Not exactly useful Java code, but did you know you can make it stop compiling by removing the “private” keyword? And that the compiler error is on the penultimate line?

Read More

Advertisements

Lock screen shortcut on Mac OS X

If you’re like me, you like being able to lock your Mac with a single keypress, but you can’t just trigger the screensaver, and you don’t want to kill your processes + network by sleeping your computer. Apple have been trying their best to make this really hard with El Capitan, but never fear! With a single open-source app and a couple of built-in Mac apps, you can get things up-and-running in just a few minutes. Read More