Override memcached page limit with dalli

Even being replaced by redis, memcached is still useful caching system.

Abobe version 1.4, memcached can change slab page limit from 1MB, but with dalli gem, memcached client library, it must configure both memcached and dalli’s setting.

$ cat /etc/memcached.conf
-- snip --
-I 2m

Abobe rails 3.2.x exsample.

# Rails.root/config/environments/production.rb or elsewhere
config.cache_store = :dalli_store, "cache-server:11211", { value_max_bytes: 2000000 }

twitter-bootstrap without gem

I know of a gem to use twitter-bootstrap with Rails, but I don’t like such solutions because of dependency. If I use it then twitter-bootstrap upgrade it’s versions, I will have to wait gem to catch up those upgrades. Even github helps us to collaborate really straightforward, but sometimes two steps solutions make problems more complicated.

This is a memorandum to use twitter-bootstrap with Rails WITHOUT any gems. I don’t know it’s a right way but it’s well enough for me.

Download and place files under “vendor”

After creating a new rails project, download twitter-bootstrap, then place files under vendor directory.



Place images under “assets/images”

Image files must be place under directory where browser can access.



Create vendor.js and vendor.css

I don’t know how to edit application.js and application.css to load whole files under vendor directory, so I create files for that.

# cd #{Rails.root}

$ cat app/javascripts/application.js
//= require vendor

$ cat app/stylesheets/application.css
 *= require vendor

$ cat vendor/javascripts/vendor.js
//= require ./twitter-bootstrap/bootstrap.min

$ cat vendor/stylesheets/vendor.css
 *= require_tree ./twitter-bootstrap

Edit file - BAD SOLUTION

Overriding selectors is the only one answer, but I edited twitter-bootstrap.min.css directly to replace image file paths. it’s a very bad solution but I gave up to be a smart.

My latest news

It is almost 2 years since I wrote on this blog. I have a feeling that I have had many words to say, but mostly forgotten those details.

About earthquate. About my family. About my work. About encounted robbery(it’s not a joke). I tried many times to write something both Japanese and English but I was fed up with full of exaggerations in my Japanese and with poor vocabulary in English.

Anyway, I’ll restart to write about programming or something :)