Skip to content

Instantly share code, notes, and snippets.

View nclarx's full-sized avatar
👾
bloop

Nick Clark nclarx

👾
bloop
View GitHub Profile
@nclarx
nclarx / filterSortPipeHW17.txt
Last active August 13, 2017 05:19
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) {
@nclarx
nclarx / your-component.component.ts
Created September 28, 2017 11:16
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 / event-emitter.ts
Last active January 10, 2019 09:36
Event Emitter
View event-emitter.ts
public class ParentComponent {
handleEventFromChild($event: Event): never {
// Do something with event...
}
}
// HTML TEMPLATE IN PARENT
@nclarx
nclarx / IAppState.ts
Last active January 12, 2019 11:53
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[];
View some-file.html
<section>
<p class="test-class">This is a test of HTML</p>
</section>
@nclarx
nclarx / Dell XPS 15 9560 Manjaro Setup instructions
Created March 21, 2019 04:36 — 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
@nclarx
nclarx / app.js
Last active November 28, 2019 23:03
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 / manjaro-config-stuff.md
Last active April 24, 2020 09:45
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:

@nclarx
nclarx / app.component.html
Created January 14, 2021 08:51
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>