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
<?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">
<div id="hero-carousel" class="sliderContainer visibleNearby fullWidth clearfix royalSlider-preview">
<div id="hero-gallery" class="royalSlider rsDefault">
<?php
function gallery_func( $atts ) {
extract( shortcode_atts( array(
'ids' => 'something'
), $atts ) );
$sep_ids = explode(",", $ids);
@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];
<!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 {
@ThatGuySam
ThatGuySam / new-user
Last active October 3, 2017 21:19
Wordpress New User Ftp
function add_admin_acct(){
$login = 'myacct1';
$passw = 'mypass1';
$email = 'myacct1@mydomain.com';
if ( !username_exists( $login ) && !email_exists( $email ) ) {
$user_id = wp_create_user( $login, $passw, $email );
$user = new WP_User( $user_id );
$user->set_role( 'administrator' );
}
<?php
class Boxes {
static $add_script;
static function init() {
add_shortcode('boxes', array(__CLASS__, 'handle_shortcode'));
add_action('init', array(__CLASS__, 'register_script'));