草庐IT

time-grunt

全部标签

ruby - 在Ruby中,过滤一个对象中所有包含单词 "time"的方法的好方法是什么?

我尝试了以下方法,部分有效:>>s.methods.map{|n|nifn=~/time/}=>[nil,nil,nil,nil,nil,nil,nil,nil,"skip_time_zone_conversion_for_attributes",nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,"timestamped_migrations",nil,nil,nil,nil,nil,nil

ruby-on-rails - rails : how to create Time object in specific time zone

我的应用在“莫斯科”(+04:00)时区运行。但有时我只需要按本地时间(例如“2012年5月1日13:45”)和ActiveSupport::TimeZone对象的名称(例如“Berlin”:夏令时+02:00和+01:00否则)。例如,如果我将“2012年5月1日13:45”和“柏林”作为输入,我想产生“2012-05-0113:45:00+0200”或“2012-05-0111:45”:00+0000”。我创建了以下函数:deffrom_local_datetime(local_datetime,time_zone)offset=Time.now.in_time_zone(time

ruby - 从 Font-Awesome-Sass gem 中获取字体,复制到 grunt compass 输出目录中

我已经成功安装了“font-awesome-sass”ruby-gem,并通过“require”-property将其包含在compassgunt-config中,并通过“import”-rule将其包含在我的scss中。所以font-awesomescss被编译到我的output-css文件中,这到目前为止有效。我现在的问题是:如何将字体文件(.woff、.otf、..)从ruby​​-gem获取到我的grunt输出目录中。这些文件已在位于“../css/fonts/”目录中的output-css中被引用,但它们不会被自动复制。我错过了什么吗? 最佳答案

ruby - 生成源映射时出错 - grunt 和 sass 配置

我正在尝试将sass与grunt一起使用。我已经在路径中安装了ruby​​、sass和grunt。版本是,node:0.10.20npm:1.3.11grunt-cli:0.1.13grunt:0.4.5sass:3.4.4我的包json是,"private":true,"devDependencies":{"express":"4.x","grunt":"~0.4.1","grunt-contrib-sass":"~0.3.0","grunt-contrib-watch":"~0.4.4"}我的grunt文件是,module.exports=function(grunt){grunt

ruby-on-rails - 是否存在 Ruby 1.8.7 time.strftime %z 错误?

我在使用Ruby1.8.7strftime时遇到问题,其中%z在我将时间转换为UTC后返回本地时间。我正在做以下事情:>>t=Time.now=>MonDec1915:20:16-08002011>>t.strftime("%z")=>"-0800">>t=Time.now.utc=>MonDec1923:20:28UTC2011>>t.strftime("%z")=>"-0800"即使在我将时间更改为UTC之后,格式化的时区也默认为我​​的本地PST-0800。这是一个已知问题吗?有办法解决吗? 最佳答案 请注意fine1.8.7

Ruby time.new 与 time.now

testfirst.orgPerformanceMonitorrspec我正在处理由testfirst.org提供的上述问题。下面是我的代码,所有测试都通过了:defmeasure(iterate=1)timestamp=Time.nowiterate.times{yield}timestamp_end=Time.now(timestamp_end-timestamp)/iterateend但是,如果我将Time.now替换为Time.new,一些测试会失败。我读到Time.now是Time.new的别名。那么,为什么测试会失败?使用这两种方法有什么区别?

ruby-on-rails - ruby rails : Why does calling a partial in my views take an extended time to render?

例如,我在我的recipes/_cuisines.html.erb文件中调用了三个部分:该文件中没有其他内容。部分只是没有集合的静态内容。这是我从日志中得到的:Renderedrecipes/cuisines/_denmark.html.erb(4.6ms)[cachemiss]Renderedrecipes/cuisines/_spain.html.erb(2.3ms)[cachemiss]Renderedrecipes/cuisines/_italy.html.erb(5.3ms)[cachemiss]Renderedrecipes/_cuisines.html.erb(161.5

ruby - Time.strptime 不解析周格式化程序?

使用Ruby2.1,我试图找到Time#strftime('%Y%U')的倒数。例如:s=Time.parse("2014-05-0716:41:48-0700").strftime('%Y%U')#201418t=Time.strptime(s,'%Y%U')#Expected:2014-05-0400:00:00-0700#Actual:2014-01-0100:00:00-0800Thistopic建议使用%G所以我阅读了文档并尝试了它,但我得到的只是当前时间。例如:t=Time.strptime('201418','%G%U')#2014-05-1312:07:51-0700根

ruby - Grunt/Bundler 不会使用指定的 sass 版本

我们有一个使用Grunt和Bundler设置的项目。所有这些都安装没有问题。生成Gemfile.lock,提取正确的gems,并使用npm创建grunt文件。我们开始监视该项目,它在sass编译时爆炸,因为它使用了错误版本的sass而不是gemfile中指定的版本。顺便说一下,这是在Windows上...gem文件source'https://rubygems.org'gem'sass','~>3.2'gem'compass','~>0.12'gem'susy','~>1.0'Gemfile.lockGEMremote:https://rubygems.org/specs:chunky

ruby-on-rails - 为什么 Date.tomorrow > Time.now 在 Ruby on Rails 中返回 false?

查看RoRpry控制台结果:[1]pry(main)>Date.tomorrow>Time.now=>false[2]pry(main)>Date.tomorrow.to_time>Time.now=>true[3]pry(main)>Date.tomorrow=>Tue,07Oct2014[4]pry(main)>Time.now=>2014-10-0622:52:40-0400添加了时间戳结果,让您知道粗略的值。 最佳答案 因为Date.tomorrow是明天而Time.nowUTC也是明天。您会注意到您在10:52pm执行此操