Skip to content

Instantly share code, notes, and snippets.

View jchadwick's full-sized avatar

Jess Chadwick jchadwick

View GitHub Profile
@jchadwick
jchadwick / ngLazyLoad
Last active October 2, 2015 01:21
Angular Lazy-Loading
(function (angular) {
angular._module = angular.module;
angular.module = function () {
var module = angular._module.apply(angular, arguments);
enableLazyLoading.$inject = ['$controllerProvider', '$provide', '$compileProvider'];
function enableLazyLoading($controllerProvider, $provide, $compileProvider) {
@jchadwick
jchadwick / TasksService.local.js
Created September 10, 2015 20:11
Intro to Angular snippets
function TasksService() {
var tasks = [];
function add(task) {
task.completed = false;
tasks.push(task);
}
function clearCompleted() {
@jchadwick
jchadwick / Animal.ts
Last active August 29, 2015 14:19
Presentation Snippets: TypeScript
interface IAnimal {
name: string;
sayName(): void;
}
class Animal implements IAnimal {
private _name: string = '[Animal]';
get name(): string {
return this._name;
@jchadwick
jchadwick / PostViewComponent_Default.cshtml
Last active February 9, 2016 20:06
Up and Running with ASP.NET 5 - Snippets
@inject WebApplication1.Services.FormattingUtility Format
@model WebApplication1.Post
<div class='blog-post' data-post-id="@Model.Id">
<h2 class='title'><a href="@Url.RouteUrl("Post", new { id = Model.Id })">@Model.Title</a></h2>
<p class='metadata'>
<span>@Format.AsDisplayDate(Model.PostedDate)</span>
by <a class="author" href='#'>@Model.Author</a>
</p>
<section class="body">
@jchadwick
jchadwick / TodoServiceProxy.angular.js
Last active September 10, 2015 19:55
Todo Service Proxy
TodosService.$inject = [ '$http' ];
function TodosService($http) {
var baseUrl = "https://jchad-todo.azurewebsites.net/todos";
function getAll() {
return _unwrap($http.get(baseUrl));
}
function getById(todoId) {
@jchadwick
jchadwick / Animal.ts
Created June 19, 2014 06:17
TypeScript demo
declare var log: {
(value): void;
};
interface Food {
name: string;
ingredients?: string[];
}
enum AnimalType {
@jchadwick
jchadwick / AutomatedTestFixture.cs
Created June 17, 2014 04:08
Selenium Extensions
using System;
using System.IO;
using NUnit.Framework;
using Website.Automation.Workflows;
public abstract class AutomatedTestFixture
{
[TestFixtureTearDown]
public void TestFixtureTearDown()
{
@jchadwick
jchadwick / bootstrap-environment.ps1
Last active August 29, 2015 14:02
Dev Environment Bootstrapper
$toolsDir = "C:\Tools"
$files = @(
# Web Essentials 2013
"http://visualstudiogallery.msdn.microsoft.com/56633663-6799-41d7-9df7-0f2a504ca361/file/105627/34/WebEssentials2013.vsix"
)
$packages = @(
"Chutzpah",
"Console2",
@jchadwick
jchadwick / InlineEditor.ts
Last active August 29, 2015 13:56
AngularJS Inline Editor (TypesSript)
/// <reference path="../../scripts/typings/angularjs/angular.d.ts" />
/// <reference path="../../Scripts/typings/angularjs/angular-scenario.d.ts" />
module InlineEditor {
'use strict';
function InlineEditor(): ng.IDirective {
function link(scope: ng.IScope, container: ng.IAugmentedJQuery, attrs: ng.IAttributes, ngModel: ng.INgModelController)
: void {
@jchadwick
jchadwick / CsvHelper.cs
Created October 9, 2013 18:37
CSV Reader/Writer
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
public abstract class CsvHelper
{
protected internal const string DefaultDelimiter = ",";
protected internal static readonly char[] SpecialChars = new[] { ',', '\n', '\r', '"' };