Skip to content

Instantly share code, notes, and snippets.

public interface IPartialActionExtension<T>
where T : class
{
T Modify(T model);
}
public class ProjectFubuRegistry : FubuRegistry
{
public ProjectFubuRegistry()
{
Applies.ToThisAssembly();
Actions.FindWith<PartialActionsSource>();
Views.TryToAttach(findViews =>
{
@RexMorgan
RexMorgan / AlternateConvention.cs
Created July 8, 2011 01:09
FubuMVC Authentication
graph
.Actions()
.Where(c => c.HasInput && c.InputType().Name.StartsWith("Add") || c.InputType().Name.StartsWith("Edit"))
.Each(c => c.WrapWith<AuthenticationRequiredBehavior>());
public class CustomAuthorizationFailureHandler : IAuthorizationFailureHandler
{
private readonly IOutputWriter _writer;
private readonly IUrlRegistry _urlRegistry;
public CustomAuthorizationFailureHandler(IOutputWriter writer, IUrlRegistry urlRegistry)
{
_writer = writer;
_urlRegistry = urlRegistry;
}
@RexMorgan
RexMorgan / FrontLoaderEndpoint.cs
Created July 10, 2011 10:30
FubuMVC FubuContinuation
public class FrontLoaderEndpoint
{
private readonly IUserRepository _userRepository;
public FrontLoaderEndpoint(IUserRepository userRepository)
{
_userRepository = userRepository;
}
public FubuContinuation Get(FrontLoaderRequestModel input)
@RexMorgan
RexMorgan / Program.cs
Created September 9, 2011 07:30
Razor Spike
using System;
using System.CodeDom.Compiler;
using System.Collections.Generic;
using System.IO;
using System.Text;
using System.Web.Razor;
using Microsoft.CSharp;
namespace RazorTest
{
/**
* Module dependencies.
*/
var express = require('express'),
mongoose = require('mongoose'),
config = require('./config').Config,
app_port = process.env.C9_PORT || 3001;
› node server.js
The "sys" module is now called "util". It should have a similar interface.
node.js:201
throw e; // process.nextTick error, or 'error' event on first tick
^
TypeError: object is not a function
at EventEmitter.CALL_NON_FUNCTION (native)
at Object.<anonymous> (/home/rex/Projects/foilr/lib/server.js:10:3)
at Object.<anonymous> (/home/rex/Projects/foilr/lib/server.js:11:4)
@RexMorgan
RexMorgan / gist:2046897
Created March 15, 2012 21:00
Selenium Error
15:15:25.348 INFO - Executing: [new session: {platform=ANY, browserName=firefox, version=}] at URL: /session)
15:15:28.876 INFO - Executing: org.openqa.selenium.remote.server.handler.Status@1e1c5dd1 at URL: /status)
15:15:28.877 INFO - Done: /status
15:15:32.073 INFO - Done: /session
15:15:33.880 INFO - Executing: org.openqa.selenium.remote.server.handler.Status@40d6dec at URL: /status)
15:15:33.881 INFO - Done: /status
15:15:37.480 INFO - Executing: org.openqa.selenium.remote.server.handler.GetSessionCapabilities@7f5c693a at URL: /session/1331825955017)
15:15:37.481 INFO - Done: /session/1331825955017
15:15:37.640 INFO - Executing: [get: http://www.uship.com/logout.aspx] at URL: /session/1331825955017/url)
15:15:38.883 INFO - Executing: org.openqa.selenium.remote.server.handler.Status@7e83fff9 at URL: /status)
app.post '/sign-up', (req, res) ->
User.create
email: req.body.email,
domain: req.body.domain + '.foilr.com'
.success (user) ->
user.setPassword req.body.password, ->
user.save()
.success ->
res.redirect '/login'
.error (err) ->