I hereby claim:
- I am waf on github.
- I am wafuqua (https://keybase.io/wafuqua) on keybase.
- I have a public key whose fingerprint is CB5A FF04 64BE 97B8 9FD3 190D 67B6 F489 167C 16A3
To claim this, I am signing this object:
| Windows Registry Editor Version 5.00 | |
| [HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager] | |
| "SilentInstalledAppsEnabled"=dword:00000000 |
| using System; | |
| using System.Linq; | |
| using System.Runtime.CompilerServices; | |
| namespace Scratch | |
| { | |
| class Program | |
| { | |
| static void Main(string[] args) | |
| { |
| 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()); |
| 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 |
| { | |
| "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": { |
| -- 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 = |
| # 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. |
| 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) | |
| } |
I hereby claim:
To claim this, I am signing this object:
| public static int AddFive(int a) | |
| { | |
| // object of a compiler-generated type is created | |
| Program.<>c__DisplayClass1_0 cDisplayClass10 = new Program.<>c__DisplayClass1_0(); | |
| // reference to a compiler-generated field | |
| cDisplayClass10.a = a; | |
| // reference to a compiler-generated method | |
| Program.<AddFive>g__InnerAdd1_0(5, ref cDisplayClass10); | |
| // reference to a compiler-generated field | |
| return cDisplayClass10.a; |