Skip to content

Instantly share code, notes, and snippets.

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

James Jackson-South JimBobSquarePants

💭
(•_•) ( •_•)>⌐■-■ (⌐■_■)
View GitHub Profile
@jamiehowarth0
jamiehowarth0 / ApplicationStartupHandler.cs
Last active August 29, 2015 14:01
How to use uMapper to return strong POCO types in Umbraco MVC mode
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Umbraco.Core;
using Umbraco.Web.Mvc;
using UmbracoStrongTypeViews.Controllers;
namespace UmbracoStrongTypeViews.App_Start {
public class ApplicationStartupHandler : IApplicationEventHandler {
public void SendMessage(MailMessage message)
{
HostingEnvironment.QueueBackgroundWorkItem(async (_) => {
using(var smtpClient = new SmtpClient()){
//configure client if needed
await smtpClient.SendMailAsync(message);
}
});
}
.NET Framework 4.5 selected
File > New Project > Visual C# > Web > ASP.NET Web Application > Empty
In Package Manager Console, https://nuget.org/api/v2/ selected as source
Install-Package UmbracoCms
F5 to run and install Umbraco
After that succeeds, back to Package Manager Console
update-package ImageProcessor -Source D:\Dropbox\Windows\Downloads
update-package ImageProcessor.Web -Source D:\Dropbox\Windows\Downloads
- Obviously "Source" is the folder where the downloaded nupkg files are
@leekelleher
leekelleher / 1-README.md
Last active August 29, 2015 14:06
Ditto - Example of mapping an Archetype property to custom POCO model/type

Here is an example of using Ditto to map an Archetype property to custom POCO model/type.


Let's say that we have an Archetype to represent some SEO meta-data, and we'll call the DocType property "metaData".

We'd have 3 properties in the Archetype:

  • metaTitle
  • metaDescription
@jamiepollock
jamiepollock / ExtensionMethods.cs
Last active August 29, 2015 14:07
Umbraco GetPropertyValueRecursively with custom logic to determine if a recursive value is valid
using System;
using System.Linq.Expressions;
using Umbraco.Core.Models;
using Umbraco.Web;
namespace My.Website.ExtensionMethods {
public static class UmbracoExtensions {
public static TPropertyValue GetPropertyValueRecursively<TPropertyValue>(this IPublishedContent content, string alias, Expression<Func<TPropertyValue, bool>> recursiveValueIsValidExpression, TPropertyValue defaultValue = default(TPropertyValue)) {
if (content.HasProperty(alias)) {
var value = content.GetPropertyValue<TPropertyValue>(alias);
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;
@davidfowl
davidfowl / dotnetlayout.md
Last active June 3, 2024 23:39
.NET project structure
$/
  artifacts/
  build/
  docs/
  lib/
  packages/
  samples/
  src/
 tests/
@kid-cavaquinho
kid-cavaquinho / DictionaryDisplayNameAttribute
Last active August 29, 2015 14:10
Helpers for Umbraco dictionary usage over MVC models
public class DictionaryDisplayNameAttribute : DisplayNameAttribute
{
private readonly string resourceName;
public DictionaryDisplayNameAttribute(string resourceName)
: base()
{
this.resourceName = resourceName;
}
@anaisbetts
anaisbetts / .gitattributes
Created December 3, 2014 16:26
USE THIS GITATTRIBUTES FOR EVERY NEW PROJECT FOREVER AND EVER
# Auto detect text files and perform LF normalization
* text=auto
# Custom for Visual Studio
*.cs diff=csharp
@p3t3r67x0
p3t3r67x0 / pseudo_elements.md
Last active January 16, 2024 01:17
A CSS pseudo-element is used to style specified parts of an element. In some cases you can style native HTML controls with vendor specific pseudo-elements. Here you will find an list of cross browser specific pseudo-element selectors.

Styling native elements

Native HTML controls are a challenge to style. You can style any element in the web platform that uses Shadow DOM with a pseudo element ::pseudo-element or the /deep/ path selector.

video::webkit-media-controls-timeline {
  background-color: lime;
}

video /deep/ input[type=range] {