This file contains hidden or 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 MeasureRender extends React.Component { | |
constructor() { | |
super(); | |
this.mounted = false; | |
} | |
render() { | |
const { name } = this.props; | |
if (this.mounted) { | |
window.performance.mark(`${name}UpdateStart`); |
This file contains hidden or 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 isRestUrl() { | |
$bIsRest = false; | |
if ( function_exists( 'rest_url' ) && !empty( $_SERVER[ 'REQUEST_URI' ] ) ) { | |
$sRestUrlBase = get_rest_url( get_current_blog_id(), '/' ); | |
$sRestPath = trim( parse_url( $sRestUrlBase, PHP_URL_PATH ), '/' ); | |
$sRequestPath = trim( $_SERVER[ 'REQUEST_URI' ], '/' ); | |
$bIsRest = ( strpos( $sRequestPath, $sRestPath ) === 0 ); | |
} | |
return $bIsRest; | |
} |
This file contains hidden or 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
Array.prototype.diff = function (a) { | |
return this.filter(function (i) { | |
return a.indexOf(i) === -1; | |
}); | |
}; |
This file contains hidden or 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
import React from 'react' | |
import Perf from 'react-addons-perf'; | |
window.Perf = Perf; | |
class Component extends React.Component { | |
componentDidMount() { | |
setImmediate(() => { | |
Perf.start(); | |
}); | |
setTimeout(() => { |
This file contains hidden or 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
let newArray = oldArray1.concat(oldArray2.filter((item) => { | |
return item.value !== duplicate.value; | |
})); |
This file contains hidden or 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
cd $HOME | |
ln -s `which php54` ~/bin/php | |
export PATH=$HOME/bin:$PATH | |
curl -sS https://getcomposer.org/installer | php54 | |
echo -e "\n# Composer\nalias composer=\"php54 \$HOME/composer.phar\"" >> $HOME/.bash_profile | |
source $HOME/.bash_profile |
This file contains hidden or 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
<?php global $woocommerce; | |
$cart_count = ($woocommerce->cart->cart_contents_count)? $woocommerce->cart->cart_contents_count:'0'; |
This file contains hidden or 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 modify_comment_form_fields($fields){ | |
$commenter = wp_get_current_commenter(); | |
$req = get_option( 'require_name_email' ); | |
$aria_req = ( $req ? " aria-required='true'" : "" ); | |
$fields['author'] = '<p class="comment-form-author">' . | |
'<input id="author" name="author" type="text" placeholder="Name*" value="' . esc_attr( $commenter['comment_author'] ) . '" size="20"' . $aria_req . ' /></p>'; | |
$fields['email'] = '<p class="comment-form-email">'. |
This file contains hidden or 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
exists () { | |
if [[ -f $1 ]] | |
then | |
. $1 | |
echo "${blue}$msgSuccess$reset $1 included" | |
else | |
echo "${red}$msgError$reset: Could not locate $1." | |
exit 1 | |
fi | |
} |
NewerOlder