Skip to content

Instantly share code, notes, and snippets.

View josephfusco's full-sized avatar
:octocat:
Building the web

Joe Fusco josephfusco

:octocat:
Building the web
View GitHub Profile
@bramnauta
bramnauta / User.php
Created October 25, 2017 08:45
app/User.php
<?php
namespace App;
use Illuminate\Notifications\Notifiable;
use Illuminate\Auth\Authenticatable;
use Illuminate\Auth\Passwords\CanResetPassword;
use Illuminate\Foundation\Auth\Access\Authorizable;
use Illuminate\Contracts\Auth\Authenticatable as AuthenticatableContract;
use Illuminate\Contracts\Auth\Access\Authorizable as AuthorizableContract;
use Illuminate\Contracts\Auth\CanResetPassword as CanResetPasswordContract;
@nunomorgadinho
nunomorgadinho / gist:b2d8e5b8f5fec5b0ed946b24fa288a91
Created February 10, 2017 13:30
PHPCS + WordPress Coding Standards
# Install brew
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
# Install composer
brew install homebrew/php/composer
### PHPCS
composer global require "squizlabs/php_codesniffer=*"
# Add to your .bash_profile
@rgrove
rgrove / Makefile
Created July 30, 2011 22:01
Simple Makefile to minify CSS and JS.
# Patterns matching CSS files that should be minified. Files with a -min.css
# suffix will be ignored.
CSS_FILES = $(filter-out %-min.css,$(wildcard \
public/css/*.css \
public/css/**/*.css \
))
# Patterns matching JS files that should be minified. Files with a -min.js
# suffix will be ignored.
JS_FILES = $(filter-out %-min.js,$(wildcard \
@robbens
robbens / main.js
Created April 5, 2017 11:36
Example on how to use Masonry.js with FacetWP
// Init Masonry
var $grid = jQuery('.facetwp-template').masonry({
percentPosition: true,
columnWidth: '.grid-sizer',
itemSelector: '.grid-item'
});
// Reload and update on FacetWP load
jQuery(document).on('facetwp-loaded', function() {
$grid.masonry('reloadItems')
@jasonbahl
jasonbahl / wp-graphql-full-site-editing-config.php
Created January 14, 2022 17:40
Adding Gutenberg Full Site Editing settings to WPGraphQL
// NOTE, THIS IS VERY EXPERIMENTAL. TAKE THIS WITH A BIG GRAIN OF SALT, BUT DO WHAT YOU WILL WITH IT.
register_graphql_object_type("ThemeSettings", [
'description' => 'Theme Settings',
'fields' => [
'primaryColor' => [
'type' => 'string',
'description' => 'Primary Color',
'resolve' => function ($settings) {
$colors = $settings->settings->color->palette->theme;
@kevinwhoffman
kevinwhoffman / plugin.php
Last active April 15, 2022 20:46 — forked from mathetos/plugin.php
Dependent Plugin Activation/Deactivation and Alert
<?php
/*
* Dependent Plugin Activation/Deactivation
*
* Sources:
* 1. https://pippinsplugins.com/checking-dependent-plugin-active/
* 2. http://10up.com/blog/2012/wordpress-plug-in-self-deactivation/
*
*/
@mdecorte
mdecorte / createUsefulAssetManifest.js
Last active July 1, 2022 06:30
Script to create a useful asset-manifest file for CRA-2 that only contains paths to assets needed on page load
const fs = require('fs')
const path = require('path')
// for CRA-2 un-comment line 5 and comment line 6
// const assetManifest = require('./build/asset-manifest.json')
const assetManifest = require('./build/asset-manifest.json')[files]
const indexFilePath = path.join(__dirname, 'build/index.html')
const BUILD_PATH = path.join(__dirname, 'build/useful-asset-manifest.json')
@spencejs
spencejs / Featured Image Instructions
Created March 22, 2013 03:35
Add Instruction Text To Featured Image Box In Wordpress Admin
@nhoizey
nhoizey / screenshots.js
Created November 12, 2012 17:07
Take screenshots at different viewport sizes using CasperJS
/*
* Takes provided URL passed as argument and make screenshots of this page with several viewport sizes.
* These viewport sizes are arbitrary, taken from iPhone & iPad specs, modify the array as needed
*
* Usage:
* $ casperjs screenshots.js http://example.com
*/
var casper = require("casper").create();
@jasonbahl
jasonbahl / faust-automated-persisted-queries-plugin.js
Created October 25, 2022 15:13
Faust.js plugin for adding Automated Persisted Query support. Plays nice with https://github.com/wp-graphql/wp-graphql-smart-cache
import {createPersistedQueryLink} from '@apollo/client/link/persisted-queries';
import {HttpLink} from "@apollo/client";
import {sha256} from 'crypto-hash';
const linkChain = createPersistedQueryLink({ sha256 }).concat(
new HttpLink({ uri: process.env.WPGRAPHQL_URL }),
);
class PersistedQueriesPlugin {
apply({ addFilter }) {