小编big*_*les的帖子

RVM + Zsh"RVM不是一个函数,用'rvm use ...'选择rubies将无法正常工作"

我首先要说的是我不是命令行的专家,所以我真的只知道自己在做什么.

我无法让RVM和oh-my-zsh一起玩得很好.我已经尝试了几种不同的解决方案,其中一些是关于SO的,但我发现的任何解决方案似乎都无法解决问题.

最初,其他人在我的机器上设置了RVM.我后来自己设置了oh-my-zsh,并且记得这样做有很多麻烦.

.zhsrc除了这2行之外,我的文件是完全默认的

export PATH=$HOME/bin:/usr/local/bin:/usr/local/rvm/bin:$PATH

#pretty sure this line does nothing, although I've seen this fix around
# several places. I noticed that I don't seem to have an .rvm file in my 
# home directory which would be an issue, but I have no idea how to 
# go about correcting this.
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" 
Run Code Online (Sandbox Code Playgroud)

我添加/usr/local/rvm到Path指令,因为zsh在zsh: rvm command not found没有它的情况下返回.否则大多数rvm命令工作,除了rvm use抛出以下错误:

RVM is not a function, selecting …
Run Code Online (Sandbox Code Playgroud)

ruby shell zsh rvm oh-my-zsh

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

在本地网络上提供WAMP www

我知道有类似的问题,但没有一个解决我的具体情况.

我有一个WAMP服务器设置用于开发一些网站,它运行良好.我需要通过无线路由器将其用于本地网络上的另一台计算机.另一台计算机实际上是Mac,我只需要能够通过浏览器查看开发站点(不需要访问phpmyadmin或mySQL).

我可以使用我的Windows机器的IP访问通过浏览器运行WAMP的本地主机(显示默认的WAMP页面,其中包含指向站点项目的链接).显然点击链接会导致找不到页面,因为URL是相对于localhost的,但即使我用IP(http://192.168.2.1/myproject)明确键入url,我仍然得不到任何结果.(即使我输入了url,url也会重定向到localhost/myproject)

我的主机有一个动态IP,但由于它是硬连接到调制解调器和路由器,IP不会改变,除非我重置路由器/调制解调器.我无法看到这是问题,因为我能够使用Mac上的IP访问默认的WAMP页面.

有任何想法吗?

ip lan wamp

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

如何触发best_in_place事件

我查看了整个Google和StackOverflow并查看了best_in_place javascript代码无济于事.

我使用best_in_place Post通过使用textarea 来编辑模型的属性,如下所示:

<%= best_in_place @post, :summary, 
                 { :type => :textarea, :display_with => 'simple_format'}  %>
Run Code Online (Sandbox Code Playgroud)

我希望能够在按下Enter/Return时触发best_in_place的提交功能,除非用shift键(允许回车)按下它,就像在可编辑区域外点击时一样.使用常规文本/输入,这是默认功能(减去回车部分).但是,当使用textareas时,它不是.

我从这里获得了一个很好的jQuery,它可以处理按下Enter时有/没有shift的情况,但我无法弄清楚如何触发best_in_place来提交数据.

//Have to bind it to the activate function, or else 
//the element won't be in the DOM when it tries to identify it
$('.best_in_place').bind('best_in_place:activate', function(){          
   $(this).find('textarea').keyup(function(e) {
      var $textarea = $(this);
      if(e.keyCode == 13 && !e.shiftKey) {
        e.preventDefault(); // Don't make a new line         
        // This line does weird things
       $(this).parents('.best_in_place').trigger('best_in_place:update').trigger('best_in_place:deactivate');
      }
    });
});
Run Code Online (Sandbox Code Playgroud)

我还有一些函数绑定到best_in_place:update函数,它基本上添加和删除样式的类.使用上面的代码,当我在best_in_place textarea中按Enter键时,我绑定到该 …

javascript jquery ruby-on-rails best-in-place ruby-on-rails-4

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