Skip to content

Instantly share code, notes, and snippets.

View jrwdexter's full-sized avatar

Jonathan Dexter jrwdexter

  • Monkeyjump Labs
  • Edina, Minnesota
View GitHub Profile
public class NotBehaviorCoupledTests
{
// GOOD
Fake<IMyDependency> _myDependency;
IMyService _myService;
[TestInitialize]
public void Initialize()
{
_myDependency = A.Fake<IMyDependency>();
@jrwdexter
jrwdexter / .cVimrc
Last active September 29, 2016 13:07
My cVimrc
" Hint searching
set numerichints
set typelinkhints
" Position bar at bottom like vimperator
let barposition = "bottom"
" Use <C-d> and <C-u> to scroll like in vimperator
map <C-u> scrollPageUp
map <C-d> scrollPageDown
@jrwdexter
jrwdexter / Challenge43.fsx
Last active March 1, 2016 00:06
Nerdery .NET Challenge #43 (In F#)
(**
# Challenge #43 solution - Lights out
*)
(**
## Helper methods
The first helper method we have is an active pattern to determine if a string is a valid bit string.
*)
let (|Bits|_|) (str:string) =

Last year, {INSERT_HOLIDAY_MYTH_HERE} (hereafter referred to as "Santa") created a special GMO: the Candy Cane Plant. However, after creating the plant Santa and his biologist friends found out that it suffered from an extreme deficiency: each plant could only breed once. Each candy cane plant has the following properties and methods:

public class CandyCanePlant
{
  int CandyCanesProducedPerWeek { get; set; }
  bool HasBred { get; set; }
}

public class BreederService
@jrwdexter
jrwdexter / 028 .NET Weekly Challenge: Oxford Commas.md
Last active November 16, 2015 23:20
.NET Weekly Challenge: Oxfordinator

028 .NET Weekly Challenge: Oxford Commas

This week's challenge is the first a series of cross-backend technology challenges (JVM, .NET, Ruby, and PHP). Code can be submitted in any language, and each submission will only be graded against like-languaged submissions.

First, some background: The oxford comma is a type of comma that is employed when there are more than two items in a list. It is also the source of countless pretentious debates.

This week's challenge is to create a set of methods that do two things: remove oxford commas from a string, and add oxford commas to a string.

class Oxfordinator
@jrwdexter
jrwdexter / Benchmark.csx
Last active August 29, 2015 14:04
Regex vs. where clause
using System.Diagnostics;
using System.Text.RegularExpressions;
var iterations = 1000;
var badString = "http://this.is.my/INVALID#!@STRING";
var replaceRegex = new Regex("[^a-z0-9]", RegexOptions.Compiled | RegexOptions.IgnoreCase);
// Test query
var sw = Stopwatch.StartNew();
@jrwdexter
jrwdexter / 0_reuse_code.js
Created July 15, 2014 16:54
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
<div class="form">
<input type="text" data-email-form name="firstName" />
<input type="text" data-email-form name="lastName" />
<input type="text" data-email-form name="email" />
<input type="text" data-email-form name="firstName" />
<input type="submit"
class="js-modal-submit-trigger"
data-url="/services/EmailSignUpService.asmx/SignUp"
data-method="POST"
data-form-fields="data-email-form" />
@jrwdexter
jrwdexter / git-branch-history
Created July 8, 2014 20:40
Displays branches and history for the current git repository. Place in $PATH to use.
#!/bin/bash
for k in `git branch -a $@|perl -pe s/^..//`;do echo -e `git show --pretty=format:"%Cgreen%ci %Cblue%cr%Creset" $k|head -n 1`\\t$k;done|sort -r