Skip to content

Instantly share code, notes, and snippets.

 I like 🌳🌳🌳 

Hendrik HoverBaum

 I like 🌳🌳🌳 
View GitHub Profile
<< ////
The script creates 'licenses' under '$ANDROID_HOME' and creates a file which proves
that the SDK license was accepted by the user.
Please copy this to your own account/gist/server. Every time there's an updated license, update the file with the new
license hash.
Legally if you run this script (or your own version of it), it means YOU accepted the license - don't trust someone else.
The hashes below are supposed to be taken from $ANDROID_HOME/licenses/android-sdk-license on YOUR machine, after you
HoverBaum /
Created Apr 9, 2018
Mongo using Docker.

Mongo using Docker

This gist detailes scripts you can use to run a Mongo instance for your development using docker.

The provided scripts help you to create, run, stop and interact with a local mongo Database. You should keep in mind that all data is stored inside the Docker container and will be lost when you destroy it.


outline for "The rise of headless CMS"


Should contain what CMS are and motivate that they are great.

Old days

Story telling time of what used to be a pain for me when working with CMS to motivate the move from traditional CMS to headless.

View categoriesToContentful.js
const createAndPublishCategories = async (categories, spaceId, managementToken, simpleLog = console.log) => {
const client = contentful.createClient({
accessToken: managementToken,
logHandler: (level, data) => simpleLog(`${level} | ${data}`)
const space = await client.getSpace(spaceId)
const createdCategories = await Promise.all( => new Promise(async resolve => {
let cmsCategory
try {
cmsCategory = await space.createEntry('blogCategory', {
View generateAssetsList.js
const generateAssetsList = (posts, baseUrl, simpleLog = console.log) => new Promise(async resolve =>{
const apiURL = `${baseUrl.replace(/\/$/, '')}/wp-json/wp/v2/media`
simpleLog('Reducing posts to asset numbers')
let infosFetched = 0
// First add the featured_media images and get ther URLs.
const featuredAssets = await Promise.all(posts.reduce((all, post) => {
if (!post.featured_media) return all
return all.concat([{
mediaNumber: post.featured_media,
View getCategories.js
const getCategories = (posts, baseUrl, simpleLog = console.log) => new Promise(async resolve => {
const apiURL = `${baseUrl.replace(/\/$/, '')}/wp-json/wp/v2/categories`
// First reduce posts to an array of category numbers.
simpleLog('Reducing posts to category numbers')
const categories = await Promise.all(posts.reduce((all, post) => {
if(!post.category) return all
if(all.indexOf(post.category) > -1) return all
return all.concat([post.category])
}, [])
.map(async categoryNumber => {
View perparePosts.js
const transformPosts = posts => => {
delete post._links
delete post.guid
delete post.excerpt
delete post.comment_status
delete post.ping_status
delete post.template
delete post.format
delete post.meta
View getPosts.js
const exportBlogposts = (apiUrl, log) => new Promise(resolve => {
const exportPageOfPosts = (apiUrl, page = 1, allPosts = []) => {
log(`Getting posts for page ${page}`)
const url = `${apiUrl}?page=${page}`
https.get(url, (res) => {
// When we get a 404 back we went one page over those with posts.
// So we are done now.
if(res.statusCode === 400) {
return resolve(allPosts)
HoverBaum / assetObject.js
Created Mar 26, 2018
Code example for blogpost about migrating from wordpress to Contentful.
View assetObject.js
link: 'link to wordpress iage.jpg',
description: 'describe the image',
title: 'and title it',
postId: 'because linking back is nice'
}, ...]
HoverBaum / convertLocale.js
Created Mar 23, 2018
Convert a exported Spaces locale.
View convertLocale.js
#!/usr/bin/env node
/* eslint-disable */
* Replace the locale in an exported space.
* Usage:
* node changeSpaceLocale.js -l es-ES < space.json > translated.json
* The above will translate the space to Spanish (currently the only supported
* language to translate to).