Skip to content

Instantly share code, notes, and snippets.

View ThatGuySam's full-sized avatar
🍉
Discovering the wonders of JAMStack

Sam Carlton ThatGuySam

🍉
Discovering the wonders of JAMStack
View GitHub Profile
.ghost-center(@className: nothing, @pre: ~'.') {
text-align: center;
&:before {
content: '';
display: inline-block;
font-size: 0;
text-decoration: none;
height: 100%;
vertical-align: middle;
@ThatGuySam
ThatGuySam / .htaccess
Last active July 22, 2018 13:05
Compression and caching for MediaTemple Grid Shared Hosting
# Put in same folder as the html folder
# ex: /domains/example.com/.htaccess
# http://clicknathan.com/web-design/gzip-compression-on-mediatemple/
# BEGIN (mt) controlled settings
<IfModule !mod_fcgid.c>
AddHandler php-stable .php
</IfModule>
<IfModule mod_fcgid.c>
@ThatGuySam
ThatGuySam / clean-post-date.php
Created August 13, 2016 13:57
Clean looking post times for Wordpress
<!--Example-->
<?php echo cleanPostDate( get_the_date( 'U' ) ); ?>
<?php echo cleanPostDate( get_the_date() ); ?>
<?php
function cleanPostDate($arg_post_date) {
@ThatGuySam
ThatGuySam / ctv.css
Created November 11, 2016 23:28
Click to View class for Visual Composer Images
.ctv .vc_single_image-wrapper {
position: relative;
}
.ctv .vc_single_image-wrapper:before {
content: " ";
color: #ffffff;
text-align: center;
letter-spacing: 0.1em;
@ThatGuySam
ThatGuySam / bg-weights.scss
Created November 26, 2016 19:28
Set background weight so focal point of photo stays in the picture on every device size (Responsive cropping)
.bg-weight {
&-north,
&-north > .vc_column-inner {
background-position-y: 0%;
}
&-north-some,
&-north-some > .vc_column-inner {
background-position-y: 20%;
@ThatGuySam
ThatGuySam / vc-cheatcodes.scss
Last active December 7, 2016 00:06
Cheat codes for advanced manipulation of Visual Composer
/* Makes text white */
.white-text,
.white-text b,
.white-text h1,
.white-text h2,
.white-text h3,
.white-text h4,
.white-text h5,
.white-text h6,
@ThatGuySam
ThatGuySam / disable-comments.php
Created December 15, 2016 20:39
Disables Wordpress Comments & Trackbacks sitewide
<?php
// - GO NUCLEAR ON COMMENT SPAMMERS -
//https://www.dfactory.eu/turn-off-disable-comments/
// Disable support for comments and trackbacks in post types
function df_disable_comments_post_types_support() {
$post_types = get_post_types();
foreach ($post_types as $post_type) {
@ThatGuySam
ThatGuySam / acf-fallback.php
Last active December 22, 2016 01:57
Fallback hook for Advanced Custom Fields to prevent missing function errors
<?php
//http://wordpress.stackexchange.com/questions/243168/providing-fallback-function-and-allow-override-by-plugin
function acf_fallback(){
//https://www.advancedcustomfields.com/resources/#functions
$acf_functions = array(
@ThatGuySam
ThatGuySam / README.md
Created July 31, 2017 15:48 — forked from astockwell/README.md
PHP Video Url Parser

Youtube/Vimeo Video Url Parser

Parses URLs from major cloud video providers. Capable of extracting keys from various video embed and link urls to manipulate and access videos in various ways.

Usage

VideoUrlParser::identify_service("https://www.youtube.com/watch?v=x_8kFbZf20I&amp;feature=youtu.be");
@ThatGuySam
ThatGuySam / FindOverflowingElements.js
Last active August 9, 2017 21:10
Find those freaking overflowing html elements that add stupid horizontal space outside of your html document
// Determines if the passed element is overflowing its bounds,
// Will temporarily modify the "overflow" style to detect this
// if necessary.
var checkOverflow = function(el)
{
var curOverflow = el.style.overflow;
if ( !curOverflow || curOverflow === "visible" ){
el.style.overflow = "hidden";
}
var isOverflowing = el.clientWidth < el.scrollWidth;