如何检查客户端计算机上加载的jQuery版本?客户端可能已加载jQuery但我不知道如何检查它.如果它们已加载,我如何检查版本和前缀,例如:
$('.class')
JQuery('.class')
Run Code Online (Sandbox Code Playgroud) 我注意到ZSH中任何cURL请求的返回都以a结尾%,例如:
$ curl http://textbelt.com/text -d number="555555555" -d message="hey"
=> { "success": true }%
Run Code Online (Sandbox Code Playgroud)
为什么要添加此字符,是否有标准的删除方法?
注意:ZSH是我注意到这种情况发生的唯一shell(在bash csh ksh sh tcsh zsh中测试)
我正在尝试设置键绑定来物理移动当前选项卡,无论是在其他选项卡的右侧还是左侧(而不是单击并拖动以重新排列它们).
我知道添加了用户定义的键绑定~/.atom/keymap.cson,我只是在确定命令时遇到问题,因为我没有看到它出现在默认的键绑定中.
因为我想要更新我的OSX到El Capitan哦我的Zsh upgrade_oh_my_zsh我得到以下错误:
Upgrading Oh My Zsh
fatal: Not a git repository (or any of the parent directories): .git
There was an error updating. Try again later?
Run Code Online (Sandbox Code Playgroud)
我从来没有使用过git,在互联网上搜索这个致命的错误,他们建议git init在/.oh-my-zsh文件夹中做.运行此命令后,当我upgrade_oh_my_zsh再次尝试运行时,会发生新的致命错误.
fatal: 'origin' does not appear to be a git repository
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
Run Code Online (Sandbox Code Playgroud)
我不知道它是否与它有任何关系但是当我打开终端(iTerm2)时我也收到了这个通知:
/Users/peter/.zshrc:1: command not found: Path
Run Code Online (Sandbox Code Playgroud)
任何人都有这方面的经验或知道我的问题的解决方案?
当第一个条件为假时,ruby是否会停止评估if语句?我不断地得到undefined method `ready' for nil:NilClass>如song = nil.
if !song.nil? && song.ready && !song.has_been_downloaded_by(event.author)
song.send_to_user(event.author)
nil
elsif !song.ready
"The song is not ready yet. Try again once it is."
elsif song.has_been_downloaded_by(event.author)
"Yo, check your private messages, I've already sent you the song."
else
'Song with such index does not exist.'
end
Run Code Online (Sandbox Code Playgroud) 我发现在Ruby中使用整数会导致它们的二进制表示形式大于32位时,它们的行为不同于JS。
a = 144419633058839139324
b = 3903086624
Run Code Online (Sandbox Code Playgroud)
JS:
a >> 0; => 1482555392
b >> 0; => -391880672
Run Code Online (Sandbox Code Playgroud)
红宝石:
a >> 0 => 144419633058839139324
[a].pack('V').unpack('V').first => 1482560508
[b].pack('V').unpack('V').first => 3903086624
Run Code Online (Sandbox Code Playgroud)
我的问题是如何转换我的Ruby代码以提供相同的返回值JS?
按照这里的步骤"gem install therubyracer -v'0.10.2"对osx mavericks没有安装,我能够得到therubyracer -v 0.10.2和0.12.0安装好,但不是0.11.4.
gem install therubyracer -v 0.11.4
返回:
Building native extensions. This could take a while...
ERROR: Error installing therubyracer:
ERROR: Failed to build gem native extension.
/Users/thooper/.rbenv/versions/2.1.2/bin/ruby -r ./siteconf20150102-7132-9ct9a4.rb extconf.rb
creating Makefile
Compiling v8 for x64
Using python 2.7.9
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Unable to find a compiler officially supported by v8.
It is recommended to use GCC v4.4 or higher
Using compiler: g++
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Unable to find a …Run Code Online (Sandbox Code Playgroud) 我正在尝试编写自己的转置方法.我想知道不同形式的连接如何影响我的代码.
multi = [[1,3,5],[2,4,6],[7,9,8]]
new = Array.new(multi.length, [])
multi.each do |c|
c.each_with_index do |x,y|
new[y] += [x]
end
end
new #=> [[1, 3, 5], [2, 4, 6], [7, 9, 8]]
Run Code Online (Sandbox Code Playgroud)
multi = [[1,3,5],[2,4,6],[7,9,8]]
new = Array.new(multi.length, [])
multi.each do |c|
c.each_with_index do |x,y|
new[y] << x
end
end
new #=> [[1, 3, 5, 2, 4, 6, 7, 9, 8], [1, 3, 5, 2, 4, 6, 7, 9, 8], [1, 3, 5, 2, 4, 6, 7, 9, 8]]
Run Code Online (Sandbox Code Playgroud)
为什么他们不能以相同的方式工作?
我错误地编写了一个方法,该方法将一个变量赋值给方法调用的返回值,该方法调用在以前未定义时将参数传递给参数.我很想知道这是Ruby中的错误,还是实际的预期行为?
RUBY_VERSION
#=> "2.2.4"
def red(arg)
arg
end
# this is expected since blue is not defined
blue
NameError: undefined local variable or method 'blue' for main:Object
from (pry):8:in '__pry__'
red(blue)
NameError: undefined local variable or method 'blue' for main:Object
from (pry):4:in '__pry__'
# here's the weird part
blue = red(blue)
#=> nil
blue
#=> nil
Run Code Online (Sandbox Code Playgroud) ruby ×5
macos ×2
atom-editor ×1
command-line ×1
curl ×1
git ×1
javascript ×1
jquery ×1
loops ×1
oh-my-zsh ×1
osx-yosemite ×1
therubyracer ×1
zsh ×1