MySQL 5.7 comes with a native JSON data type and a set of built-in functions to manipulate values of the JSON type. This document demonstrates the usage.
-- raw json
INSERT INTO json_test
(name, attributes)
VALUES (
import React, { PureComponent } from 'react' | |
import PropTypes from 'prop-types' | |
class Child extends PureComponent { | |
componentDidMount() { | |
const { getMethod } = this.props; | |
// Pass child method to the parent by calling parent getter | |
// This could be something more general (`getMethods` where array/object of methods is passed) | |
getMethod(this.handleChildMethod); |
/* eslint-disable no-console */ | |
import { } from 'config/env' | |
import { APP_ROLE_PUBLISHER } from 'config/constants' | |
import idManager from 'services/idManager' | |
import get from 'lodash/get' | |
import eachLimit from 'async/eachLimit' | |
/** | |
* Migrate publishers from momentum.roles to skpn.roles. | |
* The script can be used for any type of migration, with adjusted parameters. |
export function isObject(item) { | |
return (item && typeof item === 'object' && !Array.isArray(item) && item !== null); | |
} | |
export default function mergeDeep(target, source) { | |
let output = Object.assign({}, target); | |
if (isObject(target) && isObject(source)) { | |
Object.keys(source).forEach(key => { | |
if (isObject(source[key])) { | |
if (!(key in target)) { |
function setStatePromise(that, newState) { | |
return new Promise((resolve) => { | |
that.setState(newState, () => { | |
resolve(); | |
}); | |
}); | |
} |
background: linear-gradient(180deg, #b60f61, #f2702d, #2db5a7, #be3df4, #008000, #f2c23a); | |
background-size: 8000% 8000%; | |
animation: animate-bg 10s linear infinite; | |
@keyframes animate-bg { | |
0% {background-position:50% 0%} | |
50% {background-position:50% 100%} | |
100% {background-position:50% 0%} | |
} |
var flatten = function(arr) { | |
return arr.reduce(function (flat, toFlatten) { | |
return flat.concat(Array.isArray(toFlatten) ? flatten(toFlatten) : toFlatten); | |
}, []); | |
} | |
flatten([[1,2,[3]],4]); // [1,2,3,4] |
<!doctype html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Document</title> | |
<script> | |
document.addEventListener("DOMContentLoaded", function(event) { | |
var genBtn = document.getElementsByName("gen")[0]; | |
var emailLink = document.getElementById("email-link"); | |
genBtn.addEventListener("click", function() { |