One of many ways in which to achieve fancy checkboxes. Can do the same for radio buttons by changing the input type as needed and updating styles.
A Pen by Tiffany Brown on CodePen.
| <?php | |
| /* | |
| Add this code to functions.php. Then add Woothemes' FlexSlider to your templates | |
| as you otherwise would. | |
| Rewrite 29 September 2014 to use WordPress filters instead of overwriting the | |
| shortcode handler. | |
| */ |
| <?php | |
| function factorial($num){ | |
| $rng = range(1,$num); | |
| return array_product($rng); // array_product function requires PHP5.1.0+ | |
| } | |
| print factorial(10); // 3628800 |
| // Removes the # from hexRGB colors for use in SVG data URIs | |
| @function removeHash($hexColor){ | |
| $hexColor: $hexColor + ''; // Convert to a string | |
| $colorNum: str-slice($hexColor,2); | |
| @return $colorNum; | |
| } | |
| // Sample usage | |
| @mixin check($fillColor) { | |
| $noHashColor: removeHash($fillColor); |
One of many ways in which to achieve fancy checkboxes. Can do the same for radio buttons by changing the input type as needed and updating styles.
A Pen by Tiffany Brown on CodePen.
| const numberFormat = (number, separator = ',') => { | |
| const num = Number.isNaN(+number) ? 0 : +number; | |
| let x = 0; | |
| let fnum = []; | |
| const digits = (num + '').split(''); | |
| const seg = digits.length / 3; | |
| while(x < seg){ | |
| fnum[x] = digits.splice(-3).join(''); |
| /* | |
| Split an array into chunks and return an array | |
| of these chunks. | |
| With kudos to github.com/JudeQuintana | |
| This is an update example for code I originally wrote 5+ years ago before | |
| JavaScript took over the world. | |
| Extending native objects like this is now considered a bad practice, so use |
| function formatUSPhoneNumber(number) { | |
| var x = 0, groups = [], len, num; | |
| /* Force string conversion */ | |
| num = number+''; | |
| /* Remove non numeric characters */ |
| function formattime(timeinseconds){ | |
| var zeroes = '0', hours, minutes, seconds, time; | |
| /* | |
| Create a new date object and pass our time in seconds as the seconds parameter | |
| https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date | |
| */ | |
| time = new Date(0, 0, 0, 0, 0, timeinseconds, 0); | |
| hours = time.getHours(); |