Skip to content

Instantly share code, notes, and snippets.

View torleifhalseth's full-sized avatar

Torleif Halseth torleifhalseth

View GitHub Profile
@torleifhalseth
torleifhalseth / gist:7ea1e95b54ccf102b75b
Last active August 29, 2015 13:57
Mapping Umbraco content to Strongly typed models

###Mapping Umbraco content to Strongly typed models

Every document type in Umbraco should be reflected in a strongly typed model. Example:Article(Document type) --> ArticleModel(Strongly typed model)

Heritage in Umbraco document types should be reflected in our models.

Every view should have an assigned View Model.
Every View Model should inherit from a common view model (CommonViewModel). The common view model should contain global properties.

@torleifhalseth
torleifhalseth / Replacing uHydrator with Ditto.md
Last active March 24, 2017 09:48
uHydrator to Ditto regex replacement thingy

Add the patterns to the find and replace dialog in Visual Studio for ultimate win. Replace in entire solution for more ultimate win.

#Matching pattern

_?ModelFactory\.Create<([a-z]+)>\((_?[a-z]+\.?[a-z]+?)\)

#Replacement pattern

###Managing Database Logins -- first, connect to the master database ####Create Login

CREATE LOGIN login1 WITH password='<ProvidePassword>';

Strong Password Generator

####Create User Remember to run the queries below on the actual database (Right click the database and select "New Query")

@torleifhalseth
torleifhalseth / SassMeister-input-HTML.html
Created April 15, 2015 06:58
Grid with static gutter using outer container padding
<div class="modules">
<div class="module_container">
<div class="module"></div>
</div>
<div class="module_container">
<div class="module"></div>
</div>
<div class="module_container">
<div class="module"></div>
</div>
@torleifhalseth
torleifhalseth / SassMeister-input-HTML.html
Last active August 29, 2015 14:19
Grid with static gutter using border
<div class="modules">
<div class="module"></div>
<div class="module"></div>
<div class="module"></div>
</div>
@torleifhalseth
torleifhalseth / SassMeister-input-HTML.html
Last active August 29, 2015 14:19
Grid with static gutter using inner element margin
<div class="modules">
<div class="module_container">
<div class="module"></div>
</div>
<div class="module_container">
<div class="module"></div>
</div>
<div class="module_container">
<div class="module"></div>
</div>
@torleifhalseth
torleifhalseth / SassMeister-input-HTML.html
Created April 22, 2015 11:18
Generated by SassMeister.com.
<article>
<ul>
<li></li>
<li></li>
<li></li>
<li></li>
</ul>
</article>
@torleifhalseth
torleifhalseth / RelationConverter.cs
Last active August 29, 2015 14:21
Provides a unified way of converting picked relation nodes as a specified type.
using System;
using System.ComponentModel;
using System.Globalization;
using System.Linq;
using nuPickers;
using Our.Umbraco.Ditto;
namespace MyProject.TypeConverters
{
/// <summary>
using System.Collections.Generic;
using System.Linq;
using MyProject.Models;
using Our.Umbraco.Ditto;
using Umbraco.Web;
using Umbraco.Web.WebApi;
namespace MyProject.Controllers.WebApi
{
public class FeaturedArticlesController : UmbracoApiController