Skip to content

Instantly share code, notes, and snippets.

Avatar

Nick Clark nclarx

View GitHub Profile
@nclarx
nclarx / app.component.html
Created Jan 14, 2021
Example Demonstrating how to Render List of Orders in Angular Component from Firebase Realtime DB w/ Auth using AngularFire
View app.component.html
<section>
<ul *ngIf="orders$ | async"> <!-- The *ngIf will hide the whole list until the data has arrived-->
<li *ngFor="let order of orders$ | async"> <!-- The *ngFor will loop over and create list items for the orders once the data has arrived-->
{{order.packageName}}: {{order.packageDescription}}
</li>
</ul>
</section>
@nclarx
nclarx / manjaro-config-stuff.md
Last active Apr 24, 2020
Config Details for i3 Manjaro
View manjaro-config-stuff.md

Config Details for i3 Manjaro

Persisting Nvidia Graphic Card Settings

My excellent GeForce GTX 980, still going strong after a number of years, uses the non-free drivers on Manjaro.

The issue with Manjaro out of the box seems to be that the nvidia-settings app doesn't save the monitor config you set, and when you reboot you end up with the default settings.

To solve this issue:

View app.js
'use strict'
function getWithPromises() {
return new Promise((resolve, reject) => {
fetch('https://')
.then((data) => { // do something async
resolve(data.json()) // once data is returned, resolve
})
.catch((err) => {
reject(err) // or reject if there's an error
@nclarx
nclarx / Dell XPS 15 9560 Manjaro Setup instructions
Created Mar 21, 2019 — forked from meirbon/Dell XPS 15 9560 Manjaro Setup instructions
Small, quick guide to set up Manjaro on the XPS 15 9560
View Dell XPS 15 9560 Manjaro Setup instructions
# 1. First of all of course get Manjaro:
https://manjaro.org/get-manjaro/
# I recommend using Etcher to copy the image to your USB:
https://etcher.io/
# 2. Before installing make sure:
# - Secure boot is disabled in BIOS
# - Your SSD, HDD or NVME drive is set to AHCI instead of RAID
# - Fastboot should be on Auto or minimal, but this shouldn't matter to much
View some-file.html
<section>
<p class="test-class">This is a test of HTML</p>
</section>
@nclarx
nclarx / IAppState.ts
Last active Jan 12, 2019
Architecting
View IAppState.ts
import {IWorkflowConfig} from "./iWorkflowConfig";
import {IMarkdown} from "./iMarkdown";
import {Browser} from "puppeteer";
import {Command} from "commander";
export interface IAppState {
workflowConfig?: IWorkflowConfig;
template?: string;
styles?: string;
markdownFiles?: IMarkdown[];
@nclarx
nclarx / event-emitter.ts
Last active Jan 10, 2019
Event Emitter
View event-emitter.ts
public class ParentComponent {
handleEventFromChild($event: Event): never {
// Do something with event...
}
}
// HTML TEMPLATE IN PARENT
@nclarx
nclarx / your-component.component.ts
Created Sep 28, 2017
Example of Subscribe to Property
View your-component.component.ts
import {Component, OnDestroy, OnInit} from '@angular/core';
import {User} from './user'; // Assuming you have a class for user =====
import {Subscription} from 'rxjs/Subscription';
import {AngularFireDatabase, FirebaseListObservable, FirebaseObjectObservable} from 'angularfire2/database';
@Component({
selector: 'your-component',
template: `
<h1>{{ (user | async)?.name }}</h1>
<h1>{{ (user | async)?.price }}</h1>
@nclarx
nclarx / filterSortPipeHW17.txt
Last active Aug 13, 2017
Filter/Sort Pipe for History Week 2017 App
View filterSortPipeHW17.txt
import {Pipe, PipeTransform} from '@angular/core';
import {IEvent} from './event';
import * as moment from 'moment/moment';
export const EventFilter: (value: IEvent[], region: string, dayOfWeek: string, showFeaturedEvents: boolean) => IEvent[] = function (value: IEvent[], region: string, dayOfWeek: string, showFeaturedEvents: boolean) {
return value.filter(event => {
let today = moment();
let eventDate = moment(event.date, 'YYYY-MM-DD');
if (eventDate.isAfter(today)) {
if (region !== null) {