Skip to content

Instantly share code, notes, and snippets.

View JimBobSquarePants's full-sized avatar
💭
(•_•) ( •_•)>⌐■-■ (⌐■_■)

James Jackson-South JimBobSquarePants

💭
(•_•) ( •_•)>⌐■-■ (⌐■_■)
View GitHub Profile
@kipusoep
kipusoep / gist:9fa2dc1160d21afaabc4
Created December 16, 2014 13:37
ImageProcessor auto-resize
MediaFileSystem mediaFileSystem = FileSystemProviderManager.Current.GetFileSystemProvider<MediaFileSystem>();
IContentSection contentSection = UmbracoConfig.For.UmbracoSettings().Content;
IEnumerable<string> supportedTypes = contentSection.ImageFileTypes.ToList();
foreach (IMedia media in e.SavedEntities)
{
if (media.HasProperty("umbracoFile"))
{
// Make sure it's an image.
string path = media.GetValue<string>("umbracoFile");

By using my Skybrud.Umbraco.GridData package (which introduces a strongly typed model for the Grid), indexing the new Grid in Umbraco 7.2 is quite easy.

At Skybrud.dk we typically create a class named ExamineIndexer that takes care of the Examine related events. This class should be initalized during Umbraco startup like this:

using Umbraco.Core;

namespace FanoeTest {

 public class Startup : ApplicationEventHandler {
@digitalshadow
digitalshadow / OpenSimplexNoise.cs
Last active June 3, 2024 10:23
OpenSimplex Noise Refactored for C#
/* OpenSimplex Noise in C#
* Ported from https://gist.github.com/KdotJPG/b1270127455a94ac5d19
* and heavily refactored to improve performance. */
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.CompilerServices;
namespace NoiseTest
@zpqrtbnk
zpqrtbnk / Test.cs
Last active August 29, 2015 14:14
Recurse Vs Stack Benchmark
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace TestRunner
{
using System;
using System.Xml;
using Microsoft.Web.XmlTransform;
using Umbraco.Core.IO;
using Umbraco.Core.Logging;
using umbraco.interfaces;
namespace Our.Umbraco.Packaging
{
public class ConfigTransformations : IPackageAction
module tweak {
function getViewUrl(viewName: string) {
return `/App_Plugins/tweaks/views/${viewName}.html`;
}
export class views {
static mediaPicker = getViewUrl("media-picker");
}
@lukas-h
lukas-h / license-badges.md
Last active June 9, 2024 16:08
Markdown License Badges for your Project

Markdown License badges

Collection of License badges for your Project's README file.
This list includes the most common open source and open data licenses.
Easily copy and paste the code under the badges into your Markdown files.

Notes

  • The badges do not fully replace the license informations for your projects, they are only emblems for the README, that the user can see the License at first glance.

Translations: (No guarantee that the translations are up-to-date)

@davidfowl
davidfowl / Example1.cs
Last active March 28, 2024 20:36
How .NET Standard relates to .NET Platforms
namespace Analogy
{
/// <summary>
/// This example shows that a library that needs access to target .NET Standard 1.3
/// can only access APIs available in that .NET Standard. Even though similar the APIs exist on .NET
/// Framework 4.5, it implements a version of .NET Standard that isn't compatible with the library.
/// </summary>INetCoreApp10
class Example1
{
public void Net45Application(INetFramework45 platform)
@jbreuer
jbreuer / ContentExtensions.cs
Created May 18, 2016 14:59
An extension method to convert an IContent to an IPublishedContent.
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="ContentExtensions.cs" company="Colours B.V.">
// © Colours B.V. 2015
// </copyright>
// <summary>
// The content extensions.
// </summary>
// --------------------------------------------------------------------------------------------------------------------
namespace Project.Web.Core.Extensions
@MehdiNS
MehdiNS / bayer_matrix.cpp
Created October 31, 2016 13:49
Generate the bayer matrix of order n (of dimension 2^n x 2^n) iteratively
#include <iostream>
#include <string>
#include <vector>
#include <cassert>
using uint = unsigned int;
template<typename T>
std::ostream& operator<<(std::ostream& os, const std::vector<T>& vec)
{