Skip to content

Instantly share code, notes, and snippets.

View yannduran's full-sized avatar

Yann Duran yannduran

View GitHub Profile
<Style TargetType="TabsStudio:Tab" BasedOn="{StaticResource DefaultTabStyle}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type TabsStudio:Tab}">
<Grid>
<Border Name="Border" BorderBrush="#609ABA" BorderThickness="1,1,1,0" CornerRadius="3,3,0,0">
<ContentPresenter ContentSource="Header" Margin="12,2,12,2"/>
</Border>
</Grid>
<ControlTemplate.Triggers>
@yannduran
yannduran / AuthorizeRedirect.cs
Created September 27, 2015 13:33 — forked from bjcull/AuthorizeRedirect.cs
Authorize attribute that redirects to view if you're logged in but don't have permission
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method)]
public class AuthorizeRedirect : AuthorizeAttribute
{
public string RedirectUrl = "~/Error/Unauthorized";
protected override void HandleUnauthorizedRequest(AuthorizationContext filterContext)
{
base.HandleUnauthorizedRequest(filterContext);
if (filterContext.RequestContext.HttpContext.User.Identity.IsAuthenticated)
@yannduran
yannduran / ImportMefComponent.cs
Created November 15, 2015 06:46 — forked from madskristensen/ImportMefComponent.cs
Import MEF components from non-MEF exported classes
using System.ComponentModel.Composition;
using Microsoft.VisualStudio.Shell;
using Microsoft.VisualStudio.Shell.TableManager;
public class ExtensionPackage : Package
{
[Import]
private ITableManagerProvider _tableManagerProvider;
protected override void Initialize()
//cleans cache file (db.json) and generated files (public_dir)
gulp.task('site:clean', (cb) => {
const command = 'clean';
const args = {};
return hexo.init().then(() => {
return hexo.call(command, args);
}).then(() => {
return cb()
}).catch((err) => {
@yannduran
yannduran / VSTS_CreateReleasePullRequest.ps1
Created March 11, 2018 22:37 — forked from MarcusFelling/VSTS_CreateReleasePullRequest.ps1
Uses the VSTS REST API to create pull request
<#
.SYNOPSIS
Uses the VSTS REST API to create pull request
.DESCRIPTION
This script uses the VSTS REST API to create a Pull Request in the specified
repository, source and target branches. Intended to run via VSTS Build using a build step for each repository.
https://www.visualstudio.com/en-us/docs/integrate/api/git/pull-requests/pull-requests
.NOTES
@yannduran
yannduran / VSIX UIContext
Created March 24, 2019 05:55 — forked from madskristensen/VSIX UIContext
Shows how to add custom UIContexts
On the package
[ProvideAutoLoad(UIContexts.LoadContext)]
[ProvideUIContextRule(UIContexts.LoadContext,
"RightFileTypeOpen",
"(CSharpFileOpen | VBFileOpen)",
new[] { "CSharpFileOpen", "VBFileOpen" },
new[] { "ActiveEditorContentType:CSharp", "ActiveEditorContentType:Basic" })]
In the VSCT
Usage: VSIXInstaller.exe [/quiet] [/admin] [/skuName:name /skuVersion:version] </uninstall:vsixID | vsix_path>
- OPTIONS -
/quiet
Suppresses the UI. Short form is '/q'.
/admin
The extension will be installed to the admin extensions location. Short form is '/a'.
@yannduran
yannduran / KnownMonikersToBitmap.cs
Created July 4, 2019 12:16 — forked from madskristensen/KnownMonikersToBitmap.cs
Uses the IVsImageService2 to convert a KnownMoniker to BitmapSource
public static BitmapSource GetImage(ImageMoniker moniker, int size)
{
ImageAttributes imageAttributes = new ImageAttributes();
imageAttributes.Flags = (uint)_ImageAttributesFlags.IAF_RequiredFlags;
imageAttributes.ImageType = (uint)_UIImageType.IT_Bitmap;
imageAttributes.Format = (uint)_UIDataFormat.DF_WPF;
imageAttributes.LogicalHeight = size;
imageAttributes.LogicalWidth = size;
imageAttributes.StructSize = Marshal.SizeOf(typeof(ImageAttributes));
@yannduran
yannduran / devenv.pkgundef
Created July 4, 2019 12:20 — forked from madskristensen/devenv.pkgundef
Disable built-in Visual Studio packages
//********************************************************//
// HOW TO:
// Create a file called devenv.pkgundef in the same directory as devenv.exe.
// It's usually located at C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE
// Then call "devenv.exe /updateconfiguration" from an elevated command prompt.
// REMARKS:
// Each GUID below represent a package that Visual Studio is loading. This is the
// list of package that I personally don't ever use. You can modify the list of
@yannduran
yannduran / MyPersonalDesktopBoxstarter.ps1
Last active December 23, 2020 12:18 — forked from jnm2/JosephPersonalDesktopBoxstarter.ps1
My personal desktop Boxstarter script
Disable-UAC
# TODO: unpin Edge and Store and pin default apps
# SilentlyContinue — Don't display an error message continue to execute subsequent commands.
# Continue — Display any error message and attempt to continue execution of subsequence commands.
# Inquire — Prompts the user whether to continue or terminate the action
# Stop — Terminate the action with error.
$ErrorActionPreference = 'Continue'