Skip to content

Instantly share code, notes, and snippets.

const path = require( 'path' );
const defaultConfig = require( '@wordpress/scripts/config/webpack.config' );
const WooCommerceDependencyExtractionWebpackPlugin = require( '@woocommerce/dependency-extraction-webpack-plugin' );
module.exports = {
...defaultConfig,
plugins: [
...defaultConfig.plugins.filter(
( plugin ) =>
plugin.constructor.name !== 'DependencyExtractionWebpackPlugin'

Keybase proof

I hereby claim:

  • I am opr on github.
  • I am opr18 (https://keybase.io/opr18) on keybase.
  • I have a public key ASALC2_rcr1_0OnTbV-w72x86h8_hj_U6g6hNBqZWXWK-wo

To claim this, I am signing this object:

{
loader: 'sass-loader',
options: {
webpackImporter: false,
sassOptions: {
importer: globImporter()
}
}
},
@opr
opr / replace-function-keyword.txt
Created May 10, 2020 09:07
Regex for matching functions defined using the function keyword
Find: function (\w*)\s?(\(.*?\))\s?\{
Replace with: const $1 = $2 => {
import anime from 'animejs';
export const slideDown = (node, displayMode = 'block', easing = 'easeOutExpo', duration = 600) => {
console.log(node);
const nodeToCopy = node.cloneNode(true);
nodeToCopy.style.position = 'absolute';
nodeToCopy.style.display = 'block';
nodeToCopy.style.visibility = 'hidden';
nodeToCopy.style.height = 'auto';
const copiedNode = document.body.appendChild(nodeToCopy);
const webpack = require('webpack');
const path = require('path');
const globImporter = require('node-sass-glob-importer');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const TerserPlugin = require('terser-webpack-plugin');
const OptimizeCSSAssetsPlugin = require('optimize-css-assets-webpack-plugin');
const SassLintPlugin = require('sass-lint-webpack');
const postcssPresetEnv = require('postcss-preset-env');
@opr
opr / .htaccess
Created March 6, 2019 11:58 — forked from jacobovidal/.htaccess
Upgrade Insecure Requests via .htaccess or meta tag to prevent mixed content
<ifModule mod_headers.c>
Header always set Content-Security-Policy "upgrade-insecure-requests;"
Header always set Upgrade-insecure-requests "1";
</IfModule>
import React, {Component} from 'react';
import {Text} from 'react-native';
class Greeting extends Component {
render() {
return (
<Text>Hello {this.props.name}!</Text>
);
}
}
@opr
opr / 9.js
Created September 27, 2016 15:48
function removeLargest(a_, b_, c_) {
let a = parseInt(a_),
b = parseInt(b_),
c = parseInt(c_);
return a > b ? ( a > c ? [b, c] : [a, b] ) : ( b > c ? [a, c] : [a, b] );
}
@opr
opr / 8.js
Created September 27, 2016 15:46
function removeLargest(a, b, c) {
return a > b ? ( a > c ? [b, c] : [a, b] ) : ( b > c ? [a, c] : [a, b] );
}