A complete list of RxJS 5 operators with easy to understand explanations and runnable examples.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Injectable } from '@angular/core'; | |
import { HttpRequest, HttpHandler, HttpEvent, HttpInterceptor, HttpErrorResponse, HttpResponse } from '@angular/common/http'; | |
import { Observable } from 'rxjs/Observable'; | |
import 'rxjs/add/operator/do'; | |
@Injectable() | |
export class AngularDateHttpInterceptor implements HttpInterceptor { | |
// Migrated from AngularJS https://raw.githubusercontent.com/Ins87/angular-date-interceptor/master/src/angular-date-interceptor.js | |
iso8601 = /^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(\.\d+)?(([+-]\d\d:\d\d)|Z)?$/; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {PipeTransform, Pipe} from 'angular2/core'; | |
@Pipe({ name: 'highlight' }) | |
export class HighLightPipe implements PipeTransform { | |
transform(text: string, [search]): string { | |
return search ? text.replace(new RegExp(search, 'i'), `<span class="highlight">${search}</span>`) : text; | |
} | |
} | |
/** Usage: |
By: @BTroncone
Also check out my lesson @ngrx/store in 10 minutes on egghead.io!
Update: Non-middleware examples have been updated to ngrx/store v2. More coming soon!
Table of Contents
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Handles form errors from server. | |
*/ | |
app.factory('formErrors', function () { | |
return { | |
/** | |
* Creates $error.errorKey (String) and sets validity | |
* for every failing model validation received from the server. | |
* E.g. 'form.message.$error.errorKey' can be accessed in the view. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
app.directive('datepickerLocaldate', ['$parse', function ($parse) { | |
var directive = { | |
restrict: 'A', | |
require: ['ngModel'], | |
link: link | |
}; | |
return directive; | |
function link(scope, element, attr, ctrls) { | |
var ngModelController = ctrls[0]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public EdgeEffect(Context context) { | |
final Resources res = context.getResources(); | |
mEdge = res.getDrawable(R.drawable.overscroll_edge); | |
mGlow = res.getDrawable(R.drawable.overscroll_glow); |
Requires:
-
Homebrew (http://mxcl.github.io/homebrew/)
-
Ruby
Verify Homebrew is not sick:
brew doctor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
filter = NoteStore.NoteFilter() | |
filter.ascending = False | |
spec = NoteStore.NotesMetadataResultSpec() | |
spec.includeTitle = True | |
ourNoteList = noteStore.findNotesMetadata(authToken, filter, 0, 100, spec) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
root@ubuntu:/workspace/node/cwd# uname -a | |
Linux ubuntu 2.6.35-30-generic #61-Ubuntu SMP Tue Oct 11 15:29:15 UTC 2011 i686 GNU/Linux | |
root@ubuntu:/workspace/node/cwd# node -v | |
v0.8.11 | |
root@ubuntu:/workspace/node/cwd# node test-node.js | |
Test 1 | |
exec cmd = node cwd.js | |
exec cwd = undefined | |
FAILED (AS IT SHOULD) :> | |
expected process cwd = |
NewerOlder