F.U.nctional coding - filter, map, reduce.

I recently answered a question on stackoverflow. It was a type of problem I always find so much fun to answer - decomposition of arrays into new data structures. Gimme an array and tell me you need an object out of it, or gimme an object and tell me you need two array out of it. I find it such a fun problem to solve as elegantly as possible - using ONLY filter, map, and reduce. Ok the occasional Object.keys method as well, but thats just grease for the engine. The thing that struck me first with the SO problem...

Convert SASS to SCSS

Simple post. I had a bunch of SASS files mixed with SCSS files - we prefer SCSS. Manually convert? Fuck no! Automatically convert? Fuck yes! sass-convert -R --from sass --to scss ./path/to/files gist of the above sass-convert

Angular Component Template Unit Testing.

https://stackoverflow.com/questions/41624014/how-to-unit-test-an-angular-1-5-component-template it('should move to the previous period', inject(($compile) => { scope.test = {}; element = angular.element('<period-picker date="test.date" period="month"></period-picker>'); element = $compile(element)(scope); $rootScope.$digest(); const buttons = element.find('button'); angular.element(buttons[0]).triggerHandler('click'); const isolatedScope = element.isolateScope(); // last of February expect(isolatedScope.$ctrl.date).toEqual(moment('2015-02-28').toDate()); }));

Angular .component() Transclusion - component inception.

2017 has been a trans-year if I have ever seen one - trans-gender, trans-age, so lets not forget then about transclusion! If your not familiar with transclusion in angular then go and read about it. I’ll wait. So you have mastered making reusable components, and now you want to transclude components but still be able to use the goodies (read functions) outside the transcluded component? Cause, you as well as I wanna make stateless stupid components. Well you’ve come to the right place! Examples you say!? <search> <search-filters> <search-filter name="Filter"> <filter></filter> </search-filter> </search-filters> </search> Lets say our component is a...

Angular .component() $doCheck lifecycle event

I will assume you are already aware of the awesomeness that is angular components. Even if it is just sugary coating around the directive, it’s still sweet. So to wrap up the events we have had at our finger tips thus far. $postLink $onInit $onChanges $onDestroy I dont know where I stumbled upon the latest one, but I did. Let this be your stumbling ground! #$doCheck() This is a nifty little event - introduced to us in Angular v1.5.8 - allows us to fire off a method on each turn of the digest cycle. As per the docs it provides...
pow wow!