Skip to content

Instantly share code, notes, and snippets.

@dominictarr
dominictarr / readme.md
Created November 26, 2018 22:39
statement on event-stream compromise

Hey everyone - this is not just a one off thing, there are likely to be many other modules in your dependency trees that are now a burden to their authors. I didn't create this code for altruistic motivations, I created it for fun. I was learning, and learning is fun. I gave it away because it was easy to do so, and because sharing helps learning too. I think most of the small modules on npm were created for reasons like this. However, that was a long time ago. I've since moved on from this module and moved on from that thing too and in the process of moving on from that as well. I've written way better modules than this, the internet just hasn't fully caught up.

@broros

otherwise why would he hand over a popular package to a stranger?

If it's not fun anymore, you get literally nothing from maintaining a popular package.

One time, I was working as a dishwasher in a restu

@nathanwoulfe
nathanwoulfe / nunpublish.js
Created June 5, 2018 10:19
Hide the unpublish button for members of the editor group
/* package.manifest...
*
* {
* "javascript" : ["~/App_Plugins/nunpublish/script.js"]
* }
*/
(function () {
function directive(authResource) {
@agrath
agrath / SmartPropertyType.cs
Last active March 26, 2018 10:49
An example of dynamically generated strong properties for Umbraco ModelsBuilder
//A PublishEventHandler catches the DataTypeService.Saved method as a developer workflow entry point;
//When the data type is saved this kicks off the generation and writes a model to our models folder
//This could be app_code if you don't use VS to build your solution, but we generate our ModelsBuilder models
//into a class which is then built as part of the solution
internal class PublishEventHandler : ApplicationEventHandler
{
public const string FileSuffix = ".smartpropertytype.cs";
protected override void ApplicationStarted(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
@dawoe
dawoe / DefaultController.cs
Created November 7, 2017 08:20
Donut Cache examples from Umbraco UK Festival talk "The need for speed"
public class DefaultController : RenderMvcController
{
[UmbracoDonutOutputCache(CacheProfile = "LongPageCache",
Options = OutputCacheOptions.NoCacheLookupForPosts &
OutputCacheOptions.ReplaceDonutsInChildActions, Order = 100)]
public override ActionResult Index(RenderModel model)
{
return base.Index(model);
}
}
@mikkelhm
mikkelhm / CustomApplicationEventHandler.cs
Created June 1, 2017 12:01
Umbraco Bypass ascii encoding if all fails
using System.Globalization;
using Umbraco.Core;
using Umbraco.Core.Configuration;
using Umbraco.Core.Configuration.UmbracoSettings;
using Umbraco.Core.Strings;
namespace Custom
{
public class CustomApplicationEventHandler : ApplicationEventHandler
{
@spra85
spra85 / Rick Roll.js
Created February 10, 2017 10:52
RickRoll
var audio,music,musicParse;audio="",musicParse=function(f){return eval("for(var t=0,S='RIFF_oO_WAVEfmt "+atob("EAAAAAEAAQBAHwAAQB8AAAEACAA")+"data';++t<3e5;)S+=String.fromCharCode("+f+")")},(music=function(){var a;return a="(t<<3)*[8/9,1,9/8,6/5,4/3,3/2,0][[0xd2d2c8,0xce4088,0xca32c8,0x8e4009][t>>14&3]>>(0x3dbe4688>>((t>>10&15)>9?18:t>>10&15)*3&7)*3&7]&255",audio=new Audio("data:audio/wav;base64,"+btoa(musicParse(a))),audio.play()})();
@jamiepollock
jamiepollock / LocalizedEditorModelEventManagerEventHandler.cs
Created October 21, 2016 16:30
Working with EditorModelEventManager to localise an EditorContentModel powered by /config/lang/*.user.xml files
using System.Collections.Generic;
using System.Globalization;
using Umbraco.Core;
using Umbraco.Core.Services;
using Umbraco.Web;
using Umbraco.Web.Editors;
using Umbraco.Web.Models.ContentEditing;
namespace MyWebsite
{
@tompipe
tompipe / NestedContentEditorGroupHandler.cs
Created October 7, 2016 12:17
Nested Content Property Editor Grouping
public class NestedContentEditorGroupHandler : ApplicationEventHandler
{
protected override void OnApplicationStarted(object sender, EventArgs e)
{
base.OnApplicationStarted(sender, e);
var dtMap = Mapper.FindTypeMapFor<IDataTypeDefinition, DataTypeBasic>();
dtMap?.AddAfterMapAction((s, d) =>
{
var src = (IDataTypeDefinition) s;
using System;
using System.Collections.Generic;
using System.Linq;
using MyProj.Extensions;
using MyProj.Models;
using Umbraco.Core;
using Umbraco.Core.Persistence;
namespace MyProj.Helpers
{
@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