This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private IEnumerable<INamedTypeSymbol> FindMessageHandlersFor(INamedTypeSymbol message, IEnumerable<INamedTypeSymbol> messageHandlers) | |
{ | |
foreach (INamedTypeSymbol handler in messageHandlers) | |
{ | |
foreach(var iface in handler.AllInterfaces) | |
{ | |
foreach(var typeArgument in iface.TypeArguments) | |
{ | |
if (typeArgument.Equals(message)) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[RoutePrefix("api")] | |
public class PeopleController : ApiController | |
{ | |
private readonly DbContext _context; | |
public PeopleController(DbContext context) | |
{ | |
_context = context; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class BundleConfig | |
{ | |
public static void RegisterBundles(BundleCollection bundles) | |
{ | |
var siteCssBundle = new StyleBundle("~/css/site").IncludeDirectory("~/public/css", "*.css"); | |
siteCssBundle.Transforms.Clear(); | |
siteCssBundle.Transforms.Add(new CustomCssMinify()); | |
bundles.Add(siteCssBundle); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 1. Breaks with minifiers - no-go | |
angular.module('myModule').controller('HomeCtrl', function($scope){ | |
}); | |
// 2. My preferred method | |
angular.module('myModule').controller('HomeCtrl', ['$scope', function($scope){ | |
}]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
angular.module('app').controller('HomeCtrl', [function(){ | |
this.name = 'Yngve'; | |
}); | |
// html: | |
<div ng-controller="HomeCtrl as home"> | |
{{home.name}} | |
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class BaseController: ApiController | |
{ | |
public string Link<TController>(Expression<Func<TController, IHttpActionResult>> method) | |
where TController : ApiController | |
{ | |
UrlHelper url = new UrlHelper(this.Request); | |
var methodCallExpression = (method.Body as MethodCallExpression); | |
if (methodCallExpression == null) throw new Exception("Not a method"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public string Link<TController>(Expression<Func<TController, IHttpActionResult>> method) | |
where TController : ApiController | |
{ | |
var methodCallExpression = (method.Body as MethodCallExpression); | |
if (methodCallExpression == null) throw new Exception("Not a method"); | |
var action = methodCallExpression.Method; | |
var arguments = methodCallExpression.Arguments; | |
var methodParameters = action.GetParameters(); | |
var routeAttribute = action.GetCustomAttribute<RouteAttribute>(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function MyDirectiveController($scope){ | |
var vm = this; | |
// bind in GUI | |
vm.value = $scope.ngModel.value; | |
} | |
function MyDirective(){ | |
return { | |
templateUrl: '/my/template.html', | |
scope: { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
angular.controller('Test', function(MyProvider, MyService, MyFactory){ | |
// returnerer akkurat det samme: | |
MyProvider.sayHello(); | |
MyService.sayHello(); | |
MyFactory.sayHello(); | |
MyProvider.saySomethingElse(); // 'I might be a string from some configuration or whatevs' | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
angular.module('app', []); |
OlderNewer