Skip to content

Instantly share code, notes, and snippets.

add_filter( 'graphql_post_object_connection_query_args', function( $args ) {
$args['no_found_rows'] = false;
return $args;
} );
add_filter( 'graphql_connection_page_info', function( $page_info, $connection ) {
$page_info['total'] = null;
if ( $connection->get_query() instanceof \WP_Query ) {
if ( isset( $connection->get_query()->found_posts ) ) {
$page_info['total'] = (int) $connection->get_query()->found_posts;
@mihow
mihow / load_dotenv.sh
Last active September 16, 2024 17:00
Load environment variables from dotenv / .env file in Bash
# The initial version
if [ ! -f .env ]
then
export $(cat .env | xargs)
fi
# My favorite from the comments. Thanks @richarddewit & others!
set -a && source .env && set +a
@robertpenner
robertpenner / All the Singletons.txt
Created October 20, 2011 04:17
All the Singletons
All the Singletons, all the Singletons
All the Singletons, all the Singletons
All the Singletons, all the Singletons
All the Singletons, all the Singletons
If you liked it then you shoulda put an instance on it
If you liked it then you shoulda made it global static
Don't be mad once you see you can't unit test it
If you liked it then you shoulda made a Singleton