Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View NateJLewis's full-sized avatar
🎯
Focusing

Nate Lewis NateJLewis

🎯
Focusing
View GitHub Profile
@NateJLewis
NateJLewis / modal_expample.hmtl
Created August 25, 2015 19:10
modal_expample
<div class="col-xs-12">
<!--
use the data attribute like in this example
http://getbootstrap.com/javascript/#markup
-->
<ul class="nav nav-tabs nav-justified" id="text-image">
<li class="active">
<a class="custom-text" href="#custom-text">Text</a>
</li>
<li class="">
<?php
function _wgt_scripts() {
// styles and scripts code...
$form_html = array(
'trip_signup_form' => _wgt_get_trip_signup_form_html(),
'request_trip_quote' => _wgt_request_trip_quote_form_html()
);
wp_localize_script(
<?php
/**
* Theme Setup
* @since 1.0.0
*
* This setup function attaches all of the site-wide functions
* to the correct hooks and filters. All the functions themselves
* are defined below this setup function.
*
let root = 'src';
let resolveToComponents = ( glob = '' ) => {
return $.path.join( root, 'components', glob ); // app/components/{glob}
};
gulp.task( 'component', () => {
const cap = ( val ) => {
return val.charAt( 0 ).toUpperCase() + val.slice( 1 );
};
const name = $.yargs.argv.name;
const parentPath = $.yargs.argv.parent || '';
@NateJLewis
NateJLewis / mdChipDraggable.js
Created February 24, 2017 17:42 — forked from homerjam/mdChipDraggable.js
Angular Material draggable chips directive
angular.module('mdChipDraggable', [])
.directive('mdChipDraggable', function () {
return {
restrict: 'A',
scope: {},
bindToController: true,
controllerAs: 'vm',
controller: ['$document', '$scope', '$element', '$timeout',
function ($document, $scope, $element, $timeout) {
var vm = this;
.material-icons {
&.md-18 {
height: 18px;
width: 18px;
font-size: 18px;
min-height: 18px;
min-width: 18px;
}
&.md-24 {
@NateJLewis
NateJLewis / higherOrder.js
Last active August 22, 2016 05:03
Playing with higher-order functions.
function makeConcatenater ( left ) {
return function ( right ) {
return left + ' ' + right;
}
}
var addString = makeConcatenater ( 'Hello' );
addString( 'World' );
///////////////////////////////
function makeAdder ( left ) {
@NateJLewis
NateJLewis / states_hash.json
Created August 16, 2016 00:34 — forked from mshafrir/states_hash.json
US states in JSON form
{
"AL": "Alabama",
"AK": "Alaska",
"AS": "American Samoa",
"AZ": "Arizona",
"AR": "Arkansas",
"CA": "California",
"CO": "Colorado",
"CT": "Connecticut",
"DE": "Delaware",
@NateJLewis
NateJLewis / post_email_notifications.php
Last active July 25, 2016 19:22
Send email notifications via wp_mail when a post is submitted (pending review) then notify the post author that the post has been published.
<?php
function _pit_pending_post_status( $new_status, $old_status, $post ) {
$post_author_id = $post->post_author;
$post_author = get_the_author_meta( 'display_name', $post_author_id );
$post_date = $post->post_date;
$post_title = $post->post_title;
if ( $new_status === 'pending' && $old_status !== 'pending' ) {
$headers[] = 'Content-Type: text/html; charset=UTF-8';
<?php
// CHECK IF REPEATER EXISTS
if( have_rows('repeater_field_name') ):
// REPEATER LOOP
while ( have_rows('repeater_field_name') ) : the_row();
// ANY SUBFIELDS NOT IN THE FLEXIBLE CONTENT (IE THE HEADING)