noEmptyCities = cities.reject { |c| c.empty? }
reject 后面跟着要去除的条件
Every day to be a little better
controller
1 | before_action :detect_browser, only: :index |
在对应的action里面
1 | respond_to do |format| |
方法
1 | def detect_browser |
页面名称 例如:index.html+mobile.erb
这样在手机上就会自动走手机版的页面了
ps: 不用添加路由
右上左下
background:
linear-gradient(135deg, transparent 49.5%, deeppink 49.5%, deeppink 50.5%, transparent 50.5%);
左上右下
background:
linear-gradient(45deg, transparent 49.5%, deeppink 49.5%, deeppink 50.5%, transparent 50.5%);
html
1 | <div class="other-example-divider"> |
css
1 | .other-example-divider |
lstrip : 去掉首空格
rstrip : 去掉尾空格
gsub : 去掉全部空格,不过要用到pattern匹配
eg:
s1 = “ Test whitespace”
s2 = “ hello Ruby Rails “
s3 = “trailing “
puts s1.lstrip+s3 # show lstrip remove leading whitespace
puts s2.rstrip+s3 # show rstrip remove trail whitespace
puts s1.strip + s2.strip + s3 # show strip remove leading and trail whitespace
puts s2.gsub(/\s+/,’’)
puts s2.gsub(‘ ‘,’’)
puts s2.gsub!(‘ ‘,’’)
puts s2.gsub(//,’’) # four methods show remove all whitespace
str.gsub(/^ | $/,””)去掉首尾空格
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
ps:对于table来说要给 table 加一个
1 | table { |
1 | - (void)webView:(WKWebView *)webView runJavaScriptConfirmPanelWithMessage:(NSString *)message initiatedByFrame:(WKFrameInfo *)frame completionHandler:(void (^)(BOOL))completionHandler{ |
ps: 一定要加
_webView.UIDelegate = self;