小编chr*_*ina的帖子

brew update:以下未跟踪的工作树文件将被合并覆盖:

我试图运行brew update,我得到一个错误,如果我合并,我的本地更改将丢失.我尝试了我的本地更改(不记得制作任何,但它已经有一段时间了),这让事情变得更糟.

这是输出:

MBP:Library User$ sudo brew update
error: The following untracked working tree files would be overwritten by merge:
    Library/Aliases/fastcgi
    Library/Aliases/htop
    Library/Aliases/nodejs
    Library/Aliases/ocio
    Library/Aliases/oiio
    Library/Aliases/pgrep
    Library/Aliases/pkill
    Library/Contributions/cmds/brew-beer.rb
    Library/Contributions/cmds/brew-dirty.rb
    Library/Contributions/cmds/brew-graph
    Library/Contributions/cmds/brew-grep
    Library/Contributions/cmds/brew-leaves.rb
    Library/Contributions/cmds/brew-linkapps.rb
    Library/Contributions/cmds/brew-man
    Library/Contributions/cmds/brew-mirror-check.rb
    Library/Contributions/cmds/brew-missing.rb
    Library/Contributions/cmds/brew-pull.rb
    Library/Contributions/cmds/brew-readall.rb
    Library/Contributions/cmds/brew-server
    Library/Contributions/cmds/brew-services.rb
    Library/Contributions/cmds/brew-switch.rb
    Library/Contributions/cmds/brew-test-bot.commit.html.erb
    Library/Contributions/cmds/brew-test-bot.css
    Library/Contributions/cmds/brew-test-bot.index.html.erb
    Library/Contributions/cmds/brew-test-bot.rb
    Library/Contributions/cmds/brew-tests.rb
    Library/Contributions/cmds/brew-unpack.rb
    Library/Contributions/cmds/brew-which.rb
    Library/Contributions/install_homebrew.rb
    Library/Formula/abcl.rb
    Library/Formula/abyss.rb
    Library/Formula/akka.rb
    Library/Formula/apollo.rb
    Library/Formula/appledoc.rb
    Library/Formula/arangodb.rb
    Library/Formula/autoconf.rb
    Library/Formula/automake.rb
    Library/Formula/avidemux.rb
    Library/Formula/bind.rb
    Library/Formula/bsdconv.rb
    Library/Formula/bsdmake.rb
    Library/Formula/camellia.rb
    Library/Formula/cbmbasic.rb
    Library/Formula/cdo.rb
    Library/Formula/checkstyle.rb
    Library/Formula/cifer.rb
    Library/Formula/clhep.rb
    Library/Formula/collada-dom.rb
    Library/Formula/crash.rb
    Library/Formula/crossroads.rb
    Library/Formula/css-crush.rb
    Library/Formula/curlftpfs.rb
    Library/Formula/dart.rb
    Library/Formula/dasm.rb
    Library/Formula/dfc.rb
    Library/Formula/di.rb
    Library/Formula/dsniff.rb
    Library/Formula/dupx.rb …
Run Code Online (Sandbox Code Playgroud)

git homebrew

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

使用rvmrc或ruby-version文件用RVM设置项目gemset?

我使用RVM(Ruby版本管理器)为我的每个Rails项目指定一个Ruby版本和一组gem.

我有一个.rvmrc文件,每当我cd进入项目目录时自动选择一个Ruby版本和gemset .

安装RVM 1.19.0后,我收到一条消息

您正在使用.rvmrc,它需要信任,它速度较慢且与其他ruby管理器不兼容,您可以切换到 .ruby-version使用rvm rvmrc to [.]ruby-version或忽略此警告rvm rvmrc warning ignore /Users/userName/code/railsapps/rails-prelaunch-signup/.rvmrc, .rvmrc将继续作为RVM 1和RVM 2中的默认项目文件,忽略运行所有文件的警告rvm rvmrc warning ignore all.rvmrcs.

我应该继续使用我的.rvmrc文件还是应该切换到.ruby-version文件?哪个是最佳的?有什么后果?

ruby-on-rails rvm ruby-on-rails-3 ruby-on-rails-3.2 rvmrc

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

在MarkDown中包含一个SVG(托管在github上)

我知道一个图像可以放在一个MD的MD语法中,![Alt text](/path/to/img.jpg)或者![Alt text](/path/to/img.jpg "Optional title"),但是我很难在MD中放置一个SVG代码托管在Github上.

最终使用rails3,并且现在经常更改模型,因此我使用RailRoady生成模型架构图的SVG.我希望将该SVG放入ReadMe.md并显示.当我在本地打开SVG文件时,它确实有效,那么如何让浏览器在MD文件中呈现SVG?鉴于代码在最终确定之前是动态的(看似永远不会),在一个单独的地方托管SVG似乎有点过分,而且我错过了实现这一目标的方法.

我想包括SVG是这里 Github上:https://github.com/specialorange/FDXCM/blob/master/Rails/fdxcm/doc/models_brief.svg

我尝试了以下内容,使用实际图像来验证语法是否正常,只是没有呈现SVG代码:

![Overview][1]
[1]: https://github.com/specialorange/FDXCM/blob/master/doc/controllers_brief.svg  "Overview"

<img src="https://raw.github.com/specialorange/FDXCM/master/doc/controllers_brief.svg">

![Alt text](https://raw.github.com/specialorange/FDXCM/master/doc/controllers_brief.svg)

[Google Doc](https://docs.google.com/drawings/d/1B95ajItJTAImL2WXISX0fkBLYk3nldea4Vm9eo-VyE4/edit) :

<img src="https://docs.google.com/drawings/pub?id=117XsJ1kDyaY-n8AdPS3_8jTgMyITqaoT3-ah_BSc9YQ&w=960&h=720">

<img src="https://raw.github.com/specialorange/FDXCM/master/doc/controllers_brief.svg">

<img src="https://docs.google.com/drawings/d/1B95ajItJTAImL2WXISX0fkBLYk3nldea4Vm9eo-VyE4/edit">
Run Code Online (Sandbox Code Playgroud)

得到的结果:

概观

替代文字

Google Doc:

markdown svg github

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

将$ scope注入角度服务函数()

我有一个服务:

angular.module('cfd')
  .service('StudentService', [ '$http',
    function ($http) {
    // get some data via the $http
    var path = 'data/people/students.json';
    var students = $http.get(path).then(function (resp) {
      return resp.data;
    });     
    //save method create a new student if not already exists
    //else update the existing object
    this.save = function (student) {
      if (student.id == null) {
        //if this is new student, add it in students array
        $scope.students.push(student);
      } else {
        //for existing student, find this student using id
        //and update it.
        for (i …
Run Code Online (Sandbox Code Playgroud)

angularjs angular-ui angular-ui-router

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

检查cURL是否在本地安装?

如何检查cURL我的本地服务器实例上是否安装了该文件?

我正在运行什么类型的服务器来检查它?[如果它是PHP服务器或CF服务器,它会有所不同吗?]

curl

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

Jquery获取当前html文件的名称

如果你在,http://www.cnn.com/2012/11/09/opinion/brown-pakistan-malala/index.html你可以让Jquery抓住index.html吗?

或者如果你在http://www.washingtonpost.com/politics/decision2012/supreme-court-to-review-key-section-of-voting-rights-act/2012/11/09/dd249cd0-216d-11e2-8448-81b1ce7d6978_story.html回来dd249cd0-216d-11e2-8448-81b1ce7d6978_story.html

对于非扩展定义的页面,例如当前的页面,http://stackoverflow.com/questions/13317276/jquery-to-get-the-name-of-the-current-html-file它可以返回"目录"结构中的最后一个"文件",例如:jquery-to-get-the-name-of-the-current-html-file

html javascript jquery

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

在Mac上安装Haskell软件包

我似乎无法在我的Mac上安装一些Haskell软件包(10.6.8).我第一次尝试了哈普斯塔克,它失败了,然后我尝试了Snap.

有时当我运行ghci时,我会遇到分段错误.

其他时候它的工作原理如下:

GHCi, version 7.4.2: http://www.haskell.org/ghc/  :? for help
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
Prelude>
Run Code Online (Sandbox Code Playgroud)

在尝试获取Snap时:

....
....
....
Loading package vector-0.10.0.1 ... linking ... done.
Loading package zlib-0.5.4.0 ... linking ... done.
Loading package zlib-bindings-0.1.1.3 ... linking ... done.
Loading package zlib-enum-0.2.3 ... linking ... done.
Loading package snap-core-0.9.3.1 ... linking ... done.
Loading package snap-server-0.9.3.3 ... linking ... done.
Loading package …
Run Code Online (Sandbox Code Playgroud)

macos haskell ghci happstack haskell-snap-framework

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

jquery nth-child点击

我有以下代码:

CSS:

nav div:nth-child(1) { background: red; }
nav div:nth-child(2) { background: blue; }
nav div:nth-child(3) { background: yellow; }
Run Code Online (Sandbox Code Playgroud)

HTML:

<nav>
 <div>item #1</div>
 <div>item #2</div>
 <div>item #3</div>
</nav>
Run Code Online (Sandbox Code Playgroud)

jQuery的:

  $(document).ready(function() {

      $('.nav div:nth-child').click(function) {
          console.log(this);
      });

  });
Run Code Online (Sandbox Code Playgroud)

编辑:我现在得到:未捕获的异常:语法错误,无法识别的表达式:: nth-child

如何使用jquery单击nth-child并获取像CSS这样的项目编号?例如:我点击第二个,jquery将返回2

jquery html5 click

26
推荐指数
1
解决办法
9073
查看次数

如何在Django中向ChoiceField添加"类"?

我有一个ChoiceField我的Django表格:

gender = forms.ChoiceField(label='', choices=GENDER)
Run Code Online (Sandbox Code Playgroud)

我想添加一个class attr字段,以便我可以设计它.像下面这样的东西通常有效:

forms.Field(label="Display name",help_text='',widget=forms.TextInput(attrs={'class': 'wideInput'}))
Run Code Online (Sandbox Code Playgroud)

但是这对ChoiceField不起作用,我得到以下错误:

TypeError:init()得到一个意外的关键字参数'attrs'

widget应该使用什么来为我的ChoiceField添加一个类?

django

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

获取http/https协议以匹配maps.google.com的<iframe>

我试图使用<iframe>谷歌地图的包含,但是由于不匹配,控制台抛出了几个错误,但没有明显的不匹配,所以我假设它必须是谷歌地图一侧的功能/过程.

特别是使用maps.google.com,根据这一点,似乎对iframe的脚本进行了更改.

控制台中的错误是这样的:(我在页面加载时得到至少30个错误)

Unsafe JavaScript attempt to access frame with URL http://www.developer.host.com/ from
frame with URL https://maps.google.com/maps/msmsa=0&msid=
212043342089249462794.00048cfeb10fb9d85b995&ie=UTF8&t=
m&ll=35.234403,-80.822296&spn=0.392595,0.137329&z=10&output=embed. 

The frame requesting access has a protocol of 'https', the frame being
accessed has a protocol of 'http'. Protocols must match.
Run Code Online (Sandbox Code Playgroud)

由于我的网站是http而不是https,并且地图网址是http,为什么会出现不匹配问题,如何解决此问题以使其匹配?

javascript https google-maps protocols http

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