Skip to content

Instantly share code, notes, and snippets.

View jmarnold's full-sized avatar

Josh Arnold jmarnold

View GitHub Profile
@jmarnold
jmarnold / schedules.cs
Created October 4, 2012 04:33
For Gary
public class CurrentScheduleBoundary : ICurrentScheduleBoundary
{
private readonly ISystemTime _systemTime;
private readonly ISchedulingGateway _gateway;
public CurrentScheduleBoundary(ISystemTime systemTime, ISchedulingGateway gateway)
{
_systemTime = systemTime;
_gateway = gateway;
}
@jmarnold
jmarnold / blah.cs
Created September 26, 2012 22:53
blah
return CreateNewObject<Something>(x => {
x.SetProperty(x => x.SomethingElse.Name);
});
public class Something {
public SomethingElse SomethingElse { get; set; }
}
@jmarnold
jmarnold / EmailAddress.cs
Created September 25, 2012 01:48
Email Address
public class EmailAddress : IValidated
{
private static readonly Regex EmailRegex = new Regex(@"^(([\w-]+\.)+[\w-]+|([a-zA-Z]{1}|[\w-]{2,}))@" +
@"((([0-1]?[0-9]{1,2}|25[0-5]|2[0-4][0-9])\.([0-1]?
[0-9]{1,2}|25[0-5]|2[0-4][0-9])\."
+ @"([0-1]?[0-9]{1,2}|25[0-5]|2[0-4][0-9])\.([0-1]?
[0-9]{1,2}|25[0-5]|2[0-4][0-9])){1}|"
+ @"([a-zA-Z]+[\w-]+\.)+[a-zA-Z]{2,4})$", RegexOptions.Compiled);
public EmailAddress()
@jmarnold
jmarnold / Global.asax.cs
Created September 18, 2012 04:32
Sample twitter app
public class Global : System.Web.HttpApplication
{
protected void Application_Start(object sender, EventArgs e)
{
FubuApplication
.For(new FubuRegistry(x =>
{
x.Actions.IncludeClassesSuffixedWithController();
x.Routes.HomeIs<MyController>(c => c.get_something());
@jmarnold
jmarnold / MyRegistry.cs
Created September 5, 2012 13:27
Authentication import
public class MyRegistry : FubuRegistry
{
public MyRegistry()
{
// There are services registered here but there are a couple of defaults missing and it's confusing
Import<ApplyAuthentication>(x => {
// By default we exclude actioncalls/models with the NotAuthenticatedAttribute
x.Exclude(chain => chain.SomeCustomFilter());
});
}
@jmarnold
jmarnold / SaySomething.cs
Created September 1, 2012 19:35
Handler examples
public class get_Message_Name_handler
{
public string Execute(SaySomething input)
{
return "{0}, {1}".ToFormat(input.Message, input.Name);
}
}
public class SaySomething
{
@jmarnold
jmarnold / configureFubuMVC.cs
Created September 1, 2012 19:14
Simplified fubu registry
public class ConfigureFubuMVC : FubuRegistry
{
public ConfigureFubuMVC()
{
IncludeDiagnostics(true);
ApplyHandlerConventions<HandlersMarker>();
Views.TryToAttachWithDefaultConventions();
}
@jmarnold
jmarnold / device-compatibility.coffee
Created July 25, 2012 16:28
Device Compatibility Spike
class CompatibilityNotification
constructor: ->
@violations = []
@rules = []
registerRule: (rule) ->
# probably just need the key here
@rules.push(rule)
registerViolation: (key, message) ->
@jmarnold
jmarnold / websites.md
Created July 5, 2012 15:06
Fubu Braindump

The Websites

Documentation would be GREAT but you know what? Our website(s) SUCK. I think this is where we start. I want something that at a glance can tell someone:

  • This is what exists in the Fubu family of frameworks (maybe a simple graphic -- I'll explain later)
  • Links to the details of each individual framework
  • Links to the "philosophy/why" of the framework

I want it braindead simple like: http://nancyfx.org/. Friendly and very welcoming tone. One that makes noobs feel at ease.

The content

We talk too much and don't put our money where our mouths are. We do it because, as you said, there are a LOT OF CONCEPTS. We just don't make quite make it real enough.

public class RequiresSiteAttribute : ModifyChainAttribute
{
public override void Alter(ActionCall call)
{
call.AddBefore(ActionCall.For<SiteFilter>(x => x.HasSite()));
}
}