Skip to content

Instantly share code, notes, and snippets.

Josh JMV2112

Block or report user

Report or block JMV2112

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@kohnmd
kohnmd / flatten.php
Last active Feb 8, 2019
Function to recursively flatten multidimensional PHP array.
View flatten.php
<?php
// Requires PHP 5.3+
// Found here: http://stackoverflow.com/a/1320156
function flatten_array(array $array) {
$flattened_array = array();
array_walk_recursive($array, function($a) use (&$flattened_array) { $flattened_array[] = $a; });
return $flattened_array;
}
@tomasbasham
tomasbasham / UIImage+Scale.m
Last active Feb 10, 2020
Scale a UIImage to any given rect keeping the aspect ratio
View UIImage+Scale.m
@implementation UIImage (scale)
/**
* Scales an image to fit within a bounds with a size governed by
* the passed size. Also keeps the aspect ratio.
*
* Switch MIN to MAX for aspect fill instead of fit.
*
* @param newSize the size of the bounds the image must fit within.
* @return a new scaled image.
@maephisto
maephisto / Javascript ISO country code to country name conversion
Last active Feb 4, 2020
ISO 3166-1 alpha-2 country code to country name conversion with a simple Javascript implementation, an array and a function.
View Javascript ISO country code to country name conversion
var isoCountries = {
'AF' : 'Afghanistan',
'AX' : 'Aland Islands',
'AL' : 'Albania',
'DZ' : 'Algeria',
'AS' : 'American Samoa',
'AD' : 'Andorra',
'AO' : 'Angola',
'AI' : 'Anguilla',
'AQ' : 'Antarctica',
You can’t perform that action at this time.