Skip to content

Instantly share code, notes, and snippets.


David Bautista dbautistav

  • http://localhost:4200
View GitHub Profile

Angular Universal setup for firebase hosting

1) Install firebase-tools globally

npm i -g firebase-tools

2) Install @angular/platform-server

matt-bailey /
Last active Oct 23, 2021
How to set up DNS records on to use a custom domain on Github Pages

How to set up DNS records on to use a custom domain on Github Pages

You would think it would be easy to find this information, but none of the Github or Gandi documentation is clear so I have recorded the required steps here.

Create the following A records:

@ 1800 IN A
@ 1800 IN A
@ 1800 IN A
PCreations /
Last active Oct 25, 2021
Super Intuitive Interactive Diagrams to learn combining RxJS sequences by Max NgWizard K
fernandohu / Reading configuration files before application startup in Angular2 final
Last active Jul 24, 2021
Reading configuration files before application startup in Angular2 final release
View Reading configuration files before application startup in Angular2 final

Reading data before application startup in Angular 2

In this demonstration I will show you how to read data in Angular2 final release before application startup. You can use it to read configuration files like you do in other languages like Java, Python, Ruby, Php.

This is how the demonstration will load data:

a) It will read an env file named 'env.json'. This file indicates what is the current working environment. Options are: 'production' and 'development';

b) It will read a config JSON file based on what is found in env file. If env is "production", the file is 'config.production.json'. If env is "development", the file is 'config.development.json'.

gund /
Last active Jul 17, 2020
Concept of Http Interceptor for Angular 2

First, we need to define interfaces with which we will work:

export interface Interceptable<T extends Interceptor<any, any>> {
  addInterceptor(interceptor: T): Interceptable<T>;
  removeInterceptor(interceptor: T): Interceptable<T>;
  clearInterceptors(interceptors?: T[]): Interceptable<T>;

export interface Interceptor<T, D> {
kensnyder / 1) webpack.config.js
Created Oct 20, 2015
Using ng-annotate loader with Webpack + Angular 1.x + ES6 classes + Babel
View 1) webpack.config.js
module.exports = {
devtool: 'sourcemap',
context: __dirname,
entry: './entry.js',
output: {
filename: './dist/bundle.js'
module: {
loaders: [
// run babel first then ng-annotate
nolanlawson / protips.js
Last active Oct 26, 2021
Promise protips - stuff I wish I had known when I started with Promises
View protips.js
// Promise.all is good for executing many promises at once
// Promise.resolve is good for wrapping synchronous code
Promise.resolve().then(function () {
if (somethingIsNotRight()) {
throw new Error("I will be rejected asynchronously!");
moklick / countries.topo.json
Last active Apr 3, 2020
Maps with TopoJSON, Leaflet & Chroma.js
View countries.topo.json
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
sararob / data-structure.js
Last active Aug 18, 2021
Role-based security in Firebase
View data-structure.js
This example shows how you can use your data structure as a basis for
your Firebase security rules to implement role-based security. We store
each user by their Twitter uid, and use the following simplistic approach
for user roles:
10 - USER