Skip to content

Instantly share code, notes, and snippets.

View timelsass's full-sized avatar
🦠

Tim Elsass timelsass

🦠
View GitHub Profile
@timelsass
timelsass / pre-commit
Created March 7, 2016 18:55
JSHint pre-commit hook
#!/bin/sh
#
# Run JSHint validation before commit.
files=$(git diff --cached --name-only --diff-filter=ACMR -- *.js **/*.js)
pass=true
if [ "$files" != "" ]; then
for file in ${files}; do
@timelsass
timelsass / gist:481d8a6ac81506ff9194ee26348972f9
Created May 18, 2016 16:08
Splatter Configuration Example
<?php
/**
* This is responsible for setting the theme's configurable options.
*
* @package BoldGrid Theme
*/
/**
* Set the Theme's Configuration Options.
*
@timelsass
timelsass / compile.php
Created June 6, 2017 02:51
leafo compiler set var & import paths
<?php
// Include compiler if class isn't loaded.
if ( ! class_exists( '\Leafo\ScssPhp\Compiler' ) ) {
require get_theme_file_path( 'vendor/scssphp/scss.inc.php' );
}
// Create compiler instance.
$scss = new Compiler();
@timelsass
timelsass / phpdocumentation.php
Created June 6, 2017 05:26
basic php class documentation
<?php
function getDocumentation( $class ) {
$reflection = new \ReflectionClass( $class );
$comments = array();
foreach ( $reflection->getMethods() as $method ) {
if ( $method->isPublic() && ! $method->isConstructor() ) {
$methodDetails = array(
'class' => $method->class,
'method' => $method->name,
<?php
/**
* Add Banner to the ambition_header hook.
*/
add_action( 'ambition_header', 'ambition_child_add_banner', 15 );
function ambition_child_add_banner() {
?>
<img id="single-program-banner" src="<?php the_field( 'banner' ); ?>" alt="" />
<?php
@timelsass
timelsass / functions.php
Created July 27, 2017 18:32
BoldGrid child theme removing "Posted On Date" from posts
<?php
/**
* Prints HTML with meta information for the current post-date/time and author.
*
* @see: https://www.boldgrid.com/support/question/in-the-blog-how-can-i-remove-the-posted-on-date-text/
*/
function boldgrid_posted_on() {
if ( is_archive() ) {
return;
}
@timelsass
timelsass / example.php
Created August 23, 2017 17:11
Venetian add a 3rd column to header template for site description.
/**
* We don't want the site title and tagline to be in the same block for "site branding"
* on this theme.
*
* We will want to override the default site_title/tagline action included,
* and make our own. The default action is added in the header locations of
* the config as '[action]boldgrid_site_identity', so we will put our own
* custom override in as '[action]venetian_site_title'.
*
* This is what the markup is being displayed as currently in venetian:
@timelsass
timelsass / boostrap-media-queries.css
Last active October 10, 2017 19:29
Bootstrap 3 Media Queries
/*==================================================
= Bootstrap 3 Media Queries =
==================================================*/
/*========== Mobile First Method ==========*/
/* Custom, iPhone Retina */
@media only screen and (min-width : 320px) {
}
@timelsass
timelsass / bg-filter-to-dev.php
Created February 16, 2018 00:22
Filter AJAX Requests and WP calls to BGAPI to Dev.
<?php
/**
* Plugin name: BoldGrid Filter to Dev
* Description: Filter AJAX Requests and WP calls to BGAPI to Dev.
* Plugin URI: https://github.com/timelsass
* Author: Tim Elsass
* Author URI: https://tim.ph
*/
// Filter BoldGrid HTTP Requests made via WordPress.
function bg_filter_wp_to_dev( $preempt, $r, $url ) {