This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Text.RegularExpressions; | |
namespace RegexFail | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
var urlPattern = new Regex(@"(?i)\b((?:[a-z][\w-]+:(?:/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}/)(?:[^\s()<>]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:'"".,<>?«»“”‘’]))", RegexOptions.Compiled | RegexOptions.IgnoreCase); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace Accounts | |
{ | |
namespace NewAccounts | |
{ | |
public class When_creating_a_new_account { | |
Account account = new Account(); | |
public void Does_not_have_any_subscriptions() { | |
account.Subscriptions.Count.ShouldEqual(0); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ObjectFactory.Initialize(x => | |
{ | |
x.Scan(scan => | |
{ | |
scan.TheCallingAssembly(); | |
scan.WithDefaultConventions(); | |
scan.ConnectImplementationsToTypesClosing(typeof(AbstractValidator<>)); | |
}); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class SitePostRequest | |
{ | |
public int DatabaseIdentifier { get; set; } | |
[Required] | |
public string SiteId { get; set; } | |
[Required] | |
public string Name { get; set; } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class get_handler | |
{ | |
public SignInModel Execute(SignInRequest request) | |
{ | |
return new SignInModel {ReturnUrl = request.ReturnUrl, LoginFailed = request.LoginFailed}; | |
} | |
} | |
public class post_handler | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
define( ['jquery'], function ( $ ) { | |
var token = $( 'meta[name="csrf-token"]' ).attr( 'content' ); | |
$.ajaxSetup( { | |
beforeSend: function ( xhr ) { | |
xhr.setRequestHeader( 'X-CSRF-Token', token ); | |
} | |
}); | |
return token; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static IEnumerable<IEnumerable<TSource>> Slice<TSource>( | |
this IEnumerable<TSource> sequence, | |
int maxItemsPerSlice) | |
{ | |
if (maxItemsPerSlice <= 0) | |
{ | |
throw new ArgumentOutOfRangeException("maxItemsPerSlice", "maxItemsPerSlice must be greater than 0"); | |
} | |
var slice = new List<TSource>(maxItemsPerSlice); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// If using FubuAthentication, update auth ticket as needed (e.g. account creation or key updated) | |
private readonly IAuthenticationSession _auth; | |
public SomeController(IAuthenticationSession auth) { _auth = auth; } | |
_auth.MarkAuthenticated(user.Email); | |
// If using FubuAuthentication, make route available to anonymous users | |
[NotAuthenticated] | |
public FubuContinuation SomeRoute(SomeRouteInputModel input) | |
{ | |
// Use a continuation to redirect to input-less page |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function ($) { | |
$.fubuvalidation.Processor.findElementsWith(function(context) { | |
var element = $("#" + context.key, context.form); | |
if (element.size() == 0) { | |
return; | |
} | |
context.element = element; | |
}); | |
$.fubuvalidation.Processor.findElementsWith(function(context) { | |
var element = $("[name=" + context.key + "]", context.form); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using System.Text.RegularExpressions; | |
using System.Collections.Concurrent; | |
using System.Linq.Expressions; | |
using System.Collections; | |
namespace ExpressionParser { |