Skip to content

Instantly share code, notes, and snippets.

@AntMooreWebDev
AntMooreWebDev / EnumHelper.GetAttributeOfType.cs
Created August 26, 2021 12:39
Gets an attribute on an enum field value
public static class EnumHelper
{
/// <summary>
/// Gets an attribute on an enum field value"/>
/// </summary>
/// <typeparam name="T">The type of the attribute you want to retrieve</typeparam>
/// <param name="enumVal">The enum value</param>
/// <returns>The attribute of type T that exists on the enum value</returns>
/// <example><![CDATA[string desc = myEnumVariable.GetAttributeOfType<DescriptionAttribute>().Description;]]></example>
/// <see href="https://stackoverflow.com/a/9276348/3990156"/>
@AntMooreWebDev
AntMooreWebDev / Typeahead-BS3-css.css
Last active June 2, 2021 03:24 — forked from bhays/Typeahead-BS3-css
Bootstrap 3 style fixes for using Typeahead.js
.twitter-typeahead .tt-query,
.twitter-typeahead .tt-hint {
margin-bottom: 0;
}
.tt-hint {
display: block;
width: 100%;
height: 38px;
padding: 8px 12px;
// Select all links with hashes
$('a[href*="#"]')
// Remove links that don't actually link to anything
.not('[href="#"]')
.not('[href="#0"]')
.click(function(event) {
// On-page links
if (
location.pathname.replace(/^\//, '') == this.pathname.replace(/^\//, '')
&&
@AntMooreWebDev
AntMooreWebDev / redirect-rule-by-ip.config
Created March 10, 2021 13:50
How to add a redirect rule that is ignored if accessed from a specific IP
<rule name="[Rule name]" stopProcessing="true">
<match url="[URL to match]" ignoreCase="false" />
<conditions>
<add input="{REMOTE_HOST}" pattern="^[ip.\address]" ignoreCase="false" negate="true" />
</conditions>
<action type="Redirect" redirectType="Found" url="[Target URL]" />
</rule>
/****** Script for SelectTopNRows command from SSMS ******/
SELECT TOP (1000) [id]
,[contentNodeId]
,[versionId]
,[propertytypeid]
,[dataInt]
,[dataDecimal]
,[dataDate]
,[dataNvarchar]
,[dataNtext]
@AntMooreWebDev
AntMooreWebDev / .htaccess maintenance redirect
Created January 26, 2021 11:41
A small rewrite rule to send all users to maintenance page (except some excluded IP)
RewriteEngine on
RewriteCond %{REMOTE_ADDR} !^11\.22\.33\.44$ [NC] # Can add multiple lines here for different IPs
RewriteCond %{REQUEST_URI} !^/maintenance.html$ [NC]
RewriteRule ^(.*)$ "/maintenance.html" [R=302,L]

Umbraco Table Descriptions

Information pertaining to the tables created when UmbracoCMS is installed

cmsMemberType

Stores information relating to Member properties.

@AntMooreWebDev
AntMooreWebDev / HTML5-Template.html
Last active May 11, 2020 20:35
An empty HTML5 template
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta content="IE=edge,chrome=1' http-equiv='X-UA-Compatible">
<meta content="width=device-width, initial-scale=1.0" name="viewport">
<title></title>
<!--css here-->
<!--<link rel="stylesheet" type="text/css" href="/css/style.css">-->
</head>
@AntMooreWebDev
AntMooreWebDev / FireEventsOnDynamicElement.js
Last active December 2, 2019 16:29
The generic code for firing events on elements that are loaded dynamically. This is particularly useful if the elements are generated by a plugin and you cannot utilise CreateDynamicElements.js (https://gist.github.com/AntMooreWebDev/bbd29b7f5298409dba12aed9a71ee81b).
$('body').on('[event]', '[element]', function () { });