Legend:
- ✏️ method changes
this. - 🔒 method does not change
this.
Array<T>.prototype.*:
concat(...items: Array): T[]🔒 ES3
| function combineReducers(reducers) { | |
| const initState = {}; | |
| const finalReducers = Object.keys(reducers).map((key) => { | |
| const reducer = reducers[key]; | |
| initState[key] = reducers[key](undefined, { type: null }); | |
| return { key, reducer }; | |
| }); | |
| return (state = initState, action) => { | |
| const newState = {}; | |
| let changed = false; |
| // ==UserScript== | |
| // @name watchers | |
| // @namespace *.dev | |
| // @version 1 | |
| // @grant none | |
| // @run-at document-end | |
| // ==/UserScript== | |
| (function(){ | |
| if (!window.hasOwnProperty('angular')) return; |
| //our root app component | |
| import {Component, NgModule, Output, EventEmitter, Input} from '@angular/core' | |
| import {BrowserModule} from '@angular/platform-browser' | |
| import {ReactiveFormsModule, FormControl} from '@angular/forms'; | |
| import {Observable} from 'rxjs/Rx'; | |
| @Component({ | |
| selector: 'app-input', | |
| template: ` | |
| <input type="text" [formControl]="form" class="form-control"> |
| // Flux implementation in RxJS | |
| // https://github.com/ryardley/rxjs-as-redux | |
| // http://rudiyardley.com/redux-single-line-of-code-rxjs/ | |
| console.clear(); | |
| const action$ = new Rx.Subject(); | |
| const isObservable = obs => obs instanceof Rx.Observable; | |
| const actionDispatcher = (func) => (...args) => | |
| action$.next(func(...args)); |
| %YAML1.2 | |
| --- | |
| # See http://www.sublimetext.com/docs/3/syntax.html | |
| name: JavaScript NG | |
| file_extensions: | |
| - js | |
| - ng.js | |
| scope: source.js.ng | |
| contexts: | |
| main: |
| function getWatchers(root) { | |
| root = angular.element(root || document.documentElement); | |
| var watcherCount = 0; | |
| function getElemWatchers(element) { | |
| var isolateWatchers = getWatchersFromScope(element.data().$isolateScope); | |
| var scopeWatchers = getWatchersFromScope(element.data().$scope); | |
| var watchers = scopeWatchers.concat(isolateWatchers); | |
| angular.forEach(element.children(), function (childElement) { | |
| watchers = watchers.concat(getElemWatchers(angular.element(childElement))); |
| // 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!" |
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
Every so often I have to restore my gpg keys and I'm never sure how best to do it. So, I've spent some time playing around with the various ways to export/import (backup/restore) keys.
cp ~/.gnupg/pubring.gpg /path/to/backups/
cp ~/.gnupg/secring.gpg /path/to/backups/
cp ~/.gnupg/trustdb.gpg /path/to/backups/