This file will setup Wordpress, MySQL & PHPMyAdmin with a single command. Add the code below to a file called "docker-compose.yaml" and run the command
$ docker-compose up -d
# To Tear Down
$ docker-compose down --volumes
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>Modal Dialog</title> | |
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css"> | |
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js"></script> | |
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js"></script> | |
</head> |
function camelCaseToDash( myStr ) { | |
return myStr.replace( /([a-z])([A-Z])/g, '$1-$2' ).toLowerCase(); | |
} | |
var myStr = camelCaseToDash( 'thisString' ); | |
alert( myStr ); // => this-string |
//Coderbyte | |
function MeanMode(arr) { | |
var sum=0, | |
mean, mode, midpoint, modeStr, re, | |
champTotal=0; | |
//old faithful | |
arr.sort(function(a, b) { | |
return a - b; |
// for multiple requests | |
let isRefreshing = false; | |
let failedQueue = []; | |
const processQueue = (error, token = null) => { | |
failedQueue.forEach(prom => { | |
if (error) { | |
prom.reject(error); | |
} else { | |
prom.resolve(token); |
let isRefreshing = false; | |
let refreshSubscribers = []; | |
const instance = axios.create({ | |
baseURL: Config.API_URL, | |
}); | |
instance.interceptors.response.use(response => { | |
return response; | |
}, error => { |
function toTitleCase(str) { | |
return str.replace(/\w\S*/g, function(txt){ | |
return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase(); | |
}); | |
} | |
// or in ES6: | |
var text = "foo bar loo zoo moo"; | |
const ucfirst = text => text.toLowerCase() |
function keepTrying(otherArgs, promise) { | |
promise = promise||new Promise(); | |
// try doing the important thing | |
if(success) { | |
promise.resolve(result); | |
} else { | |
setTimeout(function() { | |
keepTrying(otherArgs, promise); |
// Providing Context | |
// ================== | |
import React, {useState, useEffect} from "react" | |
const Context = React.createContext() | |
function ContextProvider({children}) { | |
const [allPhotos, setAllPhotos] = useState([]) | |
const [cartItems, setCartItems] = useState([]) |