$ uname -r
console.log(Number(Math.round(1.005 + "e2") + "e-2")) // 1.01 | |
const roundAccurately = (number, decimalPlaces) => Number(Math.round(number + "e" + decimalPlaces) + "e-" + decimalPlaces) | |
console.log(roundAccurately(1.005, 2)) // 1.01 |
<ng-template #followingpost let-author="author" let-age="age" let-text="text" let-badge="badge"> | |
<div class="container-fluid"> | |
<div class="card"> | |
<div class="header"> | |
<h4 class="title">{{ author }}</h4> | |
<p class="category">il y a {{ age }} jours</p> | |
</div> | |
<div class="content" [innerHTML]="text"> | |
</div> |
[ { "property": "--*" | |
, "url": "http://dev.w3.org/csswg/css-variables/#propdef-" | |
, "status": "ED" | |
, "title": "CSS Custom Properties for Cascading Variables Module Level 1" | |
} | |
, { "property": "--*" | |
, "url": "http://www.w3.org/TR/2015/CR-css-variables-1-20151203/#propdef-" | |
, "status": "CR" | |
, "title": "CSS Custom Properties for Cascading Variables Module Level 1" | |
} |
/** | |
* Adjusts a number to a given precision, working around the buggy floating-point math of Javascript. Works for | |
* round, floor, ceil operations. | |
* | |
* Lifted from the Math.round entry of MDN. Minor changes without effect on the algorithm. | |
* | |
* @param {string} operation "round", "floor", "ceil" | |
* @param {number} value | |
* @param {number} [precision=0] can be negative: round( 104,-1 ) => 100 | |
* @returns {number} |
- OS X
- XCode
(function() { | |
var script, | |
scripts = document.getElementsByTagName('script')[0]; | |
function load(url) { | |
script = document.createElement('script'); | |
script.async = true; | |
script.src = url; | |
scripts.parentNode.insertBefore(script, scripts); |
⇐ back to the gist-blog at jrw.fi
Or, 16 cool things you may not have known your stylesheets could do. I'd rather have kept it to a nice round number like 10, but they just kept coming. Sorry.
I've been using SCSS/SASS for most of my styling work since 2009, and I'm a huge fan of Compass (by the great @chriseppstein). It really helped many of us through the darkest cross-browser crap. Even though browsers are increasingly playing nice with CSS, another problem has become very topical: managing the complexity in stylesheets as our in-browser apps get larger and larger. SCSS is an indispensable tool for dealing with this.
This isn't an introduction to the language by a long shot; many things probably won't make sense unless you have some SCSS under your belt already. That said, if you're not yet comfy with the basics, check out the aweso
#Remote debugging USB-connected Android via Chrome
##Phone Setup
- Requires a handset with modern Android (ala 4.X, etc)
- settings => developer options => usb debug enable
- phone => chrome => settings => developer tools => usb debug enable
##Desktop Setup - One Time Only
- Install the Android SDK for OS X: http://developer.android.com/sdk/index.html
- Android SDK is a .zip and I unpacked it into my local ~/bin/android-sdk-macosx