Skip to content

Instantly share code, notes, and snippets.

Avatar
😏

Daniel Phoebus dphoebus

😏
  • CaptiveAire, Inc.
View GitHub Profile
View git-example.sh
# 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 Aug 7, 2019 — forked from jkomyno/getGlobalPackages.sh
Get every globally install npm package
View getGlobalPackages.sh
npm list -g --depth 0
View 404.html
<!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 Aug 1, 2019 — forked from samthor/safari-nomodule.js
Safari 10.1 `nomodule` support
View safari-nomodule.js
/**
* 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 Aug 28, 2018 — 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
View CoreAutomation.tt
<#@ 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 Mar 13, 2018 — forked from hanssens/LocalDB Reset
Reset SQL's LocalDB, after corrupt rights or other problems.
View LocalDB Reset
# 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"
View CQRSWithMediatR.txt
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.
View BaseAggregateRoot.cs
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>();
View Simplified--No Nested Transactions
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
{
View gist:35de2c9638c4557fd8a3f91f6bfc888f
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)
{
You can’t perform that action at this time.