Skip to content

Instantly share code, notes, and snippets.

View dahlbyk's full-sized avatar

Keith Dahlby dahlbyk

View GitHub Profile
PS>git init test
Initialized empty Git repository in C:/temp/test/.git/
>
PS>cd test
>
PS>git commit --allow-empty -m test
[master (root-commit) 33f14f7] test
>
@dahlbyk
dahlbyk / demo.gitconfig
Created November 24, 2014 06:22
Git Demo Aliases
# To start a demo between <start-ref> and <end-ref> (default = HEAD):
# git demo <start-ref> [<end-ref>]
# To step through commits toward <end-ref>:
# git next
[alias]
demo = !sh -c 'git update-ref DEMO_HEAD $(git rev-parse ${2-HEAD}) && git checkout -fq $1~0' -
next = !sh -c 'git checkout -fq $(git log ..DEMO_HEAD --pretty=format:"%H" | tail -n1)' -
@dahlbyk
dahlbyk / gist:a8c63276536b94c463a7
Created November 1, 2014 21:58
Midwest Community Opportunities
Conferences
===========
Heartland Developer Conference in Omaha ~ September
Kansas City Developer Conf ~ June says Darin
St Louis Days of .NET ~ Nov (in two weeks, smart ass - thanks, seriously. you're the best)
Nebraska Code Camp ~ April (...)
Twin Cities Code Camp ~ April / October
Iowa Code Camp ~ "Spring" in summer (June last year, July this year), and Novemberish
That Conference ~ August (HIIIIIIGHLY recommended - Kalahari water park, BACON BAR)
Norweigian Developer Conference ~ June (a maz ing)
open System;
open System.Diagnostics;
[<EntryPoint>]
let main argv =
let rec cc amount coins =
match (amount, coins) with
| (0,_) -> 1
| (_,[]) -> 0
| (amount,_) when amount < 0 -> 0
@dahlbyk
dahlbyk / gist:6399709
Created August 31, 2013 17:59
Clarifying the D in SOLID...

Dependency Inversion Principle says do this:

class Foo
{
    IBar bar;

    public Foo(IBar bar) {
        this.bar = bar;
 }
@dahlbyk
dahlbyk / gist:5474986
Last active December 16, 2015 18:08
Git AMA from Twin Cities Code Camp, Apr 27, 2013

Keith Dahlby

@dahlbyk

  1. Philosophically, why is Git more than a Subversion killer?
  2. Should we switch from Mercurial?
  3. How does GitHub work?
  4. Is there a good distro to host a private repository (Linux)?
  5. Where to host/backup?
  • Gitolite
@dahlbyk
dahlbyk / .gitconfig
Created March 1, 2012 14:29
Windows Git Diff/Merge Tool Configuration
[alias]
dt = difftool
mt = mergetool
[diff]
tool = bc3
[difftool]
prompt = false
[difftool "bc3"]
cmd = \"c:/program files (x86)/beyond compare 3/bcomp.exe\" \"$LOCAL\" \"$REMOTE\"
[difftool "p4"]
$GitInstallDir = 'C:\Program Files (x86)\Git'
$Env:HOME = $Env:USERPROFILE
$Env:PLINK_PROTOCOL = 'ssh'
$Env:Path = "$GitInstallDir\bin;$GitInstallDir\mingw\bin;$Env:Path"
Set-Alias gitk "$GitInstallDir\cmd\gitk.cmd"
. C:\Dev\OSS\posh-git\profile.example.ps1
@dahlbyk
dahlbyk / Enable-AllowInteractWithDesktop
Created August 13, 2011 16:16
Set "Allow Interact with Desktop" for Windows Service
$svcName = Get-Service -DisplayName *cruise* | select -Exp Name
$svcKey = Get-Item HKLM:\SYSTEM\CurrentControlSet\Services\$svcName
# Set 9th bit, from http://www.codeproject.com/KB/install/cswindowsservicedesktop.aspx
$newType = $svcKey.GetValue('Type') -bor 0x100
Set-ItemProperty $svcKey.PSPath -Name Type -Value $newType
@dahlbyk
dahlbyk / gist:1102893
Created July 24, 2011 18:09
Rx Sliding Window
static IObservable<string> CheckForFraud(IObservable<string> logins)
{
return from g in logins.GroupByUntil(l => l, CheckForFraud)
from c in g.Count()
where c >= 3
select g.Key;
}
static IObservable<Unit> CheckForFraud(IGroupedObservable<string, string> g)
{