This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void Main() | |
{ | |
if (Console.NumberLock) | |
{ | |
NativeMethods.SimulateKeyPress(NativeMethods.VK_NUMLOCK); | |
} | |
} | |
public static class NativeMethods | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void Main() | |
{ | |
var psi = new ProcessStartInfo("cmd") | |
{ | |
UseShellExecute = false | |
}; | |
psi.Environment.OrderBy(kvp => kvp.Key).Dump("Current Process"); | |
var original = new Dictionary<string, string>(psi.Environment); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"background": "#FFFFFF", | |
"black": "#0C0C0C", | |
"blue": "#00008B", | |
"brightBlack": "#A9A9A9", | |
"brightBlue": "#0073FF", | |
"brightCyan": "#00FFFF", | |
"brightGreen": "#16C60C", | |
"brightPurple": "#8F08C4", | |
"brightRed": "#FF0000", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void Main() | |
{ | |
const int runCount = 1000000; | |
// GetUninitializedObject is a special instantiation method primarily used by serializers to skip calling constructors | |
// It creates a completely uninitialized instance of a managed type (all 0s/nulls/etc. no constructor/initialization logic called) | |
//var emptyInstance = FormatterServices.GetUninitializedObject(typeof(TestClass)); | |
//emptyInstance.Dump("Empty"); | |
//FancyReinjector.Reinject(emptyInstance); | |
//emptyInstance.Dump("Same Instance"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void Main() | |
{ | |
var dc = new ModalDumpContainer().Dump(); | |
dc.CreateHyperlinq(() => | |
{ | |
dc.Content = File.ReadAllText(@"C:\Temp\SomeBiggerFile.txt"); | |
dc.TitleContent = "SomeBiggerFile.txt"; | |
}, "Show Modal Content").Dump(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// this could take advantage of other text encodings using existing JS libraries, but for now just using UTF16 with no BOM and both state and current buffer length slots | |
// also could stand to be updated to use "let" where appropriate, etc. it was just a quick demo | |
function StreamWriter(sharedBuffer) { | |
// This could be optimized, but for simplicity, stateView is 2 UInt16s | |
// stateView[0] = stream state ( | |
// 0 = ready for initialization, | |
// 1 = ready for final read | |
// 2 = ready for partial read, | |
// 3 = ready for next write |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// <summary> | |
/// ILogger extension methods for common scenarios. | |
/// </summary> | |
public static class LoggerExtensions | |
{ | |
private static readonly Func<StructuredAndFormattedLogValues, Exception, string> _messageFormatter = MessageFormatter; | |
//------------------------------------------DEBUG------------------------------------------// |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void Main() | |
{ | |
"Testing this neat thing out to see if there is highlighting 123456789 evenly".HighlightStringMatches("th", "esting this", "1", "2", "3", "4", "5", "6", "7", "8", "9").Dump(); | |
} | |
public static class MyExtensions | |
{ | |
public static string HtmlEncode(this string text) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sub SetLevel() | |
' SETLEVEL sets the outline level for each selected row based on the depth of a structured number. | |
' When there is no structured number, the level is set to one higher than the previous number. | |
' Sets the level 0 to the first cell highlighted by the user. For example if 1.2.3 is the first | |
' cell, then 1.2.3.1 is level 1 and 1.2.3.1.1. is level 2 and so forth. | |
' If the first cell is not a number, then it is set to level 0, and all numbers start at 1. | |
'SYNTAX | |
' The user selects the range of structured numbers within the sheet, then runs this macro. | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head><title>Lunar Lockout</title> | |
<script src="https://code.angularjs.org/1.2.9/angular.js"></script> | |
<script> | |
// note that ng-keydown is available since angular 1.1.5 | |
var app = angular.module('lunar', []); | |
app.filter('range', function() { | |
return function(input, total) { | |
total = parseInt(total); |
NewerOlder