git init
or
The MIT License (MIT) | |
Copyright (c) 2015 Justin Perry | |
Permission is hereby granted, free of charge, to any person obtaining a copy of | |
this software and associated documentation files (the "Software"), to deal in | |
the Software without restriction, including without limitation the rights to | |
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of | |
the Software, and to permit persons to whom the Software is furnished to do so, | |
subject to the following conditions: |
This gist assumes:
This article has been given a more permanent home on my blog. Also, since it was first written, the development of the Promises/A+ specification has made the original emphasis on Promises/A seem somewhat outdated.
Promises are a software abstraction that makes working with asynchronous operations much more pleasant. In the most basic definition, your code will move from continuation-passing style:
getTweetsFor("domenic", function (err, results) {
// the rest of your code goes here.
(function($) { | |
window.VcCustomElementView = vc.shortcode_view.extend( { | |
elementTemplate: false, | |
$wrapper: false, | |
changeShortcodeParams: function ( model ) { | |
var params; | |
window.VcCustomElementView.__super__.changeShortcodeParams.call( this, model ); | |
params = _.extend( {}, model.get( 'params' ) ); | |
if ( ! this.elementTemplate ) { |
// PHP snippet included in wp-config.php (or settings.php). | |
// Including from that location in a separate file is OK as well. | |
<?php | |
// Remove any leading "www." from the host name. | |
$redirect_host = str_replace('www.', '', $_SERVER['HTTP_HOST']); | |
$redirect_path = strtolower(rtrim($_SERVER['REQUEST_URI'])); | |
if (strlen($redirect_path) > 2) { | |
$redirect_path = rtrim($redirect_path, '/'); | |
} |
I have always struggled with getting all the various share buttons from Facebook, Twitter, Google Plus, Pinterest, etc to align correctly and to not look like a tacky explosion of buttons. Seeing a number of sites rolling their own share buttons with counts, for example The Next Web I decided to look into the various APIs on how to simply return the share count.
If you want to roll up all of these into a single jQuery plugin check out Sharrre
Many of these API calls and methods are undocumented, so anticipate that they will change in the future. Also, if you are planning on rolling these out across a site I would recommend creating a simple endpoint that periodically caches results from all of the APIs so that you are not overloading the services will requests.
import React from "react"; | |
import { render } from "react-dom"; | |
const ParentComponent = React.createClass({ | |
getDefaultProps: function() { | |
console.log("ParentComponent - getDefaultProps"); | |
}, | |
getInitialState: function() { | |
console.log("ParentComponent - getInitialState"); | |
return { text: "" }; |
The ability to use PHP 4 style constructors is getting removed from PHP. Without an update, many plugins will eventually no longer work (this is PHP breaking this backwards compatibility, not WordPress)
One of the more common uses of the PHP 4 style constructor (as opposed to PHP 5 style __construct()
) are plugins with widgets calling WP_Widget::WP_Widget()
and/or parent::WP_Widget()
and/or {object}->WP_Widget()
Note: Starting in WordPress 4.3, regardless of the PHP version in use on a server, WordPress will throw a deprecated notice when one of the PHP 4 style constructors is called specifically for widgets.
Basically instead of doing these: