Skip to content

Instantly share code, notes, and snippets.

Gabe roseg43

Block or report user

Report or block roseg43

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@roseg43
roseg43 / _flex-grid.scss
Created Dec 10, 2019
Basic SCSS Flexbox Grid
View _flex-grid.scss
/**
* Basic Flex Grid
* ----------------
* This is a simple flex grid I've been using on a lot of projects. It supports both
* flexible grids as well as rigid column grids. While this is currently designed for internal use
* (it uses flexbox mixins because our build pipeline doesn't support autoprefixer yet), it's not too difficult
* to use in your own projects. Simply replace the flexbox mixins with their relevant rules, and you'll be good
* to go.
* @author Gabe Rose <https://gist.github.com/roseg43>
**/
@roseg43
roseg43 / chartist-plugin-htmllabels.js
Created Sep 17, 2019
Allows for custom HTML labels in a ChartistJS chart.
View chartist-plugin-htmllabels.js
// HTML Label plugin
Chartist.plugins = Chartist.plugins || {};
Chartist.plugins.ctHtmlLabels = function(options) {
return function(chart) {
chart.on('draw', function(context) {
if (context.type === 'label') {
// Best to combine with something like sanitize-html
context.element.empty()._node.innerHTML = context.text;
}
});
@roseg43
roseg43 / versionStringRemover.py
Last active Mar 12, 2019
A small command-line script to remove version strings from filenames and filename references in directories. Useful for parsing wget scrapes.
View versionStringRemover.py
import os, re, sys
print ("Asset Renamer v1 ::::::::::::::")
def replaceVersionsInFile(file):
#This regex matches all href and src attributes and finds version strings that either use question marks of the unicode string %3
pattern = "(?:href=[\"\']?([^\"\'>]+)[\"\']?|src=[\"\']?([^\"\'>]+)[\"\']?)([\']?(?=.*%3?)[^\"\']*)|(.*(?=.*\?)[^\"\']*)"
fo = open(file, 'r+');
text = fo.readlines()
fo.seek(0)
fo.truncate()
for line in text:
@roseg43
roseg43 / jquery.anchorNavigation.js
Created Dec 13, 2016
A small class that creates a list of page-scrolling anchors based on sections with data-nav-title set.
View jquery.anchorNavigation.js
function anchorNavigation(el) {
var self = this;
this.$el = jq(el);
this.$navigableItems = jq('[data-nav-title]');
this.$el.append('<ul />');
this.$navigationList = this.$el.find('ul');
this.navigationItems = [];
@roseg43
roseg43 / jquery.scheduleManager.js
Created Aug 30, 2016
Custom calendar schedule manager that manages selection states and passes selected objects as JSON to a PDF generator.
View jquery.scheduleManager.js
(function ($) {
// An array of presentationTimeslots
var slots = [];
function presentationTimeslot(el) {
// So that we always have a global object scope that can't be tainted by local scopes
var self = this;
this.$el = $(el);
this.$parentTable = this.$el.parents('table');
@roseg43
roseg43 / bannerMask.jquery.js
Created Feb 18, 2016
Dynamic Slanted SVG-clip Banners
View bannerMask.jquery.js
(function($) {
var index = 0;
var window_width = $('body').outerWidth();
$.fn.polygonMask = function(direction) {
var $this = $(this),
height = $this.outerHeight(),
offset_top = $this.offset().top;
@roseg43
roseg43 / shoehorn.js
Created Apr 27, 2015
Bootstrap Panel Filtering
View shoehorn.js
//TODO: turn into jQuery function
$(function() {
$('.mix').each(function(){$(this).addClass('active');});
$('.filter select').change(function() {
var filter = $(this).val().toLowerCase();
var $filterEls = $('.mix');
$filterEls.each(function() {
var isHidden = false;
var filterVal = $(this).data('filter').toLowerCase();
if (filter == 'all') {
@roseg43
roseg43 / navimate.js
Created Dec 2, 2014
Animated nav for single-page navigations
View navimate.js
$(function() {
var $navItems = $('li');
var $offsets = new Array();
var $widths = new Array();
var $activeOffset,
$activeWidth,
newPos;
$navItems.each(function() {
@roseg43
roseg43 / slicky.js
Created Sep 3, 2014
Basic slider designed to be integrated with WordPress Visual Composer.
View slicky.js
/**
* @author Gabe Rose (gabe.s.rose@gmail.com)
* Plugin Description:
* This is a simple slider plugin designed to be used in WordPress Visual Composer to make easily customizable sliders.
* @TODO: Reduce specifity so it can actually be used separate builds.
*/
var index = 1,
maxIndex = 3,
newIndex,
View interactionPosts.php
<?php
/* When a form is submitted, create two custom posts */
function after_gform_submit($entry, $form) {
$isInteraction = false;
$interaction_type_id;
$supporter_email_id;
foreach($form["fields"] as $field) {
if ( $field["label"] == "Interaction Type" ) {
You can’t perform that action at this time.