Skip to content

Instantly share code, notes, and snippets.

View rasmuseeg's full-sized avatar
💭
Coding ofc.

Rasmus Eeg Møller rasmuseeg

💭
Coding ofc.
View GitHub Profile
@rasmuseeg
rasmuseeg / docker-compose.yml
Created April 15, 2020 08:05
Minecraft Bedrock Server with Docker
version: "3.7"
services:
mcbedrock:
stdin_open: true
tty: true
image: itzg/minecraft-bedrock-server
restart: always
ports:
- "19132:19132/udp"
@rasmuseeg
rasmuseeg / Generic Umbraco Repository
Last active March 10, 2020 08:32
Generic Repository for umbraco
public abstract class GenericRepository<TKey, TEntity>
{
public DatabaseContext context;
public GenericRepository(DatabaseContext context)
{
this.context = context;
}
public virtual IEnumerable<TEntity> Get()
@rasmuseeg
rasmuseeg / DominantColorEventHandler.cs
Last active October 19, 2019 15:42
Gets the most dominant color from a image and saves it to a property with the name of "umbacoDominantColor"
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Web;
using ImageProcessor;
using ImageProcessor.Imaging;
using Newtonsoft.Json;
@rasmuseeg
rasmuseeg / 1040_CreateTables.cs
Last active June 12, 2019 09:59
Umbraco V7 Migration Runner and Configuration
using Umbraco.Core;
using Umbraco.Core.Persistence;
using Umbraco.Core.Persistence.Migrations;
using Umbraco.Core.Persistence.SqlSyntax;
using Umbraco.Core.Logging;
using LadyChamber.Core.Persistence.Models;
namespace $rootnamespace$.Core.Persistence.Migrations
{
// SemVersion: major.minor.revsion+build
@rasmuseeg
rasmuseeg / Increment-ClientDependencyVersion.ps1
Created April 17, 2019 07:04
Increment clientdependency.config version during continues deployment
param(
[Parameter(Position=0,
HelpMessage="Path to your project.")]
[ValidateNotNullOrEmpty()]
[string]
$ProjectPath = "..\DanskBilglas.UmbracoCMS\Config\",
[Parameter(Position=1,
HelpMessage="Name of your client dependency config (default: ClientDependency.config)")]
[string]
@rasmuseeg
rasmuseeg / Custom.config
Last active March 27, 2019 13:54
uCommerce Umbraco 7 UI.xml transform and file copy post install
<!--
Custom configuration for uCommerce components.
Find the ID of component you want to override
and use the same ID here. Your component will
override the default.
You can configure new components here as well
and have them injected into existing ones.
-->
@rasmuseeg
rasmuseeg / ExamineExtensions.cs
Last active February 19, 2018 13:05
Umbraco Extensions
using System;
using System.Globalization;
namespace Umbraco.Examine
{
public static class ExamineExtensions
{
private static string format = "yyyyMMddHHmmssfff";
public static DateTime? ParseExamineDate(this string s)
@rasmuseeg
rasmuseeg / default.pubxml
Last active January 16, 2018 08:20
Default WebDeploy Publish profile
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<!-- ACL will be handled by the server -->
<IncludeSetAclProviderOnDestination>False</IncludeSetAclProviderOnDestination>
<!-- Invalidate files by checksum, and not change date -->
<MSDeployUseChecksum>True</MSDeployUseChecksum>
<EnableMSDeployBackup>True</EnableMSDeployBackup>
</PropertyGroup>
</Project>
@rasmuseeg
rasmuseeg / web.config
Last active January 12, 2018 11:50
MSSQL Local DB Connection String
<add name="DefaultConnection" connectionString="Data Source=(LocalDb)\MSSQLLocalDB;AttachDbFilename=|DataDirectory|\MyDatabase.mdf;Initial Catalog=MyDatabase;Integrated Security=True" providerName="System.Data.SqlClient" />
@rasmuseeg
rasmuseeg / ContactFormModel.cs
Last active September 12, 2017 11:37
Umbraco MVC Data Annotations Attributes - Required, DisplayName, StringLength, MinLength, MaxLength etc.
public class ContactFormModel
{
[DictionaryDisplayName(nameof(CategoryId))]
[DictionaryRequired]
public int CategoryId { get; set; }
[DictionaryDisplayName(nameof(Subject))]
[DictionaryRequired]
[DictionaryMinLength(8)]
public string Subject { get; set; }