Skip to content

Instantly share code, notes, and snippets.

using Akka.Actor;
using System.Collections.Generic;
namespace Actors
{
public class PreformanceCounterActor : ReceiveActor
{
private Dictionary<string, long> _counters;
public PreformanceCounterActor()
@jpierson
jpierson / ToMarkdownTable
Last active January 25, 2017 03:12
Linq style extension method for producing a table in markdown format from IEnumerable<T> source.
public static class LinqMarkdownTableExtensions
{
public static string ToMarkdownTable<T>(this IEnumerable<T> source)
{
var properties = typeof(T).GetProperties();
var maxColumnValues = source
.Select(x => properties.Select(p => p.GetValue(x)?.ToString()?.Length ?? 0))
.Union(new[] { properties.Select(p => p.Name.Length) }) // Include header in column sizes
.Aggregate(
@jpierson
jpierson / t-sql-tips.md
Last active February 28, 2017 18:49
T-SQL Tips

T-SQL Tips

Get definitions for all stored procedures and functions for a database

Getting the definitions can be useful when attempting to locate specific constants or dynamic usage of other database objects such as functions or tables.

select p.[name], s.[definition]
from sys.procedures p
 inner join sys.sql_modules s on p.[object_id] = s.[object_id]
@jpierson
jpierson / switch-local-git-repo-to-fork.md
Last active December 26, 2022 21:48 — forked from jagregory/gist:710671
How to move to a fork after cloning

If you are like me you find yourself cloning a repo, making some proposed changes and then deciding to later contributing back using the GitHub Flow convention. Below is a set of instructions I've developed for myself on how to deal with this scenario and an explanation of why it matters based on jagregory's gist.

To follow GitHub flow you should really have created a fork initially as a public representation of the forked repository and the clone that instead. My understanding is that the typical setup would have your local repository pointing to your fork as origin and the original forked repository as upstream so that you can use these keywords in other git commands.

  1. Clone some repo (you've probably already done this step)

    git clone git@github...some-repo.git
@jpierson
jpierson / gitflow-breakdown.md
Last active May 24, 2017 02:37 — forked from JamesMGreene/gitflow-breakdown.md
A comparison of using `git flow` commands versus raw `git` commands.

Initialize

gitflow git
git flow init git init
git commit --allow-empty -m "Initial commit"
git checkout -b develop master

Connect to the remote repository

@jpierson
jpierson / one-time-git-setup.md
Created April 24, 2017 09:06
Setup instructions for Git

Install Windows 10 VM free on Windows 7

If you find yourself forced to work in a Windows 7 environment but need or would like access to some Windows 10 features it turns out there is at least one way that I've stumbled accross which has worked for me.

Install a Virtual Machine

As far as free options that are well supported in Windows 7 Oracle Virtual Box seemed to be the best option I could find. If you go this route make sure to enable virtualization in the BIOS of your system to enable installing a 64-bit guest OS.

Install Windows 10 Pro as as a Guest OS

@jpierson
jpierson / useful-ad-commands.md
Last active July 15, 2021 17:57
Useful Windows Active Directory commands

Useful Windows commands for finding information on Active Directory groups and users.

Get a list of groups on the domain

net group /domain

List groups your current user belongs to

@jpierson
jpierson / ElmScratchPad.md
Last active August 2, 2017 03:38
Experimentation with the Elm language

Elm experiments

Lists

Join a list of strings into a single string with specified separator

import Html exposing (text)

v = [1,2,3]