小编tha*_*way的帖子

Tmux与iTerm2分开的窗格

当iterm2有分割窗格时,我为什么要使用tmux?

我从未使用过tmux,并想知道在我的工作流程中使用它是否有优势,而不是iterm2具有的拆分窗格功能.

我真的很喜欢iTerm2分割窗格提供的非活动窗口的调光.tmux会做类似的事吗?

每个的优点/缺点是什么?

vim iterm tmux

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

使用rails-api的基本身份验证

我确定我在这里做错了,但这就是我的应用程序控制器的样子:

class ApplicationController < ActionController::API                                                                                                                                                                                                        
  include ActionController::HttpAuthentication::Basic                                                                                                                                                                                                      
  include ActionController::MimeResponds                                                                                                                                                                                                                   

  http_basic_authenticate_with :name => "joeyjojo", :password => "shabadoo"
end
Run Code Online (Sandbox Code Playgroud)

我无法弄清楚为什么我的http_basic_authenticate_with会抛出此错误:

undefined method `http_basic_authenticate_with' for ApplicationController:Class
Run Code Online (Sandbox Code Playgroud)

我确定这很简单,但我没有看到它.MimeResponds在其他控制器中工作得很好.

ruby-on-rails basic-authentication ruby-on-rails-3

18
推荐指数
2
解决办法
4012
查看次数

网络工作者抛出'未捕获错误:DATA_CLONE_ERR:DOM异常25'

所以我正在创建一个Web worker:

var arrayit = function(obj) {
  return Array.prototype.slice.call(obj);
};
work = arrayit(images);
console.log(work);
//work = images.push.apply( images, array );
// Method : "load+scroll"
var worker = new Worker('jail_worker.js');
worker.postMessage(work)
worker.onmessage = function(event) {
  console.log("Worker said:" + event.data);
};
Run Code Online (Sandbox Code Playgroud)

这是图像是什么:

$.jail.initialStack = this;
// Store the selector into 'triggerEl' data for the images selected
this.data('triggerEl', (options.selector) ? $(options.selector) : $window);
var images = this;
Run Code Online (Sandbox Code Playgroud)

我认为我的问题与此有关:

http://dev.w3.org/html5/spec/Overview.html#safe-passing-of-structured-data

我怎么能绕过这个?正如你所看到的,我尝试将主机对象切成真正的数组,但这不起作用.

这是我正在攻击的文件的链接:

https://github.com/jtmkrueger/JAIL

UPDATE ------------------------------------------------- -

这是我根据@davin接受的答案所做的事情:

var arrayit = function(obj) {
  return Array.prototype.slice.call(obj); …
Run Code Online (Sandbox Code Playgroud)

javascript jquery html5 dom web-worker

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

在HTML标记内调用javascript函数

我有以下内容.

<a href="#" onclick="hello()">click me</a>
Run Code Online (Sandbox Code Playgroud)

我有一个Javascript文件

$(document).ready(function() {
  function hello() {
    alert('hi');
  }
});
Run Code Online (Sandbox Code Playgroud)

但是当我点击"点击我"时,警报没有被触发.它说"你好"没有定义.我删除document.ready,它的工作原理.

这是因为在整个文档准备好之前没有定义"hello",但是当渲染上面的"anchor"标记时,它找不到该函数?

有什么方法可以让这个工作吗?

  • 我必须通过丑陋的"onclick"从html标签调用javascript函数
  • 我需要将我的JS保存在document.ready中(我还需要其他部分)

html javascript

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

QLPreviewController无法在iOS 6中运行

在iOS 6中,QLPreviewController不再从URL加载PDF.它在iOS 5中运行良好.我已经实现了QLPreviewControllerDataSource方法,如此处所述.

#pragma mark - QLPreviewControllerDataSource
- (NSInteger)numberOfPreviewItemsInPreviewController:(QLPreviewController *)controller {
    return 1;
}

- (id <QLPreviewItem>) previewController: (QLPreviewController *) controller previewItemAtIndex: (NSInteger) index;
{
    NSURL *fileURL = [NSURL URLWithString:@"http://www.bliley.net/XTAL/PDF_Instructions/Test_File.pdf"];
    return fileURL;
}
Run Code Online (Sandbox Code Playgroud)

这在iOS 5中完美运行,但在iOS 6中控制台输出:

Couldn't issue file extension for path: /XTAL/PDF_Instructions/Test_File.pdf
Run Code Online (Sandbox Code Playgroud)

objective-c qlpreviewcontroller ios6

11
推荐指数
2
解决办法
8696
查看次数

如何解析CSV文件,更新字段,然后保存

我需要读取CSV文件,更新字段,然后保存更改.除了将我的更改保存到我正在更新的字段之外,我一切正常

require 'csv'
@parsed_file = CSV::Reader.parse(File.open("#{RAILS_ROOT}/doc/some.csv"))
@parsed_file.each_with_index  do |row, x|
  address = row[5]
  l = Location.address_find(address)
  if l != nil
    puts "#{l.name} at #{l.address}"
    row[14] = l.store_code
    puts row[14]
  else
    puts "No matching address Found!!!"
  end
  #What do I do here? Something like this? CSV::Writer.generate(@parsed_file) 
end
Run Code Online (Sandbox Code Playgroud)

我该怎么办?如何保存我所做的更改并更新文件?

ruby csv

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

垂直虚线ascii或unicode字符

我试图找到一个垂直的虚线ascii字符.目前我正在使用¦但我希望找到更多与sublime文本具有的缩进指南字符相符的内容:

在此输入图像描述

绝对不一定要精确,但我希望它更像虚线而不是虚线.

unicode terminal ascii

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

为什么我得到Paperclip :: CommandNotFoundError with deploy而不是我的本地?

[paperclip] identify '-format' '%wx%h' '/tmp/stream,3360,1.jpeg[0]' 2>/dev/null
[paperclip] An error was received while processing: #<Paperclip::CommandNotFoundError: Paperclip::CommandNotFoundError>
[paperclip] identify '-format' '%wx%h' '/tmp/stream,3360,1.jpeg[0]' 2>/dev/null
[paperclip] An error was received while processing: #<Paperclip::CommandNotFoundError: Paperclip::CommandNotFoundError>
Run Code Online (Sandbox Code Playgroud)

这是我的日志尾中的错误.Image Paperclip :: CommandNotFoundError是它在flash错误中所起的作用.这只发生在我的部署,而不是我的开发.以前有人有这个问题吗?

ruby-on-rails paperclip

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

了解Backbone.js事件处理程序

所以这是我的观点:

$(function() {
var ImageManipulation = Backbone.View.extend({

    el: $('body'),
    tagName: "img",

    events: {
        'mouseover img': 'fullsize',
        'click img#current': 'shrink'
    },
    initialize: function() {
        _.bindAll(this, 'render', 'fullsize', 'shrink');

        //var message = this.fullsize;
        //message.bind("test", this.fullsize);
    },
    render: function() {

    },
    fullsize: function() {
        console.log("in fullsize function");
        console.log(this.el);
        $('.drop-shadow').click(function() {
            console.log(this.id);
            if (this.id != 'current') {
                $('.individual').fadeIn();
                $(this).css('position', 'absolute');
                $(this).css('z-index', '999');
                $(this).animate({
                    top: '10px',
                    height: '432px',
                }, 500, function() {
                    this.id = "current";
                    console.log("animation complete");
                    return true;
                });
            };
        });
    },
    shrink: function() …
Run Code Online (Sandbox Code Playgroud)

javascript jquery backbone.js

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

CoffeeScript中的Backbone.js setTimeout()循环

似乎我尝试这种方式,它会引发某种错误.这是我的代码现在的样子:

runShow: ->
  moments = @model.get('moment_stack_items')
  if inc == moments.length
    inc = 1
    pre = 0
  $("#" + moments[pre].uid).hide("slide", { direction: "left" }, 1000)
  $("#" + moments[inc].uid).show("slide", { direction: "right" }, 1000)

  inc += 1
  pre += 1

  console.log "looping" + inc
  t = setTimeout(this.runShow(),2000);
Run Code Online (Sandbox Code Playgroud)

我在我的活动中调用了这个函数.我已经inc = 1pre = 0所述Backbone.View之外定义..我的电流误差是"未捕获类型错误:对象[对象DOMWindow]无方法'runShow’"
积分:我怎样才能引用吨从另一个功能(运行我clearTimeout(t)的)?

javascript jquery coffeescript backbone.js

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