Skip to content

Instantly share code, notes, and snippets.

View davidfowl's full-sized avatar

David Fowler davidfowl

View GitHub Profile
davidfowl / server.cs
Last active September 20, 2021 13:56 — forked from DamianEdwards/server.cs
Simplified ASP.NET Core app exploration
#!/usr/bin/env dotnet run
var builder = WebApplication.CreateBuilder(args);
var config = builder.Configuration;
var connString = config["connectionString"] ?? "Data Source=todos.db";
builder.AddDbContext<TodoDb>(options => options.UseSqlite(connString));
builder.AddSqlite<Todo>(connString) // Higher level API perhaps?
var app = builder.Build();
davidfowl / trie.js
Last active January 13, 2022 02:38 — forked from sajclarke/trie.js
Building a trie using Javascript.
// Question: Implement a route matching enging
// Given a list of routes as a list of strings and a matching route, build a route matching engine
// that returns true if a path matches.
const routes = ['/foo/blah/bar', '/foo', '/products']
function buildTrie(routes) {
var root = { path: {} };
for (var route of routes) {
var node = root;
davidfowl / 0_reuse_code.js
Last active August 29, 2015 14:15
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
davidfowl / gist:3173128
Created July 24, 2012 22:36 — forked from jmangelo/gist:3173109
MethodInfo.Invoke is slow... open instance delegate to the rescue
using System;
using System.Linq;
using System.Diagnostics;
using System.Linq.Expressions;
using System.Reflection;
using System.Collections.Generic;
namespace ConsoleApplication3
class Program