Madison Ruby Conf 2012
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
| _.extend Backbone.Validation.callbacks, | |
| valid: (view, attr, selector) -> | |
| control = view.$('[' + selector + '=' + attr + ']') | |
| group = control.parents(".control-group") | |
| group.removeClass("error") | |
| if control.data("error-style") == "tooltip" | |
| # CAUTION: calling tooltip("hide") on an uninitialized tooltip | |
| # causes bootstraps tooltips to crash somehow... | |
| control.tooltip "hide" if control.data("tooltip") |
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
| I converted the SCSS mixin to LESS for the lazy coders like myself in response to this blog post (http://37signals.com/svn/posts/3271-easy-retina-ready-images-using-scss) | |
| .image-2x(@image, @width, @height) { | |
| @media only screen and (-webkit-min-device-pixel-ratio: 1.3), | |
| only screen and (-o-min-device-pixel-ratio: 3/2), | |
| only screen and (min--moz-device-pixel-ratio: 1.3), | |
| only screen and (min-device-pixel-ratio: 1.3), | |
| only screen and (min-resolution: 1.3dppx) { | |
| /* on retina, use image that's scaled by 2 */ | |
| background-image: url('@{image}'); |
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
| source :rubygems | |
| # We are not loading Active Record, nor Active Resources etc. | |
| # We can do this in any app by simply replacing the rails gem | |
| # by the parts we want to use. | |
| gem "actionpack", "~> 3.2" | |
| gem "railties", "~> 3.2" | |
| gem "tzinfo" | |
| # Let's use thin |
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
| L1 cache reference 0.5 ns | |
| Branch mispredict 5 ns | |
| L2 cache reference 7 ns | |
| Mutex lock/unlock 25 ns | |
| Main memory reference 100 ns | |
| Compress 1K bytes with Zippy 3,000 ns | |
| Send 2K bytes over 1 Gbps network 20,000 ns | |
| Read 1 MB sequentially from memory 250,000 ns | |
| Round trip within same datacenter 500,000 ns | |
| Disk seek 10,000,000 ns |