This focuses on generating the certificates for loading local virtual hosts hosted on your computer, for development only.
Do not use self-signed certificates in production ! For online certificates, use Let's Encrypt instead (tutorial).
/* | |
Copyright Phil Haack | |
Licensed under the MIT license - https://github.com/haacked/CodeHaacks/blob/main/LICENSE. | |
*/ | |
using System; | |
using System.Linq; | |
using System.Linq.Expressions; | |
using System.Reflection; | |
using Microsoft.EntityFrameworkCore; | |
using Microsoft.EntityFrameworkCore.Metadata.Builders; |
public class MyDbContext : DbContext | |
{ | |
private ITenantIdLocator tenantIdLocator; | |
public MyDbContext(ITenantIdLocator tenantIdLocator) | |
{ | |
if (tenantIdLocator == null) throw new ArgumentNullException(nameof(tenantIdLocator)); | |
this.tenantId = tenantIdLocator.GetTenantId(); | |
} | |
This focuses on generating the certificates for loading local virtual hosts hosted on your computer, for development only.
Do not use self-signed certificates in production ! For online certificates, use Let's Encrypt instead (tutorial).
/* | |
* Handling Errors using async/await | |
* Has to be used inside an async function | |
*/ | |
try { | |
const response = await axios.get('https://your.site/api/v1/bla/ble/bli'); | |
// Success 🎉 | |
console.log(response); | |
} catch (error) { | |
// Error 😨 |
using System; | |
using System.Linq; | |
namespace Extensions | |
{ | |
/// <summary> | |
/// Allow the up to the first eight elements of an array to take part in C# 7's destructuring syntax. | |
/// </summary> | |
/// <example> | |
/// (int first, _, int middle, _, int[] rest) = new[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; |
function isValidIsraeliID(id) { | |
var id = String(id).trim(); | |
if (id.length > 9 || id.length < 5 || isNaN(id)) return false; | |
// Pad string with zeros up to 9 digits | |
id = id.length < 9 ? ("00000000" + id).slice(-9) : id; | |
return Array | |
.from(id, Number) | |
.reduce((counter, digit, i) => { |
; win + v | |
#v:: | |
SendRaw %clipboard% |
rabbitmqctl add_user test test | |
rabbitmqctl set_user_tags test administrator | |
rabbitmqctl set_permissions -p / test ".*" ".*" ".*" |
Hierarchical data metrics that allows fast read operations on tree like structures.
Based on Left and Right fields that are set during tree traversal. When entered into node value is set to it's Left, when exiting node value is set to it's Right.
public class WebApplication : System.Web.HttpApplication | |
{ | |
protected void Application_Start() | |
{ | |
RouteTable.Routes.MapRoute("HttpProxy", "proxy/{*path}", new { controller = "Proxy", action = "Http" }) | |
} | |
} |