Skip to content

Instantly share code, notes, and snippets.

@leafgarland
leafgarland / Example.cs
Created September 19, 2012 17:42
Using Unfold to generate Fibonacci numbers
var fibNumbers = InfiniteUnfold(
p => Tuple.Create(p.Item1, Tuple.Create(p.Item2, p.Item1 + p.Item2)),
Tuple.Create(1, 1))
.Take(50);
public IEnumerable<T> InfiniteUnfold<T, TResult>(
Func<TResult, Tuple<T, TResult>> generator,
TResult seed)
{
var next = seed;
@leafgarland
leafgarland / foo.il
Created May 16, 2013 21:18
Compilable IL example for this stackoverflow answer http://stackoverflow.com/questions/16594075/instance-method-warning-in-f/#16597415 To test: > ilasm.exe foo.il > foo.exe
.assembly extern mscorlib
{
}
.assembly hello
{
}
.method static void main()
{
@leafgarland
leafgarland / README.md
Last active December 19, 2015 04:19 — forked from mbostock/.block
@leafgarland
leafgarland / Start-Vim.ps1
Created October 16, 2014 12:56
Powershell function to start GVim, making use of Vim's server features.
function Start-Vim {
if (!$global:VimServerName) {
$global:VimServerName = 'GVIM'
}
if ($args) {
gvim.exe --servername $global:VimServerName --remote-silent $args
} else {
$servers = (vim.exe --noplugin -u NORC --serverlist) | ? { $_ -eq $global:VimServerName }
if ($servers) {
vim.exe --noplugin -u NORC -c "call remote_foreground('$global:VimServerName')" -c 'quit'
@leafgarland
leafgarland / Set-VisualStudioEnvironment.ps1
Created October 16, 2014 14:06
Powershell function to set the Visual Studio command line environment.
function Set-VisualStudioEnvironment {
$command = "$((ls env:\VS*COMNTOOLS | sort | select -last 1).value)vsvars32.bat"
foreach ($line in cmd /c "`"$command`" 2>&1 && set") {
if ($line -match '^([^=]+)=(.*)') {
[System.Environment]::SetEnvironmentVariable($matches[1], $matches[2])
}
}
}
@leafgarland
leafgarland / gruvbox-cmd-colours.reg
Created July 22, 2015 22:37
Set Windows cmd window colours, based on gruvbox for vim https://github.com/morhetz/gruvbox
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Console]
"ColorTable00"=dword:00282828
"ColorTable01"=dword:00888545
"ColorTable02"=dword:001a9798
"ColorTable03"=dword:006a9d68
"ColorTable04"=dword:001d24cc
"ColorTable05"=dword:008662b1
"ColorTable06"=dword:002199d7
NVIM v0.2.1-190-gb6054da6
Build type: RelWithDebInfo
Compilation: C:/msys64/mingw64/bin/gcc.exe -Wconversion -DNVIM_MSGPACK_HAS_FLOAT32 -O2 -g -DDISABLE_LOG -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -D__USE_MINGW_ANSI_STDIO -D_WIN32_WINNT=0x0600 -Wvla -fdiagnostics-color=auto -DINCLUDE_GENERATED_DECLARATIONS -IC:/projects/neovim/build/config -IC:/projects/neovim/src -IC:/projects/neovim/.deps/usr/include -IC:/projects/neovim/.deps/usr/include -IC:/msys64/mingw64/include -IC:/projects/neovim/.deps/usr/include -IC:/projects/neovim/.deps/usr/include -IC:/msys64/mingw64/include -IC:/msys64/mingw64/include -IC:/projects/neovim/build/src/nvim/auto -IC:/projects/neovim/build/include
Compiled by appveyor@APPVYR-WIN
Optional features included (+) or not (-): -acl +iconv -jemalloc +tui
For differences from Vim, see :help vim-differences
system vimrc file: "$VIM\sysinit.vim"
fall-back for $VIM: "C:/Program Files (x86)/nvim/share/nvim"
@leafgarland
leafgarland / floppyfist2.gif
Last active November 16, 2017 02:12
Floppy fist
floppyfist2.gif
@leafgarland
leafgarland / main.janet
Created June 12, 2020 21:08
simple janet quickbin example: build with `jpm quickbin main.janet fmt`
(import spork/fmt)
(defn main [_ filename]
(fmt/format-file filename))