Firefox和Safari不使用带有阿拉伯语连字的字体呈现文本
这是一个示例字形svg字体:
<glyph unicode="??????" glyph-name="uniFB51" horiz-adv-x="1423" d="path.." />
Run Code Online (Sandbox Code Playgroud)
尝试用英文文本替换阿拉伯语连字,它的工作原理!
<glyph unicode="1234" glyph-name="uniFB51" horiz-adv-x="1423" d="path.." />
Run Code Online (Sandbox Code Playgroud)
这两个浏览器出了什么问题?我该如何解决这个问题,我是否在使用连字法做错了什么?
演示:http://ligga.herokuapp.com/ 请在chrome和firefox中测试演示以查看差异.
[class^="icon-"], [class*=" icon-"] {
font-family: 'icomoon' !important;
speak: none;
font-style: normal;
font-weight: normal;
font-variant: normal;
text-transform: none;
line-height: 1;
letter-spacing: 0;
-webkit-font-feature-settings: "liga";
-moz-font-feature-settings: "liga=1";
-moz-font-feature-settings: "liga";
-ms-font-feature-settings: "liga" 1;
font-feature-settings: "liga";
-webkit-font-variant-ligatures: discretionary-ligatures;
font-variant-ligatures: discretionary-ligatures;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
Run Code Online (Sandbox Code Playgroud)
我想验证两个字段的唯一性,但如果第二个字段为零只是忽略验证我有两个模型'资产'和'公司'资产有一个唯一的标识符代码我想要做的是验证资产的标识符代码的唯一性与公司.我们可以检查一下
class Asset < ActiveRecord::Base
validates :identifier, :uniqueness => {:scope => :company_id}
end
Run Code Online (Sandbox Code Playgroud)
但这也不允许两个资产为零
如果没有,我怎么能忽略标识符代码唯一性的验证
我们可以通过一个块,或添加except
或类似我们可以用控制器中的过滤器我正在寻找一些解决方案
validates:identifier,:uniqueness => {:scope =>:company_id},除非{:identifier.is_nil?}
我可以通过一些验证前回调跳过验证吗?
我想用逗号分割一个字符串:
"a,s".split ',' # => ['a', 's']
Run Code Online (Sandbox Code Playgroud)
如果它被括号括起来,我不想拆分子串:
"a,s(d,f),g,h"
Run Code Online (Sandbox Code Playgroud)
应该产量:
['a', 's(d,f)', 'g', 'h']
Run Code Online (Sandbox Code Playgroud)
有什么建议吗?
https://www.funtraker.com正在列出电影,电视节目和游戏.在每个资源(电影,电视节目等)的显示页面上,我们要列出相关资源.
class Movie < AR::Base
has_many :resource_genres, as: :resource
has_many :genres, through: :resource_genres
end
class ResourceGenre
belongs_to :resource, polymorphic: true
end
Run Code Online (Sandbox Code Playgroud)
现在我想得到一个基于匹配类型的相关电影列表(两部电影都是相关的,如果它们都有'喜剧'类型).这些相关电影需要按最大匹配类型排序.
那么这里是样本电影和预期的输出.
#Input
Movie Genres
Movie 1: horror, comedy, action, war
Movie 2: action, thriller, crime, animation
Movie 3: comedy, war, action, thriller
Movie 4: crime, animation, action, war
#Expected output
movie1.related_movies => [ movie3, movie2 ]
movie4.related_movies => [ movie2, remaining-three-movies-in-any-order ]
movie3.related_movies => [ movie1, movie2, movie4]
Run Code Online (Sandbox Code Playgroud)
希望问题有意义.
更新:寻找仅SQL解决方案.我不需要将结果缓存在任何其他表中.
Ruby 1.9.2的新哈希语法存在一个奇怪的问题.如何在1.9.2中将任何Object作为密钥放入哈希?
在1.8.7哈希它工作:
a="b"
{"a" => "some",a => "another value",:a => "3rd value"}
Run Code Online (Sandbox Code Playgroud)
但是在1.9.2中>我们不能(或者如果我错了怎么办?)
1.9.2哈希:
{a: "some"} => {:a=>"s"} #it convert to old hash format
Run Code Online (Sandbox Code Playgroud)
但
a="a"
{a: "..."} # This doesn't work
{"a": "some value"} => syntax error, unexpected '}', expecting $end
from /home/naveed/.rvm/rubies/ruby-1.9.2-p290/bin/irb:16:in `<main>'
{1: "s"} =>
SyntaxError: (irb):11: syntax error, unexpected ':', expecting tASSOC {1: "s"}
Run Code Online (Sandbox Code Playgroud) (对不起我的英语不好)
我正在尝试我的第一个rails web应用程序.这是我的代码:
模型:
class Movie < ActiveRecord::Base
attr_accessible :about, :title, :url
end
Run Code Online (Sandbox Code Playgroud)
控制器:
class MoviesController < ApplicationController
def show
@movie = Movie.find(params[:id])
end
def update
@mov = Movie.find(params[:id])
if @mov.update_attributes(params[:id])
redirect_to movies_path, :notice => "Your movie has been updated."
else
render "show"
end
end
def destroy
end
end
Run Code Online (Sandbox Code Playgroud)
Run Code Online (Sandbox Code Playgroud)<%= form_for @movie do |m| %> <center> <table> <td valign='middle' align='right'> Title: </td> <td> <%= m.text_field :title %> </td> <tr> <td valign='middle' align='right'> Description: </td> <td> <%= m.text_area :about %> …
ruby ×3
activerecord ×1
arabic ×1
firefox ×1
fonts ×1
hash ×1
join ×1
ligature ×1
postgresql ×1
regex ×1
ruby-1.9.2 ×1
validation ×1
webfonts ×1