Skip to content

Instantly share code, notes, and snippets.

function call_routes() {
add_action( 'rest_api_init', function () {
register_rest_route( 'census/v1', '/test/', array(
'methods' => 'GET',
'callback' => array($this, 'test_action')
) );
register_rest_route( 'census/v1', '/submit',
@jdcauley
jdcauley / admin.js
Created September 10, 2015 18:25
Limit Character Count in WP Content Editor
var postTypeProject = document.getElementsByClassName('post-type-post'),
projectEditor = document.getElementById('content'),
charCount = 460;
if(postTypeProject[0] && projectEditor){
var publishBtn = document.getElementById('publish'),
theValue = projectEditor.value,
contentWrap = document.getElementById('wp-content-wrap'),
message = document.createElement('div'),
errorBox = contentWrap.getElementsByClassName('message-length'),
@jdcauley
jdcauley / gulpfile.js
Created August 5, 2015 19:29
Simple WP Gulpfile
var gulp = require('gulp'),
watch = require('gulp-watch'),
sass = require('gulp-sass'),
autoprefixer = require('gulp-autoprefixer'),
minify = require('gulp-minify-css'),
jshint = require('gulp-jshint'),
stylish = require('jshint-stylish'),
uglify = require('gulp-uglify'),
concat = require('gulp-concat');
@jdcauley
jdcauley / startup.json
Created July 29, 2015 20:24
answers for StartUp Weekend
{
age: 29,
gender: 'male',
whyAttend: [
'Meet a Cofounder/Someone to work with',
'Other'
],
hearAboutUs: 'A Friend, Colleague, or Teacher',
tShirt: 'Mens XL',
twitter: 'jdcauley',

Browser Warning

Inherited a project that couldn't support IE and was slated for rebuild. Created a simple IE warning Component

A Pen by Jordan Cauley on CodePen.

License.

/**
* Bootstrap
* (sails.config.bootstrap)
*
* An asynchronous bootstrap function that runs before your Sails app gets lifted.
* This gives you an opportunity to set up your data model, run jobs, or perform some special logic.
*
* For more information on bootstrapping your app, check out:
* http://sailsjs.org/#/documentation/reference/sails.config/sails.config.bootstrap.html
*/
@jdcauley
jdcauley / index.html
Created June 4, 2015 15:11
Height Matching Elements in Vanilla JS
<ul class="sample-class">
<li>thing</li>
<li>thing</li>
<li>thing</li>
<li>thing</li>
<li>thing</li>
<li>thing</li>
<li>thing</li>
<li>thing</li>
<li>thing</li>
@jdcauley
jdcauley / getParams.js
Last active August 29, 2015 14:20
Putting form Data into an Object
function getParams(form){
var params = {};
params.action = form.action;
params.formId = form.id;
var inputs = form.getElementsByTagName('input');
for(var i = 0, x = inputs.length; i < x; i++){
var name = inputs[i].getAttribute('name');
var val = inputs[i].value;
if(name){
params[name] = val;