Skip to content

Instantly share code, notes, and snippets.

@emiaj
emiaj / app.html
Last active May 21, 2016 05:37 — forked from charlespockert/add-suffix.js
Base Aurelia Gist
<template>
<require from="nav-bar.html"></require>
<require from="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css"></require>
<nav-bar router.bind="router"></nav-bar>
<div class="page-host" style="margin-top:50px">
<router-view></router-view>
</div>
</template>
@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));