Skip to content

Instantly share code, notes, and snippets.

View darrenmothersele's full-sized avatar
🏠
Working from home

Darren Mothersele darrenmothersele

🏠
Working from home
View GitHub Profile
@darrenmothersele
darrenmothersele / 000-index.md
Last active April 29, 2021 09:26
Angular Project Setup

First I run the ng new command:

ng new --minimal --style=css --routing project-name

I use the minimal option as I like to start with the bare minimum and then add back in what I need. I then open this in my IDE of choice. I currently use IntelliJ IDEA.

The first thing I do is open the CLI config angular.json and make a few changes.

First I make sure that the schematics are configured to create inline template and styles.

{
"adapterName": "mccs",
"label": "MCCS",
"description": null,
"infoUrl": null,
"supportUrl": null,
"maintainer": null,
"version": "0.1.0",
"tags": [],
"name": "mccs",
@darrenmothersele
darrenmothersele / useful.md
Last active December 6, 2019 09:29
USEFUL THINGS
@darrenmothersele
darrenmothersele / dropbox.json
Created December 3, 2019 12:06
Read file from Dropbox API and convert to a binary file
{
"adapterName": "dropbox",
"label": "Dropbox",
"description": null,
"infoUrl": null,
"supportUrl": null,
"maintainer": null,
"version": "0.0.0",
"tags": [],
"name": "dropbox",
@darrenmothersele
darrenmothersele / local-files.json
Created December 2, 2019 10:57
Local Files adapter for Kendraio App
{
"adapterName": "local-files",
"label": "Local Files",
"description": null,
"infoUrl": null,
"supportUrl": null,
"maintainer": null,
"version": "0.0.0",
"tags": [],
"name": "local-files",
@darrenmothersele
darrenmothersele / youtube.json
Last active November 27, 2019 11:08
YouTube Adapter for Kendraio App
{
"adapterName": "youtube",
"label": "YouTube",
"description": null,
"infoUrl": null,
"supportUrl": null,
"maintainer": null,
"version": "0.0.0",
"tags": [],
"name": "youtube",
@darrenmothersele
darrenmothersele / ssr-web-components.txt
Created November 27, 2019 07:55
Server side rendering of web components (ssr, custom elements, shadow dom)
Possible approaches to rendering web components on the server...
Server side DOM library (JSDOM alternative) that supports custom elements:
https://www.npmjs.com/package/happy-dom
https://medium.com/@treshugart/%C3%A5server-side-rendering-web-components-e5df705f3f48
Approach is based on this zip:
https://gist.github.com/justinfagnani/936791248120749ff1f8188f1f4064d9
Share a template between client side code and server side code:
@darrenmothersele
darrenmothersele / gist:ddb80cf8924dd71ef7e351bbec514188
Created January 31, 2019 11:01
Util function to create rows into objects
// Util function converts rows to objects
// const labelRows = ([labels, ...data]) => {
// return data.reduce((result, item) => {
// result.push(labels.reduce((object, key, i) => {
// object[key] = item[i];
// return object;
// }, {}));
// return result;
// }, []);
@darrenmothersele
darrenmothersele / config
Created January 18, 2019 09:26
minimal i3 config
focus_follows_mouse no
exec setxkbmap gb
exec --no-startup-id compton --config ~/.config/compton.conf -b
new_window normal
hide_edge_borders vertical
for_window [class="Firefox"] border pixel 0
for_window [class="jetbrains-*"] border pixel 0
for_window [class="Google-chrome"] border pixel 0
@darrenmothersele
darrenmothersele / app-online.effects.ts
Created January 3, 2019 16:15
NgRx Effect for App Online status
@Effect()
online$ = merge(
fromEvent(window, 'online').pipe(mapTo(true)),
fromEvent(window, 'offline').pipe(mapTo(false))
).pipe(
startWith(navigator.onLine),
map(isOnline => isOnline ? new AppIsOnline() : new AppIsOffline())
);