Skip to content

Instantly share code, notes, and snippets.

View jzabroski's full-sized avatar
🎯
Focusing

John Zabroski jzabroski

🎯
Focusing
View GitHub Profile
function a($f) {& $f}
function main() {
$f = {write-host 'success'}
a {& $f} # stack-overflow
a {& $f}.getnewclosure() # okay
}
[void] (main)
@Saissaken
Saissaken / Update git fork with tags.sh
Last active May 14, 2025 10:18
Update git fork with tags
# Repo: someuser/myframework
# Fork: superteam/myframework
# Track:
git clone https://github.com/superteam/myframework.git
cd myframework
git remote add upstream https://github.com/someuser/myframework.git
# Update:
git fetch upstream
@LitKnd
LitKnd / Execution-Cache-Single-Use-Plans-Explore.sql
Created January 31, 2017 17:50
TSQL to do a quick and dirty look at single-use plans in the execution plan cache of a SQL Server.
/***********************************************************
TSQL to do a quick and dirty look at single-use plans in
the execution plan cache of a SQL Server.
************************************************************/
/* Size of single use adhoc plans in execution plan cache */
SELECT
objtype,
cacheobjtype,
SUM(size_in_bytes)/1024./1024. as [MB]
@Jaykul
Jaykul / WhatIsIt.ps1
Created December 19, 2016 05:22
All those informative variables in PowerShell 6.0
$script:IsWindows = (-not (Get-Variable -Name IsWindows -ErrorAction Ignore)) -or $IsWindows
$script:IsLinux = (Get-Variable -Name IsLinux -ErrorAction Ignore) -and $IsLinux
$script:IsOSX = (Get-Variable -Name IsOSX -ErrorAction Ignore) -and $IsOSX
$script:IsCoreCLR = (Get-Variable -Name IsCoreCLR -ErrorAction Ignore) -and $IsCoreCLR
$script:IsNanoServer = $null -ne ('System.Runtime.Loader.AssemblyLoadContext' -as [Type])
$script:IsInbox = $PSHOME.EndsWith('\WindowsPowerShell\v1.0', [System.StringComparison]::OrdinalIgnoreCase)
@GuyHarwood
GuyHarwood / essential_libs.md
Last active May 9, 2019 19:20
just a list of libraries that are useful to automatically install into new projects

CS

  • Install-Package netfx-Guard
  • Install-Package NSubstitute (or Moq)
  • Install-Package xUnit
  • Install-Package AutoFixture
  • Install-Package AutoMapper
  • Install-Package SimpleInjector
  • Install-Package FluentMigrator
  • Install-Package GitVersion
using System;
using AbotX.Core;
using AbotX.Crawler;
using AbotX.Poco;
namespace AbotX.Parallel
{
public class ManualWebCrawlerFactory : IWebCrawlerFactory
{
private readonly CrawlConfigurationX _sharedConfig;
@sjdirect
sjdirect / WebCrawlerFactory.cs
Created June 8, 2016 02:14
Used by the ParallelCrawlEngine to create individual instances of CrawlerX.
using System;
using Abot.Core;
using Abot.Crawler;
using Abot.Poco;
using AbotX.Core;
using AbotX.Crawler;
using AbotX.Poco;
namespace AbotX.Parallel
{
@atwayne
atwayne / teamcity.process.trigger.ps1
Created May 18, 2016 17:34
A powershell script to trigger TeamCity build via REST API
$user = "username"
$password = "password"
$teamCityHost = "http://teamcity:8082/"
$pair = "$($user):$($password)"
$encodedCreds = [System.Convert]::ToBase64String([System.Text.Encoding]::ASCII.GetBytes($pair))
$basicAuthValue = "Basic $encodedCreds"
$headers = @{
"Authorization" = $basicAuthValue;
"Accept" = "application/xml";
@urasandesu
urasandesu / AutoFixture.AutoMoq.Prig.spike.cs
Created March 29, 2016 11:56
Prototype: AutoFixture with auto mocking using Moq and Prig
using Moq;
using Moq.Language;
using NUnit.Framework;
using Ploeh.AutoFixture;
using Ploeh.AutoFixture.Kernel;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Diagnostics.Prig;
@refactorsaurusrex
refactorsaurusrex / JsonDeserializer.cs
Last active October 15, 2018 17:09
Debugging RestSharp Deserialization Errors http://wp.me/p4mdOw-1f9
using System;
using Newtonsoft.Json;
using Newtonsoft.Json.Serialization;
using RestSharp;
using RestSharp.Deserializers;
namespace MyAwesomeProject
{
public class JsonDeserializer : IDeserializer
{