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 / umbraco-directives.d.ts
Last active January 8, 2017 16:45
@types/umbraco
declare namespace Umbraco.Directives {
/**
* Used to implement <umb-table> directive
* Usage:
* <umb-table
* ng-if="participants"
* items="items"
* allow-select-all="options.bulkActionsAllowed"
* item-properties="options.includeProperties"
* on-select="vm.selectItem"
@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 / gulpfile-sass.js
Last active December 8, 2016 07:34
Base gulpfile for bower boostrap and site less files
/// <binding ProjectOpened='watch' />
'use strict';
require('es6-promise').polyfill();
var gulp = require('gulp');
var sass = require('gulp-sass');
var sourcemaps = require("gulp-sourcemaps");
var autoprefixer = require('gulp-autoprefixer');
var autoprefixerOptions = {
@rasmuseeg
rasmuseeg / SMTP.aspx
Last active January 20, 2022 00:47
Simple SMTP test aspx page for sending and testing smtp configuration and server response.
<%@ Import Namespace="System.IO" %>
<%@ Import Namespace="System.Configuration" %>
<%@ Import Namespace="System.Net.Mail" %>
<%@ Import Namespace="System.Net.Sockets" %>
<%@ Import Namespace="System.Net.Security" %>
<%@ Import Namespace="System.Net.Configuration" %>
<%@ Import Namespace="Umbraco.Core.Configuration" %>
<%@ Page Language="C#" %>
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
using System.Threading;
using System.Windows.Forms;
/// http://stackoverflow.com/questions/2715385/convert-webpage-to-image-from-asp-net
public class WebsiteToImage
{
private Bitmap m_Bitmap;
@rasmuseeg
rasmuseeg / gist:2ec1a14400df87ec3d1cecde999a1c74
Created November 1, 2016 08:02 — forked from tomfulton/gist:2150553
Umbraco - GetMediaByPath
/// <summary>
/// Gets the media item by it's file path
/// </summary>
/// <remarks>
/// Example usage: Use in conjunction with HtmlAgilityPack or WYSIWYG.xslt to parse your RTE for Media Images, grab associated
/// properties from the Media node, and render them in your output (think alt tags, captions, etc).
/// TODO: support non "/media" directory, cleanup & further testing
/// </remarks>
/// <param name="mediaPath">Path to the uploaded file in the media directory</param>
/// <returns>Media node which contains the specified file</returns>
module App {
"use strict";
interface IMyResource {
getData: () => string;
}
class MyResource implements IMyResource {
static $inject: string[] = ["$http"];
/// <reference path="roundabout.ts" />
// Return either top, left, bottom or right.
module Roundabout.Extentions {
export interface IOptions {
Speed: number;
Time: number;
Auto: boolean;
}
export enum Directions {
@rasmuseeg
rasmuseeg / cookies.ts
Last active September 23, 2016 11:32
TypeScript for handling cookies same way as in C#
interface IHttpCookie {
name: string;
expires: number | Date | string;
domain: string;
value: string;
values: string[];
path: string;
secure: boolean;
httpOnly: boolean;
}
@rasmuseeg
rasmuseeg / XmlConvert.cs
Last active May 11, 2021 13:58
My version of XmlConvert like the JsonConvert on Newtonsoft.Json
public static class XmlConvert
{
public static string SerializeObject<T>(T dataObject, Formatting formatting = Formatting.None)
{
if (dataObject == null)
{
return string.Empty;
}
try
{