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');
@shadow-fox
shadow-fox / EmberCLI.log
Created June 5, 2014 06:39
Ember CLI Logs
npm ERR! Error: EACCES, unlink '/home/shafox/.npm/broccoli-sane-watcher/0.0.1/package'
npm ERR! { [Error: EACCES, unlink '/home/shafox/.npm/broccoli-sane-watcher/0.0.1/package']
npm ERR! errno: 3,
npm ERR! code: 'EACCES',
npm ERR! path: '/home/shafox/.npm/broccoli-sane-watcher/0.0.1/package',
npm ERR! parent: 'ember-cli' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
npm ERR! System Linux 3.2.0-63-generic
@shadow-fox
shadow-fox / business.conf
Created May 26, 2014 19:25
Apache conf for named virtual host for ember-cli app.
<VirtualHost *:80>
ServerName business.localhost.app
ServerAdmin webmaster@localhost
#DocumentRoot /var/www/html
ProxyPass / http://0.0.0.0:4300
<VirtualHost>
<?php
namespace SomeApi;
use ZF\ApiProblem\ApiProblem;
use ZF\ApiProblem\ApiProblemResponse;
class Module
{
public function onBootstrap($e)
{
@shadow-fox
shadow-fox / file
Created April 30, 2014 21:36
nested url resource
http://api.server/resource/id/child/:id
where resource id is compulsory but child's not. So that when queries for all resource's child the request will fire up
as http://api.server/resource/id/child , for creating a new child would be same.
For individual child records it would be http://api.server/resource/id/child/:id
{"feed":[{"id":"10","type":"Join LMS","action":"Joined LMS","status":"70","iFirstName":"ajsbdkjb","iLastName":"kjbdnkjdabnkjsdn","iUsername":"ajsbdkjb-kjbdnkjdabnkjsdn648","rFirstName":null,"rLastName":null,"rUsername":null,"iTeamName":null,"iTeamUrl":null,"rTeamName":null,"rTeamUrl":null,"feed":" has Joined LMS"},{"id":"11","type":"Profile Create","action":"Created","status":"70","iFirstName":"ajsbdkjb","iLastName":"kjbdnkjdabnkjsdn","iUsername":"ajsbdkjb-kjbdnkjdabnkjsdn648","rFirstName":null,"rLastName":null,"rUsername":null,"iTeamName":null,"iTeamUrl":null,"rTeamName":null,"rTeamUrl":null,"feed":"ajsbdkjb-kjbdnkjdabnkjsdn648 has created player profile."},{"id":"12","type":"Profile Update","action":"Updated","status":"70","iFirstName":"ajsbdkjb","iLastName":"kjbdnkjdabnkjsdn","iUsername":"ajsbdkjb-kjbdnkjdabnkjsdn648","rFirstName":null,"rLastName":null,"rUsername":null,"iTeamName":null,"iTeamUrl":null,"rTeamName":null,"rTeamUrl":null,"feed":"ajsbdkjb-kjbdnkjdabnkjsdn648 has updated profile."},{"id":"4","t
model
Object {user: Class, feeds: Class}
feeds: Class
__ember1394281568565: "ember702"
__ember1394281568565_meta: Object
_attributes: Object
_changesToSync: Object
_data: Object
action: "Joined LMS"
created: undefined