Skip to content

Instantly share code, notes, and snippets.

View mwadams's full-sized avatar

Matthew Adams mwadams

View GitHub Profile
using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Linq;
using Microsoft.Extensions.DependencyInjection;
namespace DITest
{
public static class ServiceCollectionCheckerExtensions
{
@mwadams
mwadams / app.config
Created March 8, 2018 10:06
Configure specflow for XUnit
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<section name="specFlow" type="TechTalk.SpecFlow.Configuration.ConfigurationSectionHandler, TechTalk.SpecFlow"/>
</configSections>
<specFlow>
<language feature="en-US" />
<unitTestProvider name="xUnit" />
(function () {
var dateTimeController = function ($scope, $rootScope) {
$scope.vm = {
message: "Bootstrap DateTimePicker Directive",
dateTime: {}
};
$scope.$watch('change', function(){
console.log($scope.vm.dateTime);
});
'use strict';
angular
.module('datetimepicker', [])
.provider('datetimepicker', function () {
var default_options = {};
this.setOptions = function (options) {
default_options = options;
app.factory('templateRepository', [ '$injector', function($injector) {
function lookupUrlFor(contentType) {
// Do your translation here
}
return {
getTemplate: function(contentType) {
var templateCache = $injector.get('$templateCache');
return templateCache.get(lookupUrlFor(contentType));
}
app.config(["$provide", function ($provide) {
$provide.decorator("$templateCache", ["$delegate", "templateRepository", function ($delegate, templateRepository) {
// Stash away the original get method
var origGetMethod = $delegate.get;
// Replace it with our getter
$delegate.get = function (url) {
// Do we match our content type family prefix?
var prefix = 'application/vnd.endjin.test';
if (url.slice(0, prefix.length) == prefix) {
return templateRepository.getTemplate(url);
<div class="someParent">
<div ng-include="translateContentTypeToUri(resource.contentType)"></div>
</div>
$scope.translateContentTypeToUri = function(contentType) {
return '/api/views/' + encodeURIComponent(contentType);
};
<div ng-controller="SalutationController">
<p><span ng-bind="content.salutation"></span>&nbsp;<span ng-bind="content.greet"></span></p>
</div>
<div class="someParent">
<div ng-include="resource.contentType"></div>
</div>