npm Users By Downloads (git.io/npm-top)
npm users sorted by the monthly downloads of their modules, for the range May 6, 2018 until Jun 6, 2018.
Metrics are calculated using top-npm-users.
# | User | Downloads |
---|
const handler = { | |
get(target, propKey, receiver) { | |
if (/^_[0-9]+$/.test(propKey)) { | |
const result = []; | |
const first = Number(receiver); | |
const last = Number(propKey.slice(1)); | |
for (let i=first; i<=last; i++) { | |
result.push(i); | |
} | |
return result; |
function get(path, obj, fb = `$\{${path}}`) { | |
return path.split('.').reduce((res, key) => res[key] || fb, obj); | |
} | |
function parseTpl(template, map, fallback) { | |
return template.replace(/\$\{.+?}/g, (match) => { | |
const path = match.substr(2, match.length - 3).trim(); | |
return get(path, map, fallback); | |
}); | |
} |
.rounded-corners-gradient-borders { | |
width: 300px; | |
height: 80px; | |
border: double 4px transparent; | |
border-radius: 80px; | |
background-image: linear-gradient(white, white), radial-gradient(circle at top left, #f00,#3020ff); | |
background-origin: border-box; | |
background-clip: padding-box, border-box; | |
} |
npm users sorted by the monthly downloads of their modules, for the range May 6, 2018 until Jun 6, 2018.
Metrics are calculated using top-npm-users.
# | User | Downloads |
---|
React now supports the use of ES6 classes as an alternative to React.createClass()
.
React's concept of Mixins, however, doesn't have a corollary when using ES6 classes. This left the community without an established pattern for code that both handles cross-cutting concerns and requires access to Component Life Cycle Methods.
In this gist, @sebmarkbage proposed an alternative pattern to React mixins: decorate components with a wrapping "higher order" component that handles whatever lifecycle methods it needs to and then invokes the wrapped component in its render()
method, passing through props
.
While a viable solution, this has a few drawbacks:
node_modules/ |
// add to Preferences > Key Bindings - User | |
// see http://stackoverflow.com/a/26619524 for context | |
{ "keys": ["tab"], "command": "expand_abbreviation_by_tab", | |
"context": [ | |
{ | |
"operand": "source.js", | |
"operator": "equal", | |
"match_all": true, | |
"key": "selector" |
/** | |
* performance-timing.js: Polyfill for performance.timing object | |
* For greatest accuracy, this needs to be run as soon as possible in the page, preferably inline. | |
* The values returned are necessarily not absolutely accurate, but are close enough for general purposes. | |
* @author ShirtlessKirk. Copyright (c) 2014. | |
* @license WTFPL (http://www.wtfpl.net/txt/copying) | |
*/ | |
(function (window) { | |
'use strict'; |
import { Component } from "React"; | |
export var Enhance = ComposedComponent => class extends Component { | |
constructor() { | |
this.state = { data: null }; | |
} | |
componentDidMount() { | |
this.setState({ data: 'Hello' }); | |
} | |
render() { |
'use strict'; | |
var React = require('react'); | |
function createAsyncHandler(getHandlerAsync, displayName) { | |
var Handler = null; | |
return React.createClass({ | |
displayName: displayName, |