Skip to content

Instantly share code, notes, and snippets.

View bosconian-dynamics's full-sized avatar
🥓
Forever cooking breakfast

Adam Bosco bosconian-dynamics

🥓
Forever cooking breakfast
  • Glenwood Springs, CO
View GitHub Profile
@pixeldevsio
pixeldevsio / wp-cleanup.php
Created April 27, 2021 11:37
Clean up the WP Head
<?php
/********** CLEANUP *************/
/**
* Disable the emoji's
*/
function disable_emojis() {
remove_action( 'wp_head', 'print_emoji_detection_script', 7 );
remove_action( 'admin_print_scripts', 'print_emoji_detection_script' );
remove_action( 'wp_print_styles', 'print_emoji_styles' );
remove_action( 'admin_print_styles', 'print_emoji_styles' );
@gmazzap
gmazzap / AutoPaginatedQuery.php
Last active April 8, 2016 21:49
`WP_Query` subclass that takes a non-paginated query and split into different paginated queries offering a transparent interface to "standard loop" usage.
<?php
namespace GM;
/**
* `WP_Query` subclass that takes a non-paginated query and split into different
* paginated queries offering a transparent interface to "standard loop" usage.
*
* The class is not 100% transparent:
* - the var `$posts` and the method `get_posts()`, that are not used directly
* in standard loop usage, here don't return array of all posts, but only posts
@gaearon
gaearon / index.js
Last active January 5, 2022 18:45
Breaking out of Redux paradigm to isolate apps
import React, { Component } from 'react'
import Subapp from './subapp/Root'
class BigApp extends Component {
render() {
return (
<div>
<Subapp />
<Subapp />
<Subapp />
@gmazzap
gmazzap / Angie.php
Last active April 6, 2016 17:35
Very simple, quite powerful, extensible, plain-PHP one-class template engine.
<?php namespace GM;
/**
* Angie. Very simple, and quite powerful, plain PHP template engine.
*
* @author Giuseppe Mazzapica <giuseppe.mazzapica@gmail.com>
* @license http://opensource.org/licenses/MIT MIT
*/
class Angie
{
@Rarst
Rarst / doge.php
Last active December 27, 2019 10:34
Doge snippet for WordPress
<?php
add_filter('gettext',fn($t)=>
@$t[4]&&@$GLOBALS['wp_locale']
?["Such $t","Very $t",'Wow'][rand(0,2)]
:$t);
@JedWatson
JedWatson / API-Auth-With-KeystoneJS.md
Last active April 16, 2023 02:11
API Auth with KeystoneJS

To implement API authentication in KeystoneJS, you need the following:

For key based authentication

  • Middleware that validates the key in the request body or a header

For session based authentication

  • An endpoint that handles signin
  • An endpoint that handles signout
@JedWatson
JedWatson / KeystoneApiExample.md
Last active July 26, 2021 11:29
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
@franz-josef-kaiser
franz-josef-kaiser / MinFilterIterator.php
Last active January 18, 2021 19:15
An example plugin to show the use of the PHP SPL and subsidiary loops with a FilterIterator.
<?php
// Reduced to the minimum
class ThumbnailFilter extends FilterIterator
{
private $wp_query;
public function __construct( Iterator $iterator, WP_Query $wp_query )
{
NULL === $this->wp_query AND $this->wp_query = $wp_query;
parent::__construct( $iterator );
@thomascube
thomascube / README.md
Last active December 17, 2015 23:59
dcomposer - Install Composer dependencies into a global location

dcomposer

This is simple approach to work-around the missing --global option in Composer. See composer/composer#55

It reads the dependencies from a local composer.json file and installs them into a global location (e.g. /usr/local/lib/composer) and creates a light-weight local Composer installation providing the necessary autoload magic.

@Rarst
Rarst / class-autoload-wp.php
Created February 27, 2013 17:47
Generic autoloader for classes named in WordPress coding style.
<?php
if ( ! class_exists( 'Autoload_WP' ) ) {
/**
* Generic autoloader for classes named in WordPress coding style.
*/
class Autoload_WP {
public $dir = __DIR__;