Skip to content

Instantly share code, notes, and snippets.

@raykolbe
raykolbe / java8.unreachable.md
Created September 5, 2016 16:41
Java 8 Unreachable code produces warning not error - confusing

This code has an unreachable catch block and the Java compiler does not produce an error it produces a warning. I can't figure out why. Please help!

class ParentException extends Exception {}
class ChildException extends ParentException {}

public class Scratch {
    public static void foo() throws ChildException {}

    public static void main(String args[]) {

try {

@raykolbe
raykolbe / take.it.to.the.bank.md
Last active September 4, 2016 21:02
OCAJP8 Question Bank

##Description While studying for the OCAJP8 exam I have created hundreds (if not more) of small code examples that help test my knowledge. The purpose of this document is to help myself and others test their knowledge of Java 8 in preparation for the OCAJP8 exam. Use this document as-is or as a starting point to create your own question bank. Feel free to contribute by commenting on this gist.

At some point it might make sense to turn this gist into a proper repo for better organization of code and contributions.

This is a living document

@raykolbe
raykolbe / CQRS.php
Created May 21, 2013 20:36
CQRS is simple!
<?php
namespace CQRSSample\Domain\Model
{
/**
* Please read this. It may be interesting to you. You can ridicule me ONLY if you read the whole thing.
*
* CQRS is NOT about different data sources and is NOT about Event Sourcing.
* CQRS IS about breaking out your reads and writes. It's powerful and simple!
@raykolbe
raykolbe / AvailalbleVenues.php
Last active December 15, 2015 07:59
CRUD in Application Service -- Is it a smell? #dddesign
<?php
namespace Application\Catalog\ValueObject;
class AvailableVenues
{
public function __construct($isOnline, $isInClassroom)
{
// set properties as bools
}
@raykolbe
raykolbe / Module.php
Created March 19, 2013 12:44
ZF2 navigation auto-inject to viewmodel
<?php
namespace Application;
use Zend\EventManager\EventInterface;
use Zend\ModuleManager\Feature\BootstrapListenerInterface;
class Module implements BootstrapListenerInterface,
{
/**
@raykolbe
raykolbe / Module.php
Created February 19, 2013 20:55
Blamo! Module
<?php
use Zend\ModuleManager\Feature\ServiceProviderInterface;
class Module implements ServiceProviderInterface
{
public function getServiceConfig()
{
return array(
'blamo.service' => function($sm) {
<?php
namespace Application\Cache;
use Zend\Cache\Storage\StorageInterface as Storage;
interface CacheAwareInterface
{
public function setCache(Storage $cache);
}