Skip to content

Instantly share code, notes, and snippets.

@KidkArolis
KidkArolis / post.md
Last active November 17, 2020 11:21
Designing custom React hooks - sequencing of async effects

We've been building a hooks based REST API wrapper.

A specific use case discussed in this gist is – how do you close a modal after updating a remote resource completes succesfully?

Which of the following options seems best or is there a better approach altogether?

1. Async/Await

function EditNoteModal ({ id, onClose }) {
@swalkinshaw
swalkinshaw / tutorial.md
Last active November 13, 2023 08:40
Designing a GraphQL API
@julienbourdeau
julienbourdeau / wilson.php
Last active January 11, 2023 05:34
[PHP] 5 Star Rating - Lower bound of Wilson score confidence interval for a Bernoulli parameter
<?php
/*
|--------------------------------------------------------------------------
| 5 Star Rating
|--------------------------------------------------------------------------
|
| Lower bound of Wilson score confidence interval for a Bernoulli parameter (0.9604)
|
| See:
@lots0logs
lots0logs / child-theme-functions-php-snippet.php
Created May 2, 2016 22:55
WordPress :: Divi Builder :: Blog Module :: Sort Posts By Title
<?php
/* DON'T copy the first line (above) if your functions.php already has it.
* ---------------------------------------------------------------------- */
function my_et_theme_setup() {
if ( class_exists( 'ET_Builder_Module_Blog' ) ) {
get_template_part( 'my-main-modules' );
$et_pb_blog = new My_ET_Builder_Module_Blog();
remove_shortcode('et_pb_blog');
add_shortcode('et_pb_blog', array( $et_pb_blog, '_shortcode_callback' ) );