Skip to content

Instantly share code, notes, and snippets.

Ryan Lewis ryanlewis

Block or report user

Report or block ryanlewis

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View copy-k8s-resources-across-namespaces.sh
kubectl get rs,secrets -o json --namespace old | jq '.items[].metadata.namespace = "new"' | kubectl create-f -
@ryanlewis
ryanlewis / ContourInAnonymousLoadBalancing.cs
Created Jul 27, 2016
Using Umbraco Contour in an anonymous load balanced scenario (v7.3+)
View ContourInAnonymousLoadBalancing.cs
public class ContourFormRefreshPayload
{
public Guid Id { get; set; }
}
public class ContourFormCacheRefresher : JsonCacheRefresherBase<ContourFormCacheRefresher>
{
public static string Id = "AA2970FD-8785-42C2-A289-A7A6614CAE45";
protected override ContourFormCacheRefresher Instance => this;
public override Guid UniqueIdentifier => new Guid(Id);
@ryanlewis
ryanlewis / ConfigureLuceneIndexing.cs
Created Aug 18, 2015
Hooking into the Lucene events with Umbraco
View ConfigureLuceneIndexing.cs
using System.Web.UI;
using Examine;
using Examine.LuceneEngine;
using Examine.LuceneEngine.Providers;
using Umbraco.Core;
using Umbraco.Web;
namespace AMAZINGWEBSITE.Web.Core.ApplicationEventHandlers
{
public class ConfigureLuceneIndexing : IApplicationEventHandler
@ryanlewis
ryanlewis / StringExtensions.cs
Last active Aug 31, 2016
.FormatWith() extension method that we use with some of our Umbraco sites
View StringExtensions.cs
using System;
using System.Linq;
using System.Text.RegularExpressions;
using System.Web;
namespace MyUmbracoSite.Core.Extensions
{
public static class StringExtensions
{
// http://bendetat.com/the-greatest-string-formatwith-implementation-in-the-world.html
@ryanlewis
ryanlewis / sublime.reg
Created Mar 12, 2015
Add "Open folder as Sublime project" to Explorer right-click menu
View sublime.reg
Windows Registry Editor Version 5.00
; This will make it appear when you right click ON a folder
; The "Icon" line can be removed if you don't want the icon to appear
[HKEY_CLASSES_ROOT\Directory\shell\sublime]
@="Open Folder as &Sublime Project"
"Icon"="\"C:\\Program Files\\Sublime Text 3\\sublime_text.exe\",0"
[HKEY_CLASSES_ROOT\Directory\shell\sublime\command]
@ryanlewis
ryanlewis / RedirectToParent.cshtml
Created Nov 4, 2014
Redirect to Parent page template
View RedirectToParent.cshtml
@inherits UmbracoTemplatePage
@{
var parent = Model.Content.Parent;
while (true)
{
if (parent.TemplateId > 0 && parent.TemplateId != Model.Content.TemplateId)
{
break;
}
parent = parent.Parent;
@ryanlewis
ryanlewis / your.csproj
Created Jul 25, 2014
How we add all assets in our Web projects
View your.csproj
<Project>
<Target Name="BeforeBuild">
<Exec WorkingDirectory="..\.." Command="powershell.exe .\grunt-build.ps1 -target $(Configuration)" />
<ItemGroup>
<Content Include="css\**\*.css" />
<Content Include="js\**\*.js" />
<Content Include="js\**\*.js.map" />
<Content Include="fonts\**\*.*" />
<Content Include="img\**\*.png" />
<Content Include="img\**\*.gif" />
@ryanlewis
ryanlewis / umbraco-jul-fix.ps1
Created Jul 22, 2014
Powershell script to resolve the Umbraco security advisory released 21 July 2014
View umbraco-jul-fix.ps1
Param(
[Parameter(Mandatory=$true)] $path
)
$proxyHtm = @"
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>Repo proxy</title>
</head>
@ryanlewis
ryanlewis / StringArrayValueConverter.cs
Last active Aug 29, 2015
Property Value Converter for a array of strings
View StringArrayValueConverter.cs
using System;
using Newtonsoft.Json;
using Umbraco.Core.Models.PublishedContent;
using Umbraco.Core.PropertyEditors;
namespace Epiphany.PropertyEditorValueConverters
{
[PropertyValueType(typeof(string[]))]
[PropertyValueCache(PropertyCacheValue.All, PropertyCacheLevel.Content)]
public class StringArrayValueConverter : PropertyValueConverterBase
@ryanlewis
ryanlewis / package.manifest
Created Jul 15, 2014
Label datatype stored as "TEXT"
View package.manifest
{
propertyEditors: [
{
alias: "Epiphany.NoEditBig",
name: "Label (Big)",
editor: {
view: "~/umbraco/views/propertyeditors/readonlyvalue/readonlyvalue.html",
valueType: 'TEXT',
}
}
You can’t perform that action at this time.