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
| # Jwosty's powershell profile | |
| Import-Module 'C:\tools\poshgit\dahlbyk-posh-git-9bda399\src\posh-git.psd1' | |
| # Start emacs in no-window mode (CLI mode) | |
| function Private:emacs() | |
| { | |
| & emacs -nw $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
| type Mock = | |
| // poor man's Moq, for individual functions! | |
| static member SetupFunction (funcName, funcImpl) = | |
| let mutable argsState = [] | |
| let theMockFunc arg = | |
| argsState <- argsState @ [arg] | |
| funcImpl arg | |
| theMockFunc, {| | |
| calledOnce = | |
| fun () -> |
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
| let f (x: int) = | |
| let y = x / 0 | |
| async { | |
| return y | |
| } | |
| let g = async { | |
| let! x = Async.Catch (f 42) | |
| () | |
| } |
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
| open System | |
| open System.Diagnostics | |
| open System.IO | |
| open System.Runtime.ExceptionServices | |
| module ThirdPartyLibrary = | |
| // Represents some low-level async "primitive" which is used in many many places and which may fail. This type of | |
| // method/function is not typically what you're interested in when examining stacktraces. | |
| // Example: a database query function from a thid-party library | |
| let doWorkAsync crash = ExtraTopLevelOperators.async { |
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
| float Quantize(float value, float n) { | |
| return n <= 0 ? value : floor((value*(n-1.0))+0.5)/(n-1.0); | |
| } | |
| float3 Quantize(float3 value, float n) { | |
| return float3(Quantize(value.x,n), Quantize(value.y,n), Quantize(value.z,n)); | |
| } | |
| /** | |
| * Lighting contribution of a single directional light source via Phong illumination. |
OlderNewer