小编Roy*_*Roy的帖子

Windows 终端中的 Git Bash 在单独的窗口中打开

我想将 git bash 添加到 windows 终端,但是,当我在终端中添加新的 git bash 选项卡时,git bash 会在不同的窗口中打开。

这是我的配置:

{
    "guid": "{--------------------}",
    "acrylicOpacity" : 0.75,
    "closeOnExit" : true,
    "colorScheme" : "Campbell",
    "commandline" : "C:\\Users\\anonymous\\AppData\\Local\\Programs\\Git\\git-bash.exe",
    "cursorColor" : "#FFFFFF",
    "cursorShape" : "bar",
    "fontFace" : "Consolas",
    "fontSize" : 10,
    "historySize" : 9001,
    "icon" : "C:\\Program Files\\Git\\mingw64\\share\\git\\git-for-windows.ico",
    "name" : "Git Bash",
    "padding" : "0, 0, 0, 0",
    "snapOnInput" : true,
    "useAcrylic" : true
}
Run Code Online (Sandbox Code Playgroud)

输出:

在此处输入图片说明

我错过了什么?

git git-bash windows-terminal

7
推荐指数
1
解决办法
3434
查看次数

错误:无法移动缓存:使用 selenium (python) 时访问被拒绝

我正在尝试使用 selenium(在 Python 中)来抓取网站,但是,当我启动 chrome Web 驱动程序时,它会尝试加载页面几秒钟,然后关闭窗口并返回以下错误消息:

[22424:18188:0531/121110.652:ERROR:cache_util_win.cc(21)] Unable to move the cache: Access is denied. (0x5)
[22424:18188:0531/121110.653:ERROR:cache_util.cc(139)] Unable to move cache folder C:\Users\user\AppData\Local\Google\Chrome\User Data\Profile 1\ShaderCache\GPUCache to C:\Users\user\AppData\Local\Google\Chrome\User Data\Profile 1\ShaderCache\old_GPUCache_000
[22424:18188:0531/121110.653:ERROR:disk_cache.cc(184)] Unable to create cache
[22424:18188:0531/121110.653:ERROR:shader_disk_cache.cc(606)] Shader Cache Creation failed: -2
Opening in existing browser session.
Run Code Online (Sandbox Code Playgroud)

我在加载页面时使用自定义配置文件。我的ChromeOptions样子:

OPTIONS = webdriver.ChromeOptions()
OPTIONS.add_argument("--user-data-dir=C:/Users/user/AppData/Local/Google/Chrome/User Data/Profile 1")
driver = webdriver.Chrome(PATH, options=OPTIONS)

# rest of code
Run Code Online (Sandbox Code Playgroud)

聚苯乙烯

1) 我没有在后台运行任何 Chrome 进程。不过我在后台使用 Firefox。

2)前几次可以用,现在就停止了。

python selenium caching selenium-webdriver

6
推荐指数
1
解决办法
2万
查看次数

在 Windows 中的 Git bash 中全局运行 shell 脚本

我有一个想要全局运行的 shell 脚本。它的当前目录是

~/directory/script.sh
Run Code Online (Sandbox Code Playgroud)

我只能从脚本所在的目录运行该脚本,但是,我想从每个目录运行它,而不仅仅是它所在的目录。

我在 Windows 10 中使用 Git bash。我尝试将此行放在文件顶部:

#!usr/local/bin
Run Code Online (Sandbox Code Playgroud)

但这不起作用(可能是因为我使用的是 Windows),bash 说它无法识别它。

我也尝试过使用,alias但这并不是真正的解决方案。

有没有其他方法可以全局运行 shell 脚本?

windows git bash shell

6
推荐指数
2
解决办法
6286
查看次数

样式组件无法与 create-react-library 一起使用

我正在尝试导入styled-components模块create-react-library。但是,当我运行它时,我收到以下错误消息:

Error: 'typeOf' is not exported by node_modules\react-is\index.js, imported by node_modules\styled-components\dist\styled-components.browser.esm.js

at C:\Users\roypo\Projects\Web Development\wiit-ui\node_modules\styled-components\dist\styled-components.browser.esm.js:1:9

1: import { typeOf, isElement, isValidElementType } from 'react-is';
            ^
2: import React, { useState, useContext, useMemo, useEffect, useRef, createElement, useDebugValue } from 'react';
3: import shallowequal from 'shallowequal';
Run Code Online (Sandbox Code Playgroud)

我导入styled-components如下:

import styled from 'styled-components'
Run Code Online (Sandbox Code Playgroud)

我将其添加到peerDependenciesdevDependencies(以及常规依赖项)中,如下所示:

Error: 'typeOf' is not exported by node_modules\react-is\index.js, imported by node_modules\styled-components\dist\styled-components.browser.esm.js

at C:\Users\roypo\Projects\Web Development\wiit-ui\node_modules\styled-components\dist\styled-components.browser.esm.js:1:9

1: import { typeOf, isElement, isValidElementType } from …
Run Code Online (Sandbox Code Playgroud)

javascript reactjs

5
推荐指数
1
解决办法
990
查看次数

如何使用样式组件有条件地渲染?

我有一个名为 的功能性反应组件(钩子)toggle,它有一个button组件,单击时会切换<styledTitle>( styled-components)的可见性。它看起来像这样:

const Toggle = () => {
    const styledTitle = styled.h1`
        //some styles
        //SUDO CODE: display none if toggle === true else block
    `;
    const [toggle, setToggle] = useState(false)
    const handleToggle = () => {
        setToggle(!toggle)
    }
    <button onClick={handleToggle}>Click me</button>
    <styledTitle>Text</styledTitle>
}
Run Code Online (Sandbox Code Playgroud)

我希望styledTitledisplay: none,如果值toggletrue其他display: block

我怎样才能做到这一点?谢谢是提前。

javascript reactjs styled-components

1
推荐指数
1
解决办法
1334
查看次数

Sass ID 选择器在 React 和 create-react-library 中不起作用

我有一个正在用一个Header组件和一个Button组件制作的库。我给了他们 ID 以在我的 SASS 文件中识别他们,这是我目前的情况:

索引.js

import React from 'react'
import './styles.module.scss'

export const Button = ({text, bgColor, textColor, fontFamily}) => {

  return <button id="button" style={
    {backgroundColor: [bgColor],
    color: [textColor],
    fontFamily: [fontFamily]}
  }>{text}</button>
}

export const Header = ({text, size, fontFamily, textColor}) => {
  return <h1 style={{
    fontSize: [size],
    fontFamily: [fontFamily],
    color: [textColor]
  }} id="header">{text}</h1>
}

export const subHeader = () => {
  return null
}
Run Code Online (Sandbox Code Playgroud)

styles.module.scss

@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@300;400;500;700&display=swap');
$font: 'Montserrat',
sans-serif;
$blue: #1778f2; …
Run Code Online (Sandbox Code Playgroud)

javascript sass reactjs

1
推荐指数
1
解决办法
3854
查看次数

在导入不同的文件(作为库)时,有没有办法访问 React 组件的状态?

我有一个带有状态的 React 组件:

export const Toggle = ({initalValue, theme, ...otherProps}) => {

    const [isToggle, setIsToggle] = useState(initalValue)
    const toggleProps = {
        initalValue: initalValue,
        theme: theme
    }

    const handleClick = () => {
        setIsToggle(!isToggle)
    }

    return (
        <StyledToggle isToggle={isToggle} {...toggleProps}{...otherProps} onClick={handleClick}>

        </StyledToggle>
    )

}
Run Code Online (Sandbox Code Playgroud)

我在不同的文件中导入这个组件:

import {Toggle} from 'something'

//

<Toggle />
Run Code Online (Sandbox Code Playgroud)

有没有办法访问isToggle另一个文件中的状态。如果这是不可能的,有没有其他办法可以做到这一点?

javascript import state reactjs

1
推荐指数
1
解决办法
37
查看次数

删除字符串中重复的字符集 - Python

我有一个字符串'1a1b1c1d3e3e3e1f1g2h2h1i1j1k1l1m1n4o4o4o4o1p1q2r2r1s2t2t2u2u1v1w1x1y1z' ,我想删除这些承租人的所有重复项:3e, 4o, 2r等等。我如何在 Python 中做到这一点?

python string

0
推荐指数
1
解决办法
58
查看次数