-
Specify RAILS_CACHE directly in environment.rb, like:
RAILS_CACHE = ActiveSupport::Cache.lookup_store :memory_store
. -
Use
config.cache_store=
, like:config.cache_store = :memory_store
. In fact, it callsActiveSupport::Cache.lookup_store
. -
Another example of
cache_store
usage: config.cache_store = [:mem_cache_store, 'memhost:11211', {:namespace => 'gimi', :autofix_keys => true}] -
By default,
ActionController::Base.cache_store
will be set to RAILS_CACHE, but it can be changed by usingActionController::Base.cache_store=
. -
About session store:
ActionController::Base.session=
will setActionController::Base.session_options
.ActionController::Base.session_store=
decides which store will be used.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
v=0416;eval$s=%q~d=%!^Lcf<LK8, _@7gj*LJ=c5nM)Tp1g0%Xv.,S[<>YoP | |
4ZojjV)O>qIH1/n[|2yE[>:ieC ".#####%.#% " 97N-A&Kj_K_><wS5rtWk@*a+Y5 | |
yH?b[F^e7C/56j|pmRe+:)B " .#####%##% :" O98(Zh)'Iof*nm.,$C5Nyt= | |
PPu01Avw^<IiQ=5$'D-y? " #####%###: #" g6`YT+qLw9k^ch|K'),tc | |
6ygIL8xI#LNz3v}T=4W " %######## #." lL27FZ0ij)7TQCI)P7u | |
}RT5-iJbbG5P-DHB<. " :####### ###" R,YvZ_rnv6ky-G+4U' | |
$*are@b4U351Q-ug5 " ###: : ####" 00x8RR%`Om7VDp4M5 | |
PFixrPvl&<p[]1IJ " %#... #####" EGgDt8Lm#;bc4zS^ | |
y]0`_PstfUxOC(q " %### .#####" /,}.YOIFj(k&q_V | |
zcaAi?]^lCVYp!; " :. %% .#####" ;s="v=%04o;ev"% |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 所以收录中国所有省份信息。 | |
CHINA_PROVINCES = { | |
'北京市' => '京', | |
'浙江省' => '浙', | |
'天津市' => '津', | |
'安徽省' => '皖', | |
'上海市' => '沪', | |
'福建省' => '闽', | |
'重庆市' => '渝', | |
'江西省' => '赣', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Rack | |
class MemoryBloat | |
def initialize(app, logger) | |
@app = app | |
@logger = logger | |
end | |
def call(env) | |
memory_usage_before = memory_usage | |
result = @app.call(env) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def tip(msg); puts; puts msg; puts "-"*100; end | |
# | |
# 30 Ruby 1.9 Tips, Tricks & Features: | |
# http://www.igvita.com/2011/02/03/new-ruby-19-features-tips-tricks/ | |
# | |
tip "Upgrading to Ruby 1.9 is simple: rvm install 1.9.2 && rvm --default 1.9.2" | |
tip "Ruby 1.9 supports named captures in regular expressions!" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html lang='zh'> | |
<head> | |
<meta charset="UTF-8"> | |
<!-- For mobile devices. --> | |
<title>Google map</title> | |
<style type="text/css"> | |
#map_canvas { width:299px;height:234px; } | |
</style> | |
<script type="text/javascript" src="http://ditu.google.cn/maps/api/js?sensor=false"></script> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'syntax/convertors/html' | |
require 'rainbow' | |
filename = ARGV[0] | |
puts ARGV[0] | |
line_num=0 | |
tokenizer = Syntax.load "ruby" |
jquery.maskedinput jquery.metadata
VALIDATION: jquery.validate metadataRules classRules attributeRules staticRules
jquery.blockUI[http://jquery.malsup.com/block/]
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0"?> | |
<!DOCTYPE cross-domain-policy SYSTEM "http://www.adobe.com/xml/dtds/cross-domain-policy.dtd"> | |
<cross-domain-policy> | |
<allow-access-from domain="your.domain.com" /> | |
</cross-domain-policy> |