Skip to content

Instantly share code, notes, and snippets.

View thiagomajesk's full-sized avatar
💜
Happily doing some Elixir wizardry

Thiago Majesk Goulart thiagomajesk

💜
Happily doing some Elixir wizardry
  • Brazil
View GitHub Profile
@thiagomajesk
thiagomajesk / brunch-config.js
Last active August 8, 2017 17:30
ASP.NET Core Brunch Config (Babel + Bootstrap 4 + LESS + Font Awesome)
module.exports = {
paths: {
public: "wwwroot",
watched: ["wwwroot/javascripts", "wwwroot/stylesheets"]
},
npm: {
styles: {
"bootstrap": ["dist/css/bootstrap.css"],
"font-awesome": ["css/font-awesome.css"],
"animate.css": ["animate.css"]
public static class IServiceCollectionExtensions
{
public static IServiceCollection ConnectImplementations<TService>(this IServiceCollection services, Assembly assembly)where TService : class
{
return services.ConnectImplementations(typeof (TService), assembly);
}
public static IServiceCollection ConnectImplementations(this IServiceCollection services, Type serviceType, Assembly assembly)
{
if (!serviceType.IsInterface) throw new ArgumentException($"{nameof(serviceType)} must be an interface");
@thiagomajesk
thiagomajesk / CharacterController.cs
Last active May 26, 2017 15:39
ViewModelFactory (Mediator Pattern)
public class CharacterController : Controller
{
/*[...]*/
public IActionResult Profile(int id)
{
/*[...]*/
var viewModel = viewFactory.Build<int, CharacterProfileViewModelBuilder>(id);
return View(viewModel);
}
}
@thiagomajesk
thiagomajesk / Controller.cs
Created February 11, 2017 22:22
View Model Factories in ASP.NET Core with Mediator + IoC Extension
public class FooController : Controller
{
private readonly IViewFactory viewFactory;
public FooController(IViewFactory viewFactory) { this.viewFactory = viewFactory; }
public IActionResult Index()
{
var viewModel = viewFactory.Create<CreateFooViewModel>();