Skip to content

Instantly share code, notes, and snippets.

@dancancro
dancancro / YouTube.js
Created June 20, 2020 01:10
This tweak prevents a player reset when only the height or width changes
import PropTypes from 'prop-types';
import React from 'react';
import isEqual from 'fast-deep-equal';
import youTubePlayer from 'youtube-player';
/**
* Check whether a `props` change should result in the video being updated.
*
* @param {Object} prevProps
* @param {Object} props
const withOffline = require('next-offline')
module.exports = withOffline({
exportPathMap: function() {
return {
'/': { page: '/' }
};
},
webpack: config => {
config.externals = [
@dancancro
dancancro / gist:2dfafb053aaaedfade406fd4f67eb68a
Created August 22, 2019 13:20
Invariant Violation: Invalid hook call
Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons: 1. You might have mismatching versions of React and the renderer (such as React DOM) 2. You might be breaking the Rules of Hooks 3. You might have more than one copy of React in the same app See https://fb.me/react-invalid-hook-call for tips about how to debug and fix this problem.
Invariant Violation: Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:
1. You might have mismatching versions of React and the renderer (such as React DOM)
2. You might be breaking the Rules of Hooks
3. You might have more than one copy of React in the same app
See https://fb.me/react-invalid-hook-call for tips about how to debug and fix this problem.
at invariant (/Users/Dan/work/b/questions/.next/server/static/development/pages/_document.js:7247:15)
at resolveDispatcher (/Users/Dan/work/b/questio
@dancancro
dancancro / angular_vue-react.md
Last active May 15, 2019 20:35
Comparison of Angular, Vue and React
@dancancro
dancancro / alt-filestructure
Last active May 3, 2019 02:06
An ngrx project file structure with fewer unique file names. All unique words are in directory names.
.
├── app
│   ├── module.ts
│   ├── page.css
│   ├── page.html
│   ├── page.spec.ts
│   ├── page.ts
│   ├── routing.ts
│   ├── core
│   │   ├── about
@dancancro
dancancro / package.json
Last active March 7, 2019 22:34
Version problems between expo, react-native and babel
{
"babel": {
"presets": [
"@babel/preset-env",
"@babel/preset-react",
"babel-preset-expo"
]
},
"main": "node_modules/expo/AppEntry.js",
"scripts": {
[14:54:15] (angular6) gba_to6
// ♥ ./mvnw
[INFO] Scanning for projects...
[INFO]
[INFO] -------< org.exampleapps.greatbig:great-big-example-application >-------
[INFO] Building Great Big Example Application 0.0.0
[INFO] --------------------------------[ war ]---------------------------------
[INFO]
[INFO] >>> spring-boot-maven-plugin:2.0.4.RELEASE:run (default-cli) > test-compile @ great-big-example-application >>>
[INFO]
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.exampleapps.greatbig</groupId>
<artifactId>great-big-example-application</artifactId>
<version>0.0.0</version>
<packaging>war</packaging>
<name>Great Big Example Application</name>
[13:13:36] (angular6) gba_to6
// ♥ mvn dependency:tree
[INFO] Scanning for projects...
Downloading: https://repo.spring.io/snapshot/com/spotify/docker-maven-plugin/1.4.3/docker-maven-plugin-1.4.3.pom
Downloading: https://repo.spring.io/milestone/com/spotify/docker-maven-plugin/1.4.3/docker-maven-plugin-1.4.3.pom
Downloading: https://repo.maven.apache.org/maven2/com/spotify/docker-maven-plugin/1.4.3/docker-maven-plugin-1.4.3.pom
[WARNING] The POM for com.spotify:docker-maven-plugin:jar:1.4.3 is missing, no dependency information available
Downloading: https://repo.spring.io/snapshot/com/spotify/docker-maven-plugin/1.4.3/docker-maven-plugin-1.4.3.jar
Downloading: https://repo.spring.io/milestone/com/spotify/docker-maven-plugin/1.4.3/docker-maven-plugin-1.4.3.jar
Downloading: https://repo.maven.apache.org/maven2/com/spotify/docker-maven-plugin/1.4.3/docker-maven-plugin-1.4.3.jar