Skip to content

Instantly share code, notes, and snippets.

View bentzibentz's full-sized avatar
🐶

Fabian Bentz bentzibentz

🐶
View GitHub Profile
@bentzibentz
bentzibentz / SubscriptionManager.ts
Created January 23, 2019 21:27 — forked from julianpoemp/SubscriptionManager.ts
Easy and secure way to organize subscriptions in angular 6 (and less)
import {Subscription} from 'rxjs/Subscription';
/*
If you are using subscriptions in a component these should always be unsubscribed when the component is destroyed.
In order to make it easier to handle subscriptions this class can be used.
How to use it:
1.) Create an private attribute "private subscrManager = new SubscriptionManager();" in your component
2.) Wrap your subscription calls in:
@bentzibentz
bentzibentz / .htaccess
Created January 23, 2019 21:26 — forked from julianpoemp/.angular-htaccess.md
Optimal .htaccess configuration for an Angular 7, Angular 6, Angular 5 (and older app) in production.
# INSTRUCTION:
# There are two options for the redirection:
# Option 1) (default): Your app is directly on the root of the domain.
# Option 2): Your app is placed in a subfolder from the root of the domain.
#
# If you have issues with browser caching you can uncomment the BROWSER CACHING part
# For new versions of this Gist go to:
# https://gist.github.com/julianpoemp/bcf277cb56d2420cc53ec630a04a3566
@bentzibentz
bentzibentz / sw.js
Created December 20, 2018 07:46 — forked from ireade/sw.js
Handle broken images with the service worker
self.addEventListener('install', (e) => {
e.waitUntil(
caches.open("precache").then((cache) => cache.add("/broken.png"))
);
});
function isImage(fetchRequest) {
return fetchRequest.method === "GET" && fetchRequest.destination === "image";
}
@bentzibentz
bentzibentz / README.md
Created December 3, 2018 10:16 — forked from joyrexus/README.md
Vanilla JS equivalents of jQuery methods

Sans jQuery

Events

// jQuery
$(document).ready(function() {
  // code
})
@bentzibentz
bentzibentz / fix-homebrew-npm.md
Created September 4, 2017 12:42 — forked from DanHerbert/fix-homebrew-npm.md
Instructions on how to fix npm if you've installed Node through Homebrew on Mac OS X or Linuxbrew

Fixing npm On Mac OS X for Homebrew Users

Installing node through Homebrew can cause problems with npm for globally installed packages. To fix it quickly, use the solution below. An explanation is also included at the end of this document.

Solution

This solution fixes the error caused by trying to run npm update npm -g. Once you're finished, you also won't need to use sudo to install npm modules globally.

Before you start, make a note of any globally installed npm packages. These instructions will have you remove all of those packages. After you're finished you'll need to re-install them.