Skip to content

Instantly share code, notes, and snippets.

View davidchase's full-sized avatar
🐻
Working from home

David Chase davidchase

🐻
Working from home
View GitHub Profile
@davidchase
davidchase / shortcode_anonymous.php
Last active December 11, 2015 10:19
shortcode using param, and heredoc
<?php
# This is a shortcode that uses an anonymous fuction
# with atts as a single param
add_shortcode('theForm', function($atts){
# Below are some default values for the forms
extract(shortcode_atts(array(
'submitBtn' => 'Get Info'
<?php
add_shortcode( 'slider_gallery', function( $atts ) {
$defaults = array(
'show_only' => 'slider',
'img_class' => 'theImage',
);
extract( shortcode_atts( $defaults, $atts ) );
@davidchase
davidchase / index.html
Last active December 14, 2015 00:19
A CodePen by David Chase. Ajax Form - Ajax form with form and email validation
<div class="contactHolder">
<h3>The Commnunity</h3>
<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. </p>
<button class="contactUs">Contact Community</button>
<div class="formHolder">
<h4>Sign Up</h4>
<div class="loading"></div>
<form class="theForm" action="">
<input type="text" title="Enter your First Name (required)" placeholder="First Name (required)" name="firstname" class="layoutForm required"/>
<input type="text" title="Enter your Last Name (required)" placeholder="Last Name (required)" name="lastname" class="layoutForm required"/>
@davidchase
davidchase / sublimetext2
Last active December 14, 2015 00:28 — forked from lucasfais/gist:1207002
Sublime Text 2 useful shortcuts
h1. Sublime Text 2 - Useful Shortcuts (Mac OS X)
h2. General
| *⌘T* | go to file |
| *⌘⌃P* | go to project |
| *⌘R* | go to methods |
| *⌃G* | go to line |
| *⌘KB* | toggle side bar |
| *⌘⇧P* | command prompt |
@davidchase
davidchase / detectDevices.js
Last active December 14, 2015 11:18
Javascript more elaborate way of detecting os in javascript
var isMobile = {
Android: function() {
return navigator.userAgent.match(/Android/i);
},
BlackBerry: function() {
return navigator.userAgent.match(/BlackBerry/i);
},
iOS: function() {
return navigator.userAgent.match(/iPhone|iPad|iPod/i);
},
@davidchase
davidchase / rename.sh
Created March 4, 2013 19:40
Shell Fu rename multiple files with a prefix or suffix
#Renaming multiple files with a set prefix
rename 's/^/slider_/' *
#Renaming multiple files with a set suffix
rename 's/$/_slider/' *
@davidchase
davidchase / bestClearfix.css
Last active December 14, 2015 12:18
CSS a nice way of using OOCSS and clearing floats
/*Cleafix
Use group for semantic purposes
*/
.group:before,
.group:after {
content:"";
display:table;
}
@davidchase
davidchase / newExternalWindows.js
Created March 4, 2013 19:46
jQuery open all external links in a new window
$("a").filter(function () {
return this.hostname && this.hostname.replace(/^www\./, '') !== location.hostname.replace(/^www\./, '');
}).each(function () {
$(this).attr({
target: "_blank",
title: "Visit " + this.href + " (click to open in a new window)"
});
});
@davidchase
davidchase / showHiddenFiles.sh
Created March 4, 2013 19:47
Shell Fu show hidden files and hide hidden files
#Show:
defaults write com.apple.finder AppleShowAllFiles TRUE
killall Finder
#Hide:
defaults write com.apple.finder AppleShowAllFiles FALSE
killall Finder
@davidchase
davidchase / wordpressResetCSS.css
Created March 4, 2013 19:49
Wordpress rest and required styles for making your own boilerplate
/* CSS Reset, Wordpress Required & Float Clear */
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,