Skip to content

Instantly share code, notes, and snippets.

View cambiata's full-sized avatar

Jonas Nyström cambiata

View GitHub Profile
@cambiata
cambiata / testrest.php
Created March 22, 2011 07:06
Example controller extended from Controller_Cambiata_Rest
<?php
/**
* Test controller extending Controller_Cambiata_REST
* Jonas Nyström - cambiata
*
* To be used with a route like this one:
*
* Route::set('rest', 'rest(/<par1>(/<par2>(/<par3>(/<par4>(/<par5>)))))(.<format>)')
* ->defaults(array(
@cambiata
cambiata / rest.php
Created March 22, 2011 07:07
Rest Controller based on Kohana's and FuelPHP's
<?php
/**
* Quickly assemled rest controller based on Kohana 3's Kohana_Controller_REST
* https://github.com/kohana/core/blob/3.1%2Fmaster/classes/kohana/controller/rest.php
*
* Added functionality from FuelPHP's Controller_Rest
* https://github.com/fuel/fuel/blob/develop/fuel/core/classes/controller/rest.php
*
* All credits to Kohana and FuelPHP teams!
* Jonas Nyström - cambiata
@cambiata
cambiata / httpauth.php
Created March 22, 2011 07:09
Basic Http Authentication
<?php
/**
* Attempt to wrap Http Authentication into a separate class...
*
* Ideas and some code from FuelPHP Controller_Rest
* https://github.com/fuel/fuel/blob/develop/fuel/core/classes/controller/rest.php
*
*/
@cambiata
cambiata / View_Model
Created October 15, 2011 08:07
Simplistic Kohana3 View_Model attempt
<?php
/**
*
* Simplistic View_Model attempt for Kohana 3
* @author Cambiata
*/
class View_Model {
public function render($viewfile=FALSE)
{
@cambiata
cambiata / gist:3673008
Created September 8, 2012 09:23
HaxeNME workaround for KeboardEvent keyCode problem on Neko/Windows targets
/**
* ...
* @author Jonas Nyström
*/
class KeyboardTools {
/**
* Targeting neko and windows, this method returns the sam keycodes for
* letters a-z and the numeric keyboard as when targeting flash/html5
@cambiata
cambiata / Main.hx
Last active December 16, 2015 23:50
Haxe example comparing flash.display.Bitmap and starling.display.Image haxe -cp src -lib starling -swf F:/_dev/StarlingTest/bin/StarlingTest.swf -swf-header 800:600:30:FFFFFF -swf-version 11.4 -main Main -swf-lib starling.swf -D as3_native
package ;
import flash.display.Bitmap;
import flash.display.BitmapData;
import flash.display.PixelSnapping;
import flash.display.StageAlign;
import flash.display.StageScaleMode;
import flash.events.Event;
import flash.Lib;
import starling.display.Image;
@cambiata
cambiata / Main.hx
Last active December 18, 2015 12:19
HaxeDCI Greeting example - https://github.com/ciscoheat/haxedci
package ;
import neko.Lib;
import dci.Context;
/**
* ...
* @author
*/
@cambiata
cambiata / gist:471575a42676b27719e3
Created May 13, 2014 14:32
Haxe BytesLoader - binary data loader that works on Flash, JS, Neko, Cpp - Status: Proof of conept
package cx.data;
import haxe.io.Bytes;
import haxe.io.BytesData;
import haxe.io.BytesInput;
#if js
import js.html.ArrayBuffer;
import js.html.DataView;
import js.html.XMLHttpRequest;
@cambiata
cambiata / gist:cfc9a48f4e24653fc95a
Last active August 29, 2015 14:02
Lazy Evaluation idea
// The following will be macromagically transformed...
class LazyExample implements Lazy
{
var values:Array<Int>;
public function new()
{
this.values = [3, 5, 1, 7];
}
@cambiata
cambiata / Lazy Example
Last active August 29, 2015 14:02
Lazy macro implementation
package ;
import lazy.Lazy;
class Main
{
static function main()
{
var t:TestLazy = new TestLazy();
trace(t.sum);
trace(t.sum);