Joined May 2013
·

Kelly Elton

USA
·
·
·

Posted to GitHub Markdown Cheat Sheet over 1 year ago

<kbd> Key </kbd> for showing keyboard keys.

Also, with linq

int[] intArray = stringArray.Select(x=> int.Parse(x)).ToArray();

Posted to 13 line singleton implementation over 1 year ago

It's important to note that this isn't thread safe. This is something similar I always use...it's in c# though, but the idea is the same http://snippetrepo.com/snippets/the-mingleton-a-singleton-that-plays-nice. It's been awhile since I've dug around in php so I don't remember off the top of my head how to lock, but if you can implement it like I did in mine you'd have a pretty good baseline.

The reason this is important is because you plan on using this in a static/global scope, and it's possible for two things to call getInstance right now and create two separate self() objects.

Anyways, good stuff.

Yeah I agree. I use it all the time for those "I think this works like this but I'm not sure" scenarios. I used to(I and I suppose I still do) have a Playground.cs unit test file in projects I was working on just to test out various concepts quickly. Nice thing about that is you already have the rest of the project in scope. Still though, I happily purchased Linqpad and it is most definitely a must have.

Achievements
139 Karma
0 Total ProTip Views