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() | |
{ | |
// from comment discussion http://stackoverflow.com/questions/671968/retrieving-property-name-from-lambda-expression/17220748#17220748 | |
Expression<Func<O, int>> exprId = o => o.Id; | |
Expression<Func<O, string>> exprName = o => o.Name; | |
Expression<Func<O, int[]>> exprItems = o => o.Items; | |
Expression<Func<O, int>> exprItemsLength = o => o.Items.Length; | |
Expression<Func<O, Subclass>> exprChild = o => o.Child; | |
Expression<Func<O, string>> exprChildName = o => o.Child.Name; |
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
// Alias the build menu | |
alias sentry "destroy 2; build 2" | |
alias dispenser "destroy 0; build 0" | |
alias entrance "destroy 1; build 1" | |
alias exit "destroy 3; build 3" | |
// Bind the menu to F1-F4 | |
bind f1 sentry | |
bind f2 dispenser | |
bind f3 entrance |
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
give @p written_book 1 0 {title:"Weather Magic",author:"dweedul",pages:[ | |
"{text:'Weather\n\n',extra:[ | |
{text:'Summon the sun\n',color:dark_aqua,clickEvent:{action:run_command,value:'/time set day'}}, | |
{text:'Summon the moon\n',color:dark_aqua,clickEvent:{action:run_command,value:'/time set night'}}, | |
{text:'Clear the sky\n',color:dark_aqua,clickEvent:{action:run_command,value:'/weather clear 1000000'}}, | |
{text:'Summon Rain\n',color:dark_aqua,clickEvent:{action:run_command,value:'/weather rain 1000000'}}, | |
{text:'Summon Thunder Clouds',color:dark_aqua,clickEvent:{action:run_command,value:'/weather rain 1000000'}}, | |
{text:'Summon TACOS!',color:dark_aqua,clickEvent:{action:run_command,value:'/say raining tacos'}}]}" | |
]} |
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
Option Explicit | |
Public Function CreateGUID(Optional IncludeHyphens As Boolean = True, _ | |
Optional IncludeBraces As Boolean = False) _ | |
As String | |
Dim obj As Object | |
Dim strGUID As String | |
'Late-bind obj as a TypeLib -- a rare time when late-binding | |
'is actually a must! |
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
Latency Comparison Numbers (~2012) | |
---------------------------------- | |
L1 cache reference 0.5 ns | |
Branch mispredict 5 ns | |
L2 cache reference 7 ns 14x L1 cache | |
Mutex lock/unlock 25 ns | |
Main memory reference 100 ns 20x L2 cache, 200x L1 cache | |
Compress 1K bytes with Zippy 3,000 ns 3 us | |
Send 1K bytes over 1 Gbps network 10,000 ns 10 us | |
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD |
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
; Autohotkey Capslock Remapping Script | |
; Danik | |
; More info at http://danikgames.com/blog/?p=714 | |
; danikgames.com | |
; | |
; Functionality: | |
; - Deactivates capslock for normal (accidental) use. | |
; - Hold Capslock and drag anywhere in a window to move it (not just the title bar). | |
; - Access the following functions when pressing Capslock: | |
; Cursor keys - J, K, L, I |
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 is a complete solution to map the CapsLock key to Control and Escape without losing the ability to toggle CapsLock | |
; We use two tools here - any remapping software to map CapsLock to LControl and AutoHotkey to execute the following script | |
; This has been tested with MapKeyboard (by Inchwest) | |
; This will allow you to | |
; * Use CapsLock as Escape if it's the only key that is pressed and released within 300ms (this can be changed below) | |
; * Use CapsLock as LControl when used in conjunction with some other key or if it's held longer than 300ms | |
; * Toggle CapsLock by pressing LControl/CapsLock + RControl | |
~*LControl:: |
- Wikipedia: Noctis (Web page)
- Noctis - Official site (Web page)
- Proteus - early prototype screenshots (Blog post)
- Gamasutra: The Making of Elite (Video)
- The Brilliance of Dwarf Fortress
- Interview with Tarn Adams (creator of Dwarf Fortress) (Slides) (Video)
There are lots of cases that you can improve. The examples use nullable reference types, but only the WhenNotNull
example requires it.
Consider adopting the new property pattern, wherever you use IsNullOrEmpty
.
string? hello = "hello world";
OlderNewer