This file contains 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"/> | |
<title>Number Cast</title> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/benchmark/1.0.0/benchmark.min.js"></script> | |
<script src="./suite.js"></script> | |
</head> | |
<body> | |
<h1>Open the console to view the results</h1> |
This file contains 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"/> | |
<title>Gutenberg - Optimize runSelector</title> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/benchmark/1.0.0/benchmark.min.js"></script> | |
<script src="./suite.js"></script> | |
</head> | |
<body> | |
<h1>Open the console to view the results</h1> |
This file contains 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
sprintf-js: hello %s! x 3,492,089 ops/sec ±0.35% (93 runs sampled) | |
@tannin/sprintf: hello %s! x 1,737,159 ops/sec ±0.38% (87 runs sampled) |
This file contains 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
( function( blocks, element, data, components, compose ) { | |
var el = element.createElement; | |
blocks.registerBlockType( 'my-demo/demo-block-select', { | |
title: 'Demo Block (Select)', | |
icon: 'format-aside', | |
category: 'common', |
This file contains 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
#!/bin/bash | |
# https://stackoverflow.com/a/26843249/995445 | |
IFS=':' read -ra parts <<< "$1" | |
if [ ${#parts[@]} == 1 ]; then | |
branch=${parts[0]} | |
else | |
remote=${parts[0]} | |
branch=${parts[1]} | |
fi |
This file contains 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
class AsyncComponent extends Component { | |
constructor() { | |
super( ...arguments ); | |
this.state = { | |
component: null, | |
}; | |
} | |
componentWillMount() { |
This file contains 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
/** | |
* Higher-order component used to inject state-derived props using registered | |
* selectors. | |
* | |
* @param {Function} mapStateToProps Function called on every state change, | |
* expected to return object of props to | |
* merge with the component's own props. | |
* | |
* @return {Component} Enhanced component with merged state data props. | |
*/ |
This file contains 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
class MyComponent extends React.Component { | |
// ... | |
componentDidUpdate( prevProps ) { | |
for ( const key of Object.keys( this.props ) ) { | |
if ( this.props[ key ] !== prevProps[ key ] ) { | |
console.log( | |
key, | |
`(Before: ${ prevProps[ key ] })`, | |
`(After: ${ this.props[ key ] })` |
This file contains 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
#!/bin/bash | |
git remote -v | grep "(fetch)" | sed -e 's#[[:blank:]].*##g' | grep -v "origin" | xargs -n 1 git remote rm |
This file contains 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
#!/bin/bash | |
# https://stackoverflow.com/a/26843249/995445 | |
IFS=':' read -ra parts <<< "$1" | |
if [ ${#parts[@]} == 1 ]; then | |
branch=${parts[0]} | |
else | |
remote=${parts[0]} | |
branch=${parts[1]} | |
fi |