Skip to content

Instantly share code, notes, and snippets.

View ryanlewis's full-sized avatar

Ryan Lewis ryanlewis

  • Leeds, United Kingdom
  • 20:45 (UTC +01:00)
View GitHub Profile
@tompipe
tompipe / Global
Created August 11, 2014 12:34
Enable HTML Minification
public class Global : UmbracoApplication
{
protected override void OnApplicationStarting(object sender, EventArgs e)
{
GlobalFilters.Filters.Add(new RemoveHtmlWhitespaceFilterAttribute());
base.OnApplicationStarting(sender, e);
}
}
@Jeavon
Jeavon / web.config
Last active August 29, 2015 14:06
Exclude Umbraco from IIS compression to avoid View load failure
<location path="umbraco">
<system.webServer>
<urlCompression doStaticCompression="false" doDynamicCompression="false" dynamicCompressionBeforeCache="false" />
</system.webServer>
</location>
<location path="App_Plugins">
<system.webServer>
<urlCompression doStaticCompression="false" doDynamicCompression="false" dynamicCompressionBeforeCache="false" />
</system.webServer>
</location>
anonymous
anonymous / gist:bf6abd6d60b4abdc2d75
Created May 18, 2015 12:01
ImageProcessor service for Umbraco.Storage.S3
namespace ImageProcessor.Web.Services
{
using System;
using System.Collections.Generic;
using System.IO;
using System.Net;
using System.Threading.Tasks;
using System.Web;
@munr
munr / UmbracoMacro.cshtml
Created March 27, 2013 18:55
Umbraco - Render .Net User Control (ascx) macro with Razor
@*
Render Umbraco macro from within Razor macro
http://stackoverflow.com/questions/10689284/umbraco-render-net-user-control-ascx-macro-with-razor
Yes, it looks like a server control but it does work from a Razor macro.
The example below is for rendering a Contour form
*@
<umbraco:Macro runat="server" language="cshtml">
@{
var writer = new HtmlTextWriter(Output);
@leekelleher
leekelleher / MyApplication.cs
Last active December 19, 2015 13:59
Example of Umbraco 6.1's IContentFinder
using Umbraco.Core;
using Umbraco.Core.Services;
using Umbraco.Web.Mvc;
using Umbraco.Web.Routing;
namespace Our.Umbraco
{
public class MyApplication : ApplicationEventHandler
{
protected override void ApplicationStarting(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
@ryanlewis
ryanlewis / gist:6112001
Last active December 20, 2015 09:59
Get difference between two commits. Powershell snippet to filter out a list of changed files by extension from git diff --stat
git diff 1.0.2 HEAD --stat=200
git diff 1.0.2 HEAD --stat=500 | where {$_ -Match ".cshtml|.css"} | %{$line=$_.split(" "); write-host $line[1] }
git diff 1.0.2 HEAD --stat=200 | where {$_ -Match ".cshtml|.cs"} | %{$l=$_.split(" "); $file=$l[1]; $file=$file.replace("Umbraco.Site", ""); write-host $file }
@andrewrocco
andrewrocco / ga-ratio.js
Created July 17, 2012 15:48
Pixel Aspect Ratio Google Analytics Custom Variable
// Create the test
var pixelRatio = (window.devicePixelRatio >= 1.5) ? "high" : "normal";
..
// Pass it along through GA
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-xxxxxxxx-x']);
// --- IMPORTANT LINE!
// params: event method, custom variable slot, variable name, variable value, scope level
anonymous
anonymous / docker-compose.yml
Created March 15, 2017 15:23
Download stack for usenet.
version: '2'
services:
nzbget:
image: "linuxserver/nzbget:latest"
environment:
- PUID=0
- PGID=0
- TZ=Europe/Amsterdam
ports:
- "6789:6789"
@lrvick
lrvick / angular-socket.js
Created October 18, 2013 15:53
AngularJS service to connect to a websocket server (SockJS or pure WebSocket), manage reconnection, and allow the rest of the angular application to easily send/retrieve data from an open socket.
//TODO: make this a module
/**
* # SockJS socket management service
*
* Creates SockJS socket connection to server, re-connects on disconnection,
* and exports hooks to map handlers for various data interactions.
*
*/
angular.module('app').factory
@jmlacroix
jmlacroix / aws_cf_invalidate.rb
Created September 21, 2010 03:14 — forked from nbibler/amazon_cloudfront_invalidation.rb
Command line script to invalidate cloudfront objects
require 'rubygems'
require 'hmac-sha1'
require 'net/https'
require 'base64'
s3_access='S3_ACCESS_KEY'
s3_secret='S3_SECRET_KEY'
cf_distribution='CLOUDFRONT_DISTRIBUTION_ID'
if ARGV.length < 1