Skip to content

Instantly share code, notes, and snippets.

View shadow-fox's full-sized avatar

Pranaya Behera shadow-fox

  • Bangalore,India
View GitHub Profile
@shadow-fox
shadow-fox / tower-of-hanoi.scala
Created September 25, 2015 19:02 — forked from travisbrown/tower-of-hanoi.scala
Solving the Tower of Hanoi at the type level
/**
* Type-level Tower of Hanoi
* by Travis Brown
*
* Note: not optimal, and probably won't work for some valid inputs.
* Tested with Scala 2.9.2 and Shapeless 1.2.3.
*/
import shapeless._, Nat._
@shadow-fox
shadow-fox / fizzbuzz-faster.scala
Created September 25, 2015 19:02 — forked from travisbrown/fizzbuzz-faster.scala
FizzBuzz in the type system (faster)
import shapeless._, Nat._
trait FizzBuzz[N <: Nat] {
type R3 <: Nat
type R5 <: Nat
def ti: ToInt[N]
def prev: List[String]
def d3: R3 =:= _0
def d5: R5 =:= _0
<?php
//...
class Module implements ApigilityProviderInterface
{
public function onBootstrap($e)
{
$app = $e->getTarget();
public function onBootstrap(MvcEvent $e)
{
$eventManager = $e->getApplication()->getEventManager();
// load site
$eventManager->attach(MvcEvent::EVENT_ROUTE, function ($e) {
$serviceManager = $e->getApplication()->getServiceManager();
$request = $e->getRequest();
$siteMapper = $serviceManager->get('Application\Site\SiteMapper');
<?php
namespace SomeApi;
use ZF\ApiProblem\ApiProblem;
use ZF\ApiProblem\ApiProblemResponse;
class Module
{
public function onBootstrap($e)
{
<?php
/*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY