React: Unexpected use of 'location';Solution: Use window.location instead of bare location.
| def is_valid_state(state): | |
| # check if it is a valid solution | |
| return True | |
| def get_candidates(state): | |
| return [] | |
| def search(state, solutions): | |
| if is_valid_state(state): | |
| solutions.append(state.copy()) |
| const getPermutations = arr => { | |
| const output = []; | |
| const swapInPlace = (arrToSwap, indexA, indexB) => { | |
| const temp = arrToSwap[indexA]; | |
| arrToSwap[indexA] = arrToSwap[indexB]; | |
| arrToSwap[indexB] = temp; | |
| }; |
| const net = require('net') | |
| const opts = { | |
| host: 'localhost', | |
| port: 1234, | |
| sockets: 2000, | |
| respawn: false, | |
| rate: 600, | |
| method: 'GET', | |
| path: '/' |
| // Add any other logic here as needed. | |
| import { CacheableResponsePlugin } from 'workbox-cacheable-response/CacheableResponsePlugin'; | |
| import { CacheFirst } from 'workbox-strategies/CacheFirst'; | |
| import { createHandlerForURL } from 'workbox-precaching/createHandlerForURL'; | |
| import { ExpirationPlugin } from 'workbox-expiration/ExpirationPlugin'; | |
| import { NavigationRoute } from 'workbox-routing/NavigationRoute'; | |
| import { precacheAndRoute } from 'workbox-precaching/precacheAndRoute'; | |
| import { registerRoute } from 'workbox-routing/registerRoute'; |
| # Open font in [fontforge](https://fontforge.github.io/en-US/) (FontAwesome's [fa-solid-900.woff](https://github.com/FortAwesome/Font-Awesome/blob/master/webfonts/fa-solid-900.woff) in my case) | |
| # So you can see what you're doing: Menu > Encoding > Compact | |
| # ctrl+a to select all glyphs | |
| # ctrl+. should open Execute Script | |
| # Ensure desiredGlyphNames includes all glyphs used in app | |
| desiredGlyphNames = ["caret-down", "caret-up", "chart-bar", "check", "chevron-down", "clipboard-list", "comments", "expand", "filter", "flask", "images", "info-circle", "layer-group", "redo", "ruler", "ruler-horizontal", "ruler-vertical", "sort-amount-down", "star", "table", "tag", "users", "video"] | |
| font = fontforge.activeFont() |
| const publicPath = 'public'; | |
| // Node os module | |
| // The os module provides a number of operating system-related utility methods. | |
| // It can be accessed using: | |
| const os = require('os'); | |
| // Using a single monolithic configuration file impacts comprehension and | |
| // removes any potential for reusability. | |
| // As the needs of your project grow, you have to figure out the means to manage | |
| // webpack configuration more effectively. |
| var count =Math.floor(Math.random()*100); | |
| process.on('message', (msg)=>{ | |
| console.log("CHILD: message received from parent process", msg); | |
| count = parseInt(msg) +1; | |
| console.log("CHILD: +1 from child"); |
React: Unexpected use of 'location';Solution: Use window.location instead of bare location.
| import Head from 'next/head' | |
| import { Container } from 'reactstrap' | |
| const Layout = (props) => ( | |
| <div> | |
| <Head> | |
| <title>PairHub</title> | |
| <meta name="viewport" content="initial-scale=1.0, width=device-width" /> | |
| <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/css/bootstrap.min.css" /> | |
| </Head> |
| // Logs all calls to preventDefault / stopPropagation in an user-friendly way | |
| if ( process.env.NODE_ENV !== "production" ) { | |
| (function monkeyPatchEventMethods() { | |
| const logEventMethodCall = (event,methodName) => { | |
| const MinimumMeaninfulSelectors = 3; // how much meaningful items we want in log message | |
| const target = event.target; | |
| const selector = (function computeSelector() { |