Phone Number Validation (US)
^\d{3}[\-\s]{0,1}\d{3}[\-\s]{0,1}\d{4}$
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 base64_to_image( string $base64_string, string $output_filename = '', string $output_dir = '_base64-out' ): string|false | |
{ | |
$data = explode( ',', $base64_string ); | |
$mime = substr( explode( ';', $data[0] )[0], 5 ); | |
$ext = explode( '/', $mime )[1]; | |
if ( ! str_starts_with( $mime, 'image' ) ) | |
throw new InvalidArgumentException( 'Invalid image mime type data.' ); |
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
// These take t as (t/d) | |
// From: https://github.com/Prinzhorn/skrollr/issues/341 | |
EasingFunctions = { | |
linear: function (t) { return t }, | |
easeInQuad: function (t) { return t*t }, | |
easeOutQuad: function (t) { return t*(2-t) }, | |
easeInOutQuad: function (t) { return t<.5 ? 2*t*t : -1+(4-2*t)*t }, | |
easeInCubic: function (t) { return t*t*t }, | |
easeOutCubic: function (t) { return (--t)*t*t+1 }, | |
easeInOutCubic: function (t) { return t<.5 ? 4*t*t*t : (t-1)*(2*t-2)*(2*t-2)+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 | |
$tag = urlencode( $_GET['t'] ); | |
$giphyApiKey = 'dc6zaTOxFJmzC'; | |
$giphyURL = 'http://api.giphy.com/v1/gifs/random?api_key='.$giphyApiKey.'&tag='.$tag; | |
$giphy = json_decode( file_get_contents( $giphyURL ) ); | |
if ( $giphy->meta->status != 200 ) { | |
echo "**GiphyAPI Error: ".$giphy->meta->msg."**"; |
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
<template> | |
<img | |
:id="id" | |
:src="src" | |
:srcset="srcSet" | |
:sizes="rSizes" | |
:alt="alt" | |
:class="classes" | |
/> | |
</template> |
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
$readable_diff = []; | |
if ( $diff->y ) { | |
$readable_diff[] = sprintf( _n( '%s year', '%s years', $diff->y, 'textdomain' ), $diff->y ); | |
} | |
if ( $diff->m ) { | |
$readable_diff[] = sprintf( _n( '%s month', '%s months', $diff->m, 'textdomain' ), $diff->m ); | |
} | |
if ( $diff->d ) { | |
$readable_diff[] = sprintf( _n( '%s day', '%s days', $diff->d, 'textdomain' ), $diff->d ); |
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
.htaccess | |
# | |
# COMPOSER | |
# | |
composer.phar | |
/vendor/ | |
# |
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
/* | |
* | |
* Getting appropriate "X-Y of Z results" in searches | |
* with appropriate post numbering across pages | |
* | |
*/ | |
// Setting up variables for math to display | |
// proper search result counts across all pages... | |
$posts_per_page = get_option('posts_per_page'); |
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
$states = array( | |
'AL'=>'Alabama', | |
'AK'=>'Alaska', | |
'AZ'=>'Arizona', | |
'AR'=>'Arkansas', | |
'CA'=>'California', | |
'CO'=>'Colorado', | |
'CT'=>'Connecticut', | |
'DE'=>'Delaware', | |
'DC'=>'District of Columbia', |
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
// Adapted from - http://pivotallabs.com/bulletproof-font-face-syntax-with-sass/ | |
@mixin declare-font-face($font-family, $font-filename, $font-path: '.', $font-weight: normal, $font-style: normal, $font-stretch: normal) { | |
@font-face { | |
font-family: '#{$font-family}'; | |
src: url('#{$font-path}/#{$font-filename}.eot'); | |
src: url('#{$font-path}/#{$font-filename}.eot?#iefix') format('embedded-opentype'), | |
url('#{$font-path}/#{$font-filename}.woff') format('woff'), | |
url('#{$font-path}/#{$font-filename}.ttf') format('truetype'), | |
url('#{$font-path}/#{$font-filename}.svg##{$font-family}') format('svg'); | |
font-weight: $font-weight; |