Skip to content

Instantly share code, notes, and snippets.

@derekforeman
derekforeman / HttpLoggingHandler.cs
Created July 25, 2023 09:24 — forked from flobaader/HttpLoggingHandler.cs
Log HTTP Requests with Refit
public class HttpLoggingHandler : DelegatingHandler
{
public HttpLoggingHandler(HttpMessageHandler innerHandler = null)
: base(innerHandler ?? new HttpClientHandler())
{
}
async protected override Task<HttpResponseMessage> SendAsync(HttpRequestMessage request,
CancellationToken cancellationToken)
{
@derekforeman
derekforeman / MauiWindows_NoMSIXPackage.md
Last active September 19, 2022 19:05
Build a Maui windows desktop app, do not create MSIX package

Edit *.csproj

Within a <PropertyGroup />, existing or create a new one add the following.

<!--Do not create package for windows--> <WindowsPackageType Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">None</WindowsPackageType>

Save and close.

Edit Properties\launchSettings.json

Catalyst

dotnet build -t:Run -f net6.0-maccatalyst

iOS

Build with default simulator

dotnet build -t:Run -f net6.0-ios

Buid with specific simulator

/Applications/Xcode.app/Contents/Developer/usr/bin/simctl list

@derekforeman
derekforeman / addmigration.sh
Created January 18, 2021 21:51
Add migrations for two providers at one time.
#!/usr/bin/env bash
set -o errexit # Exit on most errors (see the manual)
set -o errtrace # Make sure any error trap is inherited
set -o nounset # Disallow expansion of unset variables
set -Eeuo pipefail # Use last non-zero exit code in a pipelin
trap cleanup SIGINT SIGTERM ERR EXIT
script_dir=$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd -P)
import SwiftUI
import PlaygroundSupport
struct ContentView: View {
var body: some View {
Text("Hello World")
}
}
PlaygroundPage.current.setLiveView(ContentView())
using System;
using System.Net;
using System.Net.Http;
using System.Security.Principal;
using System.Text;
using System.Threading;
using System.Web.Http.Controllers;
using System.Web.Http.Filters;
using BloomAmcatStats.DAL;
@derekforeman
derekforeman / tmux.md
Created March 5, 2020 16:33 — forked from hugodahl/tmux.md
Clean tmux cheat-sheet

Clean tmux cheat-sheet

By resources

sessions

list-sessions        ls         -- List sessions managed by server
new-session          new        -- Create a new session
#Setting the prefix from C-b to C-a
set -g prefix C-a
#Free original C-b binding
unbind C-b
#setting the delay betwen prefix and command
set -s escape-time 1
#set base index for windows to 1 instead of 0

Keybase proof

I hereby claim:

  • I am derekforeman on github.
  • I am derekforeman (https://keybase.io/derekforeman) on keybase.
  • I have a public key whose fingerprint is 0C51 690F 9524 BEB8 6791 389B DA5A C56F 7A24 C84C

To claim this, I am signing this object:

@derekforeman
derekforeman / app.py
Last active June 15, 2018 13:40
Refactor Treasurenite
def welcome():
print("Welcome to Treasurenite")
print("You come to a cave looking for treasure and find a split.\n ")
prYellow("Which way do you go?")
decision1()
def decision1():