Skip to content

Instantly share code, notes, and snippets.

View spboyer's full-sized avatar
💭
Coding, contributing, supporting, mentoring, learning, all of the right verbs

Shayne Boyer spboyer

💭
Coding, contributing, supporting, mentoring, learning, all of the right verbs
View GitHub Profile
@spboyer
spboyer / azure-cdn-image-error.js
Created August 17, 2018 14:30
Azure CDN Image Tag Helper Error Handling
//Retrieve any existing onerror handler code
var onError = output.Attributes[OnErrorAttributeName] ? .Value as string;
//Check if there's a fallback source and no onerror handler
if (!string.IsNullOrWhiteSpace(FallbackSrc) && string.IsNullOrWhiteSpace(onError)) {
string resolvedUrl;
if (TryResolveUrl(FallbackSrc, out resolvedUrl)) {
FallbackSrc = resolvedUrl;
}
if (AppendVersion) {
FallbackSrc = _fileVersionProvider.AddFileVersionToPath(FallbackSrc);
@spboyer
spboyer / cdnimage-taghelper.cs
Created August 17, 2018 14:28
azure cdn image tag helper
if (AppendVersion)
{
EnsureFileVersionProvider();
Src = output.Attributes[SrcAttributeName].Value as string;
// Check if the CDN Base URI is set and add to the src attribute
if (!string.IsNullOrWhiteSpace(CdnUri))
{
output.Attributes.SetAttribute(SrcAttributeName, string.Format("{0}{1}", CdnUri, _fileVersionProvider.AddFileVersionToPath(Src)));
}
}
@spboyer
spboyer / azure-gulp.js
Created August 17, 2018 14:24
Gulp task to push images to Azure CDN
var azure = require('gulp-azure-storage');
gulp.task("pushimages", function() {
return gulp.src("wwwroot/images/**").pipe(azure.upload({
account: process.env.ACCOUNT_NAME,
key: process.env.ACCOUNT_KEY,
container: process.env.CONTAINER_NAME
}));
});
@spboyer
spboyer / cdn_cache_thing.cs
Created August 11, 2018 15:45
serverless-cdn script
using System;
using System.IO;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Azure.WebJobs;
using Microsoft.Azure.WebJobs.Host;
using Microsoft.WindowsAzure.Storage.Blob;
namespace Workshop.Function
@spboyer
spboyer / nugetfeed.js
Created August 9, 2018 18:32
dotnet new azure function templates snippets
"2.3.3": {
"Microsoft.NET.Sdk.Functions": "1.0.14",
"cli": "https://functionscdn.azureedge.net/public/2.0.1-beta.34/Azure.Functions.Cli.win-x86.2.0.1-beta.34.zip",
"nodeVersion": "8.11.1",
"localEntryPoint": "func.exe",
"itemTemplates": "https://www.myget.org/F/azure-appservice/api/v2/package/Azure.Functions.Templates/2.0.0-beta-10224",
"projectTemplates": "https://www.myget.org/F/azure-appservice/api/v2/package/Microsoft.AzureFunctions.ProjectTemplates/2.0.0-beta-10224",
"templateApiZip": "https://functionscdn.azureedge.net/public/TemplatesApi/2.0.0-beta-10224.zip",
"sha2": "4A2B808E86AE4C4DEF38A2A14270D19EC384648AD1FDF635921A64F609D41098",
"FUNCTIONS_EXTENSION_VERSION": "beta",
\\\ ,
\ `|
) ( .-""-.
| | /_ { '.
| | (/ `\ } )
| | ^/ ^`} {
\ \ \= ( { )
\ \ '-, { {{
\ \_.' ) } )
\.-' ( (
.--------------------------------------------.
|~''--..__ |
| ~~''--..__ |
| 88 aa _ ~~''--..__ |
| 88 88 d88 oo.. ~~''--._ |
| 88a88 88 8b 88"8b 88oo | |
| 88 88 88a88 88 88 88 88 88 oo | |
| 88 88 88 88 88aP" 88 8P 88 88 | |
| " "9 88 88 88 88P" YP" | |
| " "9 98 88 88 | |
@spboyer
spboyer / post.md
Last active May 16, 2018 21:01
Why Containers?

Why should we care about using containers for development

There have probably been more than one time in your development career where you've spent a few hours troubleshooting an issue only to find out it was a dependency or versions issue right?

Environments varying from one to next, outdated components and setting up development machines are frustrations we can all do without.

Some of these issues we've solved with VMs, but managing the entire machine and under utilizing them for each enviroment is costly. This is where containers have come to solve many challenges.

Why Containers

@spboyer
spboyer / output.md
Created May 2, 2018 18:20
ASP.NET Core 2.1 - Docker HTTPS Kestrel Can't Start
$ docker-compose up                                                                                                                                            ✔  6490  13:46:10
Recreating namesweb_namesweb_1 ... done
Attaching to namesweb_namesweb_1
namesweb_1  | info: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[0]
namesweb_1  |       User profile is available. Using '/root/.aspnet/DataProtection-Keys' as key repository; keys will not be encrypted at rest.
namesweb_1  | info: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[58]
namesweb_1  |       Creating key {85e4bc76-7e37-4d9b-98d7-487f7a9cd12e} with creation date 2018-05-02 17:48:29Z, activation date 2018-05-02 17:48:29Z, and expiration date 2018-07-31 17:48:29Z.
namesweb_1  | warn: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[35]
namesweb_1  |       No XML encryptor configured. Key {85e4bc76-7e37-4d9b-98d7-487f7a9cd12e} may be persisted to storage in unencrypted form.