Skip to content

Instantly share code, notes, and snippets.

@btodts
btodts / App.Vue
Created January 29, 2018 21:23
App.Vue as a single-file component
<template>
<div id="app">
<main>
<router-view></router-view>
</main>
</div>
</template>
<script>
export default {
@btodts
btodts / App.Vue
Created January 29, 2018 21:26
App.Vue without single-file components
<template>
<div id="app">
<main>
<router-view></router-view>
</main>
</div>
</template>
<script src="./app.view.js"></script>
<style src="./app.css"></style>
@btodts
btodts / app.view.js
Created January 29, 2018 21:31
app.view.js
export default {
name: 'app'
}
@btodts
btodts / app.css
Created January 29, 2018 21:35
app.css
body {
margin: 0;
}
#app {
font-family: 'Avenir', Helvetica, Arial, sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
color: #2c3e50;
}
@btodts
btodts / Startup.cs
Last active March 8, 2018 16:15
ConfigureServices
// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
{
// Add framework services.
services.AddDbContext<ApplicationDbContext>(options =>
options.UseSqlServer(Configuration.GetConnectionString("DefaultConnection")));
services.AddMvc();
// Add application services.
namespace Foo.Infrastructure.EntityFramework
{
public static class ServiceCollectionExtensions
{
public static void AddDataAccessServices(this IServiceCollection services, string connectionString)
{
services.AddDbContext<ApplicationDbContext>(options =>
options.UseSqlServer(connectionString));
}
}
@btodts
btodts / Startup.cs
Created March 13, 2018 20:22
ConfigureServices Startup v2
// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
{
// Add framework services.
services.AddDataAccessServices(Configuration.GetConnectionString("DefaultConnection"));
services.AddMvc();
// Add application services.
services.AddTransient<IEmailSender, EmailSender>();
@btodts
btodts / config.json
Last active August 1, 2018 13:44
Debug config.json
{
"ApiBaseAddress": "https://staging.foo.com/api"
}
@btodts
btodts / config.json
Created August 1, 2018 13:44
Release config.json
{
"ApiBaseAddress": "https://foo.com/api"
}
<Target Name="CopyConfigFiles" AfterTargets="Build">
<Copy SourceFiles="$(MSBuildProjectDirectory)/Configuration-Source/$(Configuration)/config.json" DestinationFolder="$(MSBuildProjectDirectory)/Configuration/" />
</Target>