小编lfe*_*445的帖子

如何合并YAML数组?

我想在YAML中合并数组,并通过ruby加载它们 -

some_stuff: &some_stuff
 - a
 - b
 - c

combined_stuff:
  <<: *some_stuff
  - d
  - e
  - f
Run Code Online (Sandbox Code Playgroud)

我想将组合数组作为 [a,b,c,d,e,f]

我收到错误:在解析块映射时没有找到预期的键

如何在YAML中合并数组?

yaml list data-structures

79
推荐指数
4
解决办法
3万
查看次数

curl无法连接到localhost端口80

我的主机文件映射127.0.0.1localhost.

$ curl -I 'localhost'
curl: (7) Failed to connect to localhost port 80: Connection refused
Run Code Online (Sandbox Code Playgroud)

然后

$ curl -I 127.0.0.1
HTTP/1.1 200 OK
Server: nginx/1.2.4
Date: Wed, 09 Apr 2014 04:20:47 GMT
Content-Type: text/html
Content-Length: 612
Last-Modified: Tue, 23 Oct 2012 21:48:34 GMT
Connection: keep-alive
Accept-Ranges: bytes
Run Code Online (Sandbox Code Playgroud)

在我的主机文件中,我有

127.0.0.1   localhost
Run Code Online (Sandbox Code Playgroud)

看来curl命令无法识别输入 /etc/hosts.有人可以解释原因吗?

更新:我还没试过这个,但我发现你可以配置nginx来响应ipv4和ipv6

curl nginx

30
推荐指数
3
解决办法
12万
查看次数

git - 如何获得默认分支?

我的团队交替使用dev和master作为几个repos的默认分支,我想编写一个脚本,在输入目录时检查默认分支.

当在某些repos中打开pull请求时,它们默认为'dev'或'master'作为合并目标.

我了解如何设置此信息但不检索它:https: //help.github.com/articles/setting-the-default-branch/

是否有可用于确定远程存储库的默认分支的git命令?

git

28
推荐指数
13
解决办法
1万
查看次数

jasmine 2 - 在jasmine.DEFAULT_TIMEOUT_INTERVAL指定的超时时间内未调用异步回调

遇到茉莉花2问题并获得异步规格:

define(['foo'], function(foo) {
  return describe('foo', function() {
    beforeEach(function(done) {
      window.jasmine.DEFAULT_TIMEOUT_INTERVAL = 10000;
      return setTimeout((function() {
        console.log('inside timeout');
        return done();
      }), window.jasmine.DEFAULT_TIMEOUT_INTERVAL);
    });
    return it('passes', function() {
      return expect({}).toBeDefined();
    });
  });
});
Run Code Online (Sandbox Code Playgroud)

当我通过业力奔跑时,我会回来

错误:超时 - 在jasmine.DEFAULT_TIMEOUT_INTERVAL指定的超时内未调用异步回调.

然后规格失败了.我试图覆盖默认超时但我无法通过错误

javascript jasmine

17
推荐指数
2
解决办法
4万
查看次数

如何增加gulp任务的堆栈跟踪?

$ gulp patch
[17:13:27] Requiring external module coffee-script/register
[17:13:28] Using gulpfile ~/source/sem-campaign.js/gulpfile.coffee
[17:13:28] Starting 'bump'...
[17:13:28] Starting 'add'...
[17:13:28] Bumped version to: 1.0.2
[17:13:28] Bumped version to: 1.0.2
[17:13:28] Finished 'bump' after 31 ms
[17:13:28]
[17:13:28] Finished 'add' after 30 ms
[17:13:28] Starting 'commit'...
[?] enter a commit msg, eg initial commit: initial commit
[17:13:32] Finished 'commit' after 3.26 s
[17:13:32] Starting 'patch'...
no buddy
[17:13:32] Finished 'patch' after 25 ?s

events.js:72
        throw er; // Unhandled 'error' event
              ^
Error: …
Run Code Online (Sandbox Code Playgroud)

node.js gulp

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

具有WebdriverIO和Selenium的Browsermob代理

我正在尝试使用Selenium,W​​ebdriver io和browsermob代理在har文件中记录网络流量

var webdriverio = require('webdriverio');

var Proxy = require('browsermob-proxy').Proxy
, fs = require('fs')
, proxy = new Proxy()
;

proxy.cbHAR('scratchpads.eu', doSeleniumStuff, function(err, data) {
  console.log('running cb')
  if (err) {
    console.error('ERR: ' + err);
  } else {
    fs.writeFileSync('stuff.har', data, 'utf8');
  }
});

const opts = {
  desiredCapabilities: {
    browserName: 'chrome',
  },
  host: 'localhost',
  port: '4444',
  protocol: 'http',
  coloredLogs: true,
}

function doSeleniumStuff(proxy, cb) {
  var browser = webdriverio.remote(opts);

  browser
    .init()
    .url('http://scratchpads.eu')
    .getTitle().then(function(title) {
      console.log('Title was: ' + title);
    })
    .end().then(cb).catch(e …
Run Code Online (Sandbox Code Playgroud)

automation node.js webdriver-io browsermob-proxy

5
推荐指数
0
解决办法
305
查看次数

在海外安装时 NPM 超时

我在美国以外的地方度假,那里的连接速度很慢,npm install给我带来了一些麻烦。

› npm config list
; cli configs
user-agent = "npm/3.7.3 node/v5.8.0 darwin x64"

; userconfig /Users/lfender/.npmrc
registry = "http://registry.npmjs.org/"
strict-ssl = false

; globalconfig /Users/lfender/.nvm/versions/node/v5.8.0/etc/npmrc
strict-ssl = false

; node bin location = /Users/lfender/.nvm/versions/node/v5.8.0/bin/node
; cwd = /Users/lfender/source/ag.js
; HOME = /Users/lfender
; "npm config ls -l" to show all defaults.

npm install --verbose
npm info retry will retry, error on last attempt: Error: connect ETIMEDOUT 151.101.56.162:443
Run Code Online (Sandbox Code Playgroud)

我已尝试将注册表设置为 ,http但看起来好像仍在尝试连接443或 ssl。

它继续这样做并一遍又一遍地重试。我还可以尝试与注册中心建立什么通信?

即使连接到位于美国的企业 …

node.js npm

4
推荐指数
2
解决办法
7332
查看次数

调试器 - 无法构建gem native native ruby​​ 1.8.7

处理我需要调试但无法安装调试器的过时项目.

ruby -v  # => ruby 1.8.7 (2011-06-30 patchlevel 352) [i686-darwin12.3.0]
rails -v # => Rails 2.3.17

gem install debugger

Installing debugger (1.6.1)
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

        /Users/lfender/.rvm/rubies/ruby-1.8.7-p352/bin/ruby extconf.rb
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers.  Check the mkmf.log file for more
details.  You may need configuration options.

Provided configuration options:
  --with-opt-dir
  --without-opt-dir
  --with-opt-include
  --without-opt-include=${opt-dir}/include
  --with-opt-lib
  --without-opt-lib=${opt-dir}/lib
  --with-make-prog
  --without-make-prog
  --srcdir=.
  --curdir
  --ruby=/Users/lfender/.rvm/rubies/ruby-1.8.7-p352/bin/ruby
extconf.rb:16:in `require': …
Run Code Online (Sandbox Code Playgroud)

ruby ruby-on-rails bundler

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

Elasticsearch 匹配前缀,未找到匹配项

遵循有关一些基本查询的弹性搜索教程:

#Create the index with no mapping
curl -XPUT 127.0.0.1:9200/startswith/

#add some data
curl -XPOST 127.0.0.1:9200/startswith/test/ -d '{"title":"river dog"}'
curl -XPOST 127.0.0.1:9200/startswith/test/ -d '{"title":"data"}'
curl -XPOST 127.0.0.1:9200/startswith/test/ -d '{"title":"drive"}'
curl -XPOST 127.0.0.1:9200/startswith/test/ -d '{"title":"dzone"}'

#try to perform a "starts-with" style query...
curl -XGET 127.0.0.1:9200/startswith/test/_search?pretty -d '{
        "query": {
        "match_phrase_prefix": {
           "title": {
             "query": "d",
             "max_expansions": 5
           }
         }
       }
     }' | grep title
Run Code Online (Sandbox Code Playgroud)

但我收到了消息no matches found: 127.0.0.1:9200/startswith/test/_search?pretty。如果我访问http://127.0.0.1:9200/startswith/test/_search或卷曲它,结果就在那里。我错过了什么?

elasticsearch

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

如何用gulp观看符号链接?

我想观察供应商/购物者的变化以启动构建过程 - 我也在运行bower link,它会将软件包符号链接到本地​​源.

但是,当gulp尝试观察此目录时,它无法遍历由此创建的符号链接bower link.

var bowerAssets ='vendor/javascripts/my_symlinked_package/**/*.js';
if(bowerAssets){
  gulp.watch(bowerAssets, ['buildAssets']);
}
Run Code Online (Sandbox Code Playgroud)

从日志中,我收到以下内容

2015-02-19 13:16 gulp [81305](FSEvents.framework)FSEventStreamStart:register_with_server:错误:f2d_register_rpc()=>(null)( - 21)

我已经阅读了关于git的几个问题,并且错误似乎是由于依赖于不支持符号链接行走的glob - 如何使用watchFile()观看node.js中的符号链接文件看起来很有希望,但我遇到了麻烦让代码与gulp很好地配合.

如何通过gulp成功查看符号链接目录以进行更改?

node.js gulp

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