Skip to content

Instantly share code, notes, and snippets.

View timheuer's full-sized avatar
🚴‍♂️
https://twitter.com/timheuer

Tim Heuer timheuer

🚴‍♂️
https://twitter.com/timheuer
View GitHub Profile
// Open the file in an editor
if (createdFile) {
vscode.workspace.openTextDocument(createdFile).then((document) => {
vscode.window.showTextDocument(document);
});
}
@timheuer
timheuer / azure-pipelines.yaml
Created November 9, 2023 19:28
dotnet8-azpipeline
# Use .NET 8 SDK
# Ensures .NET 8 SDK is installed/used
- task: UseDotNet@2
inputs:
version: 8.0.x
@timheuer
timheuer / profile-vs.ps1
Created October 17, 2023 15:27
Start vs from a command shell
function vs {
$p = Get-Location
$sln = gci *.sln,*.csproj -n -recurse | select -f 1
Write-Output "Opening $p\$sln"
Start-Process -FilePath "C:\Program Files\Microsoft Visual Studio\2022\Preview\Common7\IDE\devenv.exe" -ArgumentList "$p\$sln"
}
{
"$schema": "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json",
"version": 2,
"final_space": true,
"blocks": [
{
"type": "prompt",
"alignment": "left",
"segments": [
{
@timheuer
timheuer / foo.xaml
Created August 17, 2023 19:09
Get default value of current foreground
<!-- I need the parameter of the foreground to be the current value which will serve as a default if not converted -->
<TextBlock Foreground="{Binding Path=Conclusion,
Converter={StaticResource ConclusionColorConverter},
ConverterParameter={Binding RelativeSource={RelativeSource Mode=Self}}}" Text="{Binding Conclusion}" />
@timheuer
timheuer / Converters.cs
Last active August 17, 2023 04:57
JsonConverters
namespace TempStick;
public class BooleanConverter : JsonConverter<bool>
{
public override bool Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
if (reader.TokenType == JsonTokenType.String)
{
return string.Equals(reader.GetString(), "1", StringComparison.OrdinalIgnoreCase);
}
@timheuer
timheuer / filter.jq
Created August 1, 2023 18:14
Query GitHub Issues
["number","title","state","labels"],
(.[] | [
.number,
.title,
.state,
(.labels | if length == 0 then "no-label" elif length > 1 then map(.name) | join(",") else .[0].name end)
]) | @csv
@timheuer
timheuer / template.xaml
Created July 28, 2023 18:40
WPF Styling problem
<HierarchicalDataTemplate x:Key="TreeViewRunNodeDataTemplate" ItemsSource="{Binding Jobs}">
<StackPanel Orientation="Horizontal" HorizontalAlignment="Left">
<TextBlock VerticalAlignment="Center" FontFamily="{StaticResource CodiconFont}"
Foreground="{Binding Path=Conclusion, Converter={StaticResource ConclusionColorConverter}}"
Text="{Binding Path=Conclusion, Converter={StaticResource ConclusionIconConverter}}"/>
<emoji:TextBlock Text="{Binding DisplayName}" VerticalAlignment="Bottom" Tag="{Binding Url}"/>
</StackPanel>
</HierarchicalDataTemplate>
@timheuer
timheuer / vsdot.ps1
Created July 19, 2023 19:37
vs dot
function vs {
$p = Get-Location
$sln = gci *.sln,*.csproj -n -recurse | select -f 1
Write-Output "Opening $p\$sln"
Start-Process -FilePath "C:\Program Files\Microsoft Visual Studio\2022\Preview\Common7\IDE\devenv.exe" -ArgumentList "$p\$sln"
}
@timheuer
timheuer / address.json
Created July 10, 2023 22:50
address.json
{
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"properties": {
"Street": {
"type": "string"
},
"City": {
"type": "string"
},