Skip to content

Instantly share code, notes, and snippets.

View DevEarley's full-sized avatar
🎯
Focusing

Alex Earley DevEarley

🎯
Focusing
View GitHub Profile
@DevEarley
DevEarley / content.html
Last active September 9, 2018 22:21
ng-container and ng-content select
<generic-container>
<ng-container header>
Header 2
</ng-container>
<ng-container body>
Hello World
</ng-container>
<ng-container footer>
<button>Save</button>
</ng-container>
@DevEarley
DevEarley / detect-scroll-with-angular.md
Created October 8, 2018 18:17
Detect Scroll event with Angular

How to detect scroll event on any element in Angular.

<div (scroll)="onScroll($event)"></div>
onScroll(event): void { ... }
@DevEarley
DevEarley / dotnet-core-angular-quickstart.md
Last active August 10, 2024 22:52
.NET Core WebAPI and Angular Quick Start Guide

.NET Core WebAPI and Angular Quick Start Guide

Why Angular and .NET Core?

Angular is a well established frontend framework. With Angular, you can quickly bind input fields to logic that calls the .NET Core WebAPI backend. WebAPI is simple to set up and can host our angular app without MVC.

Installation

  • Download VS Code
  • Download .NET Core CLI for your OS.
  • Download Node.JS
@DevEarley
DevEarley / ng-cli-on-macOS.md
Last active October 16, 2018 23:01
Setup Angular CLI on MacOS

Setup Angular CLI on MacOS

I thought it was supposed to be easy! Well it is after I did a little digging.

Install tools

Download and Install

  • NodeJS (8)
  • NVM
  • VS Code

Setup NodeJS

@DevEarley
DevEarley / file-writer.cs
Last active November 2, 2018 17:56
Writing files with .Net Core
namespace App
{
public class FileWriter
{
public void WriteFile(string filename, string content)
{
var path = "C:/Temp/" + filename;
var file = System.IO.File.Create(path);
var writer = new System.IO.StreamWriter(file);
writer.WriteLine(content);
@DevEarley
DevEarley / file-reader.cs
Created November 2, 2018 17:58
Read folders recursively in .Net Core
namespace App
{
public class FileReader
{
private List<FolderModel> GetFoldersForDocs()
{
DirectoryInfo di = new DirectoryInfo(documentationPath);
FileInfo[] files = RecursiveFetch(4, di.FullName);
var trimLength = di.FullName.Count();
var folders = files.Select(x => BuildFileModel(x, trimLength))
@DevEarley
DevEarley / file.service.ts
Last active February 18, 2019 00:02
Download a file with Angular Service
import { Injectable } from '@angular/core';
import { Router } from '@angular/router';
import * as FileSaver from "file-saver";
@Injectable({
providedIn: 'root'
})
export class FileService {
constructor() { }
@DevEarley
DevEarley / pell-input.component.html
Last active September 3, 2020 10:43
Using Pell as a Markdown WYSIWYG editor.
<div id="pell-editor" class="pell"></div>
@DevEarley
DevEarley / markdown.component.ts
Last active February 18, 2019 00:03
Using Marked and Highlight.js to view Markdown files in Angular
import { Component, OnInit } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { Marked } from 'marked-ts';
import { highlight } from 'highlight.js';
@Component({
selector: 'app-doc',
template: `
<div id="content-container" class="doc" [innerHTML]="markdownHTML" ></div>' `
})
@DevEarley
DevEarley / user-auth-sql-dotnetcore.md
Created November 8, 2018 18:01
Using .Net Core and SQL Express to build User Authentication