Categories
C Embedded

Developing for AVR with JetBrains CLion on Mac OS

Previously I used Atmel Studio 7 to do AVR development. This integrated development environment is unsurpassed in terms of ease of use and features for AVR development. However, it is Windows only. I grew tired of the hassle with virtual machines and dual boot setups as my working device is a Mac running Mac OS 10.12. I […]

Categories
Geen categorie PHP

Random values from PHP array one-liner

PHP provides the array_rand( $arr, $num )  function which returns an integer or array containing the keys of the array. To obtain an array of values the following one-liner can be used: array_intersect_key( $arr, array_flip( array_rand( $arr, $num ) ) ); This picks $num random keys from $arr (array_rand), flips keys with values (array_flip), intersects the […]