Skip to content

Instantly share code, notes, and snippets.

View robspangler's full-sized avatar

Rob Spangler robspangler

View GitHub Profile
//Move
mv ./wordpress/* ./www/
mv .wordpress/.ht* ./www/
//Copy
cp -R {src} {dest}
//Delete
rm -rf {path}
@robspangler
robspangler / wp-excerpts.php
Created July 25, 2016 19:39
Common WordPress Functions
//Update length
function custom_excerpt_length( $length ) {
return 20;
}
add_filter( 'excerpt_length', 'custom_excerpt_length', 999 );
//Update more indicator
function custom_excerpt_more( $more ) {
return '...';
}
.parent-element {
-webkit-transform-style: preserve-3d;
transform-style: preserve-3d;
}
.element {
position: relative;
top: 50%;
transform: translateY(-50%);
}
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=time], input[type=datetime], input[type=search], input[type=tel], input[type=url] { }
/* Gravity Forms */
.gform_wrapper input[type=color],
.gform_wrapper input[type=date],
.gform_wrapper input[type=datetime-local],
.gform_wrapper input[type=datetime],
.gform_wrapper input[type=email],
.gform_wrapper input[type=month],
.gform_wrapper input[type=number],
@robspangler
robspangler / enable-pointer-events-on-click.css
Created April 18, 2016 16:23
Disables mouse events on iFrames (e.g. Google Maps) until clicked on. This is especially useful for disabling the scroll wheel.
.pointer-events-on-click { cursor: pointer; }
.pointer-events-on-click iframe { pointer-events: none; }
/* Desktop First */
.only-mobile { display: none !important; }
.only-tablet { display: none !important; }
@media only screen and (max-width: 767px) {
.only-tablet { display: block !important; }
.only-desktop { display: none !important; }
}
@media only screen and (max-width: 480px) {
.only-mobile { display: block !important; }
}
/* START: Nav functions
* Initially based on https://medium.com/@mariusc23/hide-header-on-scroll-down-show-on-scroll-up-67bbaae9a78c */
var didScroll;
var lastScrollTop = 0;
var delta = 25;
var navbarHeight = jQuery('header.main').outerHeight();
jQuery(window).scroll(function(event){
didScroll = true;
});
@robspangler
robspangler / gravity-forms-sample-form.html
Last active March 31, 2016 16:06
Sample Gravity Form + default Gravity Form styles (v1.9.17.14)
<div class="gf_browser_chrome gform_wrapper" id="gform_wrapper_1"><a id="gf_1" class="gform_anchor"></a>
<form method="post" enctype="multipart/form-data" target="gform_ajax_frame_1" id="gform_1" action="/sample-page/#gf_1">
<div class="gform_heading">
<h3 class="gform_title">Contact Us</h3>
<span class="gform_description">Optional form description.</span> </div>
<div class="gform_body">
<ul id="gform_fields_1" class="gform_fields top_label form_sublabel_below description_below">
<li id="field_1_1" class="gfield gfield_contains_required field_sublabel_below field_description_below">
<label class="gfield_label" for="input_1_1_3">Name<span class="gfield_required">*</span></label>
<div class="ginput_complex ginput_container no_prefix has_first_name no_middle_name has_last_name no_suffix gf_name_has_2 ginput_container_name" id="input_1_1"> <span id="input_1_1_3_container" class="name_first">
.row { width: 100%; display: table; table-layout: fixed; }
.row .col { display: table-cell; padding: 0 15px; }
.row .col:first-child { padding-left: 0; }
.row .col:last-child { padding-right: 0; }
@robspangler
robspangler / osx-terminal-commands
Last active August 1, 2016 19:09
Common OSX Terminal commands
//Edit Hosts File
sudo nano /private/etc/hosts
//Flush DNS
sudo killall -HUP mDNSResponder