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
| upstream example_backend { | |
| server unix:/var/www/example.com/shared/unicorn.sock; | |
| } | |
| server { | |
| listen 80; | |
| server_name example.com www.example.com; | |
| access_log off; | |
| error_log off; | |
| client_max_body_size 20M; |
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
| def is_ajax_request? | |
| if respond_to? :content_type | |
| if request.xhr? | |
| true | |
| else | |
| false | |
| end | |
| else | |
| false | |
| end |
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 convert_to_brightness_value(background_hex_color) | |
| (background_hex_color.scan(/../).map {|color| color.hex}).sum | |
| end | |
| def contrasting_text_color(background_hex_color) | |
| convert_to_brightness_value(background_hex_color) > 382.5 ? '#000' : '#fff' | |
| end |
NewerOlder