Skip to content

Instantly share code, notes, and snippets.

View activebiz's full-sized avatar

Preyash Desai activebiz

  • United Kingdom, India
View GitHub Profile
@activebiz
activebiz / howto.md
Last active January 13, 2021 15:47 — forked from ckpearson/howto.md
Configuring ASP.NET Core HTTPS with a self-signed CA root & cert for iOS development on OSX

The Problem

ASP.NET core has a very useful dev-certs utility capable of producing self-signed certificates for local https development work.

This works for the most-part, but as soon as you start wanting to do local development of a native app, iOS refuses to trust the certificate, or indeed, to even let you tell it to trust it.

You can see This Issue for some more context.

The Solution

This is what worked for me, I make no guarantees as to its efficiency or ongoing efficacy.

protected override void Configure(IObjectTypeDescriptor descriptor)
{
descriptor.Field<MyField>(f => f.CreateModel(default))
.Argument("input", a => a.Type<NonNullType<MyInputType>>())
.UseValidator<MyModel, MyInputTypeValidator>()
.Type<NonNullType<MyModelResult>>();
}
internal static class MyValidationMiddlewareFieldExtensions
{
public static IObjectFieldDescriptor UseValidator<T, V>(this IObjectFieldDescriptor descriptor)
where V : AbstractValidator<T>
{
return descriptor.Use<MyValidationMiddleware<T, V>>();
}
}
public class MyValidationMiddleware<T, V>
{
private readonly FieldDelegate _next;
private readonly IMyValidator<T, V> _validator;
public MyValidationMiddleware(FieldDelegate next, IMyValidator<T, V> validator)
{
_next = next;
_validator = validator;
}
internal class MyInputTypeValidator : AbstractValidator<MyModel>, IMyValidator<MyModel, MyInputTypeValidator>
{
public MyInputTypeValidator(IMyService myService)
{
… // validation rules
}
}
public interface IMyValidator<T, V> : IValidator<T>
{
}
@activebiz
activebiz / app.html
Created March 12, 2017 09:11 — forked from ScottWhittaker/app.html
Aurelia Router Demo
<template>
<require from="components/navigation.html"></require>
<h1>Aurelia Router Demo</h1>
<navigation router.bind="router" class="primary-navigation"></navigation>
<div class="page-host">
<router-view></router-view>
</div>
</template>
<template>
<h1>${message}</h1>
<input value.bind="myText"/>
</template>
<template>
<form submit.delegate="submit()">
<!--<ul><li repeat.for="error of controller.errors">${error.message}</li></ul>-->
<div class="form-group">
<label class="control-label" for="first">First Name</label>
<input type="text" class="form-control" id="first" placeholder="First Name"
value.bind="firstName & validate">
</div>
@activebiz
activebiz / gulpfile.js
Last active January 31, 2016 16:52
VSCode & Chrome debugger (Plugin) with typescript.
gulp.task('tscompile', function (done) {
return gulp.src('app/**/*.ts')
.pipe(sourcemaps.init())
.pipe(ts({
target: "es5",
module: "system",
emitDecoratorMetadata: true,
experimentalDecorators: true
})).js
.pipe(sourcemaps.write('.',{ includeContent: true, sourceRoot: "/" }))