This Web Components keeps the year in your copyright notice up-to-date.
export { CopyrightYearElement }
const name = "copyright-year";
class CopyrightYearElement extends HTMLSpanElement {
Making multiple MySQL versions work with Homebrew was tricky to say the least. Fortunately there are 2 new easy ways that I learned of to achieve this.
As @4unkur and @henrytirla commented below, there is this extremely easy to use app called DBngin, which lets you setup multiple databases (not only MySQL) simultaneously using different ports:
/* | |
Sometimes you need to queue things up before a callback is available. This solves that issue. | |
Push any item(s) to an array. | |
Once you want to start consuming these items, pass the array and a callback to QueuedCallback(). | |
QueuedCallback will overload array.push as your callback and then cycle through any queued up items. | |
Continue to push items to that array and they will be forwarded directly to your callback. The array will remain empty. | |
Compatible with all browsers and IE 5.5+. | |
*/ |
// The classic AJAX call - dispatch before the request, and after it comes back | |
function myThunkActionCreator(someValue) { | |
return (dispatch, getState) => { | |
dispatch({type : "REQUEST_STARTED"}); | |
myAjaxLib.post("/someEndpoint", {data : someValue}) | |
.then( | |
response => dispatch({type : "REQUEST_SUCCEEDED", payload : response}), | |
error => dispatch({type : "REQUEST_FAILED", error : error}) | |
); |
<?php | |
/* Adds all user meta to the /wp-json/wp/v2/user/[id] endpoint */ | |
function sb_user_meta( $data, $field_name, $request ) { | |
if( $data['id'] ){ | |
$user_meta = get_user_meta( $data['id'] ); | |
} | |
if ( !$user_meta ) { | |
return new WP_Error( 'No user meta found', 'No user meta found', array( 'status' => 404 ) ); | |
} |
<?php | |
/** | |
* Make an internal REST request | |
* | |
* @global WP_REST_Server $wp_rest_server ResponseHandler instance (usually WP_REST_Server). | |
* @param $request_or_method WP_REST_Request|string A WP_REST_Request object or a request method | |
* @param $path (optional) if the path is not specific in the rest request, specify it here | |
* @param $data (optional) option data for the request. | |
* @return WP_Error|mixed |
// NOTE: this adds a filename and line number to winston's output | |
// Example output: 'info (routes/index.js:34) GET 200 /index' | |
var winston = require('winston') | |
var path = require('path') | |
var PROJECT_ROOT = path.join(__dirname, '..') | |
var logger = new winston.logger({ ... }) | |
// this allows winston to handle output from express' morgan middleware |
<?php | |
function my_rest_prepare_post( $data, $post, $request ) { | |
$_data = $data->data; | |
$thumbnail_id = get_post_thumbnail_id( $post->ID ); | |
$thumbnail = wp_get_attachment_image_src( $thumbnail_id ); | |
$_data['featured_image_thumbnail_url'] = $thumbnail[0]; | |
$data->data = $_data; |
###Girl Develop It
August 19th, 2015
Find this document here: