This proposal is not longer active. Context: https://twitter.com/siddharthkp/status/909818777314902016
This proposal is not longer active. Context: https://twitter.com/siddharthkp/status/909818777314902016
| class Random { | |
| async getRandom () { | |
| return await getRandomWithPromise(); | |
| } | |
| } | |
| (async function () { | |
| var random = new Random(); | |
| console.log(`Your random number is ${await random.getRandom()}!`) | |
| })(); |
| <?php | |
| function my_customize_rest_cors() { | |
| remove_filter( 'rest_pre_serve_request', 'rest_send_cors_headers' ); | |
| add_filter( 'rest_pre_serve_request', function( $value ) { | |
| header( 'Access-Control-Allow-Origin: *' ); | |
| header( 'Access-Control-Allow-Methods: GET' ); | |
| header( 'Access-Control-Allow-Credentials: true' ); | |
| header( 'Access-Control-Expose-Headers: Link', false ); |
| .type.storage,.type.storage.declaration, .storage.class.modifier { | |
| font-family: 'flottflott'; | |
| font-size: 1.7em; | |
| } | |
| .type.storage.arrow.function { | |
| font-family: 'Fira Code' | |
| } | |
| .decorator.name, .decorator.punctuation:not(.block), .import.keyword { |
| <script>console.log({{ product | json }});</script> |
| // reduce() awesomeness | |
| const a = [1, 2, 3, 4, 5, 5, 3] | |
| const b = [{ key: 1, value: 'a' }, { key: 2, value: 'b' }] | |
| const c = [Promise.resolve(), Promise.resolve(), Promise.resolve()] | |
| const d = ['a', 'a', 'a', 'a', 'a'] | |
| // Max | |
| a.reduce((x, y) => x > y ? x : y) // > 5 | |
| // Min |
| // http://paulirish.com/2011/requestanimationframe-for-smart-animating/ | |
| // http://my.opera.com/emoller/blog/2011/12/20/requestanimationframe-for-smart-er-animating | |
| // requestAnimationFrame polyfill by Erik Möller. fixes from Paul Irish and Tino Zijdel | |
| // MIT license | |
| (function() { | |
| var lastTime = 0; | |
| var vendors = ['ms', 'moz', 'webkit', 'o']; |