Skip to content

Instantly share code, notes, and snippets.

View ritcheyer's full-sized avatar
🏠
Working from home

Eric Ritchey ritcheyer

🏠
Working from home
  • E&J Design
  • Lincoln, CA
View GitHub Profile
$min = 3;
echo $min;
function hide_links_after_minimum_in_group($queue) {
$return_this_list = '<ol class="article-list">';
foreach ($queue->result as $key => $node) {
echo $min;
if($key+1 > $min) {
$return_this_list .= '<li class="article-link is-hidden">';
} else {
@ritcheyer
ritcheyer / gist:ebee06403f7419cfa797
Created June 16, 2015 22:58
sublime project settings
{
"folders":
[
{
"file_exclude_patterns":
[
"README*",
"*.css",
"config.rb"
// "settings.*.php",
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
<?php
/*
Plugin Name: SVG Upload
Plugin URI: http://www.lewiscowles.co.uk
Description: Super PHP Plugin to add Full SVG Media support to WordPress, I should live in {$webroot}/wp-content/plugins/ folder ;)
Author: Lewis Cowles
Version: 1.0
Author URI: http://www.lewiscowles.co.uk/
*/
add_action('admin_init', 'add_svg_upload');
@ritcheyer
ritcheyer / SassMeister-input.scss
Last active August 29, 2015 14:15
Generating Spacing around common elements via a mixin/function
// Discussion here: https://gist.github.com/csswizardry/c849d22bdc160dc615df
// Original gist: http://sassmeister.com/gist/407be8a68649e48abc6b
// ----
// Sass (v3.4.12)
// Compass (v1.0.3)
// ----
$spacing-unit: 24px;
@ritcheyer
ritcheyer / SassMeister-input.scss
Created February 19, 2015 22:49
Generated by SassMeister.com.
// ----
// Sass (v3.4.12)
// Compass (v1.0.3)
// ----
$spacing-unit: 24px;
$spacing-unit-tiny: round(0.25 * $spacing-unit);
$spacing-unit-small: round(0.5 * $spacing-unit);
$spacing-unit-large: round(2 * $spacing-unit);
/* ------------------------------------------------------------
Features
1. Keyboard navigation
- left/right
- escape to close
2. cover full screen with white backdrop
3. theatre image full screen / edge-to-edge while maintaining aspect ratio
4. switching between thumbnails by clicking or keyboard navigation
------------------------------------------------------------ */
<?php
/**
* implementation of hook_panels_layouts
*/
// Plugin definition
$plugin = array(
'title' => t('Updates'),
'category' => t('Tesla minipanels'),
// 'icon' => 'default_template.png',
@ritcheyer
ritcheyer / script.js
Created September 11, 2014 16:49
ok so long story short, i can't use CSS and media queries to swap images as I need the sections to shrink/grow dynamically, so i created a function to switch out an image's source attribute based on page width (if less than 625px switch this, else use that). Works great save for one piece. there's a bit of a flicker when resizing the browser wh…
(function (window, document, $, Drupal) {
"use strict";
Drupal.behaviors.homepage_hero_height = {
attach: function (context) {
var allHomepageImages = $('.section-hero'),
thisHomepageImage;
window.onload = function() {
@ritcheyer
ritcheyer / template.php
Created July 10, 2014 19:58
Rather than have a giant if statement that is used for page-specific css and javascript, use the $path_alias provided by Drupal
// TODO: there are better ways to do this. needs research
// maybe something like this: https://www.drupal.org/project/autoload_js
$path_alias = drupal_get_path_alias($_GET["q"]);
$theme_path = $base_url . '/' . drupal_get_path('theme', 'tesla_theme');
/**
* DESCRIPTION:
* page-specific CSS added through this function based on the $path_alias
* AUTHOR: eritchey@teslamotors.com
*/