Clone and build Node for analysis:
$ git clone https://github.com/joyent/node.git
$ cd node
$ export GYP_DEFINES="v8_enable_disassembler=1"
$ ./configure
$ make -j4
| App.Router.map(function() { | |
| this.resource('post', { path: '/posts/:post_id' }); | |
| }); | |
| App.PostRoute = Ember.Route.extend({ | |
| model: function(params) { | |
| return this.store.find('post', params.post_id); | |
| } | |
| }); |
Pure SASS-adaption of Lea Verou's contrast-ratio javascript. Can be useful when eg. generating colored buttons from a single supplied color as you can then check which out of a couple of text colors would give the best contrast.
This script currently lacks the support for alpha-transparency that Lea supports in her script though.
In addition to the color-contrast adaption there's also some math methods that were needed to be able to calculate the exponent of a number and especially so when the exponent is a decimal number. A 2.4 exponent is used to calculate the luminance of a color and calculating such a thing is not something that SASS supports out of the box and not something I found a good pure-SASS script for calculating and I much prefer pure-SASS over ruby extensions. The math methods might perhaps be unecessary though if you're running Compass or similar as they may provide compatible math methods themselves.
Normal usage: `color: pick_best_color(#f00
| /* ---------------------------------------------------------- */ | |
| /* */ | |
| /* A media query that captures: */ | |
| /* */ | |
| /* - Retina iOS devices */ | |
| /* - Retina Macs running Safari */ | |
| /* - High DPI Windows PCs running IE 8 and above */ | |
| /* - Low DPI Windows PCs running IE, zoomed in */ | |
| /* - Low DPI Windows PCs and Macs running Firefox, zoomed in */ | |
| /* - Android hdpi devices and above */ |
| <?php | |
| /** | |
| * Display point award report. | |
| * | |
| * Generates a list of awarded points. | |
| * | |
| * @return array $content | |
| */ | |
| function game_report_page_points() { | |
| // For some mysterious reason only parts of the db_select API is chainable. |
| sudo defaults write /Library/Preferences/com.apple.windowserver DisplayResolutionEnabled -bool YES; | |
| sudo defaults delete /Library/Preferences/com.apple.windowserver DisplayResolutionDisabled; | |
| // by the way, you need to logout and log back in for this to take effect. Or at least that's what | |
| // Quartz Debug says. Who knows, maybe it's lying? | |
| // P.S. Go to [Apple menu --> System Preferences --> Displays --> Display --> Scaled] after logging | |
| // back in, and you'll see a bunch of "HiDPI" resolutions in the list to choose from. |
| // Rounds all the corners of a box | |
| @mixin border-radius($radius, $clip: padding-box) | |
| -webkit-border-radius: $radius | |
| -moz-border-radius: $radius | |
| -o-border-radius: $radius | |
| border-radius: $radius | |
| -webkit-background-clip: $clip | |
| -mox-background-clip: $clip | |
| -o-background-clip: $clip | |
| background-clip: $clip |
I suspect that some trig calculations could make this very general.