Skip to content

Instantly share code, notes, and snippets.

View dylanyoung-dev's full-sized avatar
🥑
Focusing

Dylan Young dylanyoung-dev

🥑
Focusing
View GitHub Profile
@dylanyoung-dev
dylanyoung-dev / sitecore-query-one.txt
Last active November 9, 2016 04:20
Sitecore Query - Basic Example
query:/sitecore/content/*
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="TestIp.aspx.cs" %>
<%@ Import Namespace="Sitecore.Analytics.Lookups" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<script runat="server">
@dylanyoung-dev
dylanyoung-dev / zz.patch.config
Last active May 3, 2018 21:26
Patch for X-Forwarded-For
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
<sitecore>
<settings>
<setting name="Analytics.ForwardedRequestHttpHeader">
<patch:attribute name="value">X-Forwarded-For</patch:attribute>
</setting>
</settings>
</sitecore>
</configuration>
@dylanyoung-dev
dylanyoung-dev / GlassMapper.csx
Created April 30, 2018 01:48
Glass Mapper Leprechaun Script
// Generates Synthesis models
Log.Debug($"Emitting GlassMapper templates for {ConfigurationName}...");
public string RenderTemplates()
{
var localCode = new System.Text.StringBuilder();
foreach (var template in Templates)
{
@dylanyoung-dev
dylanyoung-dev / Constants.csx
Created April 30, 2018 02:07
Constants Generation for Glass Mapper Models
// Generates Glass Constants File
Log.Debug($"Emitting constants templates for {ConfigurationName}...");
public string RenderFields(TemplateCodeGenerationMetadata template)
{
if (template.OwnFields.Length == 0)
{
return string.Empty;
}
@dylanyoung-dev
dylanyoung-dev / gulpfile.js
Created April 30, 2018 14:14
Gulp Leprechaun Build Task
var gulp = require("gulp");
var exec = require("child_process").exec;
// Run Leprechaun to Code Generate Models
gulp.task('_Code-Generation', function(x) {
exec('.\\Tools\Leprechaun-1.0.0\\Leprechaun.console.exe /c .\\src\\Leprechaun.config', function (err, stdout, stderr) {
console.log(stdout);
console.log(stderr);
x(err);
});
@dylanyoung-dev
dylanyoung-dev / Leprechaun.config
Last active April 30, 2018 14:28
Glass Mapper Auto Generate Configuration (Comments Removed)
<?xml version="1.0" encoding="utf-8" ?>
<leprechaun>
<configurations import=".\*\*\code\CodeGen.config">
<configuration name="Helix.Base" abstract="true">
<codeGenerator scripts="Scripts/GlassMapper.csx, Scripts/Constants.csx, Scripts/Diagnostics.csx" outputFile="$(configDirectory)\$(layer)\$(module)\code\Models\$(layer).$(module).Model.cs" />
<dataStore physicalRootPath="$(configDirectory)\$(layer)\$(module)\Serialization" />
<templatePredicate rootNamespace="Helix.$(layer).$(module)" />
</configuration>
</configurations>
@dylanyoung-dev
dylanyoung-dev / CodeGen.config
Created April 30, 2018 14:34
Navigation Feature Leprechaun CodeGen Configuration Example
<?xml version="1.0" encoding="utf-8" ?>
<configuration name="Feature.Navigation" extends="Helix.Base">
</configuration>
@dylanyoung-dev
dylanyoung-dev / TestIpScript.aspx
Last active May 3, 2018 21:00
XForwardedFor Sitecore Test
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="TestIp.aspx.cs" %>
<%@ Import Namespace="Sitecore.Analytics.Lookups" %>
<%@ Import Namespace="Sitecore.Analytics.Configuration" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
@dylanyoung-dev
dylanyoung-dev / azuredeploy.json
Created June 26, 2018 00:30
This is the general look of the azuredeploy.json but with a nested template
{
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json",
"contentVersion": "1.0.0.0",
"variables": {
},
"parameters": {
},
"resources": [