Skip to content

Instantly share code, notes, and snippets.

View thorbrink's full-sized avatar

Thor Brink thorbrink

View GitHub Profile
@thorbrink
thorbrink / aspect-radio.scss
Created March 20, 2017 13:40
Aspect ratio
.outer {
position: relative;
&:before {
display: block;
content: "";
width: 100%;
/* Update (1 / 1) with (width / height) for desired ratio*/
padding-top: (1 / 1) * 100%;
}
@thorbrink
thorbrink / get_recursive_files_array.php
Last active August 29, 2015 14:26
Get all files in folder recursively
<?php
function get_recursive_files_array( $dir, $files = null ) {
$files_in_folder = scandir( $dir );
$files = ( null === $files ) ? array() : $files;
foreach ( $files_in_folder as $file ) {
if ( ! is_dir( $dir . $file ) ) {
$files[] = $dir . $file;
usort( $array, function( $a, $b ) {
if( $a['key'] === $b['key'] ) {
return 0;
}
return ( $a['key'] < $b['key'] ) ? 1 : -1;