Tales of an IT Nobody

devbox:~$ iptables -A OUTPUT -j DROP

PHP 7 Roundup: RETURN TYPES! March 27, 2015

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 the past.

Feast your eyes on this: https://wiki.php.net/rfc/scalar_type_hints_v5  – not enough for you? ok, how about THIS! https://wiki.php.net/rfc/return_types

PHP 7 is shaping up to be a pretty awesome release. FINALLY. RETURN TYPES. INTERFACES. JOY.

No Comments on PHP 7 Roundup: RETURN TYPES!
Categories: php programming rant

Composer and getting to vendor/bin March 22, 2015

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).

No Comments on Composer and getting to vendor/bin
Categories: php programming tools

Ionic – Things I wish I knew out of the gate March 18, 2015

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 be a surprise to those familiar with the generators.

“ionic run <platform> -lc”

Words cannot express how upset I was after much searching and suffering with launching emulators that livereload (‘-l’) comes OUT OF THE BOX with ionic-cli. Their ‘getting started’ documentation has nothing on this (as of this writing)!

Avoid ‘../’ (relative paths) in ANYTHING

Unless you want to mess around with building, you will end up biting yourself eventually when testing. For example, when you test with the ‘serve’ functionality, everything is served over HTTP.

You can end up biting yourself when you use relative paths in regards to css, js or angular template files, e.g.:

http://foo.bar.com/../file.js is the same as http://foo.bar.com/file.js
file://www_app/../file.js is NOT the same as file://file.js

The problems manifest themselves when you run on your device, the protocols turn into file:// and aren’t protected from the browser fail-safe’s.

$stateProvider: ‘cache: false’

$state.go('foo', {}, {reload: true}  does no good, you need to specify this extra property in your state definition in order to reload the controller.

 

No Comments on Ionic – Things I wish I knew out of the gate
Categories: Ionic

AngularJS modals: anything NOT angular-ui-bootstrap March 17, 2015

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 the butt areas is the modal dialog. Specifically, wrapping a non-angularjs variant to support controllers, etc. There is a (nearly) silver bullet for your woes, take a look at the pain free abstraction called ‘angular-modal-service’ github.com/dwmkerr/angular-modal-service

By simply adding this into your project you can get many levels of complexity for a modal dialog in WHATEVER FLAVOR YOU WANT. Take a look, it’s been a life saver for me!

 

No Comments on AngularJS modals: anything NOT angular-ui-bootstrap
Categories: angularjs

PHPCS custom standards and PHPStorm integration March 9, 2015

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 script to automatically detect your custom standards without having to install them system-wide in your development environment. *Best viewed in full screen*

No Comments on PHPCS custom standards and PHPStorm integration
Categories: php programming tools