Skip to content

Instantly share code, notes, and snippets.

Rick Strahl RickStrahl

Block or report user

Report or block RickStrahl

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@RickStrahl
RickStrahl / AbsoluteUriUrlEncoding.cs
Last active Aug 20, 2019
UrlEncoding on local Urls producing double encoded Uri.AbsoluteUri values
View AbsoluteUriUrlEncoding.cs
void Main()
{
var part1 = new Uri("C:\\temp\\"); // double encodes when combining parts
var part2 = "assets/Image%20File.jpg";
var uri = new Uri(part1, part2);
uri.Dump();
uri.ToString().Dump(); // still encoded and shouldn't be
View DateFormattingWithLibrary.md

You can do simple date formatting with a library by using the Intl.DateTimeFormat JavaScript class.

MDN for DateTimeFormat

alert( formatDate(new Date()));
// Apr 11, 2019, 1:10:40 PM

function formatDate(date, locale) {
@RickStrahl
RickStrahl / GitHubRespositoryGraphQl.cs
Last active Feb 23, 2019
Recursively parse a Github Repository with GraphQL
View GitHubRespositoryGraphQl.cs
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using Octokit.GraphQL;
using Octokit.GraphQL.Model;
namespace GithubGraphQl
{
@RickStrahl
RickStrahl / CompilingCSharpCode.cs
Last active Jun 26, 2019
A few different approaches to dynamically execute C# code dynamically at runtime from a string of code.
View CompilingCSharpCode.cs
using Microsoft.CodeAnalysis.CSharp;
using Microsoft.CodeAnalysis.CSharp.Scripting;
using Microsoft.CodeAnalysis.Scripting;
using Mono.CSharp;
using System;
using System.CodeDom.Compiler;
using System.Collections.Generic;
using System.Diagnostics;
using System.Dynamic;
using System.Linq;
@RickStrahl
RickStrahl / MarkdownMonster-Mathjax.md
Created Jan 29, 2019
Markdown Monster Math Expressions with MathJax
View MarkdownMonster-Mathjax.md
useMath
true

Math Expressions using MathJax

Markdown Monster has built in support for rendering Math expressions using Latex, MathML and AsciiMath syntax. In order to use Math expressions on your page you have to explicit ask for it via the useMath YAML header:

---
useMath: true
@RickStrahl
RickStrahl / MarkdownMonster-Mermaid.md
Last active May 31, 2019
Markdown Monster Mermaid Sample
View MarkdownMonster-Mermaid.md

Mermaid 2

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:

View XmlElementsAndAttributes.cs
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'");
View TestDynamic.prg
DO wwDynamic
DO wwJsonSerializer
CLEAR
loCust = CREATEOBJECT("TestClass")
loItem = CREATEOBJECT("wwDynamic",loCust)
*loItem = CREATEOBJECT("wwDynamic")
@RickStrahl
RickStrahl / Defender.md
Created Oct 5, 2018
Turn Defender Real-Time Protection On and Off
View Defender.md

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
View FoxProMarkdown.md

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

You can’t perform that action at this time.