Skip to content

Instantly share code, notes, and snippets.

@wickedst
wickedst / next.config.js
Last active May 27, 2022 16:47
Now V2 next.js config for postlight/headless-wp-starter
// just adds target: "serverless"
const path = require('path');
const glob = require('glob');
module.exports = {
webpack: config => {
config.module.rules.push(
{
test: /\.(css|scss)/,
@mauricedb
mauricedb / Subject under test
Last active December 7, 2023 14:46
Testing stateful React hooks
import { useState } from 'react';
export function useCounter(initial = 0) {
const [count, setCount] = useState(initial);
return [count, () => setCount(count + 1)];
}
@timurcatakli
timurcatakli / webpack.config.dev.js
Last active May 19, 2023 07:38
Webpack Configuration Files for Create-React-App v2
'use strict';
const path = require('path');
const webpack = require('webpack');
const PnpWebpackPlugin = require('pnp-webpack-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const CaseSensitivePathsPlugin = require('case-sensitive-paths-webpack-plugin');
const InterpolateHtmlPlugin = require('react-dev-utils/InterpolateHtmlPlugin');
const WatchMissingNodeModulesPlugin = require('react-dev-utils/WatchMissingNodeModulesPlugin');
const ModuleScopePlugin = require('react-dev-utils/ModuleScopePlugin');
@MKagesawa
MKagesawa / docker-compose.yml
Created August 21, 2018 08:07
Docker-compose MySQL Image create multiple databases
# The official MySQL (https://hub.docker.com/_/mysql/) supports only one MYSQL_DATABASE environment variable.
# By modifying the entrypoint and passing shell script, you can create multiple dbs without having to make a mysql image just for this purpose.
version: '3'
services:
# Some other service connecting to mysql
db:
image: mysql:5.6
@lfantone
lfantone / yup.flow.js
Created May 24, 2018 22:42
Yup's Flow types
declare module 'yup' {
declare type ValidateOptions = {
strict?: boolean,
abortEarly?: boolean,
stripUnknown?: boolean,
recursive?: boolean,
context?: any
};
declare type ValidationError = {
@tommysdk
tommysdk / select_java_version
Last active April 2, 2024 02:48
Change default Java version on Mac OS X using Fish shell
# Based on https://stackoverflow.com/a/26252993/1665539
# Show all installed Java versions
/usr/libexec/java_home -V
# Select major version (if unique, otherwise specify full name e.g. 1.8.0_131)
set -x JAVA_HOME (/usr/libexec/java_home -v 1.8)
# Verify
java -version
// moved to https://wordpress.org/plugins/classic-editor-addon/
@gbero
gbero / fish_shell_android_home.txt
Last active March 7, 2024 19:05
Export $ANDROID_HOME on MacOS with Fish shell
touch ~/.config/fish/config.fish;
echo "set --export ANDROID $HOME/Library/Android;" >> ~/.config/fish/config.fish
echo "set --export ANDROID_HOME $ANDROID/sdk;" >> ~/.config/fish/config.fish
echo "set -gx PATH $ANDROID_HOME/tools $PATH;" >> ~/.config/fish/config.fish
echo "set -gx PATH $ANDROID_HOME/tools/bin $PATH;" >> ~/.config/fish/config.fish
echo "set -gx PATH $ANDROID_HOME/platform-tools $PATH;" >> ~/.config/fish/config.fish
echo "set -gx PATH $ANDROID_HOME/emulator $PATH" >> ~/.config/fish/config.fish
echo "set --export JAVA_HOME /Applications/Android\ Studio.app/Contents/jbr/Contents/Home;" >> ~/.config/fish/config.fish
@mwickett
mwickett / formikApollo.js
Last active December 20, 2022 23:00
Formik + Apollo
import React from 'react'
import { withRouter, Link } from 'react-router-dom'
import { graphql, compose } from 'react-apollo'
import { Formik } from 'formik'
import Yup from 'yup'
import FormWideError from '../elements/form/FormWideError'
import TextInput from '../elements/form/TextInput'
import Button from '../elements/form/Button'
import { H2 } from '../elements/text/Headings'
@nasrulhazim
nasrulhazim / change-mysql-data-directory-in-osx.md
Created April 8, 2017 10:20
Change MySQL Data Directory in OSX

Stop the MySQL Service

I'm using Homebrew to stop the service

brew services stop mysql

Locate MySQL Data Directory