Skip to content

Instantly share code, notes, and snippets.

View trayburn's full-sized avatar

Tim Rayburn trayburn

View GitHub Profile
@trayburn
trayburn / Gravatar.cs
Created February 3, 2011 14:53
Blog - Gravatar Support in Round Table Armory
using System.Collections.Generic;
using System.Security.Cryptography;
using System.Web.Mvc;
using System;
using System.Web;
namespace Armory.Web
{
public class Gravatar
{
@trayburn
trayburn / gist:935406
Created April 21, 2011 20:32
Basic example of using Rhino.Mocks
using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Rhino.Mocks;
using Adventure.Commands;
using Adventure.Data;
namespace Adventure.Tests
$project = ".\ConsoleApplication1.csproj"
$file = "<Compile Include='Models\NewClass.cs' />"
[xml](Get-Content $project) | `
Set-Variable -Name doc | `
Select-Xml "//x:ItemGroup[x:Compile]" -Namespace @{"x"=$doc.Project.xmlns} | `
Select-Object -ExpandProperty Node -First 1 | `
% { $_.InnerXml += $file; $doc.Save($project) }
@trayburn
trayburn / A_ReadMe.md
Last active December 17, 2015 05:29
Powershell Scaffolding Example

PowerShell Scaffolding

Amir's RRYN Version (RRYN == Ruby Rake Yaml Nokogiri)

Setup

First, assuming you've not done a bunch of PowerShell before, lets get you setup with the minimums (in my opinion)

  • Set your execution policy, if you haven't already. You can choose Unrestricted if you prefer, RemoteSigned is a minimum for PSGet.
@trayburn
trayburn / Page.xaml
Last active December 18, 2015 05:48
DEMO Code for Hello World C# Created by Tim Rayburn
<Page.BottomAppBar>
<AppBar x:Name="bottomBar"
Padding="10,0,10,0">
<Grid>
<StackPanel Orientation="Horizontal"
HorizontalAlignment="Right">
<Button Style="{StaticResource AddAppBarButtonStyle}"
Click="Button_Click" />
</StackPanel>
</Grid>
@trayburn
trayburn / demo.cs
Last active December 24, 2015 13:19
class LetThereBeAwesome {
public string AndThereWasAwesome { get; set; }
}
@trayburn
trayburn / README.md
Created October 10, 2013 22:11
PowerShell at DDNUG

Intro to PowerShell for Developers

Welcome

  • Two types of people
    • Unix Shell users
    • Command Prompts are Scary

PowerShell Basics

@trayburn
trayburn / Program.cs
Created December 12, 2013 05:00
EF Type per Hierarchy with Required example
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Data.Entity;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication2
{
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication21
{
class Program
{
@trayburn
trayburn / gist:dbed51fc792e9e6eefc9
Created January 29, 2015 19:48
Null Object Pattern helper extensions
public static class ObjectExtensions
{
/// <summary>
/// Null-safe member access helper.
/// Invokes the given accessor if the target object is not <c>null</c>.
/// </summary>
/// <typeparam name="T">
/// The type of the target object.
/// </typeparam>
/// <typeparam name="TResult">