Skip to content

Instantly share code, notes, and snippets.

View iansvo's full-sized avatar

Ian Svoboda iansvo

View GitHub Profile
@iansvo
iansvo / Nav-Equalizer-Demo.markdown
Created February 15, 2015 15:03
Nav Equalizer Demo

Nav Equalizer Demo

The below navigation will automatically size itself according to the length/content of the links added to it. The demo below demonstrates the effect when using variable amounts of links and/or variable link text length.

The trick is to use a display table/table-cell properties on the menu and it's list items respectively. This insures that the browser handles the menu items correctly and doesn't rely on awkward margin-calulations, especially with variable amounts of menu items.

Go ahead and try adding/removing menu items to see the effect. You can also adjust your browser window to see how it performs in a responsive scenario or with variable browser widths.

A Pen by Ian Svoboda on CodePen.

@iansvo
iansvo / Responsive-Flexbox-table-with-Fallback.markdown
Created February 15, 2015 15:29
Responsive Flexbox table with Fallback

Responsive Flexbox table with Fallback

This shows an example of a responsive table that utilizes flexbox for it's layout.

Moved from my old account to new: Forked from Ian Svoboda's Pen vIqnD.

A Pen by Ian Svoboda on CodePen.

License.

@iansvo
iansvo / remove-inline-attributes.js
Last active August 29, 2015 14:22
Removes inline attributes from a list of HTML elements
var element_array = [
['.selector', true],
['.other-selector', false]
];
var remove_attributes_array = [
'style',
'align',
'border',
'cellpadding',
@iansvo
iansvo / readme.md
Created June 15, 2015 03:42
Teamtreehouse.com - Add 'Hide Completed Courses' checkbox to the library page

#How to use this Gist

This Gist is the source code for a userscript for use in Tampermonkey. Using this userscript will add a "Hide Completed Courses' checkbox to the Library page on Teamtreehouse.com.

##Download Tampermonkey

Get the browser extension here: http://tampermonkey.net/

@iansvo
iansvo / cardinal-directions-from-degrees.php
Created January 18, 2016 18:39
Simple PHP function that turns directional degrees into cardinal directions
// @param $int - degree integer value
function get_dir_from_deg($int)
{
$calc = (int) ($int / 22.5 ) + .5;
$dirs = ["N","NNE","NE","ENE","E","ESE", "SE", "SSE","S","SSW","SW","WSW","W","WNW","NW","NNW"];
$index = $calc % 16;
return $dirs[$index];
}
@iansvo
iansvo / ninja-forms-cpt-list.php
Created June 6, 2016 00:41
Populate Ninja Forms List with Custom Post Types
<?php
function locations_prepopulate_forms($data, $field_id) {
global $post;
// Populates a specific list (by field ID) with the "locations" cpt's
if($field_id == 27) {
$args = array(
'post_type' => 'location',
);
$query = new WP_Query( $args );
// Check if element is visible, above, or below the viewport
function canYouSeeMe(selector, debug)
{
var $target = selector;
if( typeof selector === 'string' ) {
$target = document.querySelector(selector);
}
@iansvo
iansvo / readme.md
Last active December 12, 2016 07:35

#Description This AppleScript will automatically sync using a predefined Favorite and all enabled Skip Rules. I use this with Codekit to autosync files when they are processed.

##Instructions

  1. Line 2 needs to be updated with the name of the Favorite in question.
  2. For best results, set the local/remote paths directly in your favorite. If you don't, you'll need to update lines 7 and 8.

##Codekit Instructions

@iansvo
iansvo / ninja-forms-prepopulate-select-with-cpt.php
Created November 28, 2016 21:33
In WordPress, use to pre-populate a Ninja Forms select list with options, using Custom Post Types
<?php
function cpt_prepopulate_forms($options, $settings) {
global $post;
if( $settings['id'] == 27 ) // change to your field ID
{
$args = array(
'post_type' => 'location', // Change to your Custom Post type
);
$query = new WP_Query( $args );
@iansvo
iansvo / content-page.php
Created April 17, 2017 17:54
Add a sub-headline to WordPress Twenty-Seventeen Theme
<?php
/**
* Template part for displaying page content in page.php
*
* @link https://codex.wordpress.org/Template_Hierarchy
*
* @package WordPress
* @subpackage Twenty_Seventeen
* @since 1.0
* @version 1.0