Skip to content

Instantly share code, notes, and snippets.

@nul800sebastiaan
nul800sebastiaan / gist:8641249
Last active December 24, 2018 09:53
What's this Umbraco route hijacking all about? (more info in this blog post: http://cultiv.nl/blog/whats-this-umbraco-route-hijacking-all-about/)
// MODEL
using System.Collections.Generic;
using System.Linq;
using Umbraco.Core.Models;
using Umbraco.Web;
using Umbraco.Web.Models;
namespace Cultiv.Models
{
public class BlogOverview : RenderModel
@cou929
cou929 / detect-private-browsing.js
Last active May 1, 2024 21:07
Detect private browsing mode (InPrivate Browsing or Incognito).
function retry(isDone, next) {
var current_trial = 0, max_retry = 50, interval = 10, is_timeout = false;
var id = window.setInterval(
function() {
if (isDone()) {
window.clearInterval(id);
next(is_timeout);
}
if (current_trial++ > max_retry) {
window.clearInterval(id);
@jramsahai
jramsahai / dynamically_resize_player_using_css.html
Last active January 14, 2019 16:20
If you're looking for a way to dynamically resize the Vidyard inline JavaScript player, you'll find an example of one way to do it below.
<!--
Refer to this article for more information:
http://knowledge.vidyard.com/Core_Features/Publish_your_players/011_Publish_your_player/014_Dynamically_resize_the_inline_player
-->
<html>
<head>
<style type="text/css">
.innerContainer {
position: relative;
display: block;
@jarrodbell
jarrodbell / main.js
Last active December 29, 2015 05:59
JavaScript example for using CommandFusion iViewer to process data returned from a HTTP Request to a Z-Wave MiCasaVerde Vera Lite system
var myJSON, baseURL = "http://192.168.1.90:3480/data_request?id=lu_status2&DataVersion=1&DeviceNum=";
function requestData(deviceNum) {
CF.request(baseURL + deviceNum, function(status, headers, body) {
if (status == 200) {
// OK response received, now grab the JSON string from body and turn it into an object
myJSON = JSON.parse(body);
// Now assign one of the known state variables to a serial join (if it will always be at a certain index in the state array)
@csharpforevermore
csharpforevermore / App_Code-GlobalHelpers.cshtml
Created October 28, 2013 15:55
Umbraco 6 - Razor - Global helper wrapper method for rending a hyperlink
@helper RenderLink(string href, string title, string target, string text)
{
<a href="@(href)" title="@(title)" target="@(target)">@(text)</a>
}
@ryanlewis
ryanlewis / Pager.cshtml
Created August 27, 2013 16:41
A Razor/ASP.NET MVC pager that is adaptable for any project (Developed for Umbraco)
@model Epiphany.Web.Models.PagerViewModel
@{
var showPages = 5;
var maxPage = (int) Math.Ceiling((decimal) Model.Total/Model.PageSize);
}
@*[[ PAGER PAGE:@Model.Page PAGESIZE:@Model.PageSize TOTAL:@Model.Total MAXPAGE:@maxPage ]]*@
<div class="pagination">
@warrenbuckley
warrenbuckley / XML-Snippet
Created July 31, 2013 09:15
Trying to create an XML Sitemap in Umbraco 6. Getting the following error: ============================================================ This page contains the following errors: error on line 9 at column 10: Extra content at the end of the document Below is a rendering of the page up to the first error.
@inherits Umbraco.Web.Mvc.UmbracoTemplatePage
@{
Layout = null;
Response.ContentType = "text/xml";
}<xml version="1.0" encoding="UTF-8">
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>http://www.example.com/</loc>
<lastmod>2005-01-01</lastmod>
<changefreq>monthly</changefreq>
@derak-kilgo
derak-kilgo / brightcove-smartplayer-api-sample.html
Last active December 19, 2015 14:29
Brightcove Smart Player API Example
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>Sample2</title>
<script language="JavaScript" type="text/javascript" src="http://code.jquery.com/jquery-1.10.2.js"></script>
</head>
<body>
<div>
<p>Make sure you've got the dev console open or you won't see my messages.</p>
<button id="positionButton">Get position</button>
@pascalmaddin
pascalmaddin / parallax-image-with-text.html
Last active May 14, 2021 14:38
An Image with parallax-effect and with some text, which is fading out while scrolling
<div id="banner">
<div class="wrap-center">
<div class="banner-centered" id="banner-text">
<h2>Hello <strong>We Are Company-Name</strong>, Glad To See You. :-)</h2>
</div>
</div>
</div>
@yetanotherchris
yetanotherchris / gist:4956622
Created February 14, 2013 21:36
Umbraco change templates on multiple documents
using System;
using System.Web;
using System.Web.Services;
using System.Collections;
using System.Web.Services.Protocols;
using umbraco.cms.businesslogic;
using umbraco.cms.businesslogic.web;
using umbraco.BusinessLogic;
using System.Xml.Serialization;
using umbraco.cms.businesslogic.property;