This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Returns the number as an ordinal eg. 1st, 2nd, 3rd, 4th etc. | |
var nth = function(o) { | |
return o+(['st','nd','rd'][(o+'').match(/1?\d\b/)-1]||'th'); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//Returns the number as an ordinal eg. 1st, 2nd, 3rd, 4th etc. | |
function nth(num) { | |
nf = new NumberFormatter('en_GB', NumberFormatter::ORDINAL); | |
return nf->format(num); | |
} | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Cast number by * 1% to create percentage, appending a % sign just creates a string. | |
@function percentage($number) { | |
@return $number * 1%; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function remove_empty_index(array arr) { | |
return array_filter(arr, 'strlen'); | |
} | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function valid_date(date,format='Y-m-d'){ | |
d = DateTime::createFromFormat(format, date); | |
return d && (d->format(format) == date); | |
} | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function is_html(string){ | |
return (string != strip_tags(string)) ? true : false; | |
} | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function change_dimensions(str, width = '600', height = '450'){ | |
return preg_replace(array('/width="\S+"/i', '/height="\S+"/i'),array(sprintf('width="%s"', width), sprintf('height="%s"', height)), str); | |
} | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//One value will create square as $height is set to $width | |
@mixin size($width, $height: $width) { | |
width: $width; | |
height: $height; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if(navigator.userAgent.toLowerCase().match(/(iphone|ipod|ipad)/)) { $('html').addClass('ios'); } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var console = (window.console = window.console || {}); |
NewerOlder