Skip to content

Instantly share code, notes, and snippets.

View uniquelau's full-sized avatar

Laurence Gillian uniquelau

View GitHub Profile
@uniquelau
uniquelau / instagram.cs
Created December 3, 2015 15:01
Insta Cache
public class InstaService
{
/// <summary>
/// Handles Connection to Instagram, configuration values are set in the web.config AppSettings element
/// </summary>
private readonly InstagramOAuthData _instagram;
private readonly InstagramService _service;
public InstaService()
@uniquelau
uniquelau / redirect.xml
Last active August 29, 2015 14:23
Quick Redirect to Production Media, for Media Heavy Sites
<!-- IIS URL Rewrite, this can be placed in the web.config -->
<!-- Handle Missing Media on Development Environment -->
<rule name="Handle missing media" stopProcessing="true">
<match url="^media/(.*)" />
<conditions logicalGrouping="MatchAll">
<!-- Add Conditions, so local only -->
<add input="{REMOTE_HOST}" pattern="localhost" />
<!-- Handle Files and Folders -->
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
@uniquelau
uniquelau / Login.aspx
Created December 15, 2014 11:53
Password Protect Azure Website
<%@ Page Language="C#" %>
<%@ Import Namespace="System.Web.Security" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
public void Login_OnClick(object sender, EventArgs args)
{
if (FormsAuthentication.Authenticate(UsernameTextbox.Text, PasswordTextbox.Text))
FormsAuthentication.RedirectFromLoginPage(UsernameTextbox.Text, NotPublicCheckBox.Checked);
@uniquelau
uniquelau / app.js
Created September 18, 2014 09:45
Basic application JavaScript file, has events for resize / etc.
// Table of Contents
// [1] Globals
// [A] Event, Ready
// [B] Event, Loaded
// [C] Event, Resized
// [1] Globals
hasObject = false;
// [A] Event, Ready (fast)
@uniquelau
uniquelau / reportSeoTitles.xslt
Created April 4, 2014 09:49
Excel importable XML that lists out indexable Umbraco pages and their 'meta data' and 'page titles'. Can be used to analyse duplicate page headers which has a negative impact on SEO.
<?xml version="1.0"?>
<!DOCTYPE xsl:stylesheet [
<!ENTITY MaxLevel "5">
<!ENTITY Page "*[@isDoc and @level &lt;= &MaxLevel;] [not(self::FormPage | self::ThankYouPage )]">
]>
<xsl:stylesheet
version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:umb="urn:umbraco.library" xmlns:msxml="urn:schemas-microsoft-com:xslt"
exclude-result-prefixes="umb xsl msxml"
<xsl:template match="* [@isDoc]" mode="sitemap-entry">
<xsl:param name="metaSitemapChangeFreq" select="&DefaultChangeFreq;" />
<xsl:param name="metaSitemapPriority" select="&DefaultPriority;"/>
<xsl:param name="recurse" select="true()" />
<url>
<loc>
<xsl:apply-templates select="@id" />
</loc>
<lastmod><xsl:value-of select="@updateDate" />+00:00</lastmod>
<changefreq>
<?xml version="1.0" encoding="utf-8" ?>
<xsl:stylesheet
version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:umb="urn:umbraco.library"
exclude-result-prefixes="umb"
>
<xsl:output method="xml" indent="yes" omit-xml-declaration="yes" />
<!-- Laurie, VooDooBytes, 14th November 2013 -->
using System;
using System.Web.Mvc;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using uComponents.Core;
using uComponents.Core.uQueryExtensions;
using umbraco.NodeFactory;
-07-08 16:06:47,091 [10] INFO Umbraco.Core.PluginManager - [Thread 28] Completed resolution of types of umbraco.interfaces.IDataType, found 77 (took 94ms)
2013-07-08 16:07:09,810 [10] INFO Umbraco.Core.Publishing.PublishingStrategy - [Thread 28] Content 'Home' with Id '1076' has been published.
2013-07-08 16:08:54,181 [10] INFO Umbraco.Core.Publishing.PublishingStrategy - [Thread 37] Content 'Home (1)' with Id '1076' has been published.
2013-07-08 16:09:00,626 [10] INFO Umbraco.Core.Publishing.PublishingStrategy - [Thread 33] Content 'Home' with Id '1076' has been published.
2013-07-08 16:19:07,726 [10] INFO Umbraco.Core.Publishing.PublishingStrategy - [Thread 24] Content 'Home' with Id '1076' has been published.
2013-07-08 16:20:31,892 [10] INFO umbraco.BusinessLogic.Log - [Thread 20] Log scrubbed. Removed all items older than 2013-05-09 16:20:31
2013-07-08 16:20:31,902 [10] INFO Umbraco.Core.UmbracoApplicationBase - [Thread 20] Application shutdown. Reason: ConfigurationChange
2013-07-08 16:20:34,63
@uniquelau
uniquelau / createWebsite.ps1
Last active December 17, 2015 10:09
Powershell file that makes creating new websites in IIS a breeze! :) $InetFolder & $Domain should be tweaked for your purposes. Original code from http://www.zerrouki.com/create-website/ + added in multiple hostnames, fixed Runtime bug. Now supports creation of a single Virtual Directory, e.g. for Media in a load balanced environment.
<#
.SYNOPSIS CreateWebsite - Automatic website creation.
.DESCRIPTION Allow to create a website and its ApplicationPool. Some tuning is included
.PARAMETER SiteName Defines the display name (in IIS Manager) of the website
Mandatory parameter.
.PARAMETER Port Defines the listening port for the website
Default is "80".
.PARAMETER Environment Defines the website environment.
This will be added as suffix in the website display name
Possible values are "LIVE", "STAGING", "UAT", "QUAL" or "DEV"