Setup:
$ mongo
> use pubsub
> db.createCollection('messages', { capped: true, size: 100000 })
> db.messages.insert({})
using System.Collections.Frozen; | |
using System.Text; | |
var text = Console.ReadLine()!; | |
using var reader = new StringReader(text); | |
var parser = new Parser(); | |
var tokens = parser.Tokenize(reader).ToList(); | |
Console.WriteLine(string.Join("\n", tokens)); |
using System; | |
using Microsoft.AspNetCore.Mvc; | |
using Microsoft.AspNetCore.Mvc.Filters; | |
namespace Example | |
{ | |
public class ModelStateValidationFilter : Attribute, IActionFilter | |
{ | |
public void OnActionExecuting(ActionExecutingContext context) | |
{ |
config.MessageHandlers.Add(new CachingHandler | |
{ | |
UriTrimmer = (uri) => uri.LocalPath, | |
LinkedRoutePatternProvider = LinkedRoutePatternProvider | |
}); | |
public static IEnumerable<string> LinkedRoutePatternProvider(string s, HttpMethod httpMethod) | |
{ | |
var appAware = new Regex("/Api/[0-9]+/([a-z]|[A-Z])+/[0-9]+"); | |
if (appAware.IsMatch(s)) |
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Web; | |
using System.Web.Hosting; | |
using System.IO; | |
using System.Globalization; | |
namespace My.Helpers | |
{ |
// From http://stackoverflow.com/questions/931207/is-there-a-jquery-autogrow-plugin-for-text-fields | |
(function ($) { | |
$.fn.autoGrowInput = function (o) { | |
o = $.extend({ | |
maxWidth:1000, | |
minWidth:0, | |
comfortZone:70 | |
}, o); |
// Tokenahead.less | |
// --------------- | |
.tokenahead { | |
cursor: text; | |
overflow: hidden; | |
height: auto; | |
padding-bottom: 0; | |
border-color: @inputBorder; | |
} |