Posts

Showing posts from June, 2014

AngularJS & Restangular

  Restangular.js    (https://github.com/mgonto/restangular) Restangular.js is a replacement for Angular's $http and $resource services. Restangular is an AngularJS service that simplifies common GET, DELETE, and UPDATE requests with a minimum of client code. Good for any WebApp that consumes data from a RESTful API. Restangular.js - nested models, decorate, mixinto() method     identity mapping (like a dictionary in C#),         getter - uniform access model (both seem like property or method regardless what it really is)     memoization - addresses performance - repeat if calculated it in the past           watch expressions should not take long in Angular. to prevent recalc over one watch cycle.     unmemoization -     computed properties - only recompute if its dependant properties changes.

Advanced AngularJS - Performance & Scaling & APIs & Progressive Saving

 AngularJS Performance Tools     1) use AngularJSBatarang - chrome extension     2) Google Developer Tools Profiler (but must disable minification)     3) performance.now() Problems     Javascript Problems         slow DOM         Single threaded     Inefficient directives         link vs compile          $parse vs $eval vs interpolation         Dirty Checking         lots of watchers         slow watchers         too many calls to $apply     When directive appears inside of a repeater         compile is called only once         link and constructor called once per iteration    ...

AngularJs & Firebase

 Angular and Firebase Evolution of Web ------------------ dhtml jQuery - DOM manipulation dojo toolkit - app framework Evolution of web servers ------------------ data centers amazon webservices - server as a service heroku - platform as a service Firebase ------------------ API to store and sync data in realtime simple Login service to auth users flexible security system *** 3-way data binding ***

AngularJs & MongooseJS

 If MongoDB, then use MongooseJS (http://mongoosejs.com/) Advantages of Mongoose over usual MongoDB wrapper:  1. MongoDB uses named collections of arbitrary objects, and a Mongoose JS Model abstracts away this layer. Because of this, we don t have to deal with tasks such as asynchronously telling MongoDB to switch to that collection, or work with the annoying createFromHexString function.  2. Mongoose Models handle the grunt work of setting default values and validating data.  3. Mongoose lets us attach functions to our models  4. Mongoose handles limited sub-document population using manual references (i.e. no MongoDB DBRefs), which gives us the ability to mimic a familiar SQL join. Ways to use Mongoose correctly: 1) 1 Schema = 1 file 2) Mongoose can t handle multi-level population yet, and populated fields are not Documents. Nesting schemas is helpful but it s an incomplete solution. Design your schemas accordingly.   3) Declare your models exactly once a...

AngularJs & RequireJs

 http://requirejs.org/ AngularJS injects instances RequireJS injects references to classes or functions Organize things into package, but must remember dependency order package manager - (linker) 4 features using RequireJS:   1) Package Dependency Manager   2) Injector   2) Javascript File Loader   4) Concatenate / Uglify Require.JS Manages:   1) load dependency   2) runtime dependency Angular.JS Manages:   1) construction dependency (IoC)   2) Module dependency 3 Simple RequireJS API   1) define() - asynch module definition, ready handlers called when dependencies resolve or immediately if none        Every file is wrapped in a define()        Every define needs to return a value     filename => implicit ID         builds tree of dependencies, builds flat registry of values   2) require() - call back function to be invok...

AngularJS & Deployd

 Deployd [* typed correctly *] why use quick-turnaround apps     1) test idea     2) UX experiments     3) min viable product     4) marketing campaigns     5) etc. what is typical of quick-turnaround apps     substance over style         avoid custom CSS     skip optimizing runtime performance     fewer cooks in the kitchen     less security tools     1) deployd for server magic     2) bootstrap for UI magic     3) AngularStrap: Angular + bottstrap compare against other server tools     1) better support and maint. (firebase & strongloop / loopback)     2) serving speed - real time dynamic queries are expensive     3) user management is half baked - no forgot my password, hard to extend auth/session mgmt. Has    ...