Skip to content

Instantly share code, notes, and snippets.

@barryokane
barryokane / sso_login_freshdesk.cs
Created May 17, 2012 11:08
SSO Login for Freshdesk support portal - ASP.Net C# Sample Code
protected void Page_Load(object sender, EventArgs e)
{
string url = GetSsoUrl(ConfigurationManager.AppSettings["FreshDesk.BaseUrl"], //including trailing slash
ConfigurationManager.AppSettings["FreshDesk.Secert"], user.UserName, user.Email);
Response.Redirect(url);
}
string GetSsoUrl(string baseUrl, string secert, string name, string email)
{
return String.Format("{0}login/sso/?name={1}&email={2}&hash={3}", baseUrl, Server.UrlEncode(name),
@barryokane
barryokane / Google Analytics Cross domain tracking.aspx
Last active December 29, 2015 10:09
Google Analytics Cross domain tracking when using server side redirect
<%@ Page Language="C#" %>
<script runat="server">
protected void RedirectClick(object sender, CommandEventArgs e)
{
if (Page.IsValid)
{
string url = RedirectUrl.Value;
//... whatever else ...
-- ** Clean up old versions and other content from Umbraco Database
-- ** Compatible with SQLCE (eg run using LinqPad on an SDF file)
--https://gist.github.com/dampee/a8ead728165b16d49c00
-- Umbraco Clear Old Document Versions To Decrease Database Size And Improve Performance
-- http://borism.net/2008/12/16/fixing-a-large-cmspropertydata-table-in-umbraco/
DELETE FROM cmsPropertyData WHERE
versionId NOT IN (SELECT versionId FROM cmsDocument WHERE updateDate > DATEADD(m, -1, getdate()) OR published = 1 OR newest = 1) AND
@barryokane
barryokane / 0_reuse_code.js
Created February 1, 2016 21:45
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@barryokane
barryokane / uWhiteLabelDashboardAction.cs
Created March 22, 2016 15:08
Umbraco install package action that adds a new "tab" to the dashboard (not a "Section"). Used in: https://github.com/EndzoneSoftware/uWhiteLabel
using System.Xml;
using umbraco.interfaces;
using Umbraco.Core.IO;
using Umbraco.Core;
using uWhiteLabel.Properties;
namespace uWhiteLabel.Install
{
public class uWhiteLabelDashboardAction : IPackageAction
{
@barryokane
barryokane / uWhiteLabel.Install.InstallControl.ascx
Created March 22, 2016 15:58
An example User Control used for "Load control after installation" when creating an Umbraco package. (See http://issues.umbraco.org/issue/U4-7471)
<%@ Control Language="C#" AutoEventWireup="true" Inherits="uWhiteLabel.Install.InstallControl" %>
<div>
<h3>uWhiteLabel Installed Successfully!</h3>
</div>
<hr />
<div>
<p class="umb-abstract">Instructions</p>
<ol>
<li>...more stuff here...</li>
</ol>
namespace OnePageImpactReport.Models
{
[UIOMaticAttribute("ImpactOrganisations", "icon-users", "icon-user")]
[TableName("ImpactOrganisations")]
[PrimaryKey("Id", autoIncrement = true)]
[ExplicitColumns]
public class ImpactOrganisation : IUIOMaticModel
{
[UIOMaticIgnoreField]
@barryokane
barryokane / umbraco.helper.sample.before.cshtml
Last active March 15, 2017 15:52
Simple example of using Razor @Helper in an Umbraco template. In this example we have some repeating HTML, using @Helper removes the duplication.
@inherits Umbraco.Web.Mvc.UmbracoTemplatePage
@{
Layout = "Layout.cshtml";
}
<main>
<section id="content" class="offers">
@{
@barryokane
barryokane / EventsList_all.cshtml
Created April 12, 2016 20:31
Combining “FullCalendar” with “KS.Umbraco7.Calendar” to create a great Umbraco events listing
@inherits Umbraco.Web.Mvc.UmbracoTemplatePage
@using KS.Umbraco7.Calendar.Core
@{
Layout = "Layout.cshtml";
}
@section styles {
<link rel='stylesheet' href='//cdnjs.cloudflare.com/ajax/libs/fullcalendar/2.6.1/fullcalendar.min.css' />
<link media="print" rel='stylesheet' href='//cdnjs.cloudflare.com/ajax/libs/fullcalendar/2.6.1/fullcalendar.print.css' />
}
@barryokane
barryokane / nav_partial.cshtml
Last active April 14, 2016 00:34
Getting Nested Content property values from child pages.
@{
var root = Model.Content.AncestorOrSelf(1);
var pages = root.DescendantsOrSelf("DocTypeAlias");
foreach (var p in pages) {
var items = p.GetPropertyValue<IEnumerable<IPublishedContent>>("NestedContentPropertyName");
<div class="outer">
<h1><a href="@p.Url">@Umbraco.Field(p,"HeadingText")</a></h1>
<ul class="innerList">
@if (items != null) {
foreach(var item in items) {