Skip to content

Instantly share code, notes, and snippets.

Avatar
🔥

Sebastiaan Janssen nul800sebastiaan

🔥
View GitHub Profile
View gist:2dfb053cc5523e735e48afbed456f091
using System.Collections.Generic;
using System.IO;
using System.IO.Compression;
using System.Net;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Web.Hosting;
using System.Web.Http;
using Umbraco.Web.WebApi;
View gist:e7fc28130d083a6e4c25c8a420d383fc
### Keybase proof
I hereby claim:
* I am nul800sebastiaan on github.
* I am cultiv (https://keybase.io/cultiv) on keybase.
* I have a public key ASAauWBO4XaKeymtplaJ1_H_AutCKhCYBSAvnEI9lIr5ZQo
To claim this, I am signing this object:
@nul800sebastiaan
nul800sebastiaan / gist:c3459731791577582e38254fa6e0ccd6
Last active Jul 30, 2019
Example of catch-all route and added constraints
View gist:c3459731791577582e38254fa6e0ccd6
RouteTable.Routes.MapRoute("Default", "{controller}/{action}/{id}",
//Defaults
new { controller = "Home", action = "Index", id = "" },
//Constraints (controller cannot start with UmbProfile, UmbRegister, UmbLogin, UmbLoginStatus or Tags)
new { controller = "^(?!(UmbProfile|UmbRegister|UmbLogin|UmbLoginStatus|Tags))" });
View gist:0aa1fc02911604bf11eeb4a5c15b7d51
using System.Web.Routing;
using Umbraco.Core.Composing;
using Umbraco.Web.Runtime;
namespace RemoveRoutes
{
// This is required to ensure this composer runs after
// Umbraco's WebFinalComposer which is the component
// that creates all of the routes during startup
[ComposeAfter(typeof(WebFinalComposer))]
View gist:927dcf155439fcc867e97a4d8dda6e16
using System.Web.Routing;
using Umbraco.Core;
namespace RemoveRoutes
{
public class RemoveRoutesStartupHandler : ApplicationEventHandler
{
protected override void ApplicationStarted(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
{
// Reference: https://github.com/umbraco/Umbraco-CMS/issues/5206
View SetMediaNameToFilename
using System;
using Umbraco.Core;
using Umbraco.Core.Services;
namespace My.Namespace
{
public class EventHandler : ApplicationEventHandler
{
protected override void ApplicationStarted(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
{
@nul800sebastiaan
nul800sebastiaan / Rss.cshtml
Last active Nov 9, 2018
Simple altTemplate RSS feed - see comments for usage instructions.
View Rss.cshtml
@inherits UmbracoTemplatePage
@{
Response.ContentType = "text/xml";
// The variables in this code block are the only ones you might need to change a little to get it to work
var blogName = "Cultiv";
var currentUrl = string.Format("https://{0}", Request.Url.Host);
// Find first node under the root of document type BlogOverview
var blogNode = Model.Content.AncestorOrSelf(1).Descendants("BlogOverview").First();
View gist:53ae1903491cdc70c072a21b9a7d16db
<dependentAssembly>
<assemblyIdentity name="System.Web.Cors" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-5.2.3.0" newVersion="5.2.3.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-10.0.0.0" newVersion="10.0.0.0" />
</dependentAssembly>
View gist:1b838b33fca257467b831ebd77d8e43b
<system.net>
<mailSettings>
<smtp deliveryMethod="SpecifiedPickupDirectory" from="info@test.com">
<network host="localhost" />
<specifiedPickupDirectory pickupDirectoryLocation="D:\Temp\Umbraco-CMS\src\Umbraco.Web.UI\App_Data\mail\" />
</smtp>
</mailSettings>
</system.net>
View gist:d86c2dcd515040fb5d2701c67d9a513e
### Keybase proof
I hereby claim:
* I am nul800sebastiaan on github.
* I am cultiv (https://keybase.io/cultiv) on keybase.
* I have a public key whose fingerprint is A91D 058D 06E9 1CA5 5EA2 E6F5 35A8 8B3E 0346 40B7
To claim this, I am signing this object:
You can’t perform that action at this time.