Skip to content

Instantly share code, notes, and snippets.

View loic-sharma's full-sized avatar

Loïc Sharma loic-sharma

View GitHub Profile
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net5.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Hosting" Version="5.0.0" />
</ItemGroup>
@loic-sharma
loic-sharma / 1 - Ideal.cs
Last active April 4, 2021 01:15
The case for async dependency injection
public class MyApp {
private IPackageDownloadClient _nuget;
public MyApp(IPackageDownloadClient nuget) {
_nuget = nuget;
}
public RunAsync() {
// This is the code I want to write.
// The NuGet package download client is injected into my application.
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net5.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Azure.Storage.Blobs" Version="12.9.0" />
<PackageReference Include="NuGet.Packaging" Version="5.9.1" />
@loic-sharma
loic-sharma / import.ps1
Created September 13, 2021 20:20
Import NuGet packages to a new BaGet instance
$destination = "<BaGet package source>"
# Uncomment this line if you've configured BaGet to require an API key
# & nuget.exe setapikey "MY-API-KEY" -Source $destination
$packages = Get-ChildItem -Path .\ -Filter *.nupkg -Recurse -File
$packages |% {
& nuget.exe push -Source $destination $_.FullName
}
@loic-sharma
loic-sharma / Function1.cs
Created October 1, 2021 22:41
AzFuncLogging
using Microsoft.Azure.Functions.Worker;
using Microsoft.Azure.Functions.Worker.Http;
using Microsoft.Extensions.Logging;
using System.Net;
namespace AzFuncLogging
{
public class Function1
{
private readonly ILogger<Function1> _logger;
@loic-sharma
loic-sharma / main.dart
Last active June 28, 2022 23:56
dart:ui app that renders text containing a tab and saves it as a PNG to disk
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// This example shows how to use the ui.Canvas interface to draw various shapes
// with gradients and transforms.
//import 'dart:io';
import 'dart:typed_data';
import 'dart:ui' as ui;
@loic-sharma
loic-sharma / bug.patch
Last active September 19, 2022 20:49
ANGLE closes COM incorrectly
diff --git a/samples/gles1/HelloTriangle.cpp b/samples/gles1/HelloTriangle.cpp
index 0220b9678..2896ec547 100644
--- a/samples/gles1/HelloTriangle.cpp
+++ b/samples/gles1/HelloTriangle.cpp
@@ -13,6 +13,8 @@
// URLs: http://safari.informit.com/9780321563835
// http://www.opengles-book.com
+#include <objbase.h>
+
@loic-sharma
loic-sharma / fix.patch
Last active September 19, 2022 21:13
ANGLE fix for unbalanced COM closing
diff --git a/src/libANGLE/renderer/d3d/d3d11/converged/CompositorNativeWindow11.cpp b/src/libANGLE/renderer/d3d/d3d11/converged/CompositorNativeWindow11.cpp
index a2b190f38..bac68d5d0 100644
--- a/src/libANGLE/renderer/d3d/d3d11/converged/CompositorNativeWindow11.cpp
+++ b/src/libANGLE/renderer/d3d/d3d11/converged/CompositorNativeWindow11.cpp
@@ -305,8 +305,13 @@ RoHelper::RoHelper()
auto result = RoInitialize(RO_INIT_MULTITHREADED);
- if (SUCCEEDED(result) || result == S_FALSE || result == RPC_E_CHANGED_MODE)
+ if (SUCCEEDED(result) || result == RPC_E_CHANGED_MODE)
@loic-sharma
loic-sharma / uwp-issues.md
Last active October 5, 2022 18:02
UWP issues
@loic-sharma
loic-sharma / all_issue_reactions.graphql
Last active October 7, 2022 00:10
Grab a timeline of reactions for a repository's issues
{
repository(owner: "nuget", name: "home") {
issues(
first: 20
filterBy: {states: [OPEN]}
orderBy: {field: CREATED_AT, direction: DESC}
) {
pageInfo {
endCursor
}