View server.cs
This file contains 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
#!/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(); |
View trie.js
This file contains 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
// 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; |
View 0_reuse_code.js
This file contains 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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
View gist:3173128
This file contains 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.Linq; | |
using System.Diagnostics; | |
using System.Linq.Expressions; | |
using System.Reflection; | |
using System.Collections.Generic; | |
namespace ConsoleApplication3 | |
{ | |
class Program |