Deep Copies of Objects in JS

So you wanna copy objects in JS. Great me too. Want them to be not referenced to each other? Yep. Here too. So go read this. Done? Sweet. Well if you’re like me, a little naive I suppose, but never the less I thought I knew. Object.assign({}, someOtherObject) Thats supposed to be a reliable method to clone objects… Until I read that post and realized shit, have I fucked it up. Well kinda yes maybe and kinda no maybe. So if you check out what happens if you modify a nested array then yes, PBR - not the beer -...

Prettier and the Dog

Working on a team of developers is always interesting. I’ll leave it at that. Developers always seem to have the most interesting of personalities, and of course opinions. Spaces vs Tabs. 2 vs 4. Patch vs Put. etc… We can probably compile a much larger list, but point made. The first two in the list is where we will focus - patch vs put can be a subject of another post. The first two items are simply put - styling of the code. I prefer to look at 4 spaces or tabs. I never really bit into any importance of...

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. it('should move to the previous period', inject(($compile) => { scope.test = {}; element = angular.element('<period-picker 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.$'2015-02-28').toDate()); }));
pow wow!