Skip to content

Instantly share code, notes, and snippets.

@bvaughn
bvaughn / index.md
Last active June 16, 2024 21:50
How to use profiling in production mode for react-dom

React recently introduced an experimental profiler API. This page gives instructions on how to use this API in a production release of your app.

Table of Contents

Profiling in production

React DOM automatically supports profiling in development mode for v16.5+, but since profiling adds some small additional overhead it is opt-in for production mode. This gist explains how to opt-in.

@paulirish
paulirish / open-chrome-tabs-in-safari.scpt
Created April 4, 2016 00:24
open chrome tabs in safari
tell application "Google Chrome"
set tab_list to every tab in the front window
repeat with the_tab in tab_list
set the_url to the URL of the_tab
tell application "Safari" to open location the_url
end repeat
end tell
@ghaiklor
ghaiklor / iterm-fish-fisherman-meslo-osx.md
Last active December 5, 2022 11:14
iTerm 2 + fish + fisherman + Material Design + Meslo
@justinstern
justinstern / wc-email-recipient-for-payment-type.php
Created April 23, 2014 16:38
WooCommerce New Order email alert based on payment type. This snippet will send a new order alert email to an additional email address, based on payment type. Reader question from http://www.skyverge.com/blog/how-to-add-a-custom-woocommerce-email/
<?php
// Add everything below to your current theme's functions.php:
// The email to send can be changed by using a different filter in place of 'woocommerce_email_recipient_new_order'
// The payment method can be changed by using a different payment method id in place of 'cod'
add_filter( 'woocommerce_email_recipient_new_order', 'wc_new_order_cash_on_delivery_recipient', 10, 2 );
function wc_new_order_cash_on_delivery_recipient( $recipient, $order ) {
@mikejolley
mikejolley / gist:9971101
Created April 4, 2014 09:23
WC customising checkout fields using actions and filters - Lesson 3 snippet 1
/**
* Add the field to the checkout
*/
add_action( 'woocommerce_after_order_notes', 'my_custom_checkout_field' );
function my_custom_checkout_field( $checkout ) {
echo '<div id="my_custom_checkout_field"><h2>' . __('My Field') . '</h2>';
woocommerce_form_field( 'my_field_name', array(
@O-Zone
O-Zone / transitionEnd.js
Last active November 23, 2023 22:43
Get the name of the browsers transitionEnd event. After calling this, window.transitionEnd will contain the browser specific name of the transitionEnd event. This is an extract of EvandroLG's transitionEnd snippet, without all support for testing different elements and using cache.
(function (window) {
var transitions = {
'transition': 'transitionend',
'WebkitTransition': 'webkitTransitionEnd',
'MozTransition': 'transitionend',
'OTransition': 'otransitionend'
},
elem = document.createElement('div');
for(var t in transitions){
@LeaVerou
LeaVerou / dabblet.css
Created March 19, 2013 17:35
Change an SVG file through the URL hash
/**
* Change an SVG file through the URL hash
* Warning: Does NOT work on WebKit.
*/
body {
background: silver;
}
.logo {