Skip to content

Instantly share code, notes, and snippets.

View RickStrahl's full-sized avatar

Rick Strahl RickStrahl

View GitHub Profile

This works with an abstract class:

Base class:

/// <summary>
/// Handles the Administration Form API backend tasks
/// </summary>
[Route("api/LocalizationAdministration")]
[UnhandledApiExceptionFilter]    
@RickStrahl
RickStrahl / UsingGistsForGeneralPurposeWebPagesWithMarkdown.md
Last active September 6, 2022 19:29
Using Gists for General Purpose Web Pages with Markdown
title abstract keywords categories weblogName postId
Using Gists for General Purpose Web Pages with Markdown
Most of you probably know and use Github Gists for sharing Code snippets. But did you know that Gists also support Markdown? Using Markdown makes it easy to create much richer code shareable code and even allows for an easy way to create self-contained Web content.
Gist,Markdown,Share,Social Media
Markdown
West Wind Web Log
502103

Using Gists for General Purpose Content with Markdown

@RickStrahl
RickStrahl / Slug.cs
Created January 4, 2018 07:57
Generate Slug
/// <summary>
/// Creates a unqique slug
/// </summary>
/// <param name="titleText"></param>
/// <returns></returns>
public string CreateSlug(string titleText = null)
{
if (titleText == null)
titleText = Title;
if (string.IsNullOrEmpty(titleText))
@RickStrahl
RickStrahl / usingjint.md
Last active December 8, 2021 10:36
Using Jint to run JavaScript handlebars in C#
[TestMethod]
public void LoadHandleBarsTest()
{
    var engine = new Engine()
        // callback functions
        .SetValue("log", new Action<object>(Console.WriteLine))
        // set global values
        .SetValue("startValue", 10);

Windows Setup Notes

based on original document from Alan Stevens

Installation

IMPORTANT:

  • Install using Local Account first, attach Microsoft account later

Marking up the World with Markdown

Markdown has easily been one of the most influential technologies that have affected me in the last few years. Specifically it has changed how I work with documentation and a number of documents both for writing and also for text editing and content storage inside of applications.

Markdown is a plain text representation of HTML typically. Markdown works using a relatively small set of easy to type markup mnemonics to represent many common document centric HTML elements like bold, italic, underlined text, ordered and unordered lists, links and images, code snippets, tables and more. This small set of markup directives is easy to learn and quick to type in any editor without special tools or applications.

In the past I've been firmly planted in the world of rich text editors like Word, or using a WYSIWYG editor on the Web, or for Blog Editing using something like Live Writer which used a WYSIWYG editor for post editing. When I first discovered Markdown a number of years a

@RickStrahl
RickStrahl / Defender.md
Created October 5, 2018 19:52
Turn Defender Real-Time Protection On and Off

Defender's real time protection can significantly slow down disk and IO bound operations on Windows, so if you're doing disk intensive work or stress tests I find turning off Defenders Real Time Protection can improve performance drastically.

The following Powershell script provides a quick way to turn Powershell Real Time protection on and off quickly. Dump this file into a folder on your path to quickly turn.

##################################################
# Turn Defender Real Time Monitoring off

# turns defender real time monitoring -on or -off 
# Has to run under an Admin prompt
DO wwDynamic
DO wwJsonSerializer
CLEAR
loCust = CREATEOBJECT("TestClass")
loItem = CREATEOBJECT("wwDynamic",loCust)
*loItem = CREATEOBJECT("wwDynamic")
void Main()
{
var doc = new XmlDocument();
doc.LoadXml("<d><t>This is &amp; a \"test\" and a 'tested' test</t></d>");
doc.OuterXml.Dump();
var node = doc.CreateElement("d2");
node.InnerText = "this & that <doc> and \"test\" and 'tested'";
doc.DocumentElement.AppendChild(node);
var attr = doc.CreateAttribute("note","this & that <doc> and \"test\" and 'tested'");
@RickStrahl
RickStrahl / MarkdownMonster-Mermaid.md
Last active March 18, 2024 14:54
Markdown Monster Mermaid Sample

Mermaid

Mermaid is a JavaScript based parsing engine that allows you to embed blocks of graph markup into a page. Markdown Monster supports two different approaches using either code block or HTML tag syntax to embed the mermaid blocks.

@icon-warning Internal Preview Limitations

Note the MM internal preview can't properly display or refresh all chart types, but you can preview in your system browser via Shift-F12 to see proper representation.

Sequence Diagram

You can use a mermaid code block: