Skip to content

Instantly share code, notes, and snippets.

View UpdateGitHubBranch.cs
using Octokit;
using System;
using System.Threading.Tasks;
using System.Diagnostics;
namespace UpdateGitHub
{
class Program
{
@swlaschin
swlaschin / effective-fsharp.md
Last active Sep 20, 2021
Effective F#, tips and tricks
View effective-fsharp.md

Architecture

  • Use Onion architecture

    • Dependencies go inwards. That is, the Core domain doesn't know about outside layers
  • Use pipeline model to implement workflows/use-cases/stories

    • Business logic makes decisions
    • IO does storage with minimal logic
    • Keep Business logic and IO separate
    • Keep IO at edges
@punker76
punker76 / MainWindow.xaml
Created Feb 6, 2019
Detecting Windows 10 Dark/Light mode
View MainWindow.xaml
<Window x:Class="WpfApp1.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:WpfApp1"
mc:Ignorable="d"
Title="MainWindow" Height="450" Width="800">
<Grid>
View New-Machine-Windows-Configuration-Notes.md

Windows Setup Notes

based on original document from Alan Stevens

Installation

IMPORTANT:

  • Install using Local Account first, attach Microsoft account later
@realvictorprm
realvictorprm / PaketDependencyManagementMadeEasy.fsx
Last active Jun 12, 2018
A must have for your script file to ease spreading a small proof of concept with dependencies!
View PaketDependencyManagementMadeEasy.fsx
open System
open System.IO
open System.Diagnostics
let downloadDependencies deps =
Environment.CurrentDirectory <- __SOURCE_DIRECTORY__
if not (File.Exists "paket.exe") then
async {
let url = "http://fsprojects.github.io/Paket/stable"
@bslatner
bslatner / ExampleCall.fs
Last active Nov 12, 2017
Code for making rest API requests in F# using the RestSharp library
View ExampleCall.fs
// StartResult would be the type of the response. Must be marked with [<CLIMutable>]
let response =
restWithResponse<StartResult> (
POST >> toResource "stopwatch/{type}/{key}/start" >> atUrl config.Url
>> withUrlSegment "type" stopwatchType
>> withUrlSegment "key" key
>> withFormValue "owner" owner
>> withExpectedStatusOk
)
View Windows10_Setup.md

This guide was created using Microsoft Windows 10 Pro

Version 10.0.17134 Build 17134

Installation

System Updates:

  • Settings -> Update & Security
  • Install all updates

Powershell Execution Policy:

  • launch Windows Powershell as administrator and execute:
@jessfraz
jessfraz / boxstarter.ps1
Last active Sep 23, 2021
Boxstarter Commands for a new Windows box.
View boxstarter.ps1
# Description: Boxstarter Script
# Author: Jess Frazelle <jess@linux.com>
# Last Updated: 2017-09-11
#
# Install boxstarter:
# . { iwr -useb http://boxstarter.org/bootstrapper.ps1 } | iex; get-boxstarter -Force
#
# You might need to set: Set-ExecutionPolicy RemoteSigned
#
# Run this boxstarter by calling the following from an **elevated** command-prompt:
@RickStrahl
RickStrahl / DebounceDispatcher.cs
Last active Sep 3, 2020
Debouncing events by a timeout using a Dispatcher.
View DebounceDispatcher.cs
public class DebounceDispatcher
{
private DispatcherTimer timer;
public void Debounce(int timeout, Action<object> action,
object param = null,
DispatcherPriority priority = DispatcherPriority.ApplicationIdle,
Dispatcher disp = null)
{
if (disp == null)
@ploeh
ploeh / Tuple2.fs
Last active Sep 8, 2020
Helpful functions for working with pairs in F#
View Tuple2.fs
module Tuple2
let replicate x = x, x
let curry f x y = f (x, y)
let uncurry f (x, y) = f x y
let swap (x, y) = (y, x)