Skip to content

Instantly share code, notes, and snippets.

@DalSoft
DalSoft / webpack.config.js
Last active Jan 14, 2020
Webpack with multiple entries
View webpack.config.js
const glob = require('glob');
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const htmlPlugins = generateHtmlPlugins();
function generateHtmlPlugins() {
@DalSoft
DalSoft / app.html
Last active Dec 5, 2019 — forked from lstarky/app.html
Test
View app.html
<template>
<require from="styles.css" />
<require from="tree-view" />
<tree-view />
</template>
@DalSoft
DalSoft / ValidateCertificateChain.cs
Created Jul 10, 2019
ValidateCertificateChain for custom Root CA
View ValidateCertificateChain.cs
private static bool ValidateCertificateChain(X509Certificate certificate)
{
var chain = new X509Chain();
var root = new X509Certificate2("ca.cer"); // Root CA of Self signed cert
var cert = new X509Certificate2(certificate);
chain.Reset(); // Not sure is this is needed
chain.ChainPolicy.VerificationFlags = X509VerificationFlags.IgnoreRootRevocationUnknown;
chain.ChainPolicy.RevocationMode = X509RevocationMode.Online; // Check with our own CA if the cert has been revoked
chain.ChainPolicy.ExtraStore.Add(root); // Self signed Root CA
@DalSoft
DalSoft / bip39+bip32.cs
Created Nov 28, 2018 — forked from imyourm8/bip39+bip32.cs
BIP39 & BIP32 C# example implementation
View bip39+bip32.cs
/*
This code allows you to export BIP39 12 words phrase and use it with Ethereum/Loom
To check Popular derivative paths look here https://www.myetherwallet.com/#view-wallet-info
Or here is quick cheatsheet https://gyazo.com/a4199116750b57a02917eb255d4c033e
Dependency on very nice library https://github.com/MetacoSA/NBitcoin - clone and build it
*/
using NBitcoin;
@DalSoft
DalSoft / DalSoftDbContext.cs
Last active Mar 12, 2018
Entity Framework Core Migrations and Seeding
View DalSoftDbContext.cs
using System;
using System.IO;
using System.Linq.Expressions;
using System.Reflection;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.Extensions.Configuration;
namespace DalSoft.Data
@DalSoft
DalSoft / Startup.cs
Last active Nov 25, 2015
Professional WebApi Part 1 - WebApi bootstrap without any bloat using Owin
View Startup.cs
public class Startup
{
public void Configuration(IAppBuilder app)
{
var config = new HttpConfiguration();
var jsonSerializerSettings = config.Formatters.JsonFormatter.SerializerSettings;
//Remove unix epoch date handling, in favor of ISO
jsonSerializerSettings.Converters.Add(new IsoDateTimeConverter { DateTimeFormat = "yyyy'-'MM'-'dd'T'HH':'mm':'ss.fff" });
@DalSoft
DalSoft / CreateMessage.cs
Last active Aug 29, 2015
DalSoft.RestClient - dynamic C# rest client in action PushWoosh SDK
View CreateMessage.cs
// Method /createMessage https://www.pushwoosh.com/programming-push-notification/pushwoosh-push-notification-remote-api/#PushserviceAPI-Method-messages-create
dynamic pushwoosh = new RestClient("https://cp.pushwoosh.com/json/1.3");
var pushWooshResponse = await pushwoosh.CreateMessage.Post(new
{
request = new
{
application = "APPLICATION_CODE",
auth = "API_ACCESS_TOKEN",
notifications = new[] { new {
send_date = "now", // YYYY-MM-DD HH:mm OR 'now'
@DalSoft
DalSoft / Put.cs
Last active Aug 29, 2015
Introducing DalSoft.RestClient the dynamic rest client
View Put.cs
dynamic client = new RestClient("http://jsonplaceholder.typicode.com");
var post = new { title = "foo", body = "bar", userId = 10 };
var result = await client.Posts(1).Put(post);
Assert.That(result.title, Is.EqualTo(post.title));
Assert.That(result.body, Is.EqualTo(post.body));
Assert.That(result.userId, Is.EqualTo(post.userId));
Assert.That(result.HttpResponseMessage.StatusCode, Is.EqualTo(HttpStatusCode.OK));
@DalSoft
DalSoft / Get.cs
Last active Aug 29, 2015
Introducing DalSoft.RestClient the dynamic rest client
View Get.cs
dynamic client = new RestClient("http://jsonplaceholder.typicode.com");
var post = await client.Posts(1).Get();
Assert.That(post.HttpResponseMessage.StatusCode, Is.EqualTo(HttpStatusCode.OK));
Assert.That(post.id, Is.EqualTo(1));
@DalSoft
DalSoft / h1.css
Last active Aug 29, 2015
Introducing Brunch Below is a trivial example, it's obviously not a production quality and is for brevity just to show brunch working http://www.dalsoft.co.uk/blog/index.php/2014/10/15/introducing-brunch
View h1.css
h1 {
font-size: 3rem;
color:red;
}
You can’t perform that action at this time.