The following code will produce code-splitting in Webpack, which means that the source code will be split into several files that will be loaded async at runtime.. More info here;
import('./some-module').then((SomeModule) => {});
import { uniqBy } from 'lodash'; | |
import { ClientOptions, SubscriptionClient } from 'subscriptions-transport-ws'; | |
export class AWSSubscriptionClient extends SubscriptionClient { | |
constructor( | |
url: string, | |
options?: ClientOptions, | |
webSocketImpl?: any, | |
webSocketProtocols?: string | string[] | |
) { |
The following code will produce code-splitting in Webpack, which means that the source code will be split into several files that will be loaded async at runtime.. More info here;
import('./some-module').then((SomeModule) => {});
This procedure explains how to install MySQL using Homebrew on macOS Sierra 10.12
$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
At this time of writing, Homebrew has MySQL version 5.7.15 as default formulae in its main repository :
// more minimal version of https://github.com/olahol/scrollparent.js/blob/master/scrollparent.js | |
const regex = /(auto|scroll)/; | |
const style = (node, prop) => | |
getComputedStyle(node, null).getPropertyValue(prop); | |
const scroll = (node) => | |
regex.test( | |
style(node, "overflow") + | |
style(node, "overflow-y") + |
All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.
Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.
elem.offsetLeft
, elem.offsetTop
, elem.offsetWidth
, elem.offsetHeight
, elem.offsetParent
To enable window.gc() on Chrome browser console you just need to start Chrome like this: | |
> /Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --js-flags="--expose-gc" --enable-memory-info | |
Those flags enable the following console API, very usefull to debug memory leaks: | |
> console.memory // print memory information | |
> window.gc() // force garbage collection |
// Source: https://groups.google.com/forum/#!topic/angular/hVrkvaHGOfc | |
// jsFiddle: http://jsfiddle.net/pkozlowski_opensource/PxdSP/14/ | |
// author: Pawel Kozlowski | |
var myApp = angular.module('myApp', []); | |
//service style, probably the simplest one | |
myApp.service('helloWorldFromService', function() { | |
this.sayHello = function() { | |
return "Hello, World!" |