Skip to content

Instantly share code, notes, and snippets.

https://stackoverflow.com/questions/1186535/how-to-modify-a-specified-commit
You can use git rebase. For example, if you want to modify commit bbc643cd, run
$ git rebase --interactive 'bbc643cd^'
Please note the caret ^ at the end of the command, because you need actually to rebase back to the commit before the one you wish to modify.
In the default editor, modify pick to edit in the line mentioning 'bbc643cd'.
Save the file and exit: git will interpret and automatically execute the commands in the file. You will find yourself in the previous situation in which you just had created commit bbc643cd.
@undrafted
undrafted / env-var-in-script.sh
Created March 11, 2020 14:02
Use env variables in package.json
"scripts": {
"e2e:staging": "yarn run $(grep API_KEY .env | cut -d '=' -f2)",
},
const preloadLazy = (dynamicImport) => {
let promise;
function load() {
if(!promise) {
promise = dynamicImport();
}
return promise;
}
const component = React.lazy(load);
export const preloadImage = (url: string) => {
return new Promise(resolve => {
const img = document.createElement('img');
img.src = url;
img.onload = () => resolve(src);
});
};
import React, { PureComponent, ReactNode } from 'react';
const isBrowser = () => typeof window !== 'undefined' && typeof document !== 'undefined';
const shouldPolyfillIntersectionObserver = () =>
isBrowser() &&
!(
'IntersectionObserver' in window &&
'IntersectionObserverEntry' in window &&
'intersectionRatio' in IntersectionObserverEntry.prototype
const svg = document.querySelector("svg");
const bbox = svg.getBBox();
svg.setAttribute("viewBox", [bbox.x, bbox.y, bbox.width, bbox.height].join(" "));
console.log(svg.outerHTML);