Skip to content

Instantly share code, notes, and snippets.

@a4099181
a4099181 / Convert-ToPackageReference.ps1
Last active Feb 18, 2021
Converts packages.config into PackageReference at *.csproj project file. Requires XSLT stylesheet available as second file in the gist.
View Convert-ToPackageReference.ps1
Function Convert-ToPackageReference
{
Param ( [Parameter( Mandatory, ValueFromPipeline )][String] $inputUri,
[String] $stylesheetUri = "https://gist.githubusercontent.com/a4099181/074a6c3dd524ea0d343382137492399c/raw/cdd0fb31efd70c4c0f8c86ddb314de86ab8972e8/Convert-ToPackageReference.xsl",
[String] $resultsFile = [System.IO.Path]::GetTempFileName() )
Process {
$xslt = New-Object System.Xml.Xsl.XslCompiledTransform
$xslt.Load( $stylesheetUri )
$xslt.Transform( $inputUri, $resultsFile )
@Jargon64
Jargon64 / RSACryptoServiceProviderExtensions.cs
Last active Sep 17, 2020
RSACryptoServiceProvider Extension to add FromXmlString and ToXmlString methods for ASP.NET Core
View RSACryptoServiceProviderExtensions.cs
using System;
using System.Security.Cryptography;
using System.Xml;
namespace RSACryptoServiceProviderExtensions
{
public static class RSACryptoServiceProviderExtensions
{
public static void FromXmlString(this RSACryptoServiceProvider rsa, string xmlString)
{
@hperantunes
hperantunes / tail-grep.ps1
Created Feb 25, 2016
tail + grep powershell equivalent
View tail-grep.ps1
Get-Content C:\temp\mylogfile.log -tail 100 –wait | Select-String 'search'
@StevenLiekens
StevenLiekens / TypeMemberLayout.xaml
Last active Sep 21, 2020
StyleCop Type Member Layout for Resharper 9
View TypeMemberLayout.xaml
<?xml version="1.0" encoding="utf-16"?>
<Patterns xmlns="urn:schemas-jetbrains-com:member-reordering-patterns">
<TypePattern DisplayName="COM interfaces" Priority="2000">
<TypePattern.Match>
<And>
<Kind Is="Interface" />
<Or>
<HasAttribute Name="System.Runtime.InteropServices.InterfaceTypeAttribute" />
<HasAttribute Name="System.Runtime.InteropServices.ComImport" />
</Or>
@jen20
jen20 / CharacterEllipsisButtonStyle.xaml
Created Jan 6, 2014
WPF style which puts character ellipsis on button contents without replacing the ContentPresenter with a TextBlock and thus losing the ability to support access keys.
View CharacterEllipsisButtonStyle.xaml
<Style x:Key="CharacterEllipsisTextButtonStyle" TargetType="{x:Type Button}">
<Setter Property="FocusVisualStyle">
<Setter.Value>
<Style>
<Setter Property="Control.Template">
<Setter.Value>
<ControlTemplate>
<Rectangle Margin="2" SnapsToDevicePixels="True" Stroke="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" StrokeThickness="1" StrokeDashArray="1 2"/>
</ControlTemplate>
</Setter.Value>
@nickgravelyn
nickgravelyn / TextureManager.cs
Last active Jul 17, 2018
A texture manager for XNA that allows for "hot reloading" of textures in debug mode by using Texture2D.FromStream to load PNG files with the same name as the content requested. Falls back to content loading in release mode or if there's no PNG available. SpriteTexture has some extra stuff for tiles since I need it in my game, but the important t…
View TextureManager.cs
using System;
using System.Collections.Generic;
using System.IO;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Graphics;
namespace MyGame
{
public class SpriteTexture