Skip to content

Instantly share code, notes, and snippets.

Avatar
:shipit:

Kim Gunnarsson kimgunnarsson

:shipit:
View GitHub Profile
@kimgunnarsson
kimgunnarsson / FindProperty.cs
Last active Aug 29, 2015
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.
View FindProperty.cs
using EPiServer;
using EPiServer.Core;
using EPiServer.ServiceLocation;
namespace Core.Properties
{
public static class PropertyFinder
{
public static T FindProperty<T>(PageData currentPage, string propertyName)
View .gitconfig
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 Jan 9, 2015
EPiServer UI Descriptor to set DefaultView to All Properties View
View PageDataUIDescriptor.cs
using EPiServer.Shell;
namespace Meridium.UIDescriptors
{
[UIDescriptorRegistration]
public class PageDataUIDescriptor: UIDescriptor<PageData>
{
public BasePageUIDescriptor()
{
DefaultView = CmsViewNames.AllPropertiesView;
View 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]);
}
View EPiServer.EmbeddedLangFiles.language_EN.xml
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<languages>
<language name="English" id="en">
<admin>
<categories>
<tabledescription>Description</tabledescription>
</categories>
</admin>
</language>
</languages>
View 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 Nov 18, 2015 — forked from twalther/index.html
webos-blogpost
View index.html
<!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 Dec 20, 2015
Custom SelectionFactory with generic EditorDescriptor
View CustomSelectionFactory.cs
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)
View SelectionEditor.js
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"],
View ConfigurableUnifiedSearchFor.Overload.cs
public static IQueriedSearch<ISearchContent, QueryStringQuery> ConfigurableUnifiedSearchFor(this IClient client, string query, Language language)
{
return ConfigurableUnifiedSearchFor(client, query, language, DefaultOperator.OR);
}