Skip to content

Instantly share code, notes, and snippets.

View dphoebus's full-sized avatar
😏

Daniel Phoebus dphoebus

😏
  • CaptiveAire, Inc.
View GitHub Profile
@dphoebus
dphoebus / git-example.sh
Created September 28, 2020 20:22 — forked from akihiroy/git-example.sh
git example
# Clean up backup and loose objects.
git for-each-ref --format='delete %(refname)' refs/original | git update-ref --stdin
git reflog expire --expire=now --all
git gc --prune=now
# 全ての履歴に .gitignore / .gitattributes を追加する
git filter-branch --index-filter "cp -t ./ ../.gitignore ../.gitattributes && git add .gitignore .gitattributes" -f -- --all
@dphoebus
dphoebus / getGlobalPackages.sh
Created August 7, 2019 14:35 — forked from jkomyno/getGlobalPackages.sh
Get every globally install npm package
npm list -g --depth 0
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Single Page Apps for GitHub Pages</title>
<script type="text/javascript">
// Single Page Apps for GitHub Pages
// https://github.com/rafrex/spa-github-pages
// Copyright (c) 2016 Rafael Pedicini, licensed under the MIT License
// ----------------------------------------------------------------------
@dphoebus
dphoebus / safari-nomodule.js
Created August 1, 2019 18:18 — forked from samthor/safari-nomodule.js
Safari 10.1 `nomodule` support
/**
* Safari 10.1 supports modules, but does not support the `nomodule` attribute - it will
* load <script nomodule> anyway. This snippet solve this problem, but only for script
* tags that load external code, e.g.: <script nomodule src="nomodule.js"></script>
*
* Again: this will **not** prevent inline script, e.g.:
* <script nomodule>alert('no modules');</script>.
*
* This workaround is possible because Safari supports the non-standard 'beforeload' event.
* This allows us to trap the module and nomodule load.
@dphoebus
dphoebus / CoreAutomation.tt
Created August 28, 2018 14:33 — forked from troyanov/CoreAutomation.tt
Generate Enums from database lookup tables. CoreAutomation.tt - t4 helper class, that uses EnvDTE to get all Projects in Solution, configurations, etc. DBEnum.tt - generates enums for tables by criteria enumDescriptionColumnName
<#@ template debug="true" hostspecific="true" language="C#" #>
<#@ output encoding="utf-8" extension=".cs"#>
<#@ assembly name="EnvDTE" #>
<#@ assembly name="EnvDTE80" #>
<#@ assembly name="System.Core" #>
<#@ assembly name="System.Configuration" #>
<#@ import namespace="System.Collections.Generic" #>
<#@ import namespace="System.Configuration" #>
<#@ import namespace="System.Text.RegularExpressions" #>
<#@ import namespace="EnvDTE" #>
@dphoebus
dphoebus / LocalDB Reset
Created March 13, 2018 04:14 — forked from hanssens/LocalDB Reset
Reset SQL's LocalDB, after corrupt rights or other problems.
# After problems with a company-wide ActiveDirectory shaker, all (local) SQL Server instances were FUBAR.
# This 'resets' the LocalDB sql instance.
sqllocaldb stop "v11.0" -k
sqllocaldb delete "v11.0"
sqllocaldb create "v11.0"
sqllocaldb start "v11.0"
@dphoebus
dphoebus / CQRSWithMediatR.txt
Created November 13, 2017 19:15 — forked from pradeepn/CQRSWithMediatR.txt
CQRS with MediatR
MediatR
Simple mediator implementation in .NET for In-process messaging.
Supports request/response, commands, queries, notifications and events, synchronous and async with intelligent dispatching via C# generic variance.
https://github.com/jbogard/MediatR/wiki
Workflow
Workflow is kind of container for business logic. It could combine set of queries and commands into single operation which matters to end user.
namespace Cqrs.Domain
{
using System;
using Messages;
public abstract class BaseAggregateRoot<TAggregate> : IAggregateRoot
where TAggregate : class, IAggregateRoot
{
private static readonly IDispatchMessages<TAggregate> Dispatcher = new MessageDispatcher<TAggregate>();
using System;
using System.Diagnostics;
using System.Linq;
using System.Transactions;
using Raven.Client;
using Raven.Client.Document;
using Raven.Client.Linq;
public class Program
{
@dphoebus
dphoebus / gist:35de2c9638c4557fd8a3f91f6bfc888f
Created November 8, 2017 20:29 — forked from joliver/gist:1311195
NServiceBusCommitDispatcher
public sealed class NServiceBusCommitDispatcher : IPublishMessages
{
private const string AggregateIdKey = "AggregateId";
private const string CommitVersionKey = "CommitVersion";
private const string EventVersionKey = "EventVersion";
private const string BusPrefixKey = "Bus.";
private readonly IBus bus;
public NServiceBusCommitDispatcher(IBus bus)
{