Skip to content

Instantly share code, notes, and snippets.

View darscan's full-sized avatar

Shaun Smith darscan

  • United Kingdom
View GitHub Profile
@darscan
darscan / or.js
Created May 9, 2011 13:49
And so I abandoned the Ruby to Node port after writing this:
Function.prototype.or = function(callback) {
var next = this;
return function(err, doc) {
if (err) {
callback(err, doc);
} else {
next(doc, callback);
}
};
};
protected var _foo:String;
[Bindable( "fooChanged" )]
public function get foo():String
{
return _foo;
}
public function setFoo( foo:String ):void
{
// IMediaRenderer.as
package example
{
public interface IMediaRenderer extends IDataRenderer, IUsesResources, IUsesPermissions
{
}
}
// MediaRenderer.as
package example
@darscan
darscan / DawnInjector.as
Created October 6, 2010 21:00
Initial stab at a Dawn Adapter for Robotlegs
package org.robotlegs.adapters
{
import flash.system.ApplicationDomain;
import org.robotlegs.core.IInjector;
import uk.co.ziazoo.injector.IInjector;
import uk.co.ziazoo.injector.impl.Injector;
public class DawnInjector implements org.robotlegs.core.IInjector
@darscan
darscan / ClassWithPrivateInjection.as
Created September 23, 2010 15:26 — forked from troygilbert/ClassWithPrivateInjection.as
private injection from troy
package
{
import private_injection;
class ClassWithPrivateInjection
{
include "inject.include.as";
private var mySecretWord:String;
$ bash < <( curl http://rvm.beginrescueend.com/releases/rvm-install-head )
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
121 364 121 364 0 0 201 0 0:00:01 0:00:01 --:--:-- 298
Initialized empty Git repository in [..]
remote: Counting objects: 13228, done.
remote: Compressing objects: 100% (3250/3250), done.
remote: Total 13228 (delta 8712), reused 13116 (delta 8638)
Receiving objects: 100% (13228/13228), 2.35 MiB | 128 KiB/s, done.
Resolving deltas: 100% (8712/8712), done.
@darscan
darscan / ruby_fun.rb
Created August 23, 2010 23:07
Some basic Ruby snacks
# Why Ruby is Fun
# Everything is an object
5.times {|x| puts x}
# Even nil is an object
puts nil.nil?
# Yes, nil is an object
nil.methods.each {|x| puts x}
@darscan
darscan / module_model.php
Created August 2, 2010 15:42
The Worst Code I've Ever Written
<?php
class Module_model extends Model
{
private $log = array();
private $module_row_cache = array();
private $module_field_cache = array();
/**
* Get Module Data and Resolve Dependencies
package com.visfleet.robotlegs {
import flash.display.DisplayObject;
import flash.display.DisplayObjectContainer;
import org.robotlegs.base.ContextEvent;
import org.robotlegs.core.IMediatorMap;
import org.robotlegs.mvcs.Actor;
public class Presenter extends Actor {
package org.robotlegs.utilities.remote
{
import com.adobe.serializers.json.JSONDecoder;
import mx.collections.ArrayCollection;
public class JsonRemoteService extends RemoteServiceBase
{
public function JsonRemoteService(rootURL:String = "")
{