所以我使用eslint作为我的反应项目的linter,我希望它能检查我的所有.js文件.
我可以通过脚本执行此操作:
"lint": "eslint back/*.js && eslint backTest/*.js && eslint front/actions/*.js"
Run Code Online (Sandbox Code Playgroud)
如何让它以.js递归方式检查每个文件,例如:
"lint": "eslint -r *.js"
Run Code Online (Sandbox Code Playgroud)
这样可以省去我必须在每个文件中输入内容
在此先感谢您的帮助
我想git grep为 a 运行命令<pattern>,但排除超过 200 个字符的行。
我已经成功地通过命令实现了这一点:
git grep <pattern> | grep -Ev '.{200}'
Run Code Online (Sandbox Code Playgroud)
如果可能的话,我想将其作为一个命令运行(没有管道)。我以为我可以利用该git grep --not标志来实现此目的,但遇到了困难。
这是我的尝试:
git grep -e <pattern> --not -e '.{200}'
Run Code Online (Sandbox Code Playgroud)
我尝试了上述命令的不同组合,但没有得到所需的输出。
任何关于我下一步应该尝试什么的指示将不胜感激,提前感谢您的帮助。
解决方案:
(感谢@torek)
git grep -E -e one --and --not -e '.{200}'
Run Code Online (Sandbox Code Playgroud) 如果我想输入一个案例,我会做以下事情:
amount
|> calculate
|> case do
1 -> "one"
2 -> "two"
_ -> "many"
end
Run Code Online (Sandbox Code Playgroud)
是否有可能以for类似的方式管道循环,例如:
amounts
|> calculate
|> for do
IO.inspect &1
end
Run Code Online (Sandbox Code Playgroud)
要么
amounts
|> calculate
|> Kernel.for(&IO.inspect/1)
Run Code Online (Sandbox Code Playgroud)
我知道我可以使用这些Enum方法,但我更好奇上面的方法是如何工作的.
当我向我的服务器发送 xhr post 请求时。它回复 302 重定向,但我只能记录整个重定向 html,无法让浏览器重定向到新的 url。
服务器.js
const Hapi = require('hapi');
const Inert = require('inert');
const server = new Hapi.Server();
const port = 8888;
server.connection({ port });
server.register([ Inert ], () => {
server.route([
{
method: 'get',
path: '/',
handler: (request, reply) => {
reply.file('index.html');
}
},
{
method: 'get',
path: '/login',
handler: (request, reply) => {
reply.file('login.html');
}
},
{
method: 'post',
path: '/login',
handler: (request, reply) => {
reply.redirect('/');
}
}
]);
server.start(() => {
console.log('Server …Run Code Online (Sandbox Code Playgroud) 我有一个带有主应用程序和组件的elm项目.
我希望该组件具有自己的内部更新,并且还能够更新主模型.
我希望组件的update功能能够运行一个Cmd将数据传递到主应用程序并更改主应用程序URL的功能.
我发现能够做到这一点的唯一方法是使用Task.perform和Task.succeed.
是否可以不使用Task.perform和Task.succeed?在这种情况下使用Task.perform和Task.succeed模式的负面影响是什么?
使用最新版本的节点,
打字 node --inspect ajavascriptfile.js
输出一个网址供您在Chrome浏览器中访问,太棒了!
(这里有 V8检查员的文件)
但是如何用我的终端打开该网址?
我可以使用以下命令打开浏览器中的文件或网址:
open -a Google\ Chrome ./path/to/file.html
要么
open -a Google\ Chrome http://google.com
但尝试相同的网址:
open -a Google\ Chrome chrome-devtools://devtools/remote/se...
给我错误:
The file /Users/samhouston/proj/chrome-devtools:/devtools/remote/se... does not exist.
Run Code Online (Sandbox Code Playgroud)
如何通过我的终端让Chrome浏览器打开这个网址?
在此先感谢您的帮助
我有一个包含 3 个应用程序的伞形项目:main_web,main和child.
我定义了main一个child应用程序使用的宏。
编译时,我有时会收到一个错误,说当我再次运行相同的命令时Main.MyMacro未定义some_file_in_child_app.ex,一切都很好。
我认为这是由于some_file_in_child_app.ex在编译之前尝试使用宏。
确保Main.MyMacro加载并避免此错误的好方法是什么?
我不确定沿着跑步mix compile apps/main路线走是否正确
我有两个container元素,它们有position: sticky和 a z-index: 1。
其中一个元素有一个带有 的子节点position: absolute。
我希望子节点在视觉上位于两个container元素的顶部。
这是我必须保留的 html 结构以及我尝试过的内容:
.square {
height: 100px;
width: 100px;
position: absolute;
background-color: red;
z-index: 10; /* this doesn't work */
}
.container {
height: 40px;
width: 200px;
position: sticky;
background-color: blue;
margin-top: 1rem;
margin-bottom: 1rem;
z-index: 1;
}Run Code Online (Sandbox Code Playgroud)
<!DOCTYPE html>
<html>
<body>
<div class="container">
<div class="square"></div>
</div>
<div class="container"></div>
</body>
</html>Run Code Online (Sandbox Code Playgroud)
这是它目前的样子:
这是我希望它的外观:
但我想保持元素的html结构和sticky对齐方式container。
我想运行两个elixir脚本,first.exs和second.exs.我想第二个也先跑.什么是一个很好的方式来运行它?
例如,代码可能如下所示:
first.exs
IO.puts "first"
Run Code Online (Sandbox Code Playgroud)
second.exs
IO.puts "second"
System.cmd("mix run first.exs")
Run Code Online (Sandbox Code Playgroud)
并输出这样的东西:
mix run first.exs
first
mix run second
first
second
Run Code Online (Sandbox Code Playgroud)
我想避免使用System.cmd,Mix尽可能使用该模块