Skip to content

Instantly share code, notes, and snippets.

View sonicparke's full-sized avatar
🤠
Doing what I want

Brad McAlister sonicparke

🤠
Doing what I want
View GitHub Profile
@sonicparke
sonicparke / Startup.cs
Created May 7, 2017 17:21
Setting Up the Angular CLI in Visual Studio for Mac
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.IO;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
@sonicparke
sonicparke / Startup.cs
Last active May 7, 2017 17:19
Setting Up the Angular CLI in Visual Studio for Mac
services.AddCors(options =>
{
options.AddPolicy("CorsPolicy",
builder => builder.AllowAnyOrigin()
.AllowAnyMethod()
.AllowAnyHeader()
.AllowCredentials());
});
@sonicparke
sonicparke / Startup.cs
Last active May 7, 2017 17:40
Setting Up the Angular CLI in Visual Studio for Mac
using System.IO;
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
{
loggerFactory.AddConsole(Configuration.GetSection(“Logging”));
loggerFactory.AddDebug();
app.Use(async (context, next) =>
{
@sonicparke
sonicparke / Startup.cs
Last active May 7, 2017 17:40
Setting Up the Angular CLI in Visual Studio for Mac
app.Use(async (context, next) =>
{
await next();
// If there’s no available file and the request doesn’t contain an extension, we’re probably trying to access a page.
// Rewrite request to use app root
if (context.Response.StatusCode == 404 && !Path.HasExtension(context.Request.Path.Value) && !context.Request.Path.Value.StartsWith(“/api”))
{
context.Request.Path = “/index.html”;
context.Response.StatusCode = 200; // Make sure we update the status code, otherwise it returns 404
await next();
@sonicparke
sonicparke / myApp.csproj
Last active May 7, 2017 17:40
Setting Up the Angular CLI in Visual Studio for Mac
<Project Sdk=”Microsoft.NET.Sdk.Web”>
<PropertyGroup>
<TargetFramework>netcoreapp1.1</TargetFramework>
<TypeScriptCompilerBlocked>true</TypeScriptCompilerBlocked>
</PropertyGroup>
<ItemGroup>
<Folder Include="wwwroot\" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore" Version="1.1.1" />
import { Component, OnInit, OnDestroy } from '@angular/core';
import { SubscriptionManager } from 'path/to/subscription_manager';
@Component({
selector: 'app-thing',
templateUrl: './app-thing.component.html',
styleUrls: ['./app-thing.component.scss']
})
export class PatientReviewComponent implements OnInit, OnDestroy {
public isLoading: boolean = true;
@sonicparke
sonicparke / controller.js
Last active December 30, 2015 16:25
testing functions
(function() {
"use strict";
angular.module('msa')
.controller('msaCtrl', msaCtrl);
msaCtrl.$inject = ['AppService', 'AppACL'];
function msaCtrl( AppService, AppACL ) {
var vm = this;
@sonicparke
sonicparke / option1.js
Created November 20, 2015 20:18
namespaces
(function() {
angular.module('vcModules')
.factory('QualityService', QualityService);
QualityService.$inject = ['$rootScope','AppLocalStorage'];
function QualityService($rootScope, AppLocalStorage) {
var vm = this;
var foo, bar;
@sonicparke
sonicparke / 1.routes.js
Last active August 29, 2015 14:25
named views content swapping
(function() {
'use strict';
angular.module('app.flipbook').config(config);
config.$inject = ['$stateProvider'];
/* @ngInject */
function config($stateProvider) {
$stateProvider
@sonicparke
sonicparke / karma.conf.js
Created June 15, 2015 16:00
Karma-coverage
// Karma configuration
// Generated on Tue Sep 24 2013 17:56:40 GMT-0400 (EDT)
module.exports = function(config) {
config.set({
preprocessors: {
'src/**/!(*test).js': ['coverage'],
// 'build/**/!(webtrends).js': ['coverage'],
// 'src/!(webtrends)/*.html': ['coverage'],
// 'build/*.html': ['coverage'],