Skip to content

Instantly share code, notes, and snippets.

// yield syntax
[ for _ in [1..5] do
yield "A" ]
// `->` syntax - shortcut for do .. yield
[ for _ in [1..5] -> "A" ]
// sequence instead of list
seq {
for _ in [1..5] -> "A"
open System
let dateRange (first:DateTime) count =
[1 .. count]
|> List.map (float >> first.AddDays)
let dateRangeInf (first:DateTime) count =
Seq.initInfinite (float >> first.AddDays)
|> Seq.take count
|> Seq.toList
@theimowski
theimowski / .gitconfig
Created January 23, 2017 11:34
Git config for windows box
[alias]
co = checkout
ci = commit
br = branch
st = status
l = log --graph --pretty=format:'%Cred%h%Creset%C(yellow)%d%Creset %s %C(cyan)<%an>%Creset' --all
lg = log --graph --all --decorate --abbrev-commit
lgo = log --graph --oneline --all --decorate
compare = "!f(){ git diff ${1}... --name-status; };f"
comparet = "!f(){ git difftool ${1}...; };f"
@theimowski
theimowski / settings.json
Last active January 11, 2017 10:47
VSCode user settings
{
"window.zoomLevel": 2,
"extensions.autoUpdate": true,
"vsicons.dontShowNewVersionMessage": true,
"editor.fontSize": 16,
"editor.wordWrap": true
}
@theimowski
theimowski / boxstarter.ps1
Last active January 23, 2017 11:36
boxstarter
Set-ExplorerOptions -showHidenFilesFoldersDrives -showProtectedOSFiles -showFileExtensions
Enable-RemoteDesktop
Set-WinUserLanguageList -LanguageList pl-PL
powercfg.exe /hibernate off
Write-BoxstarterMessage "Removing page file"
$pageFileMemoryKey = "HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management"
Set-ItemProperty -Path $pageFileMemoryKey -Name PagingFiles -Value ""
let (|Contains|_|) xs input =
let rec contains xs' input' acc =
match xs', input' with
| [], after ->
let length = List.length acc - List.length xs
let before = acc |> List.rev |> Seq.take length |> List.ofSeq
Some (before, after)
| _, [] -> None
| h1 :: t1, h2 :: t2 when h1 = h2 ->
contains t1 t2 (h2 :: acc)
@theimowski
theimowski / App.config
Created April 21, 2015 12:51
Mess after Install / uninstall top 100 nuget packages in VS on empty C# project
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 --></configSections>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.1" />
</startup>
<entityFramework>