Skip to content

Instantly share code, notes, and snippets.

View davevanhoorn's full-sized avatar
🌴

Dave van Hoorn davevanhoorn

🌴
View GitHub Profile
@sibelius
sibelius / usePrompt.tsx
Last active October 27, 2022 19:05
Prompt user before leaving route or reload
import { useEffect, useRef } from 'react';
import { useHistory } from 'react-router-dom';
export const usePrompt = (when: boolean, message: string = 'Are you sure you want to quit without saving your changes?') => {
const history = useHistory();
const self = useRef(null);
const onWindowOrTabClose = event => {
if (!when) {
@1natsu172
1natsu172 / .eslintrc
Last active July 5, 2023 10:23
My airbnb based ESLint config for "typescript-eslint" with React & prettier
{
"parser": "@typescript-eslint/parser",
"parserOptions": {
"project": "./tsconfig.json",
"tsconfigRootDir": "."
},
"env": {
"browser": true,
"jest/globals": true
},
@yratof
yratof / acf-variations.php
Last active October 11, 2017 19:22
Woocommerce ACF to Variations
<?php
class woocommerce_acf_variations {
/**/
static function setup() {
/* Add this form to variations */
add_action( 'admin_head','acf_form_head', 20 );
add_action( 'woocommerce_product_after_variable_attributes', 'woocommerce_acf_variations::variation_field_group', 99, 3 );
add_action( 'woocommerce_product_thumbnails', 'woocommerce_acf_variations::display_thumbs', 99, 3 );
@magicznyleszek
magicznyleszek / multiply-blending-mode-to-png.md
Created August 20, 2014 11:27
Multiply blending mode to PNG in Photoshop
  1. copy your image (Ctrl+A and Ctrl+C)
  2. make a new document-sized pure-black layer behind it
  3. group the black layer and yor image together
  4. add mask to the group
  5. enter mask edit mode (alt+click on the mask icon/thumbnail)
  6. paste your image in the mask (b/w) and then invert it.
  7. save it as a 24-bit transparent PNG