Skip to content

Instantly share code, notes, and snippets.

@tihuan
tihuan / public.md
Created March 10, 2020 17:32
Public

hi

@tihuan
tihuan / ng2RxJS.md
Last active April 18, 2017 15:21
Angular2 + RxJS Feedback
  1. Need more complex examples - Say, a two model app with multiple instances of each model and interaction/communication between the models.

E.g., SelfDrivingCar/Passenger - 2 cars, 10 passengers, where a passenger can only be in 1 car at a time, and a car takes up to 5 passengers, display cars and their passengers dynamically (pick up/drop off/passenger change car/passenger change car seat), etc..

This is because we find that simple Todo List is not complex enough to help us see more detailed implementation for a larger app, where you can easily get multiple models interacting with each other through streams. E.g., tracking which car a passenger belongs to, which seat a passenger takes, etc..

  1. Event handler (click, keyup, etc.) - when to use stream, when not to use stream? I see that currently in the tutorial, click handlers are not streams. But I know rx.angular.js actually provides an

Keybase proof

I hereby claim:

  • I am tihuan on github.
  • I am tihuan (https://keybase.io/tihuan) on keybase.
  • I have a public key ASAT2DA8A4Ylw8487Q6E03ehHWVJme_6B_F-2GaIG2n3iAo

To claim this, I am signing this object:

  1. We use a third party gem stock_quote to pull real time data. But currently it's being called directly in StocksController#update_stocks. How would you improve the code and make the controller skinnier? Hint: Services

  2. StocksController#update_stocks is only used by StocksController internally, so where would you move the method to?

<!DOCTYPE html>
<html ng-app>
<head>
<meta name="description" content="Camp NG Example 0" />
<script src="http://code.jquery.com/jquery.min.js"></script>
<link href="http://getbootstrap.com/2.3.2/assets/css/bootstrap.css" rel="stylesheet" type="text/css" />
<link href="http://getbootstrap.com/2.3.2/assets/css/bootstrap-responsive.css" rel="stylesheet" type="text/css" />
<script src="http://getbootstrap.com/2.3.2/assets/js/bootstrap.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.1.5/angular.min.js"></script>
<meta charset=utf-8 />
<!DOCTYPE html>
<html ng-app>
<head>
<meta name="description" content="Camp NG Example 0" />
<script src="http://code.jquery.com/jquery.min.js"></script>
<link href="http://getbootstrap.com/2.3.2/assets/css/bootstrap.css" rel="stylesheet" type="text/css" />
<link href="http://getbootstrap.com/2.3.2/assets/css/bootstrap-responsive.css" rel="stylesheet" type="text/css" />
<script src="http://getbootstrap.com/2.3.2/assets/js/bootstrap.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.1.5/angular.min.js"></script>
<meta charset=utf-8 />
<!DOCTYPE html>
<html ng-app>
<head>
<meta name="description" content="Camp NG Example 0" />
<script src="http://code.jquery.com/jquery.min.js"></script>
<link href="http://getbootstrap.com/2.3.2/assets/css/bootstrap.css" rel="stylesheet" type="text/css" />
<link href="http://getbootstrap.com/2.3.2/assets/css/bootstrap-responsive.css" rel="stylesheet" type="text/css" />
<script src="http://getbootstrap.com/2.3.2/assets/js/bootstrap.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.1.5/angular.min.js"></script>
<meta charset=utf-8 />
<!DOCTYPE html>
<html ng-app>
<head>
<meta name="description" content="Camp NG Example 0" />
<script src="http://code.jquery.com/jquery.min.js"></script>
<link href="http://getbootstrap.com/2.3.2/assets/css/bootstrap.css" rel="stylesheet" type="text/css" />
<link href="http://getbootstrap.com/2.3.2/assets/css/bootstrap-responsive.css" rel="stylesheet" type="text/css" />
<script src="http://getbootstrap.com/2.3.2/assets/js/bootstrap.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.1.5/angular.min.js"></script>
<meta charset=utf-8 />
<!DOCTYPE html>
<html ng-app>
<head>
<meta name="description" content="Camp NG Example 0" />
<script src="http://code.jquery.com/jquery.min.js"></script>
<link href="http://getbootstrap.com/2.3.2/assets/css/bootstrap.css" rel="stylesheet" type="text/css" />
<link href="http://getbootstrap.com/2.3.2/assets/css/bootstrap-responsive.css" rel="stylesheet" type="text/css" />
<script src="http://getbootstrap.com/2.3.2/assets/js/bootstrap.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.12/angular.min.js"></script>
<meta charset=utf-8 />