import { useLayoutEffect, useCallback, useState } from 'react' | |
export const useRect = (ref) => { | |
const [rect, setRect] = useState(getRect(ref ? ref.current : null)) | |
const handleResize = useCallback(() => { | |
if (!ref.current) { | |
return | |
} |
// Requires Gulp v4. | |
// $ npm uninstall --global gulp gulp-cli | |
// $ rm /usr/local/share/man/man1/gulp.1 | |
// $ npm install --global gulp-cli | |
// $ npm install | |
const { src, dest, watch, series, parallel } = require('gulp'); | |
const browsersync = require('browser-sync').create(); | |
const sass = require('gulp-sass'); | |
const autoprefixer = require('gulp-autoprefixer'); | |
const sourcemaps = require('gulp-sourcemaps'); |
[Settings] | |
ID = "Your_Site_ID" | |
# Settings in the [build] context are global and are applied to all contexts unless otherwise overridden by more specific contexts. | |
[build] | |
# This is the directory to change to before starting a build. | |
base = "project/" | |
# NOTE: This is where we will look for package.json/.nvmrc/etc, not root. | |
# This is the directory that you are publishing from (relative to root of your repo) |
"use strict"; | |
// Load plugins | |
const autoprefixer = require("autoprefixer"); | |
const browsersync = require("browser-sync").create(); | |
const cp = require("child_process"); | |
const cssnano = require("cssnano"); | |
const del = require("del"); | |
const eslint = require("gulp-eslint"); | |
const gulp = require("gulp"); |
/** | |
* Custom Jest transformer for SVG files | |
* Replace SVG file contents by a pseudo <svg /> JSX element containing only a data-filename attribute | |
* | |
* To make this work with Jest you need to update your Jest configuration with this: | |
* "transform": { | |
* "^.+\\.js$": "babel-jest", | |
* "^.+\\.svg$": "path/to/svg-transform.js" | |
* } | |
* |
This issue is so infuriating that I'm going to take some time to write about it.
-
MOST IMPORTANT. Your local development server must be bound to IP address 0.0.0.0. Some do this by default, but many don't. You need to make sure that you run your local server with correct IP bindings. You may need to provide additional flags to your serve commands e.g.
polymer serve --hostname domain.local
,hugo serve --bind 0.0.0.0
. If you use a named domain likedomain.local
, it has to be defined in/etc/hosts
and pointing at 0.0.0.0. -
My Parallels setting is using Shared Network, nothing special there.
-
Open macOS Terminal and type
ifconfig
. Look for the value undervnic0
>inet
. It is typically10.211.55.2
.
Last updated March 13, 2024
This Gist explains how to sign commits using gpg in a step-by-step fashion. Previously, krypt.co was heavily mentioned, but I've only recently learned they were acquired by Akamai and no longer update their previous free products. Those mentions have been removed.
Additionally, 1Password now supports signing Git commits with SSH keys and makes it pretty easy-plus you can easily configure Git Tower to use it for both signing and ssh.
For using a GUI-based GIT tool such as Tower or Github Desktop, follow the steps here for signing your commits with GPG.
This is a curated list of iOS (Swift & ObjC) frameworks which are inspired by React and Elm.
- ReactSwift by @ColinEberhardt
- https://github.com/ColinEberhardt/ReactSwift
This is an example to my article “How webpack’s ContextReplacementPlugin works”
You have the moment.js library, and you have a dynamic import:
require('./locale/' + name + '.js')