JNI Object | Use across JNI calls? | Use on different thread? | Notes |
---|---|---|---|
JavaVM |
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
namespace Test | |
open System.Runtime.InteropServices | |
// F# implementation of http://pinvoke.net/default.aspx/mpr.WNetAddConnection2 | |
module NativeMethods = | |
type ResourceScope = | |
| Connected = 0x1u | |
| GlobalNet = 0x2u |
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
<# | |
Dumps capture group locations and names/numbers | |
Example: | |
> regexinfo 'Jenny: 555-867-5309' '(?<name>\w+):\s+(?<phone>(?:(?<area>\d{3})-)?(\d{3}-\d{4}))' | |
[Jenny]: [[555]-[867-5309]] | |
| || | | |
| || 1 | |
| |area | |
| phone |
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
open System | |
open System.Collections | |
open System.Collections.Generic | |
open System.Diagnostics | |
open System.Linq | |
module Algos = | |
// | |
// non-lazy solutions | |
// |
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
# dot-source this function and try running `f 0` | |
# It work on Windows in Windows PowerShell and PowerShell Core | |
# On Mac the powershell process terminates with `Process is terminating due to StackOverflowException. Abort trap: 6` | |
# programmatically generated by parsing https://www.unicode.org/Public/10.0.0/ucd/LineBreak.txt | |
function f { param($codepoint) | |
if(($codepoint -ge 0x0000) -and ($codepoint -le 0x0008)){ 'CM' } | |
elseif($codepoint -eq 0x0009) { 'BA' } | |
elseif($codepoint -eq 0x000A) { 'LF' } | |
elseif(($codepoint -ge 0x000B) -and ($codepoint -le 0x000C)){ 'BK' } |
I hereby claim:
- I am latkin on github.
- I am latkin (https://keybase.io/latkin) on keybase.
- I have a public key ASCflg_ClIWLE2q9NWAhQHrj7HkQGqf0na2Msud4uTsV6Ao
To claim this, I am signing this object:
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
# | |
# Benchmarking code used to produce results from blog post | |
# http://latkin.org/blog/2016/08/02/curious-behavior-when-de-duplicating-a-collection-in-powershell/ | |
# | |
# home-grown HashSet-based approach | |
function hashunique { | |
param( | |
[Parameter(Mandatory=$true, ValueFromPipeline = $true)] | |
[Object[]] $InputObject |
F# units of measure are nice, but what if I'm using a 3rd-party library which doesn't support UOM? I don't want to re-implement the library, but it would be nice to add the extra safety afforded by UOM. Can I somehow annotate the APIs of the 3rd party library with units?
Yes!
Say you have some unit-free external library like this, which you can't modify:
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
<?xml version="1.0" encoding="utf-8" standalone="no"?> | |
<!--This file represents the results of running a test suite--> | |
<test-results name="C:\src\FSharp.Compiler.Service\bin\v4.0\FSharp.Compiler.Service.Tests.dll" total="373" errors="2" failures="14" not-run="8" inconclusive="0" ignored="8" skipped="0" invalid="0" date="2016-02-15" time="21:36:11"> | |
<environment nunit-version="2.6.3.13283" clr-version="2.0.50727.8670" os-version="Microsoft Windows NT 6.2.9200.0" platform="Win32NT" cwd="C:\src\FSharp.Compiler.Service" machine-name="LINCOLN-PC" user="lincoln" user-domain="LINCOLN-PC" /> | |
<culture-info current-culture="en-US" current-uiculture="en-US" /> | |
<test-suite type="Test Project" name="" executed="True" result="Failure" success="False" time="112.439" asserts="0"> | |
<results> | |
<test-suite type="Assembly" name="C:\src\FSharp.Compiler.Service\bin\v4.0\FSharp.Compiler.Service.Tests.dll" executed="True" result="Success" success="True" time="52.240" asserts="0"> | |
<results> | |
<test-suite |
NewerOlder