PHP convert CSV to associative arrays

<?php $csv = array_map(‘str_getcsv’, file($file)); array_walk($csv, function(&$a) use ($csv) { $a = array_combine($csv[0], $a); }); array_shift($csv); # remove column header ?> This will yield something like this – keys are the fields/ table header of the CSV file. [2] => Array ( [Campaign ID] => 295095038 [Ad group ID] => 22460178158 [Keyword ID] => 3993587178 … 

 

Helpful CURL usage examples

Some nice advice and tutorials, well explained about using CURL found on gist.github.com/subfuzion/08c5d85437d5d4f00e58

 

Started learning NodeJS

I’ve been into PHP programming for 10 years now. I decided to start learning NodeJS for a side project that I am rewriting and got from https://github.com/sergtitov/NodeJS-Learning to this interesting comparison between PHP and NodeJS from https://webapplog.com/php-vs-node-js/ Another comparison I have found is from SitePoint https://www.sitepoint.com/sitepoint-smackdown-php-vs-node-js/ The GitHub repo above has a lot of interesting tutorials and starting points, a … 

 

Clean Code Concepts Adapted for PHP

Clean Code PHP (jupeter/clean-code-php), is a guide based on the book Clean Code: A Handbook of Agile Software Craftmanship, a classic programming book about writing maintainable code by Uncle Bob Martin. Learn more about it from this Laravel News post

 

Yii – bypassing beforeSave()

If you have defined in your model some “actions” / “mutators” in your, beforeSave method there is a simple way to prevent that these actions to take place in certain cases when you need that. For example, having a Company model and a field,  unpaid_invoices_count that you are updating during each saving. If you want that in a certain … 

 

Easy way to download files via terminal through wetransfer.com

If you are having a big file stored on wetransfer.com, let’s say an archive, and you want to copy it on a remote server, you might think of downloading it on you local computer and move it via FTP on the remote server. But that can take a long time, the alternative is to download … 

 

About throwing away the code and starting over

We’re programmers. Programmers are, in their hearts, architects, and the first thing they want to do when they get to a site is to bulldoze the place flat and build something grand. We’re not excited by incremental renovation: tinkering, improving, planting flower beds. There’s a subtle reason that programmers always want to throw away the …