这是我的一些示例代码,目前我只设置为一次使用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) 作为前言,我已经看到了这个问题是否可以使用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) 我目前正在设置一个 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)
任何人都可以对此有所了解吗?谢谢。
我正在构建一个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等)都运行正常.
我想从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时间戳.
谢谢
git ×1
github ×1
javascript ×1
mongodb ×1
node.js ×1
pip ×1
python ×1
stdout ×1
sublimetext2 ×1
tty ×1
ubuntu ×1
virtualenv ×1