Skip to content

Instantly share code, notes, and snippets.

View btroncone's full-sized avatar

Brian Troncone btroncone

View GitHub Profile
@ValentinFunk
ValentinFunk / README.md
Created January 18, 2019 09:58
Fixes SVG Gradients for Safari by changing fill URLs to the current pathname. Also fixes xlink:href URLs.

Snippet to fix SVG issues in Angular (2+) with Safari, Firefox and Chrome

This listens to Angular route changes and on route change does the following:

  1. Replaces the link in <use xlink:href="#some-id"></use> by a path prefixed version
  2. Replaces the fill property in referenced SVGs by a path prefixed version
  3. Replaces the style in <svg style="fill: url(#gradient)"> with a prefixed version

Adapted from Gist by Leon Derijke

@lyyourc
lyyourc / RxJS 5 Operators By Example.md
Last active June 3, 2017 12:57
「译」RxJS 5 Operators By Example
import { createStore, applyMiddleware } from 'redux';
import { Observable, Subject } from 'rxjs';
const api = type => {
console.log(`calling API ${type}`);
return new Promise(res => setTimeout(() => res(), 500));
};
const actionOrder = (actions, order) => actions.every((action, index) => action.type === order[index]);
const actionPredicate = actions => filterableAction => actions.some(action => action === filterableAction.type);