Author Archive

Using _.intersection for deep many to many filter

Sometime you might find yourself needing a fast way to do a complex match on property from an array of objects under a property (confused?) Let's say I have a collection of objects as such: [crayon-5b02541c10a16636439916/] I want to have a fast way to get all items that are in group ID: 1...
Read More

PHP Interface rant

This isn't my first rant about interfaces (which are finally receiving a due adjustment). I haven't tested it, but don't believe I've seen anything pertaining to interface inheritance, look at the following use case for example, which fails in current PHP 5.6: [crayon-5b02541c10dea231042797/] There are some benefits to doing this, however as you...
Read More

How to show us your company is immature.

I've seen 'Sentry' pop up a few times - it's a neat SaaS that ails the pains of logging and monitoring  for development level logging. It's pretty neat, has a spot for business for sure. Here's the problem and I touched base on this a while ago - your business WILL...
Read More

Laravel/Lumen vs Symfony/Silex a corporate perspective

YAPFC. Yet Another PHP Framework Comparison. I'm judging Silex and Lumen through their bigger brothers, Symfony 2 and Laravel 5. After doing some extensive research, re-evaluating the PHP framework atmosphere, two frameworks and their respective "mini-me" counterparts seem to rule the seas. In this post I'm simply sharing my opinion of Laravel and Symfony...
Read More

Commando style: triage dashboard

If you're working on a foreign system, or one that doesn't have the bells and whistles that make you feel at home, sometimes you need to improvise tools on the spot by chaining together commands, etc. This little one-snip serves as a "dashboard" approach for quickly assessing consumption, [crayon-5b02541c111ad090658700/]   [crayon-5b02541c111b3074256533/]  ...
Read More

iptables list – a helpful ~/.bashrc alias

I grow tired of asking iptables to give me my line numbers for insert/deletes, and sometimes, I just want it to "cut to the chase" and give me numbers. Toss this into your ~/.bashrc for making life easier: [crayon-5b02541c113ce819520866/] then run [crayon-5b02541c113d4097138496-i/]  to reload. Output sample: [crayon-5b02541c113d6376297966/] Voila! Now you've got counters (helpful for debugging btw), numeric...
Read More

Worthy of Distribution: Angularjs patterns

Feel like you've gotten 'over the hump' on getting AngularJS to do what you want? Check out the video below to help save yourself from being overly analytical for your project structuring and avoiding common pitfalls (and general javascript pitfalls) for moving on to the "next level" for AngularJS development.   https://www.youtube.com/watch?v=UlvCbnKAH3g...
Read More

A PHP bug – really? (custom session handlers)

It's not often I ramble about PHP, since it's my bread and butter. But after perusing the RFC notes to get up to speed on the PHP 7 pipeline, I found this: https://wiki.php.net/rfc/session.user.return-value That bug has been around for how long? I'm amazed folks with pitchforks haven't come out on that one...
Read More

PHP 7 Roundup – implicit ‘array to string’ conversion

Feast your eyes upon this: https://wiki.php.net/rfc/array-to-string If you've been in the trenches for a long time, chances are you've been bitten more than enough by the implicit array to string conversion as such: [crayon-5b02541c115aa266262488/] It will now look like this in PHP 7: [crayon-5b02541c115b0416990296-i/]    ...
Read More

PHP 7 Roundup: Chainable ternary awesomeness.

Feast your eyes on this: https://wiki.php.net/rfc/isset_ternary This eliminates quite a bit of 'noise' and 'fluff' use in any display logic, it's a new ternary operator that allows you to quickly set a default without doing the isset() dance. This has a limited affect if you use a templating engine like Twig, but it's...
Read More

A better way to give Logstash permissions to your logs

So you're ready to rock out Logstash to ship your logs - there's one little headache: You still need to give it access to your files. Chances are, you want "all of the files!" The internet will (at the moment) instruct you to use "setfacl", or various chown/chmod techniques or even...
Read More

How to use PHPUnit installed by composer in PHPStorm

Ever wonder how to properly use those packages installed from the require-dev section of composer.json? Ideally you'd integrate them with your IDE, or perhaps set up your system path to access it via vendor\bin\phpunit - If you use PHPUnit, take a quick look at this on how to properly set up...
Read More

PHP 7 Roundup: RETURN TYPES!

Many years ago (in 2011) I wrote "interfaces are worthless". For the most part they have remained mostly worthless for me as typically a superclass of sorts has proven to be a better solution for taxonomy and enforcing the exact typing rules I have criticized interfaces in PHP for in...
Read More

Composer and getting to vendor/bin

Want to stop typing 'vendor\bin\toolname' to access tools like PHPUnit, phpcs, etc when installed through composer? It's a simple process really - merely add "vendor\bin" into your PATH variable and profit! (as long as you're running the command from the project root). https://www.youtube.com/watch?v=UrME91Ta_aY...
Read More

Ionic – Things I wish I knew out of the gate

Cordova is a gamechanger. Ionic framework (and ngCordova) are game changers to the Cordova scene. However, I have already learned two very painful lessons as a beginner into the bowels of Cordova-tech: Avoid ionic-generator While yeoman generators can be helpful, the ionic-generator simply imposes too much junk into your workflow. It shouldn't...
Read More

AngularJS modals: anything NOT angular-ui-bootstrap

I have grown warmly toward the semantic ui offerings. However, when dealing with a fledgling framework that doesn't have an active port for angularJS, some things can be frustrating since you sometimes have to re-implement boilerplate calls that are already bundled in with the angular-ui-bootstrap project. One of the bigger pain in...
Read More

PHPCS custom standards and PHPStorm integration

At about 6 minutes long, I threw together this screencast to show a method to involve your custom PHP CodeSniffer standards into your project workflow when using Composer. Essentially it covers the convenience of putting your standards into a Composer package and adding a wrapper to 'extend' the PHPCS shell/batch...
Read More

Securing Elasticsearch – Part 1

The most frequently asked question for ElasticSearch and security is "how do I require login"? Once you've answered and implemented the answer to that question; a larger, truly more troublesome issue looms. The same principals used to secure ElasticSearch; typically a proxy fronted by Apache/nginx use various auth techniques. If you...
Read More

angular-ui-router – IE8 and nested states

Just a quick tip, If you still have to maintain compatibility with IE8 (< AngularJS 1.3) - and you're using angular-ui-router for nested views, the documentation for nesting states says you should use "<ui-view />" for your template for an abstract parent state: Remember: Abstract states still need their own <ui-view/> for their children...
Read More

Skeletons: Older versions of ntp and not using DNS

A while ago (years), I reluctantly set up ntp on some servers using an IP address for the source server; at the time, using a DNS name in ntp.conf was incompatible with the ntp/ntpd version and I didn't want to go out of my way to compile it from scratch. Today,...
Read More