Skip to content

Instantly share code, notes, and snippets.

@ShiYuanjun-Tim
Last active April 22, 2016 09:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ShiYuanjun-Tim/d416633549f320933507feb1fdee64c3 to your computer and use it in GitHub Desktop.
Save ShiYuanjun-Tim/d416633549f320933507feb1fdee64c3 to your computer and use it in GitHub Desktop.
collections of great post about programming

collections of great post about programming

content in my comments and updated any time

@ShiYuanjun-Tim
Copy link
Author

Angular

The "Magic" behind AngularJS Dependency Injection (TAG:DI )!

SUMMARY : for ver 1.X
  • defination case 1. controller=function($http,$scope){...}
  • defination case 2. controller=['$http','$scope',function(a,v){...}]

in case 1, it use the toString method of the function to get the parameter declaration and then store the computing result to $inject property of the function for later use, these names can be used to map to the angular services
But When minified the parameter names are mangled to e or t so cannot be mapped to service names by angular. so the array form of case 2 is used to avoid this.

@ShiYuanjun-Tim
Copy link
Author

ShiYuanjun-Tim commented Apr 21, 2016

NodeJS

Well, in node everything runs in parallel, except your code.
  1. top-10-common-nodejs-developer-mistakes !

EventLoop Related

Offical explainantion 👋 !

give you the concept Concurrency model and Event Loop!

get the `stack` , `heap`, `queue`

The JavaScript Event Loop [Presentation]!

webworker allows you to offload work to a separate thread. cool

Philip Roberts: What the heck is the event loop anyway?! Or text verison Here!

how the block happen ,stack exceed the maxizme size

The JavaScript Event Loop: Explained!

Check the Pic!

Event loop and others from Stackoverflow QA1 is great answer!

what is a `tick` mean ,

What is the Node.js single-threaded event loop? link1!, link2!

What is the Node.js single-threaded event loop?
Any time something happens in a NodeJS application, an event is created.

New events are loaded onto the event queue. These events are processed serially. The event loop takes events from the head of the event queue one at a time and hands them off to the file system, network, or another process.

As those events are processed, they create more events. Those new events are placed at the back of the event queue, and the cycle continues.

nextTick() Vs setImmediate

also!

check the last pragraph in answer!

In the nextTick example, we end up executing all the nextTick callbacks before ever returning to the event loop. Since setTimeout's callback will be called from the event loop, the text 'TIMEOUT FIRED' will not be output until we're done with every nextTick callback.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment