Skip to content

Instantly share code, notes, and snippets.

Darren Reid Layoric

Block or report user

Report or block Layoric

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@lahma
lahma / npgsql.cs
Last active Oct 26, 2018
Npgsql 3.0 with Quartz.NET 2.x - programmatic provider registration
View npgsql.cs
// reference Npgsql NuGet package v3 in project
using Npgsql;
using NpgsqlTypes;
// register provider with name Npgsql-30, Quartz V3 has this OOTB
// could also just do a assembly binding redirect
DbProvider.RegisterDbMetadata("Npgsql-30", new DbMetadata
{
@Layoric
Layoric / main.cs
Last active Sep 1, 2016
Auto mapping
View main.cs
using System;
using ServiceStack;
using ServiceStack.Text;
public class GetPersonResponse
{
public string FirstName { get;set; }
public string LastName { get;set; }
public int Age { get;set; }
}
@Layoric
Layoric / index.md
Last active Sep 1, 2016
Auto mapping
View index.md

Auto mapping

Auto mapping it a helpful utility in ServiceStack that allows you to easy populate different classes with the same structure allowing you to keep appropriate separations whilst reducing lines of code.

For example, it's common in ServiceStack to keep your request and response DTO classes separate from others like your OrmLite model classes or other logic classes even thought they might share the same structure.

public class GetPersonResponse
{
    public string FirstName { get;set; }
@hitsujiwool
hitsujiwool / docker.json
Created Sep 15, 2015
docker + docker-compose on Amazon Linux
View docker.json
{
"variables": {
"aws_access_key": "{{env `AWS_ACCESS_KEY`}}",
"aws_secret_key": "{{env `AWS_SECRET_KEY`}}"
},
"builders": [
{
"type": "amazon-ebs",
"ssh_pty": true,
"access_key": "{{user `aws_access_key`}}",
@igrigorik
igrigorik / server-timing.md
Last active Jun 14, 2016
Mechanism to communicate server timing data to the client (Server Timing)
View server-timing.md

Navigation and Resource Timing provides timing data for the fetch, but currently there is no interoperable way for the server to communicate own timing information to the client. For example:

  • What steps were taken to generate the resource, and how long each took. Many sites already embed this type of information via HTML comments - e.g. wordpress emits <!--Page generated in X.X seconds.--> , and many sites provide more detailed stats (cache, db, generation) to enable performance debugging.
  • If proxied, where was the time spent - e.g. time to fetch from origin, time to process response, etc.

Instead of relying on arbitrary HTML comments, we can define an HTTP header that can be used to send key-value pairs in a well defined format. Making this data available via a well defined interface would...

  • Allow UA and other developer tools to automatically annotate appropriate timelines.
  • Allow analytics vendors to gather this data for operational analysis.
  • Allows proxies and CDNs to append custom timing d
@davidfowl
davidfowl / dotnetlayout.md
Last active Oct 22, 2019
.NET project structure
View dotnetlayout.md
$/
  artifacts/
  build/
  docs/
  lib/
  packages/
  samples/
  src/
  tests/
@ReedD
ReedD / ec2-startup.sh
Last active Aug 4, 2019
User data for EC2 to set up Docker and Compose (Fig) for ec2-user
View ec2-startup.sh
#!/bin/sh
export PATH=/usr/local/bin:$PATH;
yum update
yum install docker -y
service docker start
# Docker login notes:
# - For no email, just put one blank space.
# - Also the private repo protocol and version are needed for docker
# to properly setup the .dockercfg file to work with compose
You can’t perform that action at this time.