This file contains 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
import { addons } from '@storybook/manager-api'; | |
import events from '@storybook/core-events'; | |
addons.register('my-manager-addon', () => { | |
const channel = addons.getChannel(); | |
Object.values(events).forEach((event) => { | |
channel.on(event, (data) => { | |
console.log(event, data); | |
}); |
This file contains 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
/** | |
* Customise some of the HTML output of xdebug + add highlightjs + hackily customise that | |
* Requires: | |
* - HighlightJS: https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.8.0/highlight.min.js | |
* - HighlightJS PHP: https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.8.0/languages/php.min.js | |
* - Optionally, a base theme, e.g., https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.8.0/styles/github.min.css | |
**/ | |
document.addEventListener('DOMContentLoaded', function () { | |
const codeBlocks = document.querySelectorAll('.xdebug-error td:nth-of-type(4)'); | |
if(codeBlocks.length) { |
This file contains 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 | |
/** | |
* Function to export the orders list to a CSV download (not stored anywhere) | |
* CSV construction based on https://gist.github.com/vrushank-snippets/4274500 | |
* Dev notes: | |
* - This file is designed to be called via AJAX, with that function providing the order IDs. | |
* - To use this without AJAX you would just need to define $order_ids = wp_list_pluck($wp_query->posts, 'ID') instead, | |
* and define $filename as something appropriate here. | |
*/ | |
function doublee_export_orders() { |
This file contains 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
# ZSH Theme based on Solus (https://gist.github.com/cloudnull/4cc7890acaae6cb809e811e09e9eaade#file-solus-zsh-theme) | |
# Modified with custom colours | |
# See https://coderwall.com/p/pb1uzq/z-shell-colors for colour codes | |
if [[ $UID -eq 0 ]]; then | |
local user_symbol='%F{196}#%f' | |
else | |
local user_symbol='%F{226}$%f' | |
fi |
This file contains 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
// I have sections (called blocks here) that should have top and bottom padding, | |
// unless two of the same kind with the same background colour are together - | |
// in which case I want them to be right up next to each other - no padding between them. | |
// In the HTML it looks something like this: | |
// <section class="block my-special-block has-primary-background-color"> | |
.block { | |
padding-top: map-get($spacing, 'lg'); | |
padding-bottom: map-get($spacing, 'lg'); | |
} |
This file contains 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 | |
/** | |
* Add reCaptcha to checkout form | |
* Note: Can't place within the payment part of the form, WooCommerce just won't show it, choose an appropriate action to add it to accordingly | |
* @param $checkout | |
*/ | |
function doublee_show_me_the_checkout_captcha($checkout) { | |
echo '<div class="g-recaptcha" data-sitekey="YOUR_KEY_HERE"></div>'; | |
} | |
add_action('woocommerce_checkout_order_review', 'doublee_show_me_the_checkout_captcha', 18); |
This file contains 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
<script setup lang="ts"> | |
import Drawer from './components/Drawer.vue'; | |
</script> | |
<template> | |
<div class="app-wrapper"> | |
<Drawer position="left" :open="true" as="header"> | |
<p>Stuff goes here</p> | |
</Drawer> | |
<main class="page-content"> |
This file contains 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 | |
// Note: it's not mandatory to put this in a class, it's just how I write my plugins | |
class Doublee_Admin_UI { | |
public function __construct() { | |
add_action('admin_menu', array($this, 'rename_menu_items')); | |
// ...other function calls | |
} | |
/** |
This file contains 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
// Note: This assumes you already have the CSS set up for the classes you want to use. | |
function initCarousel() { | |
$('.my-carousel').slick({ | |
slidesToShow: 1, | |
slidesToScroll: 1, | |
autoplay: false, | |
adaptiveHeight: false, | |
fade: true, |
NewerOlder