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 / RichSiteSummary.cshtml
Last active September 2, 2015 10:43
Rendering RSS feed Razor as an Umbraco Macro
@using System.Xml.Linq;
@using umbraco.cms.businesslogic.web;
@using System.Web.Configuration;
@using System.Text;
@inherits Umbraco.Web.Macros.PartialViewMacroPage
@{
List<string> contentTypes = new List<string>() { "Article" };
// Current site root
@rasmuseeg
rasmuseeg / News.cshtml
Last active October 1, 2015 07:51
Basic media list with pagination in Umbraco
@inherits Umbraco.Web.Mvc.UmbracoTemplatePage
@{
Layout = "Master.cshtml";
}
@{
int currentPage = 1;
int.TryParse(Request.QueryString["p"] + "", out currentPage);
var model = new Pagination()
{
@rasmuseeg
rasmuseeg / Gruntfile.js
Created October 2, 2015 07:50
Basic Gruntfile for web projects
/// <binding ProjectOpened='watch' />
module.exports = function (grunt) {
'use strict';
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
less: {
dist: {
options: {
@rasmuseeg
rasmuseeg / NameConversion.cs
Last active October 23, 2015 08:10
Coverting string between CamelCase PascalCase PropperCase
namespace Project.Web {
public class StringExtensions {
/// <summary>
/// Convert the string to Pascal case.
/// </summary>
/// <param name="strValue"></param>
/// <returns></returns>
public static string ToPascalCase(this string strValue)
{
// If there are 0 or 1 characters, just return the string.
@rasmuseeg
rasmuseeg / Pagination.cshtml
Last active January 11, 2016 09:20
Pagination using bootstrap styles
@model Pagination
@RenderPagination(model)
@helper RenderPagination(Pagination model)
{
<nav>
<ul class="pagination">
<li class="@(model.Page <= 1 ? "disabled" : string.Empty)">
<a href="@(model.Page > 1 ? "?p=" + (model.Page-1) : "#" )" aria-label="Previous">
@rasmuseeg
rasmuseeg / EmailService.cs
Last active January 18, 2016 07:34
Sample for sending emails with umbraco content
using System.Collections.Generic;
using System.Net.Mail;
using System.Text;
using Umbraco.Core.Models;
using Umbraco.Web;
using Tasks = System.Threading.Tasks;
namespace ProjectName.Web.Services
{
public class EmailService
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Web;
namespace Umbraco.Web
{
public static class UmbracoExtensions
using System.Collections.Generic;
using System.Linq;
namespace System.Web
{
public static class StringExtensions {
/// <summary>
/// Splits a string into parts
/// </summary>
@rasmuseeg
rasmuseeg / HtmlHelperExtensions.cs
Last active March 11, 2016 07:57
HtmlHelper extensions
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
namespace System.Web.Mvc
{
public static class HtmlHelperExtensions
{
#region HtmlHelper Extensions
public static string Email(this HtmlHelper helper, string email, string message = "JavaScript is disabled, please enable to read this email address")
@rasmuseeg
rasmuseeg / DateTimeExtensions.cs
Last active March 11, 2016 08:50 — forked from ncelico/PrettyDate.cs
Inspired by moment.js
using System;
namespace System.Web
{
public static class DateTimeExtensions {
#region Momentjs
/// <summary>
///
/// </summary>