Skip to content

Instantly share code, notes, and snippets.

@CoreyKaylor
CoreyKaylor / CustomerEndpoints.fs
Last active August 29, 2015 13:57
F# FubuMVC Endpoints Hypothetical
module CustomerEndpoints
let ``GET /customers/list`` (repository: ICustomerRepository) =
repository.List
|> Seq.map customerToViewRecord
type GetCustomerInput = {Id: int;}
let ``GET /customers/{Id}`` (repository: ICustomerRepository) (input: GetCustomerInput) =
repository.Get input.Id |> customerToViewRecord

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name:

using MvcSample.Web.Models;
namespace MvcSample.Web
{
public class HomeController
{
public User Index()
{
var user = new User
{
public class ViewDataForActivation
{
[Activate]
public ViewDataDictionary ViewData { get; set; }
}
public class Startup
{
public void Configure(IApplicationBuilder app)
{
app.UseStaticFiles();
app.UseServices(services =>
{
services.AddMvc();
services.SetupOptions<MvcOptions>(x =>
@CoreyKaylor
CoreyKaylor / Main.kt
Created June 17, 2018 17:22
ktor structured logging - relies on logstash-logback-encoder
fun main(args: Array<String>) {
val server = embeddedServer(Netty, port = 9000) {
intercept(ApplicationCallPipeline.Infrastructure) {
val requestId = UUID.randomUUID()
log.attach("req.Id", requestId.toString(), {
log.info("Interceptor[start]")
proceed()
log.info("Interceptor[end]")
})
}