Skip to content

Instantly share code, notes, and snippets.

View mouadcherkaoui's full-sized avatar
🎯
Focusing

Mouad Cherkaoui mouadcherkaoui

🎯
Focusing
View GitHub Profile
public class MefControllerFactory : IControllerFactory
{
private readonly WebScopedContainerManager _containerManager;
public MefControllerFactory(WebScopedContainerManager containerManager)
{
_containerManager = containerManager;
}
#region IControllerFactory Members
@Fireforge
Fireforge / push_replace.ps1
Last active October 25, 2019 18:59
Nuget Package push Powershell script with debug/release specific files
#
# push_replace.ps1
#
# This script is designed to produce customized release and debug nupkgs from a Visual Studio C# project. This is especially useful
# for nupkgs that include native DLLs that are different depending upon debug or release mode.
#
# How to use:
# In your .nuspec file in the <files> section, add the following line:
# <file src="$filelist$" target="lib\native" />
# That line is set to go to lib\native because this script was made for handling native DLLs, but that target can be anything.
using System;
using System.IO;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
using System.Reflection.Emit;
using ObjectDumper;
using Xunit;
namespace Classdynamic.BK5
@awright18
awright18 / Sample.fsproj
Last active March 27, 2020 11:24
F# http reqeust with HttpClient
<Project Sdk="FSharp.NET.Sdk;Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp1.1</TargetFramework>
</PropertyGroup>
<ItemGroup>
<Compile Include="rss.fs" />
@SimonLuckenuik
SimonLuckenuik / HttpRequests.cs
Last active December 29, 2020 16:38
Concept example: Hosting an AspNetCore WebAPI inside an Azure Functions
using System.Configuration;
using System.IO;
using System.Net.Http;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Azure.WebJobs;
@davidhagg
davidhagg / WPF Visual Geometry Border Inside
Created May 5, 2015 04:50
WPF Create Visual with border that appears to be only inside of drawn geometry
private static DrawingVisual CreateVisual()
{
var noBorderPen = new Pen(new SolidColorBrush(Colors.Transparent), 0);
var selectionPen = new Pen(new SolidColorBrush(Colors.Yellow), 20 * 2);
var drawingVisual = new DrawingVisual();
using (var dc = drawingVisual.RenderOpen())
{
StreamGeometry geometry = new StreamGeometry();
@mouadcherkaoui
mouadcherkaoui / Icon.xaml
Last active March 5, 2021 07:46 — forked from davidhagg/WPF Visual Geometry Border Inside
WPF Create Visual with border that appears to be only inside of drawn geometry
<UserControl x:Class="Wpf3DPlayer.InformationsIcon"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:Wpf3DPlayer"
mc:Ignorable="d"
d:DesignHeight="50" d:DesignWidth="50">
<Grid>
<Viewbox xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" Stretch="Uniform">
@nicholasdille
nicholasdille / Show-JobProgress.ps1
Last active December 30, 2021 20:38
Retrieve progress from PowerShell job and display progress bar
function Show-JobProgress {
[CmdletBinding()]
param(
[Parameter(Mandatory,ValueFromPipeline)]
[ValidateNotNullOrEmpty()]
[System.Management.Automation.Job[]]
$Job
,
[Parameter()]
[ValidateNotNullOrEmpty()]
@benjamincharity
benjamincharity / CreateGuid.ts
Created August 10, 2017 12:15
A TypeScript class that generates a guid
// http://stackoverflow.com/questions/26501688/a-typescript-guid-class
class Guid {
static newGuid() {
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
const r = Math.random() * 16 | 0, v = c === 'x' ? r : ( r & 0x3 | 0x8 );
return v.toString(16);
});
}
}
@KazeroG
KazeroG / gist:ed8c88928e5a7a3383f606546a9fa3f4
Created December 3, 2019 06:39
GitHub Api download zip or tarball link
You can `wget` your way out of the GitHub repo to get a tar file ([archive][1]):
wget --no-check-certificate https://github.com/User/repo/archive/master.tar.gz
# better, if the certificate authorities are present:
wget https://github.com/User/repo/archive/master.tar.gz
will get you a file named 'master' from the user 'User''s repo 'repo'.
The [updated V3 API url][2] is: