Skip to content

Instantly share code, notes, and snippets.

View kimgunnarsson's full-sized avatar
:shipit:

Kim Gunnarsson kimgunnarsson

:shipit:
View GitHub Profile
@kimgunnarsson
kimgunnarsson / FindProperty.cs
Last active August 29, 2015 14:02
Code for using page properties as Dynamic Properties in EPiServer and retrieve their values up the chain. Code is provided as is. If you use it, you might consider doing some nice null- and empty checks.
using EPiServer;
using EPiServer.Core;
using EPiServer.ServiceLocation;
namespace Core.Properties
{
public static class PropertyFinder
{
public static T FindProperty<T>(PageData currentPage, string propertyName)
@kimgunnarsson
kimgunnarsson / .gitconfig
Last active August 29, 2015 14:02
Alias config
co = checkout
ci = commit
st = status
log1 = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit
lg1 = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit
exclude = !sh -c 'echo "$1" >> .git/info/exclude'
@kimgunnarsson
kimgunnarsson / PageDataUIDescriptor.cs
Created January 9, 2015 14:47
EPiServer UI Descriptor to set DefaultView to All Properties View
using EPiServer.Shell;
namespace Meridium.UIDescriptors
{
[UIDescriptorRegistration]
public class PageDataUIDescriptor: UIDescriptor<PageData>
{
public BasePageUIDescriptor()
{
DefaultView = CmsViewNames.AllPropertiesView;
@kimgunnarsson
kimgunnarsson / staticserver.js
Created January 28, 2015 21:00
staticserver.js
var express = require("express"),
open = require('open'),
app = express(),
port = ENTERPORT,
host = 'ENTER HOST IP';
if(process.argv.length > 2) {
port = parseInt(process.argv[2]);
}
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<languages>
<language name="English" id="en">
<admin>
<categories>
<tabledescription>Description</tabledescription>
</categories>
</admin>
</language>
</languages>
@kimgunnarsson
kimgunnarsson / PreDeploy.ps1
Created October 7, 2015 17:32
PreDeploy.ps1
Import-Module WebAdministration
if($SiteNamesForDeploy) {
$sitesForDeploy = $SiteNamesForDeploy.Split(',')
for ($i=0; $i -lt $sitesForDeploy.length; $i++) {
$currentSite = $sitesForDeploy[$i].Trim()
Write-Output "Stop-Website $currentSite"
@kimgunnarsson
kimgunnarsson / index.html
Created November 18, 2015 07:44 — forked from twalther/index.html
webos-blogpost
<!doctype html>
<html>
<head>
<title>Meridium blogginlägg</title>
<style>
body {
font-family: 'Nunito', HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, sans-serif;
font-weight: 300;
@kimgunnarsson
kimgunnarsson / CustomSelectionFactory.cs
Last active December 20, 2015 20:35
Custom SelectionFactory with generic EditorDescriptor
using System;
using System.Collections.Generic;
using System.Linq;
using EPiServer.Shell.ObjectEditing;
namespace Alloy.Business.Properties.CustomSelectionFactory
{
class CustomSelectionFactory<T> : ISelectionFactory
{
public IEnumerable<ISelectItem> GetSelections(ExtendedMetadata metadata)
define([
// Dojo
"dojo/_base/declare",
"dojo/_base/array",
"dojox/html/entities",
// EPi
"epi-cms/contentediting/editors/SelectionEditor",
// Resources
"epi/i18n!epi/cms/nls/episerver.cms.widget.contentselector"],
@kimgunnarsson
kimgunnarsson / ConfigurableUnifiedSearchFor.Overload.cs
Last active February 17, 2016 21:22
ConfigurableUnifiedSearchFor
public static IQueriedSearch<ISearchContent, QueryStringQuery> ConfigurableUnifiedSearchFor(this IClient client, string query, Language language)
{
return ConfigurableUnifiedSearchFor(client, query, language, DefaultOperator.OR);
}