根据手册,我似乎在努力克服我认为是捆绑器的标准功能.
使用:platforms选项或platforms块,某些平台需要指定gems的能力
我想根据所使用的ruby版本指定不同版本的gem
source "http://rubygems.org"
gem "trollop", "~> 1.16.2"
gem "chronic", "~> 0.6.4"
gem "highline", "~> 1.6.2"
gem "colorize", "~> 0.5.8"
gem "queryparams", "~> 0.0.3"
platforms :ruby_18 do
gem "json"
gem "activesupport", "~>2.8.9"
end
platforms :ruby_19 do
gem "activesupport", "~>3.1.3"
end
Run Code Online (Sandbox Code Playgroud)
但是这在运行时失败了 bundle install
You cannot specify the same gem twice with different version requirements.
You specified: activesupport (~> 2.8.9) and activesupport (~> 3.1.3)
Run Code Online (Sandbox Code Playgroud) 在使用r.js 进行优化之后,我很难让requirejs工作.它正常工作我正在遵循配置main.js和构建配置文件的文档empty:
但是在优化之后,不再加载CDN脚本.
公共/ index.html的
<script data-main="editor/js/main" src="editor/js/vendor/require.js"></script>
Run Code Online (Sandbox Code Playgroud)
公共/编辑/ JS/main.js
requirejs.config({
baseUrl: "/editor/js",
paths: {
"jquery": "http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min",
"order": "vendor/require_order",
"underscore": "vendor/underscore",
"handlebars": "vendor/handlebars-1.0.0.beta.4",
"jquery.mobile.router": "vendor/jquery.mobile.router",
"jquery.mobile": "http://code.jquery.com/mobile/1.0.1/jquery.mobile-1.0.1.min"
}
});
require(["order!jquery", "order!underscore", "order!handlebars", "order!jam", "order!jquery.mobile"], function () {
//loaded
});
Run Code Online (Sandbox Code Playgroud)
配置/ build.js
({
baseUrl: "../public/editor/js",
name: "main",
out: "../public/editor/js/main-built.js",
paths: {
"order": "vendor/require_order",
"underscore": "vendor/underscore",
"handlebars": "vendor/handlebars-1.0.0.beta.4",
"jquery.mobile.router": "vendor/jquery.mobile.router",
"jquery": "empty:",
"jquery.mobile": "empty:"
}
})
Run Code Online (Sandbox Code Playgroud)
当我运行r.js node config/r.js -o config/build.js
main-built.js成功构建.
jquery :visible和:hidden选择器有点误导,他们选择在文档中占用空间的元素,因此即使它不是o_O visibility:hidden也被归类为:visible
我需要能够只选择:reallyvisible我能用眼睛看到的元素,例如,不是opacity:0或visibility:hidden
显然,对于一个元素在视觉上可见所有它的祖先也必须是可见的所以我假设一个递归的查找树是必要的.
这太贵了吗?谁能建议一种可靠有效的方法来实现这一目标?
我知道有许多时区与UTC / GMT有相同的偏移量。使用strftime('%Z')时,它以小时/分钟为单位返回偏移量。
有谁知道将时区作为3个字符的时区字符串的简单方法,例如。+0100 => CET
我在自己的time_formats.rb初始化程序中按自己的日期格式定义了
Time::DATE_FORMATS[:friendly_datetime] = '%A, %-d %B %Y at %H:%M %Z'
这将产生:
Sunday, 11 January 2015 at 20:00 +0100
我希望%Z(+0100)为CET。我考虑过要创建自己的翻译哈希,并在自定义时间格式上使用proc。我有点希望有一种内置的方式,或者也许是我不知道的宝石。
关于按名称动态调用函数有很多类似的问题.但是,我找不到我的特定问题的解决方案,其中我在闭包内部有本地函数,而不将函数暴露给我的对象的公共接口.
让我们看一些代码(这是一个虚构的例子)......
(function(window,$) {
MyObject = (function($) {
var obj = {};
obj.publicMethod = function(number,otherarg) {
this['privateMethod'+number].apply(this,[otherarg]);
};
var privateMethod1 = function(arg) {
//do something with arg
};
var privateMethod2 = function(arg) {
//do something else with arg
};
return obj;
})($);
window.MyObject = MyObject;
})(window,jQuery);
Run Code Online (Sandbox Code Playgroud)
这不起作用,因为"this"是MyObject,并且不公开本地函数.此外,我希望能够在尝试调用之前检查函数是否存在.例如.
var func_name = 'privateMethod'+number;
if($.isFunction(this[func_name])) {
this[func_name].apply(this,[otherarg]);
}
Run Code Online (Sandbox Code Playgroud)
我不确定如何继续进行,除了将我的私有函数暴露给公共接口之外,它一切正常.
obj.privateMethod1 = function(arg) {
//do something with arg
};
obj.privateMethod2 = function(arg) {
//do something else with arg
};
Run Code Online (Sandbox Code Playgroud)
我的想法已经不多了.非常感谢您的帮助和建议.
我正在使用jQuery Mobile和jQuery Mobile Router来动态更改listviews的内容.
在更改处理程序中,我正在动态地将内容添加到插入列表视图中,然后调用listview('refresh')以将所有样式重新应用于新元素.它主要起作用,但是当它应用于ui-corner-allUL时ui-corner-top,ui-corner-bottom类不应用于正确的LI,因此它们不会应用圆角.

我准备了一个演示该问题的实例.第一页是静态的,第二页是在rounter处理程序中生成的,它由jqm beforepageshow事件触发
谢谢你的帮助.
是否仍然可以(Lion)在网页中嵌入Quartz Compositions(对于OSX Safari用户)?
文档在
表明Quartz Compositions应该可以嵌入到网页中
<embed type="application/x-quartzcomposer"
src="my_composition.qtz"
id="myComposition"
width="300px"
height="150px"
opaque="false">
</embed>
Run Code Online (Sandbox Code Playgroud)
但是我在Safari 5中看到了"Missing Plugin"消息.
做Safari>帮助>已安装的插件没有显示配置为处理.qtz文件的插件,但浏览到库> Internet插件,我有一份Quartz Composer.webplugin
我究竟做错了什么?
我希望能够声明一个具有3级继承的泛型类,我无法从继承树的顶部获取泛型类型到泛型.
所以在这个例子中,动物的类型将是狗.这将如何实现?
public class Animal<T> : MonoBehaviour where T : MonoBehaviour
{
}
public class Quadruped<T> : Animal<T> where T
{
}
public class Dog : Quadruped<Dog>
{
}
Run Code Online (Sandbox Code Playgroud)
目前我确定如何继续,这是无效的
类型'T'不能用作泛型类型或方法'Animal'中的类型参数'T'.从'T'到'UnityEngine.MonoBehaviour'没有装箱转换或类型参数转换.[汇编CSHARP]