Skip to content

Instantly share code, notes, and snippets.

module app.controllers {
export class MyController extends BaseController {
public static $inject = [
"$scope",
"MyService"
];
public SomeData: app.models.DataClass[] = [];
// Scope members
@cdroulers
cdroulers / svgHover.ts
Created April 13, 2015 12:50
svgHover.ts
angular.module("shared.ui").directive(
"svgHover",
[
() => {
return {
restrict: "A",
link: (scope: ng.IScope, element: ng.IAugmentedJQuery) => {
function getSvg(svg: HTMLObjectElement): SVGElement {
var svgDocument: Document;
try {
@cdroulers
cdroulers / SvgHandler.cs
Last active August 29, 2015 14:19
SvgHandler.cs
public class SvgHandler : IHttpHandler
{
public void ProcessRequest(HttpContext context)
{
var fileName = Path.GetFileName(context.Request.AppRelativeCurrentExecutionFilePath) ?? string.Empty;
var svgIndex = fileName.LastIndexOf(".svg", StringComparison.InvariantCultureIgnoreCase);
var classIndex = fileName.IndexOf('.');
string[] classNames = new string[0];
string svgPath;
@cdroulers
cdroulers / SuperFakeHttpContext.cs
Last active August 29, 2015 14:16
This file is required because the FakeHttpContext does not implement the Cache property.
public class SuperFakeHttpContext : HttpContextBase
{
public SuperFakeHttpContext(string relativeUrl)
{
}
public override System.Web.Caching.Cache Cache
{
get { return HttpRuntime.Cache; }
}
@cdroulers
cdroulers / FileVirtualPathProvider.cs
Last active August 29, 2015 14:16
Since a lot of .NET classes are internal, I copied one and implemented missing methods.
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Web.Hosting;
namespace Helpers.Web
{
public class FileVirtualPathProvider : VirtualPathProvider
{