This file contains hidden or 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
| // | |
| // C# 8 port of F# brace matching. | |
| // | |
| using System; | |
| using System.Linq; | |
| using Microsoft.VisualStudio.TestTools.UnitTesting; | |
| namespace BraceMatching | |
| { | |
| using ParseState = Nullable<int>; // we get to cheat a bit because the C# compiler will "map" over nullable types implicitly |
This file contains hidden or 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
| <!-- | |
| Quick instructions below, see full, detailed instructions here: | |
| https://github.com/joonro/ConEmu-Color-Themes/blob/master/README.org#how-to-install | |
| To install this ConEmu theme, add it to C:\Users\USER\AppData\Roaming\ConEmu.xml: | |
| ... | |
| <key name="Colors" modified="2018-10-08 22:42:53" build="180503"> | |
| <value name="Count" type="long" data="1"/> | |
| ... paste the xml tag here and increment the above count... |
This file contains hidden or 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
| Windows Registry Editor Version 5.00 | |
| [HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager] | |
| "SilentInstalledAppsEnabled"=dword:00000000 |
This file contains hidden or 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
| using System; | |
| using System.Linq; | |
| using System.Runtime.CompilerServices; | |
| namespace Scratch | |
| { | |
| class Program | |
| { | |
| static void Main(string[] args) | |
| { |
This file contains hidden or 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
| class Program | |
| { | |
| const int trials = 1_000_000; | |
| static void Main(string[] args) | |
| { | |
| Dictionary<int, string> dict = Enumerable | |
| .Range(1, 10) | |
| .ToDictionary(number => number, number => number.ToString()); |
This file contains hidden or 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
| What is parsing? | |
| Turning text (or some other stream of bytes) into a more useful format | |
| - Turning strings into JSON objects | |
| - Turning bytes into TCP packet structs | |
| - Turning strings into some C# object hierarchy | |
| Levels of parsing: | |
| 0 - avoid it -- use some standard format and library (json, xml, etc) | |
| 1 - string indexOf / split | |
| 2 - regex |
This file contains hidden or 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
| { | |
| "iPad": { | |
| "deviceScaleFactor": 2, | |
| "mobile": true, | |
| "height": 1024, | |
| "width": 768, | |
| "touch": true, | |
| "userAgent": "Mozilla/5.0 (iPad; CPU OS 9_1 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Version/9.0 Mobile/13B143 Safari/601.1" | |
| }, | |
| "Laptop with touch": { |
This file contains hidden or 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
| -- Counter app, count up in 30 seconds increments, and | |
| -- then count down the last 10 seconds | |
| module Main | |
| import System | |
| -- given a second, what should we say at that second? | |
| sayWhatAt : Int -> String | |
| sayWhatAt 30 = "30 seconds passed" | |
| sayWhatAt 60 = "1 minute passed" | |
| sayWhatAt seconds = |
This file contains hidden or 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
| # main entry point | |
| function Main | |
| { | |
| $total = 60 * 2 + 58 | |
| $timings = Generate-Timings -Total $total | |
| Speak-Timings $timings | |
| } | |
| # int -> string[] | |
| # generates an array of strings representing what should be said at each second. |
This file contains hidden or 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
| Add-Type -AssemblyName System.Speech; | |
| $synth = (New-Object System.Speech.Synthesis.SpeechSynthesizer) | |
| $synth.SelectVoice("Microsoft Zira Desktop") | |
| # speak the text, blocking the current thread | |
| function Speak($text) | |
| { | |
| $synth.Speak($text) | |
| } |