Skip to content

Instantly share code, notes, and snippets.

View joanjane's full-sized avatar

Joan Jané joanjane

  • Barcelona
View GitHub Profile
@joanjane
joanjane / .net framework development settings.md
Last active September 19, 2018 08:24
.NET Framework development settings

Using settings for development on netframework:

If you need a working way to use development settings like .net core does with appsettings.json and appsettings.Development.json, you can follow this steps.

  1. Install nuget package MSBuild.Microsoft.VisualStudio.Web.targets dependency on your executable project to transform config files.

  2. Edit your .csproj file on executable project.

  3. Add your App.Debug.config as below (in case of being a web application, Web.config & Web.Debug.config). This adds a nice tree list on VS of these two files:

@joanjane
joanjane / assign-app-group-keyvault.ps1
Created September 14, 2018 10:07
Assign/create a group of Azure MSI apps to key vault as an AAD group
# Run Connect-AzureAD and Connect-AzureRmAccount before executing this script
# https://docs.microsoft.com/en-us/azure/key-vault/key-vault-group-permissions-for-apps
# Ex.: ./assign-app-group-keyvault -appName "your-app-service-name" -vaultName "your-vault-name" -subscriptionName "your-subscription" -groupName "your-aad-group-name" -newGroup
param([string]$appName, [string]$vaultName, [string]$subscriptionName, [string]$groupName, [switch]$newGroup, [switch]$confirm)
function Confirm($message, $confirm) {
# Confirm prompt
if ($confirm -eq $false) {
$confirmation = Read-Host "$message [y/n]"
@joanjane
joanjane / clean-dev-projects.ps1
Last active March 22, 2021 22:51
Powershell script to clean development packages and binaries recursively (node_modules, nuget packages...)
# WARNING:
# IF YOU ARE NOT SURE OF WHAT THIS SCRIPT DOES, DO A BACKUP FIRST.
# THIS CANNOT BE UNDONE, SO BE AWARE OF ANY POSSIBLE LOST FILES.
# Run this on a safe folder where you know the contents, DO NOT RUN THIS IN A FOLDER LIKE "Program Files"!
# I take no responsability of any lost files or damages related to this script.
#
# Instructions:
# This script will delete bin, obj, node_modules and packages folders recursively from the current folder. You can specify the path and folders to delete with -path and -folderNames options.
# Options:
# -path (Optional): The path to delete subfolders recursively, by default the current folder.
@joanjane
joanjane / msal-example.html
Last active September 7, 2020 10:12
Sample of authentication with msaljs with Azure B2C login automatic
<html>
<head>
<title>Authentication with Msal.js app</title>
</head>
<body>
<!-- bluebird only needed if this page needs to run on Internet Explorer -->
<script src="//cdnjs.cloudflare.com/ajax/libs/bluebird/3.3.4/bluebird.min.js"></script>
<script src="//rawgit.com/AzureAD/microsoft-authentication-library-for-js/v0.1.3/dist/msal.min.js"></script>
@joanjane
joanjane / DefaultImplementationWithDelegates.cs
Last active December 23, 2016 21:20
This demo shows how to build a class that implements one or more interfaces and make use of an existing implementation through delegates and composition.
using System;
namespace DefaultImplementationWithDelegates
{
interface ISomeInterface
{
string Foo();
}
interface IAnotherInterface