git rebase -i --autosquash

Posted in Code, Git on Feb 26, 2016

So here's a tip I just found out, via (of course) Stackoverflow. Say you have been working on some Javascript for a bit, and you want to go home. So, like a good software engineer (or ninja rockstar developer) you commit your work in semantically separated pieces, using: git commit -p assets/ to get git to propose hunks to add to your commits. You end up with a nice list of commits, like this: * 9034a53 2016-02-26 refs #AG-44 @2h - add new SinglePartPicker (HEAD -> AG-44) <Tom Macdonald> * 02233ec 2016-02-26 refs #AG-44 @2h - speed up double part selector <Tom Macdonald> * e8c0665 2016-02-26...

npm extraneous package

Posted in Code, Javascript on Feb 11, 2016

I am posting this here because it happens infrequently enough that I have to search for a solution each time. The problem: $ npm shrinwrap <...snip...> npm ERR! Problems were encountered npm ERR! Please correct and try again. npm ERR! extraneous: bower@1.7.7 <path to second copy of bower> The solution: $ npm prune Basically, npm is great for doing all the work of finding and installing javascript libraries, but as a package manager (ie: minimal graph calculator) it is not quite there yet.

PHP stream_filter_prepend cannot find iconv filters

Posted in Code, PHP on Feb 01, 2016

There appears to be little information on the internet about this, so I'm recording it here so that it might help someone. If you get a message from PHP that looks like this: stream_filter_prepend(): unable to create or locate filter "convert.iconv.ASCII/utf8" Then you need to open /etc/php/php.ini and make sure the line ; is uncommented: Save, and if necessary, restart PHP-FPM. I had this issue on Arch Linux, after the update to PHP 7.

Laravel and the compiled.php file

Posted in Code, Laravel, PHP on Dec 18, 2014

To be more efficient, Laravel can optimize its files, by putting certain classes in bootstrap/compiled.php to allow the framework to load all of them in one go. The standard composer.json includes a call to php artisan clear-compiled as a post-update and post-install command, which has the effect of removing this file. Unfortunately if the updated files are incompatible with the old ones that were just replaced, this can lead to the following error: Declaration of Illuminate\\View\\Engines\\CompilerEngine::handleViewException() should be compatible with Illuminate\\View\\Engines\\PhpEngine::h...

Get a mysql replication running again ASAP

Posted in Code, MySQL on Dec 17, 2014

Sometimes, mysql replication fails, because of network problems, a reboot or what have you. The fastest way to get it running again is often to reinitialise the data completely. This assumes the actual master - slave MySQL configuration is configured properly - the slave can read from the master, but has somehow lost the plot. On the master server: Dump the databases: mysqldump -u <database_user> -p --databases <list your databases> \ --add-drop-database --add-drop-table --dump-date -e --skip-lock-tables \ --single-transaction --flush-logs --hex-blob --master-data=2  > dump.sql Get the replica...