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
<!doctype html>
<html>
<head>
<!-- Run in full-screen mode. -->
<meta name="apple-mobile-web-app-capable" content="yes">
<!-- Make the status bar black with white text. -->
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_ACCEPT} image/webp
RewriteCond %{REQUEST_FILENAME} (.*)\.(jpe?g|png)$
RewriteCond %{REQUEST_FILENAME}\.webp -f
RewriteRule (.+)\.(jpe?g|png)$ %{REQUEST_FILENAME}.webp [T=image/webp,E=accept:1]
</IfModule>
<IfModule mod_headers.c>
Header append Vary Accept env=REDIRECT_accept
</IfModule>
@ThatGuySam
ThatGuySam / hex2rgb
Created November 18, 2014 15:48
Convert Hex colors to RGB
<?php
function hex2rgb($hex) {
$hex = str_replace("#", "", $hex);
if(strlen($hex) == 3) {
$r = hexdec(substr($hex,0,1).substr($hex,0,1));
$g = hexdec(substr($hex,1,1).substr($hex,1,1));
$b = hexdec(substr($hex,2,1).substr($hex,2,1));
} else {
<?php if(get_field('posts_category') != ""): ?>
<?php $slide_posts = new WP_Query(); ?>
<?php $slide_posts->query('category_name=' . get_field(posts_category) ); ?>
<?php $count = $slide_posts->post_count; ?>
<section>
<div class="sliderContainer visibleNearby fullWidth clearfix royalSlider-preview">
<div class="rsHeight">
<div id="four-up-gallery" class="carousel-gallery royalSlider rsDefault">
<div class="carouselSlide">
@ThatGuySam
ThatGuySam / dabblet.css
Created February 15, 2013 22:32 — forked from anonymous/dabblet.css
The first commented line is your dabblet’s title
/**
* The first commented line is your dabblet’s title
*/
body {
margin: 0;
padding: 0;
height: 100%;
width: 100%;
}
@ThatGuySam
ThatGuySam / holidays.php
Created May 23, 2013 21:01
Just thought I'd post this save someone some time: Auto generates american holidays for the current year for FullCalendar by arshaw
<?php $year = date('Y'); ?>
[
{
start: new Date( <?php echo $year . ', 1-1, 1'; ?> ),
url: "http://wikipedia.org/wiki/New_Year%27s_Day" ,
title: "New Year's Day",
allDay: true,
category: "Holidays",
},
{
@ThatGuySam
ThatGuySam / new_gist_file
Created June 11, 2013 21:02
Guts Chop Campus Javascript
WebFontConfig = {
google: { families: [ 'Oswald:400,300,700:latin' ] }
};
(function() {
var wf = document.createElement('script');
wf.src = ('https:' == document.location.protocol ? 'https' : 'http') +
'://ajax.googleapis.com/ajax/libs/webfont/1/webfont.js';
wf.type = 'text/javascript';
wf.async = 'true';
var s = document.getElementsByTagName('script')[0];
.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 / 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;