Skip to content

Instantly share code, notes, and snippets.

@dancancro
dancancro / YouTube.js
Created Jun 20, 2020
This tweak prevents a player reset when only the height or width changes
View YouTube.js
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
View next.config.js
const withOffline = require('next-offline')
module.exports = withOffline({
exportPathMap: function() {
return {
'/': { page: '/' }
};
},
webpack: config => {
config.externals = [
@dancancro
dancancro / gist:2dfafb053aaaedfade406fd4f67eb68a
Created Aug 22, 2019
Invariant Violation: Invalid hook call
View gist:2dfafb053aaaedfade406fd4f67eb68a
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 / package.json
Last active Mar 7, 2019
Version problems between expo, react-native and babel
View package.json
{
"babel": {
"presets": [
"@babel/preset-env",
"@babel/preset-react",
"babel-preset-expo"
]
},
"main": "node_modules/expo/AppEntry.js",
"scripts": {
View gist:f5024f4710dc5d5047824b408c476dbb
[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]
View gist:b6c905f7ed83a70c0116d4b63d7b1384
[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
View Errors
[12:15:19] (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]
View pom.xml
<?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>
View gist:25746178d67449a546611d04f344fcae
<?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>
@dancancro
dancancro / gist:0e124a59822968ed5779bb3464dc9a15
Created Oct 14, 2018
Broken com.fasterxml.jackson.databind.deser.SettableBeanProperty constructor
View gist:0e124a59822968ed5779bb3464dc9a15
org.springframework.web.util.NestedServletException: Handler dispatch failed; nested exception is java.lang.NoSuchMethodError: com.fasterxml.jackson.databind.deser.SettableBeanProperty.<init>(Lcom/fasterxml/jackson/databind/deser/SettableBeanProperty;Lcom/fasterxml/jackson/databind/JsonDeserializer;)V
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1006)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:925)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:974)
at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:877)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:851)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
at io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:74)
at io.undertow.servlet.handlers.FilterHandler$Fi