Skip to content

Instantly share code, notes, and snippets.

View jmarnold's full-sized avatar

Josh Arnold jmarnold

View GitHub Profile
@jmarnold
jmarnold / JObjectValues.cs
Created October 17, 2013 16:56
Improved JObjectValues
public class JObjectValues : IValueSource
{
private readonly JObject _jObject;
public JObjectValues(string json)
: this(JObject.Parse(json))
{
}
public JObjectValues(JObject jObject)
@jmarnold
jmarnold / sample.fubu
Created August 26, 2013 15:10
sample config
solution:
name 'ripple'
nuspecs 'packaging/nuget'
srcFolder 'src'
buildCmd 'rake'
fastBuildCommand 'rake compile'
constraints:
float 'current'
fixed 'current,nextMajor'
@jmarnold
jmarnold / outline.md
Last active December 21, 2015 04:39
Validation Demo

Standard form (Create Account)

  • Attributes first
  • Drop in authentication, re-style the form, and use OverridesFor to add validation
  • Add custom validation keys class (show how easy localization is)
  • Create the PastDateRule (show how easy testing can be)

Switch to ClassValidationRules (this helps enforce rule order)

Define the rules for the DateOfBirth property:

@jmarnold
jmarnold / hooks.js
Last active December 20, 2015 19:09
New hooks for Matt
$('#myForm').on('validation:started', function() {
// you could have remote rules so you'll want to disable the button while you wait
$(this).find(':submit').prop('disabled', true);
});
// This happens AFTER the promise has been completed and the notification has been resolved
$('#myForm').on('validation:onsubmission', function(e, validation) {
// Gives you access to the notification before the submission handler returns
// You could technically register additional messages here
//validation.notification
@jmarnold
jmarnold / hooks.js
Created August 7, 2013 15:52
Validation hooks for Matt
// This is missing but easy to add
$(form).bind('validation:onsubmit', function(e, promise) {
promise.done(function(notification) {
// query the notification itself
notification.isValid()
// use the continuation
notification.toContinuation();
});
});
@jmarnold
jmarnold / fubuvalidation.angular.js
Created August 6, 2013 14:03
fubuvalidation.js + angular.js
(function (angular, fubuvalidation) {
var validation = angular.module('$fubuvalidation', []);
validation.directive('validatedForm', function () {
return {
restrict: "C",
scope: true,
link: function (scope, element, attrs) {
element.activateFormValidation();
@jmarnold
jmarnold / 2.md
Last active December 20, 2015 02:58 — forked from anonymous/2.md
Reflection Kata 2

Reflection Kata 2

  • Level: Beginner
  • Target time: 5 minutes

Setup

Begin by creating a new Console application in Visual Studio called: ReflectionKata2. You will need to create two files:

  1. ReflectionTarget.cs
  2. ReflectionTests.cs
public interface IUserContext
{
User Current();
}
@jmarnold
jmarnold / 1.md
Last active December 19, 2015 22:59
Reflection Kata 1

Reflection Kata 1

  • Level: Beginner
  • Target time: 5 minutes

Setup

Begin by creating a new Console application in Visual Studio called: ReflectionKata1. You will need to create two files:

  1. ReflectionTarget.cs
  2. ReflectionTests.cs
@jmarnold
jmarnold / fubucontinuations.js
Created July 10, 2013 19:24
fubucontinuations.js tester
// fubucontinuations v2.0.0
//
// Copyright (C)2011-2013 Joshua Arnold, Jeremy Miller
// Distributed Under Apache License, Version 2.0
//
// https://github.com/DarthFubuMVC/jquery-continuations
(function () {
var exports = {};