Skip to content

Instantly share code, notes, and snippets.

@anthonycoffey
anthonycoffey / gp-copy-cat-copy-label.html
Last active August 13, 2018 06:29 — forked from spivurno/gp-copy-cat-copy-label.html
Gravity Perks // GP Copy Cat // Copy Label (instead of Value)
<!--
Gravity Perks // GP Copy Cat // Copy Label (instead of Value)
http://gravitywiz.com/documentation/gravity-forms-copy-cat/
Instructions:
1. Add an HTML field to your form.
2. Copy and paste the entire contents of this snippet into the "Content" field setting.
-->
<script>
gform.addFilter( 'gppc_copied_value', function( value, $elem, data ) {
@anthonycoffey
anthonycoffey / states_hash.json
Created August 23, 2018 16:48 — 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",
@anthonycoffey
anthonycoffey / wp_rest_api_endpoint_example.php
Last active June 30, 2022 11:27
WordPress REST API Custom Endpoint Example
<?php
/* 1. add function to rest_api_init hook, */
/* 2. then, call register_rest_route() function */
add_action( 'rest_api_init', 'define_endpoint');
function define_endpoint(){
register_rest_route( 'namespace', '/new/route', array(
'methods' => array('POST','GET','UPDATE','DELETE'),
'callback' => 'my_awesome_func'
) );
}
@anthonycoffey
anthonycoffey / WP REST API Controller Class
Created October 14, 2018 01:51 — forked from JMWebDevelopment/WP REST API Controller Class
This is the base WP REST API Controller class
<?php class Sports_Bench_Team_REST_Controller extends WP_REST_Controller {
/**
* Register the routes for the objects of the controller.
*/
public function register_routes() {
$namespace = 'sportsbench';
$base = 'teams';
register_rest_route( $namespace, '/' . $base, array(
array(
@anthonycoffey
anthonycoffey / page-templates-for-plugins.php
Last active October 25, 2018 23:14
Page Template Class to include in plugin
<?php
class PageTemplater {
/**
* A reference to an instance of this class.
*/
private static $instance;
/**
@anthonycoffey
anthonycoffey / html - the basics - part 1.2.html
Last active November 15, 2018 11:01
HTML: The Basics - Part 1.2
<!DOCTYPE html>
<html>
<head>
<!-- meta tags, tracking pixels, links to stylesheets, fonts and scripts go here. -->
</head>
<body>
<!-- The rest of your HTML goes here. Oh, and by the way... This is what a HTML comment looks like! -->
<!-- HTML Comments are only displayed in the code, they are for communicating with yourself and others -->
</body>
</html>
@anthonycoffey
anthonycoffey / useful-sass-mixin-for-responsive-design.scss
Last active April 30, 2019 00:15
Useful and Customizable SASS Mixin for Responsive Breakpoints
// default breakpoints for UIKit
// https://getuikit.com/v2/docs/core.html#breakpoints
$breakpoints: (
xsmall: 479px,
small: 767px,
medium: 959px,
large: 1199px,
xlarge: 1200px
);
@anthonycoffey
anthonycoffey / usage-of-useful-sass-mixin-for-responsive-design.scss
Last active April 30, 2019 00:18
Example of using the useful sass mixin for responsive design
.selector {
// small screens (xsmall - small)
@include breakpoint(small){
// add styling here
}
// medium screens (small - medium)
@include breakpoint(medium){
// add styling here
@anthonycoffey
anthonycoffey / inset-box-shadow.css
Created December 2, 2018 22:08
Good Inset Box Shadow for a mouseover "pushed in" effect
box-shadow: inset 0px 1px 3px rgba(0,0,0,.5);
@anthonycoffey
anthonycoffey / map-array-with-property-name-as-index.js
Last active January 22, 2019 06:47
jQuery Map array with property name as index
var data = [];
jQuery.map(obj , function (n, i) {
data[n.name] = n.value;
});