save_and_open_page
have_button(locator)| //豆瓣:只显示楼主 | |
| javascript:void(function(){$(".topic-reply li").each(function(){ if($(this).find(".user-face a").attr('href')!=$(".user-face:first").find('a').attr('href')){$(this).toggle() } });})(); |
| // Fixed for prototype extend issue | |
| function hackjQuery(jQuery){ | |
| if(jQuery.fn.jquery == '1.3.2'){ | |
| jQuery.event.handle = function(event) { | |
| // returned undefined or false | |
| var all, handlers; | |
| event = arguments[0] = jQuery.event.fix( event || window.event ); | |
| event.currentTarget = this; |
| RewriteRule ^/jobs/([^-^/]*)-([^-]*)-([^-]*)-([^-]*)-([^-]*)-([^-]*)-([^-]*)-(.*) /house/$8/trade=$1&category=$2&subclass=$3&district=$4&education=$5&education=$6&experience=$7 [C,NC] | |
| RewriteRule ^/jobs/([^-^/]*)-([^-]*)-([^-]*)-([^-]*)-([^-]*)/(.*) jobs-list.php?$6&wage=$1&nature=$2&searchtype=$3&key=$4&page=$5 [QSA,L,NC] |
| require 'methodfinder' | |
| # _why's MethodFinder addition tweaked and revised. | |
| # <http://redhanded.hobix.com/inspect/stickItInYourIrbrcMethodfinder.html> | |
| class MethodFinder | |
| def self.with_redirected_streams | |
| redirect_streams | |
| yield | |
| ensure |
| # ActiveAdmin use Formtastic as the "filter" field builder | |
| # this patch allowed to use a proc to :label option, then we can pass a proc to `filter` method | |
| # e.g.: filter :foo, :label => proc { I18n.tr('activerecord.attributes.foo.bar') } | |
| module Formtastic | |
| class Localizer | |
| def localize_with_proc_value(key, value, type, options = {}) | |
| if value.is_a?(::Proc) | |
| value.call(key) | |
| else | |
| localize_without_proc_value(key, value, type, options = {}) |
| ActiveAdmin.register AdminUser do | |
| # define routes for "autocomplete :admin_user, :email" | |
| collection_action :autocomplete_admin_user_email, :method => :get | |
| controller do | |
| autocomplete :admin_user, :email | |
| end | |
| index do | |
| column :email |
| data:text/html, <style type="text/css">#e{position:absolute;top:0;right:0;bottom:0;left:0;}</style><div id="e"></div><script src="http://d1n0x3qji82z53.cloudfront.net/src-min-noconflict/ace.js" type="text/javascript" charset="utf-8"></script><script>var e=ace.edit("e");e.setTheme("ace/theme/monokai");e.getSession().setMode("ace/mode/ruby");</script> |
| class Photo < ActiveRecord::Base | |
| module Statues | |
| QUEUED = 'queued' | |
| NEW = 'new' | |
| def self.values | |
| constants.map(&method(:const_get)) | |
| end | |
| # you can define more special methods as you wanted for Statues | |
| end |
| namespace :private_pub do | |
| desc "Start private_pub server" | |
| task :start do | |
| run "cd #{current_path};RAILS_ENV=#{rails_env} bundle exec rackup private_pub.ru -s thin -E #{rails_env} -D -P tmp/pids/private_pub.pid" | |
| end | |
| desc "Stop private_pub server" | |
| task :stop do | |
| run "cd #{current_path};if [ -f tmp/pids/private_pub.pid ] && [ -e /proc/$(cat tmp/pids/private_pub.pid) ]; then kill -9 `cat tmp/pids/private_pub.pid`; fi" | |
| end |