Skip to content

Instantly share code, notes, and snippets.

View DamianSuess's full-sized avatar
👍
Enjoying every day

Damian DamianSuess

👍
Enjoying every day
View GitHub Profile
@DamianSuess
DamianSuess / Remove-DotNet-Linux.md
Last active April 23, 2024 05:51
Remove DotNet From Linux (Ubuntu)

Remove .NET From Linux

This document outlines steps for performing a deep clean on your Linux (Ubuntu 20.04) machine.

An example for performing could be, if your installation does not show in dotnet --list-sdks. Performing this deep clean and reinstalling will solve it in most cases.

Install

wget https://packages.microsoft.com/config/ubuntu/20.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
@DamianSuess
DamianSuess / Xamarin.Forms-Examples.md
Last active March 6, 2024 02:56
Xamarin.Forms components and examples

Curated list of Xamarin.Forms heplers, plugins, and examples.

Special thanks to all authors, contributors, and especially Javier Suárez

Editors Top Picks

UI

Name Description
DesktopTrayIcon A Xamarin Forms plugin for adding tray icon functionality to Xamarin.Mac and Xamarin.WPF
@DamianSuess
DamianSuess / SpecialFolderLocations.md
Last active February 2, 2024 19:25
C# Environment.SpecialFolder
@DamianSuess
DamianSuess / VSCode-Linting.md
Last active January 23, 2024 15:02
VSCode Automatic Linting

When developing in medium to larger teams, becomes more important to be able to automatically maintain code styling throughout the project to maintain readability and clarity. This rule also applies to smaller projects as well, abiet at times easier to manage ("New guy, please remove the 5 blank lines in a row in the method. And the blank spaces after the statements.").

Below is a quick snip for configuring VSCode to automagically take care of this every time you press save (Ctrl+S). The following assumes you already have a project workspace already started in VSCode.

TL;DR Configuration

Key files:

  • .vscode/extensions.json
  • .vscode/settings.json
@DamianSuess
DamianSuess / threads.md
Last active January 2, 2024 22:30
Awaiting a task with timeout

C# - Awaiting Task with Timeout

Source Article

Scenerio, you have an awaitable object and you want to await it with a timeout. How would you build that?

What you can do is use a when_any-like function in combination with a timeout coroutine. For C# this would be something like

await Task.WhenAny(
<UserControl.Resources>
<!--<converter:BoolStringConverter x:Key="BooleanToStringConverter" TrueValue="Yes" FalseValue="No" />
<converter:InverseBoolConverter x:Key="InverseBoolConverter" />-->
<ResourceDictionary>
<DataTemplate x:Key="GridDeviceInfo" DataType="models:DeviceInfo">
<Panel Background="Transparent">
<i:Interaction.Behaviors>
<ia:EventTriggerBehavior EventName="DoubleTapped">
<ia:InvokeCommandAction Command="{Binding $parent[Grid].((vm:AccessViewModel)DataContext).CmdCopyText}" CommandParameter="Hello" />
</ia:EventTriggerBehavior>
@DamianSuess
DamianSuess / ProjectGuids.md
Created August 7, 2018 19:41
Visual Studio Project GUIDs
Title GUID
ASP.NET 5 {8BB2217D-0F2D-49D1-97BC-3654ED321F3B}
ASP.NET MVC 1 {603C0E0B-DB56-11DC-BE95-000D561079B0}
ASP.NET MVC 2 {F85E285D-A4E0-4152-9332-AB1D724D3325}
ASP.NET MVC 3 {E53F8FEA-EAE0-44A6-8774-FFD645390401}
ASP.NET MVC 4 {E3E379DF-F4C6-4180-9B81-6769533ABE47}
ASP.NET MVC 5 {349C5851-65DF-11DA-9384-00065B846F21}
C# {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
@DamianSuess
DamianSuess / CommandBehaviorBase.cs
Last active September 7, 2023 21:22
Avalonia Custom Behaviors
using System.Windows.Input;
using Avalonia;
using Avalonia.Xaml.Interactivity;
namespace SuessLabs.Tool.Common.Behaviors;
/// <summary>Base class for behavior command binding event on its source and executes its actions when that event is fired.</summary>
/// <typeparam name="T">Type of behavior.</typeparam>
public class CommandBehaviorBase<T>
: Behavior<T>
@DamianSuess
DamianSuess / CacheService.cs
Last active August 29, 2023 20:20
C# CacheService
using System;
using System.Collections;
using System.Collections.Concurrent;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Extensions.Caching.Memory;
using CacheExample.Extensions;
namespace CacheExample.Services;
@DamianSuess
DamianSuess / Page.xaml
Created August 1, 2018 13:09
Xamarin.Forms - Password hide/show
<Entry x:Name="Email" Placeholder="Email" TextColor="Black" Grid.Row="1" Grid.Column="1"></Entry>
<StackLayout Grid.Row="2" Grid.Column="1">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Entry IsPassword="True" x:Name="Password" TextColor="Black" Placeholder="Password" Grid.Column="0" Grid.ColumnSpan="2" />
<Image Source="eye32.png" HorizontalOptions="End" VerticalOptions="Center" Grid.Column="1">
<Image.GestureRecognizers>