(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.
| <script src="http://cdn.jsdelivr.net/chartist.js/latest/chartist.min.js"></script> | |
| <link href="http://cdn.jsdelivr.net/chartist.js/latest/chartist.min.css" rel="stylesheet" type="text/css" /> | |
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <script src="https://cdnjs.cloudflare.com/ajax/libs/rxjs/4.0.6/rx.all.js"></script> | |
| <script src="https://rawgit.com/cyclejs/cycle-core/v6.0.0/dist/cycle.js"></script> | |
| <script src="https://rawgit.com/cyclejs/cycle-dom/v9.0.1/dist/cycle-dom.js"></script> | |
| <script src="https://rawgit.com/cyclejs/cycle-http-driver/v7.0.0/dist/cycle-http-driver.min.js"></script> | |
| <meta charset="utf-8"> |
| //TODO: Validar os operadores necessários para diminuir o tamanho | |
| import 'rxjs/Rx'; | |
| import {App, Platform} from 'ionic-angular'; | |
| import {StatusBar} from 'ionic-native'; | |
| import {LoginPage} from './pages/login/login'; | |
| import {HttpClient} from "./common/providers/http"; |
(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.
#RxJS 5 Operators By Example
UPDATE: I have moved the contents of this gist plus more to https://github.com/btroncone/learn-rxjs and http://www.learnrxjs.io. For expanded examples, explanations, and resources, please check out this new location!
A complete list of RxJS 5 operators with easy to understand explanations and runnable examples.
| import {bootstrap, Component, Decorator, View, If, For, EventEmitter} from 'angular2/angular2'; | |
| import {FormBuilder, Validators, FormDirectives, ControlGroup} from 'angular2/forms'; | |
| @Component({ | |
| selector: 'app', | |
| injectables: [FormBuilder] | |
| }) | |
| @View({ | |
| template: ` | |
| <div class="container" [control-group]="myForm"> |
| // file: app/scripts/directives/myDirective.js | |
| angular.module('someApp.directive').directive('myDirective', function () { | |
| return { | |
| templateUrl: 'templates/myDirective.html', // HERE | |
| .... | |
| } | |
| }); |
When using directives, you often need to pass parameters to the directive. This can be done in several ways. The first 3 can be used whether scope is true or false. This is still a WIP, so validate for yourself.
Raw Attribute Strings
<div my-directive="some string" another-param="another string"></div>On the Refinery29 Mobile Web Team, codenamed "Bicycle", all of our unit tests are written using Jasmine, an awesome BDD library written by Pivotal Labs. We recently switched how we set up data for tests from declaring and assigning to closures, to assigning properties to each test case's this object, and we've seen some awesome benefits from doing such.
Up until recently, a typical unit test for us looked something like this:
describe('views.Card', function() {| namespace :grape do | |
| desc "Grape API Routes" | |
| task :routes => :environment do | |
| mapped_prefix = '/api' # where mounted API in routes.rb | |
| params_str = ' params:' | |
| desc_limit = 45 | |
| route_info = Kanban::API.routes.map {|r| [r, r.instance_variable_get(:@options)] } | |
| max_desc_size = route_info.map{|_,info| (info[:description] || '')[0..desc_limit].size }.max | |
| max_method_size = route_info.map{|_,info| info[:method].size }.max | |
| max_version_size = route_info.map{|_,info| info[:version].size }.max |