Skip to content

Instantly share code, notes, and snippets.

View EvanAgee's full-sized avatar
🎯
Focusing

Evan Agee EvanAgee

🎯
Focusing
View GitHub Profile
@EvanAgee
EvanAgee / useBreakpoint.js
Created March 11, 2021 02:03
React breakpoint / responsive hook
/**
* Example:
* import useBreakpoint from './useBreakpoint'
*
* const MyComponent = () => {
* const breakpoint = useBreakpoint();
*
* {breakpoint.isMdUp && <AnotherComponent />}
* {breakpoint.xl && <AnotherComponent />}
* };
// Get The Page ID You Need
get_option( 'woocommerce_shop_page_id' );
get_option( 'woocommerce_cart_page_id' );
get_option( 'woocommerce_checkout_page_id' );
get_option( 'woocommerce_pay_page_id' );
get_option( 'woocommerce_thanks_page_id' );
get_option( 'woocommerce_myaccount_page_id' );
get_option( 'woocommerce_edit_address_page_id' );
get_option( 'woocommerce_view_order_page_id' );
get_option( 'woocommerce_terms_page_id' );
@EvanAgee
EvanAgee / ie11svg.js
Created July 18, 2018 18:20
IE11 add/remove/contains class for SVG
if (!("classList" in SVGElement.prototype)) {
Object.defineProperty(SVGElement.prototype, "classList", {
get() {
return {
contains: className => {
return this.className.baseVal.split(" ").indexOf(className) !== -1;
},
add: className => {
return this.setAttribute('class', this.getAttribute('class') + ' ' + className);
},

GifHub

Gone are the days of simple text-based comments in Github!

Squerge

![image](http://i.giphy.com/3og0IuECgoRILJUAfu.gif)

image

Merge

![image](https://media.giphy.com/media/3o7btP3U51GnFkj4f6/giphy.gif)

@EvanAgee
EvanAgee / changelog.md
Created March 6, 2017 20:15
changelog.md example

Change Log

All notable changes to this project will be documented in this file.

The format is based on Keep a Changelog and this project adheres to Semantic Versioning.

[Unreleased]

Added

  • Marketing banner to prompt users to upgrade to a free account
@EvanAgee
EvanAgee / pug-bomb.php
Created December 7, 2016 20:21 — forked from retgef/pug-bomb.php
Pug Bomb API Endpoint WordPress Plugin
<?php
/*
Plugin Name: Pug Bomb API Endpoint
Description: Adds an API endpoint at /api/pugs/$n_pugs
Version: 0.1
Author: Brian Fegter
Author URL: http://coderrr.com
*/
class Pugs_API_Endpoint{
@EvanAgee
EvanAgee / KeystoneApiExample.md
Created December 7, 2016 20:15 — forked from JedWatson/KeystoneApiExample.md
Example of how to scaffold API endpoints for Posts in a Keystone project (based on the yo keystone example).

This is an example of how to scaffold API endpoints to list / get / create / update / delete Posts in a Keystone website.

It's a modification of the default project created with the yo keystone generator (see https://github.com/JedWatson/generator-keystone)

Gists don't let you specify full paths, so in the project structure the files would be:

routes-index.js        -->    /routes/index.js         // modified to add the api endpoints
routes-api-posts.js    -->    /routes/api/posts.js     // new file containing the Post API route controllers
@EvanAgee
EvanAgee / notifyHipchat.php
Last active August 29, 2015 14:01
Send alert to HipChat with Behat test fails
<?php
/**
* Send an alert to HipChat when a test fails
*
* @AfterStep
*/
public function notifyHipchat(Behat\Behat\Event\StepEvent $event)
{
if ($event->getResult() === Behat\Behat\Event\StepEvent::FAILED) {
@EvanAgee
EvanAgee / ContentTypes.feature
Created May 13, 2014 17:47
Example Behat Scenario Outline
Feature: Content Type Tests
As an Administrator
I should be able to create nodes of all Content Types
@api
Background:
Given I am logged in as a user with the "administrator" role
@api @Env::Backend @Creator::EvanAgee
Scenario Outline: Make sure we can create nodes of type <node-type>
@EvanAgee
EvanAgee / Views.feature
Created May 9, 2014 19:37
Behat test to verify the display of multiple Drupal views
Feature: Views Tests
As an unauthenticated user
I should see various views throughout the site
@api @Env::Frontend @Creator::EvanAgee
Scenario: Check Home Page Views
Given I am not logged in
Then the element "#views_slideshow_cycle_main_sliding_banners-sliding_banner" should exist
Then the element ".view-id-ministry_partner" should exist
Then the element ".view-id-speaker" should exist