Skip to content

Instantly share code, notes, and snippets.

View ChrisBarberRiley's full-sized avatar
🚀

Chris Barber-Riley ChrisBarberRiley

🚀
View GitHub Profile
@ChrisBarberRiley
ChrisBarberRiley / WP-SSL-URL-Update.sql
Last active February 9, 2018 12:11
Update Wordpress Images After SSL Insert
UPDATE wp_posts SET `post_content` = REPLACE (`post_content`, 'src="http://www.example.com', 'src="https://www.example.com');
const asyncHandler = fn => (req, res, next) =>
Promise
.resolve(fn(req, res, next))
.catch(next);
module.exports = asyncHandler;
// Implementation (Controller method)
exports.someRoute = asyncHandler(async (req, res, next) => {
const foo = await Bar.find();
function longestWord(str) {
// Match all the words and numbers
const wordsArray = str.toLowerCase().match(/[a-z0-9]+/g)
// Organise words (longest at the top)
const sortedList = wordsArray.sort((a,b) => {
return b.length - a.length
})