Skip to content

Instantly share code, notes, and snippets.

View trayburn's full-sized avatar

Tim Rayburn trayburn

View GitHub Profile
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Query;
using Microsoft.EntityFrameworkCore.Query.SqlExpressions;
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Reflection;
namespace ConsoleApp1
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<configuration>
<release>11</release>
</configuration>
</plugin>
@trayburn
trayburn / GitAliases.sh
Created May 3, 2017 19:18
Tim Rayburn's GIT Aliases
git config --global alias.a 'add -A'
git config --global alias.b 'branch'
git config --global alias.c 'checkout'
git config --global alias.cb 'checkout -b'
git config --global alias.f 'fetch'
git config --global alias.l 'log --pretty=oneline --abbrev-commit'
git config --global alias.r 'rebase --interactive HEAD~10'
git config --global alias.s '-p status'
# primary workflow related aliases
@trayburn
trayburn / index.js
Created September 8, 2016 21:16
Node, Express & MongoDB for DDNUG
// Presented by Tim Rayburn
// VP of Consulting for Improving
// http://improving.com
// [email protected]
console.log('Started');
if ((Get-Process -Name slack -ErrorAction SilentlyContinue) -ne $null) {
$totalMemory = gwmi Win32_OperatingSystem | select -ExpandProperty TotalVisibleMemorySize
$slackMemory = (get-process slack | measure -Sum WS | select -ExpandProperty Sum) / 1024
$slackExecutable = (Get-Process -Name slack | select -First 1).path
if (($slackMemory / $totalMemory) -ge .1) {
Get-Process slack | Stop-Process
Start-Process $slackExecutable
}
}
$excludes = @("node_modules", "packages", ".git", ".vs")
function Get-SolutionFiles() {
(
@(Get-ChildItem *.sln) +
@(Get-ChildItem -Directory | ? { $excludes -notcontains $_.Name } | % { Get-ChildItem $_ -Recurse -Filter *.sln })
)
}
function Analyze-Solutions() {
$excludes = @("node_modules", "packages", ".git", ".vs")
function Get-SolutionFiles() {
(
@(Get-ChildItem *.sln) +
@(Get-ChildItem -Directory | ? { $excludes -notcontains $_.Name } | % { Get-ChildItem $_ -Recurse -Filter *.sln })
)
}
@trayburn
trayburn / ControllerConventions.cs
Created April 2, 2015 17:48
Example of a simple AppConvention written by Tim Rayburn
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using NUnit.Framework;
namespace Example.Tests.AppConventions
{
[TestFixture]
@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">
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication21
{
class Program
{