Skip to content

Instantly share code, notes, and snippets.

View jmarnold's full-sized avatar

Josh Arnold jmarnold

View GitHub Profile
@jmarnold
jmarnold / fubuvalidation.js
Created June 19, 2012 03:42
Ajax continuation js
// fubuvalidation.js v0.5.7
//
// Copyright (C)2011 Joshua Arnold
// Distributed under Apache License, Version 2.0
//
// https://github.com/DarthFubuMVC/fubuvalidation-js
(function ($, continuations) {
_.templateSettings = { interpolate: /\{\{(.+?)\}\}/g };
@jmarnold
jmarnold / timer.coffee
Created June 18, 2012 19:36
coffee coffee
class Timer
constructor: (interval) ->
@handle = null
@interval = interval
start: () ->
action = @action
@handle = window.setInterval(action, @interval)
stop: ->
@jmarnold
jmarnold / UniqueUsernameRule.cs
Created June 14, 2012 04:32
DI-Enabled validation rules
public class UniqueUsernameRule : IFieldValidationRule
{
private readonly IEntityRepository _repository;
public UniqueUsernameRule(IEntityRepository repository)
{
_repository = repository;
}
public void Validate(Accessor accessor, ValidationContext context)
@jmarnold
jmarnold / Wait.cs
Created June 13, 2012 14:35
Lessons learned
public static class Wait
{
public static void Until(Func<bool> condition, int millisecondPolling = 500, int timeoutInMilliseconds = 5000)
{
if (condition()) return;
var clock = new Stopwatch();
@jmarnold
jmarnold / AjaxContinuationExtensions.cs
Created June 10, 2012 04:13
Continuation payloads
public static class AjaxContinuationExtensions
{
public const string TOPIC = "topic";
public const string PAYLOAD = "payload";
public static AjaxContinuation SetPayload(this AjaxContinuation continuation, string topic, object payload)
{
continuation[PAYLOAD] = payload;
continuation[TOPIC] = topic;
@jmarnold
jmarnold / hello-world.js
Created June 8, 2012 06:16
Hello World Screen
$(function() {
var helloView = null;
var helloScreen = {
activate: function() {
helloView = $.diagnostics.createView('Hello World!');
helloView.configure(function() {
this.append('<p>Check this out</p>');
});
helloView.show();
},
public interface ISessionBoundary : IDisposable
{
IDocumentSession Session();
bool WithOpenSession(Action<IDocumentSession> action);
void SaveChanges();
void Start();
void MakeReadOnly();
}

Co-Working Fun

List of things for Josh to show off

  • Serenity Runner
  • Fubu Projections
  • fubu new command

Things to definitely discuss

@jmarnold
jmarnold / extensions.cs
Created June 1, 2012 16:57
Templating junk
public static class TemplateExtensions
{
public static string ToMustacheKey(this string name)
{
return "{{" + name + "}}";
}
public static string ToMustacheKey<T>(this Expression<Func<T, object>> expression)
{
return expression.ToAccessor().Name.ToMustacheKey();
@jmarnold
jmarnold / amplify.diagnostics.js
Created May 31, 2012 05:20
Simple amplifyjs diagnostics that open up when you hit '?'
amplifyDiagnostics = (function () {
var messages = [];
var publish = amplify.publish;
amplify.publish = function () {
var msg = {
topic: arguments[0]
};
if (arguments.length != 1) {
msg.data = arguments[1];