save_and_open_page
have_button(locator)| /* | |
| _ooOoo_ | |
| o8888888o | |
| 88" . "88 | |
| (| -_- |) | |
| O\ = /O | |
| ____/`---'\____ | |
| .' \\| |// `. | |
| / \\||| : |||// \ | |
| / _||||| -:- |||||- \ |
| # Install specific version of Homebrew formula | |
| # usage example: | |
| # $ brew-install ssh-copy-id 6.0p1 | |
| function brew-install { | |
| local formula version formula_hash | |
| formula=$1 | |
| version=$2 | |
| cd `brew --prefix` | |
| git_last_commit_id=`git rev-parse --short HEAD` |
| 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 |
| 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 |
| 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> |
| 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 |
| # 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 = {}) |
| 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 |
| 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] |