Home
Wade Ruby
Cancel

Rufu Scheduler的at,只能用time格式(onlyuseaspecifictimeformatinrufuscheduler'sat)

如题。 下面是个例子: # -*- encoding : utf-8 -*- ENV['RAILS_ENV'] = ARGV.first || ENV['RAILS_ENV'] || 'production' require File.expand_path(File.dirname(__FILE__) + "/../config/environment") require 'rubygem...

Ruby中的return(the'return'keywordinruby)

Ruby中的 return 还是有些学问的,平时用着看不出来,但是真到见真章的时候就考验功夫了: 1. eval 中不能出现 return ,否则会报错 (LocalJumpError) 2. Proc.new 中不能出现return, 出错也是 LocalJumpError 3. lambda中可以return . 在caller method中之后继续执行 4. 总则: 在ru...

使用bower管理javascript,css

1. 更新: npm update -g bower 2. cd <your project> && bower init { "name": "bestProjectEvar", "version": "1.2.3", "main": "./path/to/main.js", "dependencies": { "jquery":...

Blockbasicinruby(block基础)

以前虽然学习过block, proc, lambda, 但是一直没有大规模的使用。最近的项目让我不得不用到这个技术。但是遇到些问题。翻了书才知道原委。 (I have to review the 'block in Ruby' because of one of my projects) 一个例子: (a concise example) # no &param in this me...

Newfeatureinrails4:strongparameters(rails4的新特性)

今天开始了一个RAILS4的项目。 扑面而来的一个特性: strong parameter( today I started my first Rails 4 project and met the "strong parameter" feater)  传统的rails 3 项目,需要在model中控制 可以访问的属性(in Rails 3, the attribute whit...

使用pyramidcas

注: 不好用,还是算了吧,回归rails.  1. git clone https://github.com/aaguirre/pyramid_cas.git 2. use your pyramid_env ( cd <pyramid_env> && . bin/active) 3. cd <pyramid_cas folder> &...

使用angular Ui时,不但要有对应的js,还要有jquery和jqueryui

嗯哪。 还是找个 gem 组件吧,在rails 中用的话。 pyramid ...哎。。。

使用不同版本的rails来建立新项目(createrailsprojectwithaspecificrailsversion)

see: http://stackoverflow.com/questions/379141/specifying-rails-version-to-use-when-creating-a-new-application   $ gem list -l rails  # =>  3.0.1, 4.0.1, 4.0.0 $ rails _3.0.1_ new...

Angular刷新当前页面

refer to:  http://stackoverflow.com/questions/16703215/how-to-reload-or-re-render-the-entire-page-using-angularjs $location.path('/') # 可以刷新到除当前页面之外的页面 $route.reload() # 刷新当前页面 , 类似于 rai...

在ruby中模拟class。(openstructandstructinruby)

今天碰到一个困难,我想在gem 中调用另外一个项目的model. 可我又不想把那个项目的代码copy 过来,也不想用factory_girl, (太麻烦了)。 想到 delayed_job 中使用了struct 这个东东,所以我google了一下发现还有个 openstruct.   ( today I am trying to write the unit test code i...

Fromrailstodjango(viceversa)从rails到django(反之亦然)

checkout this post:    http://blog.jupo.org/2011/07/30/rails-quick-start-for-djangonauts/ July 30, 2011  /  Home I recently started a new role at a Ruby on Rails shop, which a...

Rails中手动开关connection(closeopenconnectionsinrails)

for details, please refer to : http://blog.daniel-azuma.com/archives/216 connection = User.connection obj = User.find(1) connection = obj.connection User.clear_active_connections! $ show &#160...

使用jeweler来管理发布建立你的rubygem(usingjewelertomanageyourrubygemproject)

refer to: https://github.com/technicalpickles/jeweler . TODO: finish this post. <p>经典方式请看这里:  http://siwei.me/blog/posts/classic-way-to-publish-a-rubygem </p>

Rubyseleniumgem:selenium Webdriver(复制过来的文档)

 官方文档挂了,所以我就复制过来了。看起来很有效。( copied from other site because it seems that we can't access its official site from China mainland )  Introduction The Ruby bindings for Selenium/WebDriver...

经典方式发布一个rubygem(classicwaytopublisharubygem)

( 如何写gem, 在这里 simplest gem guide here: how to create a gem   )  1. 写好你的gem (finish your gem )  2. gem build youku_video_utility.gemspec (确认你的credential 文件是正确的-- 登录rubygems.org之后...

正则表达式中的贪婪和懒惰(greedyexpressioninregexp)

in short: adding "?" to the regexp "123 123 123".match(/1.*3/) # => "123 123 123" "123 123 123".match(/1.*?3/) # => "123" http://rubyer.me/blog/357/ 6、贪婪匹配vs懒惰匹配这两种匹配属于标准正则表达式内容,与Ruby没关,...

Rubyonlyincludemodule1time(preventincludingamodulemultipletimes)

approaches: 1. use raw ruby ( not recommended)    2. use ActiveSupport::Concern ( http://api.rubyonrails.org/classes/ActiveSupport/Concern.html ) p.s. 3. require_dependency &#16...

使用mongoid后无法generatemigration(can'tinvolkrailsgmigration)

看这里有解决方案: ( see this post:  http://stackoverflow.com/questions/6372626/using-active-record-generators-after-mongoid-installation) $ rails g active_record:migration 之所以会这样,是因为mongoid 一样会调用...

定时执行的几个gem比较(comparisonofscheduled Taskgems)

delayed_jobs: 可以延后执行一个任务。最常见的: 发送EMAIL。( it is used for one-off tasks, classic example: sending emails) whenever: 可读性极强的 crontab.   需要配合具有crontab的操作系统来使用   ( fits for those OS with cronta...

Encodingprobleminruby(ruby中的汉字转换)

Today I am face a problem:  how to convert 汉字 to \uxxx\uxxx ?  after googled and quickly browsed several posts, I found this answer:   Using active support:  >> require ...