Skip to content

Instantly share code, notes, and snippets.

View kgiszewski's full-sized avatar

Kevin Giszewski kgiszewski

View GitHub Profile
@kgiszewski
kgiszewski / footer.cshtml
Created December 31, 2015 15:11
MVP Part 4 - Header
//not the glossary terms exactly but have a look at the code below to cobble something together
//have a look at this
//https://github.com/kgiszewski/G42.UmbracoGrease/blob/a48f1190c9252eab63b30ee70927a51d044fb90d/src/G42.UmbracoGrease/Extensions/StringExtensions.cs#L95-L183
//this is a helper that is used in the above link
//https://github.com/kgiszewski/G42.UmbracoGrease/blob/master/src/G42.UmbracoGrease/G42TransformationHelper/TransformationHelper.cs
//then call it on a view like this
//@Model.Content.GetPropertyValue("anRteAlias").TransformImages(controllerContext...);
@kgiszewski
kgiszewski / gist:b52edd4dcf6f132145d2
Last active October 16, 2015 23:38
AzureBlobUrl()
imageUrl = image.GetCropUrl(width: 125, height: 125).ToAzureBlobUrl();
<?xml version="1.0" encoding="utf-8"?>
<caching currentCache="AzureBlobCache">
<caches>
<cache name="AzureBlobCache" type="ImageProcessor.Web.Plugins.AzureBlobCache.AzureBlobCache, ImageProcessor.Web.Plugins.AzureBlobCache" maxDays="365">
<settings>
<setting key="CachedStorageAccount" value="DefaultEndpointsProtocol=https;AccountName=accountgoeshere;AccountKey=keygoeshere" />
<setting key="CachedBlobContainer" value="mediacacheContainerName" />
<setting key="CachedCDNRoot" value="mycdnhostname" />
<setting key="SourceStorageAccount" value="DefaultEndpointsProtocol=https;AccountName=accountgoeshere;AccountKey=keygoeshere" />
<setting key="SourceBlobContainer" value="mediaContainerName" />
[HttpPost]
public ActionResult UploadFile()
{
var isSavedSuccessfully = true;
var fName = "";
var newPath = string.Format("{0}{1}", Constants.TEMP_UPLOAD_PATH, DateTime.Now.Ticks.ToString());
try
{
@kgiszewski
kgiszewski / gist:ef12d2d8323aab7c131f
Created October 8, 2015 13:51
Long running Azure Webjob with HTTP request
using System;
using System.Diagnostics;
using System.Net.Http;
using System.Threading.Tasks;
namespace MyWebJob
{
class Program
{
private static bool _isWaiting = true;
@kgiszewski
kgiszewski / gist:8ff9a6c3fa3a0a34f4da
Created September 3, 2015 19:17
HTML Agility Pack
using System;
using System.Web;
using HtmlAgilityPack;
namespace MyNamespace
{
public class MyClass
{
public IHtmlString DoSomething(string html)
{
var MyCustomTemplates = (function() {
//public functions
return {
Entity: function (value, scope, args) {
if(!args.entityType) {
args = {entityType: "Document", propertyName: "name"}
}
[HttpPost]
public object MyMethod(List<string> ids)
{
}
//Register some JS with Umbraco
//~/App_Plugins/ArchetypeLabelTemplates/package.manifest
{
"javascript": [
"~/App_Plugins/ArchetypeLabelTemplates/urlpicker.js"
]
}
//Define your label code here
//~/App_Plugins/ArchetypeLabelTemplates/urlpicker.js