Skip to content

Instantly share code, notes, and snippets.

View uniquelau's full-sized avatar

Laurence Gillian uniquelau

View GitHub Profile
@uniquelau
uniquelau / _Media.xslt
Last active December 14, 2015 16:49
1. Detect devicePixelRatio 2. Set Cookie 3. Render correct image for dPR - adjust jpeg quality based on dPR.
<!-- Fetch devicePixelRatio -->
<xsl:variable name="devicePixelRatio" select="normalize-space(umb:RequestCookies('dPR'))" />
<!-- Template for a Media Image -->
<xsl:template match="Image" name="GenericImage">
<xsl:param name="class"/>
<xsl:param name="crop"/>
<xsl:param name="id"/>
<xsl:param name="size"/>
<xsl:param name="retinafy"/>
@uniquelau
uniquelau / picturefill.ultralight.js
Created March 7, 2013 17:27
Very simple reduction of PictureFill.js - not suitable for production
// var retina = window.devicePixelRatio > 1;
var retina = window.devicePixelRatio > 1;
if (retina) {
// the user has a retina display
// tbh - lets just drop a cookie, and handle this stuff server-side
// document.cookie='HTTP_IS_RETINA=1;path=/'
$(function () {
@uniquelau
uniquelau / _Article.xslt
Created February 28, 2013 16:34
XSLT Document Property templating with Fallback.
<?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" />
@uniquelau
uniquelau / xsltouch error
Created February 28, 2013 15:49
XSLTouch Error
Unhandled Exception: System.IO.FileNotFoundException: Could not load file or ass
embly 'XSLTouchLibrary, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' o
r one of its dependencies. The system cannot find the file specified.
File name: 'XSLTouchLibrary, Version=1.0.0.0, Culture=neutral, PublicKeyToken=nu
ll'
at XSLTouch.Program.Main(String[] args)
WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLM\Software\M
@uniquelau
uniquelau / MyTemplate.xslt
Last active December 14, 2015 07:18
Rough working of a 'recall' template, that allows the media templates to be 'recalled', allowing content to be wrapped around the Video, Image, without having to write a whole template. (less duplication!)
<xsl:template match="Image" priority="1">
<article>
<h1><xsl:value-of select="@nodeName" />
<a href="image/{@id}">
<xsl:apply-templates select="." mode="media.recall">
<xsl:with-param name="crop" select="'gallery'" />
</xsl:apply-templates>
</a>
</article>
<!-- Here we wrap some data around our standard 'Image' template -->
@uniquelau
uniquelau / usync error
Created February 25, 2013 17:14
uSync Error, on initial application startup. Recycle app pool, error disappears.
Server Error in '/' Application.
Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.
Source Error:
@uniquelau
uniquelau / Debug.pubxml.xml
Last active December 14, 2015 01:29
Example of a projects targets file
<?xml version="1.0" encoding="utf-8"?>
<!--
This file is used by the publish/package process of your Web project. You can customize the behavior of this process
by editing this MSBuild file. In order to learn more about this please visit http://go.microsoft.com/fwlink/?LinkID=208121.
-->
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<WebPublishMethod>MSDeploy</WebPublishMethod>
<LastUsedBuildConfiguration>Debug</LastUsedBuildConfiguration>
<LastUsedPlatform>Any CPU</LastUsedPlatform>
@uniquelau
uniquelau / falm log.html
Last active December 14, 2015 01:19
Umbraco Error for SC
<table cellspacing="0" cellpadding="4" rules="all" id="body_gvLogTypesList" style="color:Black;background-color:White;border-color:#DEDFDE;border-width:1px;border-style:solid;border-collapse:collapse;width:100%;">
<tbody><tr align="center" style="color:White;background-color:#6B696B;font-weight:bold;white-space:nowrap;">
<th scope="col" style="width:10%;"><a href="javascript:__doPostBack('ctl00$body$gvLogTypesList','Sort$UserName asc')" style="color:White;">User Name</a></th><th scope="col" style="width:5%;"><a href="javascript:__doPostBack('ctl00$body$gvLogTypesList','Sort$NodeId asc')" style="color:White;">Node Id</a></th><th scope="col" style="width:26%;"><a href="javascript:__doPostBack('ctl00$body$gvLogTypesList','Sort$NodeName asc')" style="color:White;">Node Name</a></th><th scope="col" style="width:9%;"><a href="javascript:__doPostBack('ctl00$body$gvLogTypesList','Sort$DateStamp asc')" style="color:White;">Log Date</a></th><th scope="col" style="width:10%;"><a href="javascript:__doPostBack('ct
REM For IIS7 plus, using Application Pool Identities
set identity=IIS APPPOOL\{app-pool-name}
icacls app_code /grant "%identity%":(OI)(CI)RX
icacls app_browsers /grant "%identity%":(OI)(CI)RX
icacls app_data /grant "%identity%":(OI)(CI)M
icacls bin /grant "%identity%":(OI)(CI)R
icacls config /grant "%identity%":(OI)(CI)M
icacls css /grant "%identity%":(OI)(CI)M
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:umb="urn:umbraco.library" version="1.0" exclude-result-prefixes="umb">
<xsl:output method="xml" indent="yes" omit-xml-declaration="yes"/>
<xsl:key name="document-by-id" match="*[@isDoc]" use="@id"/>
<xsl:template match="MultiNodePicker" mode="multipicker">
<!--
Make possible to override the key used to retrieve nodes
-->
<xsl:param name="key" select="'document-by-id'"/>
<!--