小编Rob*_*ezy的帖子

Sublime Text 2:自动修复javascript的缩进?

这是我的一些示例代码,目前我只设置为一次使用4个空格缩进.有没有办法突出显示一个javascript块并按下一个按钮或菜单选项来格式化它像这样:

之前:

app.get('/csvtest', function (req, res) {
  MyModel.find(function (err, mymodel) {
    if (!err) {
      var csv = [];
      _.each(mymodel, function(obj) {
       csv.push(obj['mymodel']);
      });
      res.send(csv.join());
    } else {
      console.log(err);
    }
  });
});
Run Code Online (Sandbox Code Playgroud)

后:

app.get('/csvtest', function (req, res) {
    MyModel.find(function (err, mymodel) {
        if (!err) {
            var csv = [];
            _.each(mymodel, function(obj) {
                csv.push(obj['mymodel']);
            });
            res.send(csv.join());
        } else {
            console.log(err);
        }
    });
});
Run Code Online (Sandbox Code Playgroud)

javascript sublimetext2

70
推荐指数
4
解决办法
9万
查看次数

使用pip安装私有github存储库时遇到问题

作为前言,我已经看到了这个问题是否可以使用pip从私有github存储库安装包?

我正在尝试从我可以使用pip访问的私有存储库安装一个包.

我可以像这样直接克隆它:

(myenv)robbie@ubuntu:~/git$ git clone git@github.com:matherbk/django-messages.git
Cloning into 'django-messages'...
remote: Counting objects: 913, done.
remote: Compressing objects: 100% (345/345), done.
remote: Total 913 (delta 504), reused 913 (delta 504)
Receiving objects: 100% (913/913), 165.73 KiB, done.
Resolving deltas: 100% (504/504), done.
Run Code Online (Sandbox Code Playgroud)

但是当我尝试通过pip安装它时(我的virtualenv被激活):

(myenv)robbie@ubuntu:~/git$ pip install git+https://git@github.com/matherbk/django-messages.gitDownloading/unpacking git+https://git@github.com/matherbk/django-messages.git
  Cloning https://git@github.com/matherbk/django-messages.git to /tmp/pip-13ushS-build
Password for 'https://git@github.com': 
fatal: Authentication failed
  Complete output from command /usr/bin/git clone -q https://git@github.com/matherbk/django-messages.git /tmp/pip-13ushS-build:

----------------------------------------
Command /usr/bin/git clone -q https://git@github.com/matherbk/django-messages.git /tmp/pip-13ushS-build failed with error code 128 …
Run Code Online (Sandbox Code Playgroud)

python git pip github virtualenv

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

什么是 TTY,如何在 Ubuntu 上启用它?

我目前正在设置一个 node.js 服务器,我正在使用这里的调试模块https://github.com/visionmedia/debug

我正在尝试启用它,以便我可以在输出中获取彩色调试信息,但是我的终端看起来像底部的最后一个终端屏幕,它说:

When stdout is not a TTY, Date#toUTCString() is used, making it more useful for logging the debug information as shown below:
Run Code Online (Sandbox Code Playgroud)

任何人都可以对此有所了解吗?谢谢。

ubuntu stdout tty node.js

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

chrome.extension.onRequest已被弃用吗?

我正在构建一个chrome扩展并尝试将事件监听器附加到此,但我在后台页面的控制台中没有看到任何内容.

chrome.extension.onRequest.addListener(function(request, sender, sendResponse) {
          console.log('REFERRER', request.ref);
        });
Run Code Online (Sandbox Code Playgroud)

这段代码在我的main.js后台页面中,我所有的其他事件监听器(chrome.tabs.onUpdated,chrome.extension.onMessage等)都运行正常.

google-chrome google-chrome-extension

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

MongoDB:如何为集合中的所有值运行某个字段的函数?

我想从mongo shell做到这一点.基本上我想改变时间存储在当前数据库中的方式.

现在我的'时间'字段存储的字符串看起来像'2012年10月11日15:27:58 GMT-0500(CDT)',但我想运行Date.parse('Thu Oct 11 2012 15: 27:58 GMT-0500(CDT)')以便存储unix时间戳.

我想在所有当前条目中全面执行此操作,因为我将来会使用unix时间戳.

谢谢

mongodb

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