Skip to content

Instantly share code, notes, and snippets.

using ALS.Validation.Ajax;
using FubuMVC.Core.Ajax;
using FubuMVC.Core.Security;
using HelloWorld.Handlers.Home;
using HelloWorld.Services;
namespace HelloWorld.Handlers.Account
{
// ...
<!DOCTYPE html>
<html>
<head>
<title><use:title /></title>
${this.WriteScriptTags()}
</head>
<body>
<div class="page">
<div id="main">
<use:view />
console.log("test");
[AttributeUsage(AttributeTargets.Method)]
public class UrlAliasAttribute : Attribute
{
private readonly string _url;
public UrlAliasAttribute(string url)
{
_url = url;
}
public string Url
[TestFixture]
public class NumberBindingFixture
{
private CultureInfo _currentCulture;
private CultureInfo _currentUICulture;
private Model _model;
private string _rawValue;
private double _expectedNumber;
[SetUp]
@emiaj
emiaj / UniqueUsernameRule.cs
Created June 14, 2012 04:59 — forked from jmarnold/UniqueUsernameRule.cs
DI-Enabled validation rules
public class UniqueUsernameRule : IFieldValidationRule
{
public void Validate(Accessor accessor, ValidationContext context)
{
var email = accessor.GetValue(context.Target) as EmailAddress;
var repository = context.Services.Get<IEntityRepository>();
if (email == null) return;
var isUnique = !repository.All<User>().Any(x => x.Username.Equals(email.Address, StringComparison.OrdinalIgnoreCase));
var foo = new ObjectDef(typeof(Foo)); // you can also target a value instead of a type (new Foo())
foo.DependencyByType(typeof(IBar), typeof(Bar)); // by type
foo.DependencyByValue(typeof(IBaz), new Baz()); // by value
Services(x =>
{
x.AddService(typeof(IFoo), foo);
});
using System.Collections.Generic;
using Bottles;
using Bottles.Diagnostics;
using FubuCore;
using Spark;
namespace WebApplication7
{
public class SparkSettingsActivator : IActivator
{
public class MyOwnPolicy : IAssetPolicy
{
private readonly IAssetTagPlanCache _planCache;
private readonly IAssetDependencyFinder _finder;
public MyOwnPolicy(IAssetTagPlanCache planCache, IAssetDependencyFinder finder)
{
_planCache = planCache;
_finder = finder;
}
public class AssetsWarmUpPolicy : IAssetPolicy
{
private readonly IAssetRequirements _requirements;
private readonly IAssetTagPlanCache _planCache;
public AssetsWarmUpPolicy(IAssetRequirements requirements, IAssetTagPlanCache planCache)
{
_requirements = requirements;
_planCache = planCache;
}