Skip to content

Instantly share code, notes, and snippets.

Avatar

David Bautista dbautistav

  • http://localhost:4200
View GitHub Profile
View angular-universal-firebase-hosting.md

Angular Universal setup for firebase hosting

1) Install firebase-tools globally

npm i -g firebase-tools

2) Install @angular/platform-server

@matt-bailey
matt-bailey / github-pages-custom-domain-gandi-dns-records.md
Last active Oct 23, 2021
How to set up DNS records on gandi.net to use a custom domain on Github Pages
View github-pages-custom-domain-gandi-dns-records.md

How to set up DNS records on gandi.net 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 185.199.108.153
@ 1800 IN A 185.199.109.153
@ 1800 IN A 185.199.110.153
@PCreations
PCreations / rxjs-diagrams.md
Last active Oct 25, 2021
Super Intuitive Interactive Diagrams to learn combining RxJS sequences by Max NgWizard K
@fernandohu
fernandohu / Reading configuration files before application startup in Angular2 final release.md
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 release.md

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
gund / http-interceptor-concept.md
Last active Jul 17, 2020
Concept of Http Interceptor for Angular 2
View http-interceptor-concept.md

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
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
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.all([
promise1,
promise2
]);
// Promise.resolve is good for wrapping synchronous code
Promise.resolve().then(function () {
if (somethingIsNotRight()) {
throw new Error("I will be rejected asynchronously!");
@moklick
moklick / countries.topo.json
Last active Apr 3, 2020
Maps with TopoJSON, Leaflet & Chroma.js http://blog.webkid.io
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
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:
0 - GUEST
10 - USER
20 - MODERATOR