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
// From https://www.sitepoint.com/cache-fetched-ajax-requests/ | |
// All credits to: Peter Bengtsson | |
// Added Content-type to headers so it can go to traditional validation like fetch does | |
// Add some debugging messages: activate with { verbose: true } | |
// Add a request to be able to add headers instead of just calling URL | |
const CachedFetch = (url, options) => { | |
let expiry = options.seconds || 5 * 60 // 5 min default | |
let logger = (options.verbose) ? console.log : function(){}; |
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 | |
// This is so easy, it's embarassing that I took 20 minutes to find it. | |
// "Catalog" is a custom taxonomy. | |
function make_catalog_sortable( $sortables ) { | |
$sortables[] = 'catalog'; | |
return $sortables; | |
} | |
add_filter( 'woocommerce_sortable_taxonomies', 'make_catalog_sortable' ); |
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
$address = array( | |
'first_name' => $customer_name, | |
'last_name' => '', | |
'company' => '', | |
'email' => $customer_email, | |
'phone' => $customer_phone, | |
'address_1' => '', | |
'address_2' => '', | |
'city' => '', | |
'state' => '', |
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 React from 'react'; | |
export type GenHTMLFormControlsCollection<T> = HTMLFormControlsCollection & { | |
[inputName in keyof T]: HTMLInputElement; | |
}; | |
interface GenericFormElement<T extends { [inputName: string]: HTMLInputElement }> | |
extends HTMLFormElement { | |
readonly elements: GenHTMLFormControlsCollection<T>; | |
} |
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
{ | |
"name": "wpsitename", | |
"version": "1.0.0", | |
"description": "", | |
"author": "jacekolczak", | |
"private": true, | |
"devDependencies": { | |
"gulp": "latest", | |
"gulp-livereload": "latest", | |
"gulp-sass": "latest", |
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
var gulp = require('gulp'), | |
sass = require('gulp-sass')(require('sass')), | |
livereload = require('gulp-livereload'), | |
concat = require('gulp-concat'), | |
uglify = require('gulp-uglify'), | |
dest = require('gulp-dest'), | |
order = require('gulp-order'), | |
sourcemaps = require('gulp-sourcemaps'), | |
autoprefixer = require('gulp-autoprefixer') | |
rename = require('gulp-rename'), |
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
/** | |
* Composes single-argument functions from right to left. The rightmost | |
* function can take multiple arguments as it provides the signature for | |
* the resulting composite function. | |
* | |
* @param {...Function} funcs The functions to compose. | |
* @returns {Function} A function obtained by composing the argument functions | |
* from right to left. For example, compose(f, g, h) is identical to doing | |
* (...args) => f(g(h(...args))). | |
*/ |
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
/*** | |
* function sum(a,b,c) { return a +b + c;} | |
* const cSum = curry(sum) | |
* cSum(1, 2, 3) => 6 | |
* cSum(1)(2)(3) => 6 | |
* cSum(1)(2,3) => 6 | |
*/ | |
function curry(func) { | |
return (...args) => { |
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
// target.addEventListener shim, hat tip [mdn](http://mzl.la/18ELrGJ) | |
(function() { | |
if (!Event.prototype.preventDefault) { | |
Event.prototype.preventDefault=function() { | |
this.returnValue=false; | |
}; | |
} | |
if (!Event.prototype.stopPropagation) { | |
Event.prototype.stopPropagation=function() { | |
this.cancelBubble=true; |
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
# <type>: (If applied, this commit will...) <subject> (Max 50 char) | |
# |<---- Using a Maximum Of 50 Characters ---->| | |
# Explain why this change is being made | |
# |<---- Try To Limit Each Line to a Maximum Of 72 Characters ---->| | |
# Provide links or keys to any relevant tickets, articles or other resources | |
# Example: Github issue #23 |
NewerOlder