Skip to content

Instantly share code, notes, and snippets.

View NateJLewis's full-sized avatar
🎯
Focusing

Nate Lewis NateJLewis

🎯
Focusing
View GitHub Profile
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)
<section id="home-sub-hero" class="container-fluid">
<article class="row center-xs around-xs">
<div class="col-xs-12 col-md-8"><?php
if( get_field( 'subhero_heading', $post_id ) ) :
?><h3 class="subhero_heading"><?php
_e( the_field( 'subhero_heading', $post_id ), '_tvk' );
?></h3><?php
endif;
if( get_field( 'subhero_content', $post_id ) ) :
?><div class="subhero_content"><?php
@NateJLewis
NateJLewis / extras.php
Created July 14, 2016 22:46
Months of the year, Next year, Countries, US States functions for WordPress includes
<?php
function _pit_month_names() {
for ( $m=1; $m<=12; $m++ ) {
$months[] = array(
'month_display_name' => date( 'F', mktime( 0,0,0, $m, 1, date('Y') ) ),
'month_attr_name' => date( 'M', mktime( 0,0,0, $m, 1, date('Y') ) ),
);
}
return $months;
/*
Welcome to Custom CSS!
CSS (Cascading Style Sheets) is a kind of code that tells the browser how
to render a web page. You may delete these comments and get started with
your customizations.
By default, your stylesheet will be loaded after the theme stylesheets,
which means that your rules can take precedence and override the theme CSS
rules. Just write here what you want to change, you don't need to copy all