Skip to content

Instantly share code, notes, and snippets.

View TimGeyssens's full-sized avatar

Tim Geyssens TimGeyssens

View GitHub Profile
@TimGeyssens
TimGeyssens / gist:5489463
Created April 30, 2013 15:28
Custom value injection classes (for use with http://valueinjecter.codeplex.com/) to map from a umbraco's IPublishedContent to a view model and from a view model to IContent (first rough version)
public class InjectionToIContent : ValueInjection
{
protected override void Inject(object source, object target)
{
var content = target as IContent;
var type = source.GetType();
if (type.GetProperty("Name") != null)
content.Name = type.GetProperty("Name").GetValue(source).ToString();
Implementor
- Forms with Contour - 10/10/2013
- Users - 14/11/2013
- Members - 12/12/2013
- Complete site start to finish - 30/1/2014
Developer
- UmbracoApiControllers - 26/9/2013
- Media and Relations API - 31/10/2013
- Extending backend using MVC - 28/11/2013
- Custom property editors - 9/1/2014
@TimGeyssens
TimGeyssens / gist:7705239
Created November 29, 2013 12:46
Add twitter embed support to the Umbraco embed em all Add this snippet to /config/embeddedMedia.config
<!-- Twitter Settings -->
<provider name="Twitter" type="Umbraco.Web.Media.EmbedProviders.OEmbedRich, umbraco">
<urlShemeRegex><![CDATA[twitter\.com/]]></urlShemeRegex>
<apiEndpoint><![CDATA[https://api.twitter.com/1/statuses/oembed.xml]]></apiEndpoint>
<requestParams type="Umbraco.Web.Media.EmbedProviders.Settings.Dictionary, umbraco">
</requestParams>
</provider>
@TimGeyssens
TimGeyssens / gist:7784961
Created December 4, 2013 09:48
Tea and biscuits
18:00 - 18:15: Arrival
18:15 - 19:15: Umbraco v7 and all that jazz
19:15 - 20:00: Food, glorious food
20:00 - 21:00: World premiere of Tea Commerce on v7
21:00 - 21:15: Special guest
21:15 - ... :Closing drinks
int score = 0;
Dictionary<string, int> scores = new Dictionary<string, int>();
foreach (string mapping in Scoremappings.Split(';'))
{
if (!string.IsNullOrEmpty(mapping) && mapping.Split(',').Length > 0)
{
int weight = 0;
scores.Add(mapping.Split(',')[0], int.TryParse(mapping.Split(',')[1], out weight) ? weight : 0);
@TimGeyssens
TimGeyssens / gist:b439217835d0ea41913e
Created October 30, 2014 09:22
v7 dialogservice pass custom data to dialog
dialogService.open(
{
template: "/app_plugins/SomePlugin/dialog.html",
customData: myData
});
to access in your dialog use
dialogOptions.customData
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using umbraco.cms.businesslogic.Tags;
using umbraco.interfaces;
using Umbraco.Forms.Core;
using Umbraco.Web;
namespace Contour.Addon.Tags
$('input[type=submit]').not('.cancel').click(function (evt) {
evt.preventDefault();
var self = $(this);
var frm = self.closest('form');
frm.validate();
if (frm.valid()) {
$.ajax({
cache: false,
async: true,
@TimGeyssens
TimGeyssens / Contour send email workflow
Created May 11, 2015 13:17
Contour send email workflow
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Mail;
using System.Text;
using System.Web;
using Umbraco.Forms.Core.Enums;
using System.Text.RegularExpressions;
using Umbraco.Forms.Data.Storage;
using System.Xml;