Skip to content

Instantly share code, notes, and snippets.

glcheetham glcheetham

Block or report user

Report or block glcheetham

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
@glcheetham
glcheetham / javascript-uk-number-plate-validation.md
Last active Jun 21, 2019 — forked from danielrbradley/uk-number-plate-validation.md
Javascript Regular Expression to Validate UK Number Plates
View javascript-uk-number-plate-validation.md

Javascript Regular Expression to Validate UK Number Plates

Regular Expression

Works in jQuery, React, Angular, Javascript es6 and es5

(^[A-Z]{2}[0-9]{2}\s?[A-Z]{3}$)|(^[A-Z][0-9]{1,3}[A-Z]{3}$)|(^[A-Z]{3}[0-9]{1,3}[A-Z]$)|(^[0-9]{1,4}[A-Z]{1,2}$)|(^[0-9]{1,3}[A-Z]{1,3}$)|(^[A-Z]{1,2}[0-9]{1,4}$)|(^[A-Z]{1,3}[0-9]{1,3}$)

Source information

Forked from here but updated to work in JavaScript, and added an optional space

@glcheetham
glcheetham / App.jsx
Created Oct 7, 2017
JSX Bootstrap 3 Kitchen Sink
View App.jsx
const KitchenSink = () => (<div classNameName="App">
<div className="navbar navbar-default navbar-static-top">
<div className="container">
<div className="navbar-header">
<button type="button" className="navbar-toggle" data-toggle="collapse" data-target=".header-collapse">
<span className="sr-only">Toggle navigation</span> <span className="icon-bar"></span> <span className="icon-bar"></span> <span className="icon-bar"></span>
</button>
<a className="navbar-brand" href="#">Kitchen Sink</a>
</div>
@glcheetham
glcheetham / Example.cs
Created Jan 29, 2017
Example instantiation of loosely-coupled class which depends on UmbracoHelper
View Example.cs
var umbracoHelper = new Umbraco.Web.UmbracoHelper(Umbraco.Web.UmbracoContext.Current);
// Or from any other environment that comes with UmbracoHelper already available https://our.umbraco.org/documentation/reference/querying/umbracohelper/
// UmbracoHelper.ContentQuery implements the ITypedContentQuery interface
var resourceService = new ResourceService(umbracoHelper.ContentQuery);
@glcheetham
glcheetham / Startup.cs
Created Jan 29, 2017
Using Inversion of Control with UmbracoHelper
View Startup.cs
builder.RegisterInstance(umbracoHelper.ContentQuery).As<ITypedPublishedContentQuery>();
builder.RegisterType<ResourceService>().As<IResourceService>();
@glcheetham
glcheetham / ResourceService.cs
Created Jan 29, 2017
Loosely-Coupled Class Which uses APIs from UmbracoHelper
View ResourceService.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using MyProject.Models;
using Umbraco.Web;
using Our.Umbraco.Ditto;
namespace MyProject.Services
{
@glcheetham
glcheetham / XMLSitemap.cshtml
Last active Oct 12, 2016
Example dynamic Umbraco sitemap.xml template
View XMLSitemap.cshtml
@inherits Umbraco.Web.Mvc.UmbracoTemplatePage
@{
Layout = null;
umbraco.library.ChangeContentType("text/xml");
}
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
@foreach (var root in Umbraco.TypedContentAtRoot())
{
@glcheetham
glcheetham / UrlRewriting.xml
Created Oct 2, 2016
Line to add in UrlRewriting.config to rewrite your robots.txt URL
View UrlRewriting.xml
<add name="robots-rewrite"
virtualUrl="^~/robots.txt"
destinationUrl="~/robotstxt"
/>
@glcheetham
glcheetham / TXTFile.cshtml
Created Oct 2, 2016
Text File Umbraco Template
View TXTFile.cshtml
@inherits Umbraco.Web.Mvc.UmbracoTemplatePage
@{
Layout = null;
umbraco.library.ChangeContentType("text/plain");
}
@(Model.Content.GetPropertyValue<string>("fileContent"))
@glcheetham
glcheetham / Web.debug.config
Created Aug 8, 2016
Web.debug.config if you already have Umbraco set up
View Web.debug.config
<?xml version="1.0" encoding="utf-8"?>
<!-- For more information on using web.config transformation visit http://go.microsoft.com/fwlink/?LinkId=125889 -->
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
<!--
Set your connection string in the XML snippet below
-->
<connectionStrings>
<add name="umbracoDbDSN"
@glcheetham
glcheetham / Web.debug.config
Created Aug 8, 2016
Web.debug.config to trigger Umbraco setup
View Web.debug.config
<?xml version="1.0" encoding="utf-8"?>
<!-- For more information on using web.config transformation visit http://go.microsoft.com/fwlink/?LinkId=125889 -->
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
<appSettings>
<add key="umbracoConfigurationStatus" value="" xdt:Transform="SetAttributes" xdt:Locator="Match(key)"/>
</appSettings>
</configuration>
You can’t perform that action at this time.