What I Learned Last Week 2016.09.19

Apparently, CSS has a toggle notation — who knew? It allows child values to have different values than the parent…

Docs: https://www.w3.org/TR/css3-values/#funcdef-toggle

Demo: http://cssdeck.com/labs/awu2unik

NativeScript Has a Slack Group

I’ve been playing with NativeScript for a while now, and just recently found out there is an official Slack group! If you want to join and chat with everyone, visit: http://developer.telerik.com/wp-login.php?action=slack-invitation

TypeScript: Class Property Typecasting Issues

TypeScript compiler freaks out if you define an Array<Object> for a generic object array and then try to call something.propety on said array objects. You either need to either do Array<any> or define an interface and use that (which you really should do anyway) like Array<MyDefinedInterface>

TypeScript: Class Property Default Value

So, this is another stupid mistake, but maybe someone else can learn from it… When you typecast your class properties like

export class Something { private foo: Array; }

it’s not an array by default, it’s still null — I’m not sure why I thought it would be an array, I just overlooked my code and got errors… you need to actually set it to [] to make it an array so it can be used as one.

Google Analytics Chrome Tools Debugger

I was playing with analytics for a client, and stumbled across this gem… It may be old news to you, if you do a lot of analytics work, but it was a lifesaver for me. You can completely debug and see all the analytics tracking info in chrome.

Link: https://chrome.google.com/webstore/detail/google-analytics-debugger/jnkmfdileelhofjcijamephohjechhna

GitLab Master Plan

GitLab, the DIY Github, just got a ton of money in another round of financing. With this, they released their master plan for a completely integrated platform/service. It looks really intriguing and I look forward to following it.

Link: https://about.gitlab.com/2016/09/13/gitlab-master-plan/

JavaScript Pass By Reference Stupid Mistake

Ok, this one… this one I should have known better, but thankfully someone caught it in a code review and saved my butt. I wrote an ng2 component, and set a public property to the value of a services public property — an array of objects for a list. The idea was that the template would auto-change when the array changed in an ngFor loop… nothing strange yet.

The problem occurred when, in the service, I changed the array. Not the value of the array, but the actual array — i did one of these “this.contacts = []” to zero out the array and rebuild it. Well, this is a huge mistake, because it breaks the original reference to the original array, i needed to splice the array like so “this.contacts.splice(0, this.contacts.length) — so the original array stays in tact, and all the references stay connected.

Show your support

Clapping shows how much you appreciated Phil Palmieri’s story.