Skip to content

Instantly share code, notes, and snippets.

View YodasMyDad's full-sized avatar
🤙
OSS

Lee YodasMyDad

🤙
OSS
View GitHub Profile
@JimBobSquarePants
JimBobSquarePants / DominantColor.cs
Created June 7, 2018 11:58
Get dominant color from an image using ImageSharp and ImageProcessor
// ##### ImageSharp #####
using (var image = Image.Load<Rgb24>(inPath))
{
image.Mutate(
x => x
// Scale the image down preserving the aspect ratio. This will speed up quantization.
// We use nearest neighbor as it will be the fastest approach.
.Resize(new ResizeOptions() { Sampler = KnownResamplers.NearestNeighbor, Size = new Size(100, 0) })
@davidfowl
davidfowl / Global.asax.cs
Last active May 11, 2024 02:04
ASP.NET MVC and ServiceCollection sample
using System;
using System.Collections.Generic;
using System.Web;
using System.Web.Mvc;
using System.Web.Optimization;
using System.Web.Routing;
using Microsoft.Extensions.DependencyInjection;
using WebApplication16;
using WebApplication16.Controllers;
@madsrasmussen
madsrasmussen / umbraco.api.js
Created May 28, 2018 11:16
Slave and Eagle - Umbraco Headless JS Client
import axios from 'axios'
import _ from 'lodash'
const baseUrl = 'https://slave-eagle.s1.umbraco.io/'
const restUrl = 'umbraco/rest/v1/content/published/'
class Umbraco {
constructor () {
this.baseUrl = baseUrl
}
@abjerner
abjerner / ExaminePublishedContent.cs
Created October 11, 2016 21:17
Convert SearchResult into IPublishedContent
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using Examine;
using Umbraco.Core;
using Umbraco.Core.Models;
using Umbraco.Core.Models.PublishedContent;
namespace Skybrud.ExamineDevStuff {
@alanmac
alanmac / UmbracoDonutOutputCacheAttribute.cs
Created September 18, 2015 11:31
This is a DonutOutputCache attribute extension that checks for use of Umbraco Doc Type Grid Editor. It's useful in the backoffice if Donut Output Caching is being used and it is throwing exceptions trying to cache DTGE in the backoffice
/// <summary>
/// Used to stop Donut Caching from executing on the request if the Doc Type Grid Editor is being used in the backoffice
/// Put this attribute on the Controller/Method that is causing a problem in the backoffice.
/// e.g. [UmbracoDonutOutputCacheAttribute(CacheProfile = "FiveMin")]
// public ActionResult Home()
/// </summary>
public class UmbracoDonutOutputCacheAttribute : DonutOutputCacheAttribute
{
public override void OnActionExecuting(ActionExecutingContext filterContext)
@cssquirrel
cssquirrel / FileUploadApiController.cs
Last active January 25, 2019 11:49
Using AngularJS API service and Umbraco API controller to permit users to upload files to the server
// Use whatever namespacing works for your project.
namespace YourSite.Web.Controllers.Api
{
using System.IO;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Threading.Tasks;
using System.Web;
using System.Web.Http;
@six519
six519 / JsonPost.vb
Created April 1, 2015 07:19
JSON HTTP POST Request In Visual Basic .NET
'Install Newtonsoft.json
'-----------------------
'
'PM> Install-Package Newtonsoft.Json -Version 6.0.8
'Sample Usage
'------------
'Dim jsonPost As New JsonPost("http://192.168.254.104:8000")
'Dim dictData As New Dictionary(Of String, Object)
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.Serialization;
using System.Web.Script.Serialization;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using Umbraco.Core;
using Umbraco.Core.Events;
using Umbraco.Core.Models;
@0liver
0liver / GoogleAnalyticsApi.cs
Last active March 24, 2023 09:34
C# wrapper around the Google Analytics Measurement Protocol API
/* based on the docs at: https://developers.google.com/analytics/devguides/collection/protocol/v1/devguide */
/*
* LICENSE: MIT
* AUTOHR: oliver@teamaton.com
*/
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
@leekelleher
leekelleher / cmsContentType_Usage.sql
Last active January 19, 2024 19:03
Umbraco - database analysis - SQL Queries
-- Copied from Hendy https://our.umbraco.org/forum/umbraco-7/using-umbraco-7/72814-creating-a-list-of-unused-doc-types#comment-233729
-- Find all unused docTypes
-- These results may contain docTypes that are masters of used ones, so need to exclude these too...
SELECT
A.nodeId as 'DocTypeId',
B.text AS 'Name',
A.alias AS 'Alias'
FROM
cmsContentType A LEFT JOIN