See the new site: https://postgresisenough.dev
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI/CD production | |
| on: | |
| push: | |
| branches: [ production ] | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| # Mandatory : fetch the current repository |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (function($){ | |
| const $root = $( '#root' ); | |
| const $stage1 = $( '.stage-1', $root ); | |
| const $stage2 = $( '.stage-2', $root ); | |
| // If there's no GET string, then no credentials have been passed back. Let's get them. | |
| if ( ! window.location.href.includes('?') ) { | |
| // Stage 1: Get the WordPress Site URL, Validate the REST API, and Send to the Authentication Flow | |
| const $urlInput = $( 'input[type=url]', $stage1 ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // See: wp-includes/js/api-request.js | |
| // Returns a jqXHR object. See: https://api.jquery.com/jQuery.ajax/#jqXHR | |
| wp.apiRequest({path: '/namespace/vendor/v1/config'}) | |
| .then(configOptions => console.log(configOptions)); | |
| // jqXHR object has method then(), but does not have methods catch() or | |
| // finally(). Use fail() or always() instead | |
| wp.apiRequest({path: '/namespace/vendor/v1/config'}) | |
| .done(configOptions => console.log(configOptions)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Serverless Delete example | |
| on: | |
| delete: | |
| branches: | |
| - actions-** | |
| # Specify what jobs to run | |
| jobs: | |
| deploy: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Get the data of a block | |
| wp.data.select( 'core/block-editor' ).getBlocks()[0] | |
| // Update attributes of another block | |
| // wp.data.dispatch( 'core/editor' ).updateBlockAttributes( clientID, attributes ) | |
| wp.data.dispatch( 'core/block-editor' ).updateBlockAttributes( '10d88a6d-95d6-4e07-8293-5f59c83a26c0', { heading: 'New Heading' } ) | |
| // Get currently selected block. | |
| wp.data.select( 'core/block-editor' ).getBlockSelectionStart() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * A very simple autocomplete component | |
| * | |
| * This is to replace the OOTB Gutenberg Autocomplete component because it is | |
| * currently broken as of v4.5.1. | |
| * | |
| * See Github issue: https://github.com/WordPress/gutenberg/issues/10542 | |
| * | |
| * Note: The options array should be an array of objects containing labels and values; i.e.: | |
| * [ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /** | |
| * @license GPLv3 (or any later version) | |
| * @see http://kizu514.com/blog/refactor-your-slow-form-using-php-generators-and-event-streams/ | |
| */ | |
| namespace KIZU514; | |
| class EventEmitter | |
| { |
Moved to Shopify/graphql-design-tutorial
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export const toCamelCase = (e) => { | |
| return e.replace(/_([a-z])/g, (g) => g[1].toUpperCase()); | |
| }; | |
| export const toSnakeCase = (e) => { | |
| return e.match(/([A-Z])/g).reduce( | |
| (str, c) => str.replace(new RegExp(c), '_' + c.toLowerCase()), | |
| e | |
| ) | |
| .substring((e.slice(0, 1).match(/([A-Z])/g)) ? 1 : 0); |
NewerOlder