Skip to content

Instantly share code, notes, and snippets.

View markryd's full-sized avatar

Mark Rydstrom markryd

  • Brisbane, Australia
View GitHub Profile
@markryd
markryd / composition.cs
Created February 17, 2014 00:20
Mapping from the domain with expressions and function composition
void Main()
{
var h = Compose(Domain.ToContract, Herp.FromContract);
var mapped = Contacts.Select(h);
mapped.Dump();
}
public class Domain
{
//maintain a mapping to our public contract classes
@markryd
markryd / spinner.xaml
Created July 23, 2014 10:23
A Xaml spinner template with a polar gradient
<ControlTemplate x:Key="BusyIndicatorProgressBarControlTemplate" TargetType="telerik:RadProgressBar">
<Grid>
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="CommonStates">
<VisualState x:Name="Determinate"/>
<VisualState x:Name="Indeterminate">
<Storyboard RepeatBehavior="Forever">
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="IndeterminateDonut" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(RotateTransform.Angle)">
<SplineDoubleKeyFrame KeyTime="00:00:01" Value="360"/>
</DoubleAnimationUsingKeyFrames>
@markryd
markryd / LeakCheck
Created August 4, 2014 05:15
Check if something will leak memory
//via http://stackoverflow.com/questions/578967/how-can-i-write-a-unit-test-to-determine-whether-an-object-can-be-garbage-collec
[Test]
public void MyTest()
{
WeakReference reference = null;
new Action(() =>
{
var service = new Service();
// Do things with service that might cause a memory leak...
@markryd
markryd / media.ahk
Created August 19, 2014 03:38
Media Keys for AutoHotKey
^!p:: Send {Media_Play_Pause}
^!]:: Send {Media_Next}
^![:: Send {Media_Prev}
^!;:: Send {Volume_Down}
^!':: Send {Volume_Up}
^!l:: Send {Volume_Mute}
@markryd
markryd / vs.ahk
Created August 19, 2014 03:39
Kill and restart Visual Studio AutoHotKey
^!z::
SetTitleMatchMode RegEx
IfWinExist, .*NextGen.*Visual Studio
WinKill ; use the window found above
Run, "C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\devenv.exe" C:\dev\Centium\nextgen\NextGen.sln ; your sln
return
@markryd
markryd / dbup_buildtarget
Created July 15, 2015 04:42
Build target to force sql files to be embedded resources for dbup
<Target Name="AfterBuild">
<Message Text="@(Content)" Importance="high" Condition="%(Content.Extension) == '.sql'" />
<Error Condition="%(Content.Extension) == '.sql'" Text="The following scripts are marked as Content and must be changed to Embedded Resource: @(Content)" />
</Target>
- Overall Area (with Rating NC, M, NB, O), there should be 3-4 of these
- Highlights (Achievements and Outstanding)
- Areas for improvement (with Rating NC or M)
- How you are going to improve
- Leave out NB
@markryd
markryd / build-numbers.ps1
Created September 22, 2015 05:07
Set release numbers in Teamcity
# TeamCity's auto-incrementing build counter; ensures each build is unique
$buildNumber = "%build.number%"
$deploymentProject = "%deploymentTarget%"
# This gets the name of the current Git branch.
$branch = "%teamcity.build.branch%"
# Sometimes the branch will be a full path, e.g., 'refs/heads/master'.
# If so we'll base our logic just on the last part.
if ($branch.Contains("/"))
//_fixture.Call(patient, "UpdateDemographics");
//call a method with values from autofixture.
public static T Call<T>(this T component, Fixture fixture, string methodName) where T : class
{
var methodInfo = typeof(T).GetMethod(methodName);
var fixtureCreateMethod = typeof(SpecimenFactory)
.GetMethods()
.Where(m => m.Name == "Create" && m.IsGenericMethodDefinition)
@markryd
markryd / Reactive Extensions
Last active December 16, 2015 12:08
Reactive Extensions
Observable
.FromEventPattern<PropertyChangedEventArgs>(this, "PropertyChanged")
.Where(e => e.EventArgs.PropertyName == "FilterText")
.Throttle(TimeSpan.FromMilliseconds(500))
.Subscribe(e => FilterItems());