Skip to content

Instantly share code, notes, and snippets.

View oliviertassinari's full-sized avatar

Olivier Tassinari oliviertassinari

View GitHub Profile
@mycolaos
mycolaos / CreatableAutocomplete.tsx
Last active February 1, 2024 15:42
Creatable Autocomplete simplifying the MUI Autocomplete usage.
/**
* This is a CreatableAutocomplete component that can be used to create new
* options using MUI's Autocomplete component.
*
* Motivation: the MUI interface for creatable autocomplete is complex and hard
* to follow, this component simplifies the interface by separating the event of
* selecting an option from the event of creating a new option.
*
* Usage copy-paste it and use it like this:
*
@RobertAKARobin
RobertAKARobin / safari.md
Last active January 5, 2024 05:41
Safari's date-picker is the cause of 1/3 of our customer support issues

Safari's date-picker is the cause of 1/3 of our customer support issues

...and obviously we're building a workaround. But I'm absolutely flabbergasted that a standard <input type="date"> HTML field, in a standard browser, from a company that bases its reputation good design, could be so dreadful.

The context

I'm the developer for a startup that sells a genetic test to recommend medications for high blood pressure. For medical reasons we need to know our customers' birth date. Most of our customers are in their 60s or older. We've found that many of them use iPads or iPhones. And they're the ones who complain to our customer support that our site is unusable.

The problem

@wecreatedigital
wecreatedigital / gist:f52c2c8a897276d13a72c6bb2bdccb0e
Created May 23, 2021 13:15
SQL to export WooCommerce reviews
# Based on https://deanandrews.uk/export-woocommerce-reviews-wordpress/ but enhanced to include the rating and filter out other comments.
```
SELECT `post_title` AS 'Product', `comment_author` AS 'Customer Name', `comment_author_email` AS 'Customer Email', `comment_date`, `comment_content` AS 'Review', `wp_commentmeta`.`meta_value` AS 'Rating'
FROM `wp_comments`
INNER JOIN `wp_posts` ON `comment_post_ID`=`ID`
INNER JOIN `wp_commentmeta` ON `wp_commentmeta`.`comment_id`=`wp_comments`.`comment_ID`
WHERE `comment_author` != 'WooCommerce'
AND `wp_posts`.`post_type` = 'product'
AND `wp_posts`.`post_status` = 'publish'
0 new icons
0 new variants

babel-plugin-transform-mui-imports npm

A plugin to make authoring with MUI components efficient, both for humans and bundlers.

Here's why:

@Hollywood
Hollywood / branches-and-commits-by-repository.graphql
Last active October 24, 2022 12:31
GraphQL Branch and Commit Queries by Repository
query getCommitsByBranchByRepo($org:String!,$repo:String!) {
organization(login:$org) {
name
repository(name:$repo) {
name
refs(refPrefix: "refs/heads/", first: 10) {
nodes {
id
name
target {
@tkrotoff
tkrotoff / FrontendFrameworksPopularity.md
Last active May 7, 2024 14:13
Front-end frameworks popularity (React, Vue, Angular and Svelte)
@oliviertassinari
oliviertassinari / metric.js
Created October 26, 2018 19:03
Isomorphic performance metric.
import warning from 'warning'
const times = new Map()
const implementations = {
mark: {
start: name => {
times.set(name, performance.now())
performance.mark(`metric_${name}_start`)
},
@bvaughn
bvaughn / index.md
Last active April 3, 2024 07:41
Interaction tracing with React

This API was removed in React 17


Interaction tracing with React

React recently introduced an experimental profiler API. After discussing this API with several teams at Facebook, one common piece of feedback was that the performance information would be more useful if it could be associated with the events that caused the application to render (e.g. button click, XHR response). Tracing these events (or "interactions") would enable more powerful tooling to be built around the timing information, capable of answering questions like "What caused this really slow commit?" or "How long does it typically take for this interaction to update the DOM?".

With version 16.4.3, React added experimental support for this tracing by way of a new NPM package, scheduler. However the public API for this package is not yet finalized and will likely change with upcoming minor releases, so it should be used with caution.

@lukecav
lukecav / functions.php
Created August 14, 2018 13:50
Enable revisions on products in WooCommerce
add_filter( 'woocommerce_register_post_type_product', 'wc_modify_product_post_type' );
function wc_modify_product_post_type( $args ) {
$args['supports'][] = 'revisions';
return $args;
}