Gleb
Member since Oct 27, 2014
- Profile: /members/12385-gleb.htm
- URL: http://glebbahmutov.com/
- Comments: 19
Recent Blog Comments By Gleb
-
Simulating Network Latency In AngularJS With $http Interceptors And $timeout
Posted on Mar 17, 2015 at 9:08 AM
If you can, you can simulate delays or server responses using ServiceWorker without requiring application code modifications https://github.com/bahmutov/ng-wedge Pretty advanced but might come in handy... read more »
-
Creating Objects With A Null Prototype In Node.js
Posted on Mar 9, 2015 at 9:20 AM
As it happens sometimes, I have looked at the "naked" objects too, see http://glebbahmutov.com/blog/sweet-naked-objects/.... read more »
-
Monkey-Patching The $q Service Using $provide.decorator() In AngularJS
Posted on Feb 9, 2015 at 4:27 PM
@Ward, maybe one could make Q to behave synchronously for the purpose of the unit test. For example I made q-flush for Node (could be extended to browser I guess), https://github.com/bahmutov/q-flush It adds `Q.deferFlush()` and `Q.flush()` methods that can do things like <pre> var result... read more »
-
Monkey-Patching The $q Service Using $provide.decorator() In AngularJS
Posted on Feb 7, 2015 at 11:49 PM
I described why it is important to start the promises right (and handle any errors via promise mechanism) http://bahmutov.calepin.co/starting-promises.html... read more »
-
Monkey-Patching The $q Service With .fcall() In AngularJS
Posted on Jan 31, 2015 at 7:13 PM
@Ben, Fixed the firefox (textContent property), all set.... read more »
-
Monkey-Patching The $q Service Using $provide.decorator() In AngularJS
Posted on Jan 31, 2015 at 6:57 PM
Ben, you can release it as a stand alone library by cloning my https://github.com/bahmutov/angular-q-timeout using decorator repo (includes unit tests too), and putting your code in.... read more »
-
Monkey-Patching The $q Service With .fcall() In AngularJS
Posted on Jan 30, 2015 at 9:58 AM
Ben, It would be nice to have this patch as a stand alone bower / npm module, because I want to use it.... read more »
-
Monkey-Patching The $q Service With .fcall() In AngularJS
Posted on Jan 30, 2015 at 9:57 AM
Ben, For your demos - just include https://github.com/bahmutov/console-log-div script on your page (you can even do this through https://rawgit.com/bahmutov/console-log-div/master/console-log-div.js ) to mirror console.log and console.error calls onto the page. Then you don't need to open browser... read more »
-
Handling Top-Level Errors In A Promise Workflow In AngularJS
Posted on Jan 29, 2015 at 9:19 AM
@Gleb, Sorry, the code got abridged in the above comment var S = require('spots'); // _to does NOT return a promise function _to(folderName) { } // exports a method to that returns a promise and catches any error in _to module.exports = { to: S(q.try, _to, S) };... read more »
-
Handling Top-Level Errors In A Promise Workflow In AngularJS
Posted on Jan 29, 2015 at 9:17 AM
It is important to wrap the initial call and catch any errors there and direct them into `.catch` callback. There is Q.fcall, I prefer to use an alias to it `Q.try ` https://github.com/kriskowal/q/wiki/API-Reference#promisefcallargs I usually start my promise chains (I should write a blog po... read more »
-
Exploring Asynchronous Promise-Based Workflows In AngularJS
Posted on Jan 28, 2015 at 8:45 AM
Good points, understanding how the rejected promise gets handled by the first catch function but then becomes good again is very important. I call these promise paths, but overall the idea is the same http://bahmutov.calepin.co/promise-paths.html... read more »
-
Creating And Extending A Lodash / Underscore Service In AngularJS
Posted on Dec 17, 2014 at 8:53 AM
@Ben http://bahmutov.calepin.co/lodash-to-ramda-example.html... read more »
-
Directive Controllers Can Use Dependency Injection In AngularJS
Posted on Dec 5, 2014 at 9:02 AM
@Jorge, I prefer custom directives with isolate scopes - makes each part of the page pretty well defined and simple to understand since there is less coupling. As far as testing / performance: we try to keep number of things a directive needs to minimum (number of injected dependencies + scope prope... read more »
-
Creating And Extending A Lodash / Underscore Service In AngularJS
Posted on Nov 18, 2014 at 10:30 AM
@Ben Yup, the $provider allows you to add new stuff to the injector (this is what gets called when you do angular.module().value or angular.module().factory). I use it to add new stuff to the injector at run time.... read more »
-
Creating And Extending A Lodash / Underscore Service In AngularJS
Posted on Nov 18, 2014 at 10:19 AM
@Ben I liked your example so much, I wrote ng-wrap https://github.com/bahmutov/ng-wrap that can wrap arbitrary global (and optionally remove it) to make it available as a dependency. <pre> angular.module('App', ['ng-wrap']) .run(function (ngWrap) { ngWrap('_'); // or t... read more »
-
Creating And Extending A Lodash / Underscore Service In AngularJS
Posted on Nov 18, 2014 at 8:52 AM
Cool, good observation on `.run` to make sure this factory always happens. Also, good decision on deleting from window scope to make sure people do not use _ directly. You could also extend lodash using their own built-in method mixin.... read more »
-
Directive Controllers Can Use Dependency Injection In AngularJS
Posted on Nov 3, 2014 at 8:58 AM
Wouldn't it be better to DI the directive function explicitly? ``` app.directive('myFoo', ['myController', function (myController) { return { restrict: 'E', controller: myController }; }]); ```... read more »
-
Counting The Number Of Watchers In AngularJS
Posted on Nov 2, 2014 at 11:30 AM
@Srini, I have ng-count-watchers code snippet that counts both normal and isolate scopes https://github.com/bahmutov/code-snippets... read more »
-
Counting The Number Of Watchers In AngularJS
Posted on Oct 27, 2014 at 9:51 AM
I included a code snippet based on ng-snippets to count number of watchers for both normal and isolate scopes in my collection of code snippets https://github.com/bahmutov/code-snippets Use them in Chrome DevTools code snippets like this: http://bahmutov.calepin.co/chrome-devtools-code-snippets.ht... read more »