Skip to content

Instantly share code, notes, and snippets.

View thebentern's full-sized avatar

Ben Meadors thebentern

View GitHub Profile
@jsnape
jsnape / EnumerableReader.fs
Last active November 21, 2018 14:52
F# IEnumerable<'T> -> IDataReader
open System
open System.Reflection
open System.Collections.Generic
open System.Data
open System.Linq
open System.Linq.Expressions
type private accessor<'T> = { Index: int; Name: string; Getter: 'T -> obj }
/// IEnumerable to IDataReader wrapper class
@mkchandler
mkchandler / DisableNuGetPackageRestore.ps1
Last active February 13, 2018 04:07
Disable the NuGet Package Restore functionality in a Visual Studio solution.
# Usage: .\DisableNuGetPackageRestore.ps1 C:\Path\To\Solution.sln
# Get the path that the user specified when calling the script
$solution = $args[0]
$solutionPath = Split-Path $solution -Parent
$solutionName = Split-Path $solution -Leaf
# Delete the .nuget directory and all contents
Remove-Item (Join-Path $solutionPath ".nuget") -Force -Recurse -ErrorAction 0
@FGRibreau
FGRibreau / 0_readme.md
Created November 2, 2013 22:56
Mock NodeJS net.Socket with ReadWriteStream
var dummySocket = new ReadWriteNetStream();

// Debug
dummySocket.on('data', function(data){
console.log('write received', data);
});

dummySocket.write('hey !');
@joey-qc
joey-qc / TSQL-to-POCO
Created September 26, 2013 06:56
A simple TSQL script to quickly generate c# POCO classes from SQL Server tables and views. You may tweak the output as needed. Not all datatypes are represented but this should save a bunch of boilerplate coding. USAGE: Run this query against the database of your choice. The script will loop through tables, views and their respective columns. Re…
declare @tableName varchar(200)
declare @columnName varchar(200)
declare @nullable varchar(50)
declare @datatype varchar(50)
declare @maxlen int
declare @sType varchar(50)
declare @sProperty varchar(200)
DECLARE table_cursor CURSOR FOR
public static class LINQPadExtensions
{
private static readonly Dictionary<Type, string> TypeAliases = new Dictionary<Type, string> {
{ typeof(int), "int" },
{ typeof(short), "short" },
{ typeof(byte), "byte" },
{ typeof(byte[]), "byte[]" },
{ typeof(long), "long" },
{ typeof(double), "double" },
{ typeof(decimal), "decimal" },
@robdmoore
robdmoore / init.ps1
Last active November 2, 2020 11:22
Prototyping NuGet install.ps1 script to install chrome driver as embedded .exe to project
param($installPath, $toolsPath, $package, $project)
Import-Module (Join-Path $toolsPath "webdriver_installs.psm1")
@drub0y
drub0y / NewRelicIgnoreTransactionOwinModule.cs
Created June 25, 2013 16:46
This is a proof of concept (read: not tested yet) Owin module that one could configure in an Owin pipeline to ensure that NewRelic will ignore the transaction.
public class NewRelicIgnoreTransactionOwinModule
{
private AppFunc _nextAppFunc;
public NewRelicIgnoreTransactionOwinModule(AppFunc nextAppFunc)
{
_nextAppFunc = nextAppFunc;
}
public Task Invoke(IDictionary<string, object> environment)
@stevenkuhn
stevenkuhn / gist:5062660
Last active March 7, 2023 16:03
This PowerShell script generates release notes for Octopus Deploy that contain the GitHub commits and JIRA issues from the current build to the latest production release. It will also create the Octopus release based on the TeamCity build number.
#
# Assumptions
#
# 1. If you have a Octopus release deployed, say 1.0.0.73, there is a git
# tag set for that commit in GitHub that is "v1.0.0.73".
#
# 2. You have TeamCity label each successful build in GitHub with the format
# "v{build number}. Sidenote: it appears that TeamCity only labels the
# default branch, but not feature branches.
#
@josheinstein
josheinstein / LINQ.psd1
Created April 30, 2012 16:29
LINQ-ish Cmdlets for PowerShell
@{
# MODULE
Description = 'LINQ for PowerShell'
ModuleVersion = '3.0'
GUID = '03BDA80F-0831-406E-B6AE-59E32D73F190'
# AUTHOR
Author = 'Josh Einstein'
CompanyName = 'Einstein Technologies'
@davidfowl
davidfowl / Powershell Magic
Created March 2, 2011 06:41
Script showing how to use Register-TabExpansion. The sample is adding intellisense for Scaffold-Controller
function global:Get-Types {
param (
$ProjectName,
$BaseType,
[switch]$IgnoreProjectReferences
)
if($ProjectName) {
$project = Get-Project $ProjectName
}
else {