Skip to content

Instantly share code, notes, and snippets.

// General resource format:
{
metadata: [ // array of metadata objects
{ "<any-string1>": <any-json> },
{ "<any-string2>": <any-json> },
"<any-string3>" // short hand for { "<any-string3>": null },
...
],
data: <any-javascript-value> // e.g. string, number, boolean, object, array
@andrewdavey
andrewdavey / Object.inherit.js
Created July 3, 2012 14:15
Simple object inheritance in JavaScript
(function () {
"use strict";
var copyOwnProperties = function (from, to) {
for (var propertyName in from) {
if (from.hasOwnProperty(propertyName)) {
to[propertyName] = from[propertyName];
}
}
};
@andrewdavey
andrewdavey / app.ts
Created October 20, 2013 17:38
Example AngularJS application using TypeScript
/// <reference path="angular.d.ts"/>
class KittenController {
constructor(
private $scope: ng.IScope,
private debounce: IDebounce
) {
this.watchForSizeChanges();
}
@andrewdavey
andrewdavey / index.html
Created October 20, 2013 17:39
HTML for AngularJS and TypeScript example
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>TypeScript AngularJS Controller Example</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link href="//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css" rel="stylesheet" />
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.2.0-rc.3/angular.min.js"></script>
<script src="app.js"></script>
public class MailSender
{
// Call this from Application_Start in Global.asax.cs
public static void Init()
{
var viewRenderer = new EmailViewRenderer(ViewEngines.Engines) {EmailViewDirectoryName = "Emails"};
var emailParser = new EmailParser(viewRenderer);
Email.CreateEmailService = ()=>new EmailService(viewRenderer, new PremailerEmailParser(emailParser), ()=>new SmtpClient());
}