Jupyter in WordPress

I want to include Jupyter Notebooks in WordPress posts… a simple solution is to use something like https://github.com/ghandic/nbconvert plugin, and use the shortcode a la:

[nbconvert url="https://github.com/veduz/data-science-for-librarians/blob/master/jupyter-getting-started.ipynb"]

Unfortunately it didn’t fully fit my needs 🙁 but the code is very simple, and opensource 🙂 so I just made fork and fitted the plugin as needed, which is now available on https://github.com/veduz/nbconvert.

Simple WordPress development setup.

One configuration file, and two commands, – let docker-compose.yml contain:

version: '2'
services:
  mariadb:
    image: mariadb
    environment:
      MYSQL_ROOT_PASSWORD: XXXXXX
    volumes:
      - ./mariadb:/var/lib/mysql
  wordpress:
    image: wordpress
    ports:
      - 3002:80
    environment:
      WORDPRESS_DB_PASSWORD: XXXXXX
      WORDPRESS_DB_USER: root
      WORDPRESS_DB_HOST: mariadb
    volumes:
      - ./www:/var/www/html

And then run these two commands:

docker-compose up
npx browser-sync start --proxy "localhost:3002" --files www/**

Voila, development wordpress installation, with automatic reload 🙂

Just create your development repository in www/wp-content/plugins/, make a symlink to it for easy access, and start coding…

WordPress Notes

Various notes about WordPress configuration and development

Setup

define('WP_DEBUG', true);
define('WP_SITEURL', ($_SERVER['HTTPS'] ? 'https://' : 'http://') . $_SERVER['HTTP_HOST']);
define('WP_HOME', ($_SERVER['HTTPS'] ? 'https://' : 'http://') . $_SERVER['HTTP_HOST']);

Plugins

  • JetPack allows markdown, and wordpress-app. NB: /wp-admin/admin.php?page=jetpack_modules makes it possible to disable different part of jetpack, including it statistics.

Development Environment

Simple WordPress Development Setup

Study material

https://github.com/DevinVinson/WordPress-Plugin-Boilerplate/

 

JS-IPFS Mini Hackathon

JS-IPFS Mini Hackathon, 25.-26. August 2017

I have recently started diving into the code of js-ipfs, and think it could be fun to make a mini hackathon, to see what we can build on top of it in 20 hours.

Let’s meet at my place at 17:00 on Friday 25., talk about what we could build, and start building it. Then we find something to eat, and code and play, until we get tired. We meet again in the morning the next day, and continue, until 14:00, where we do a demo, and debriefing of what we have learned and done.

It is quite easy to get started using js-ipfs, – there are some nice demo/introductions here:

During the hackathon, we can also have small breaks, we present what we are doing, – or if we have learned something interesting. I have a projector if needed for presentations (800×600, and only vga-cable, so bring adaptor or hdmi-cable, if you want to use it, and your computer do not have a vga-output).

The plan is to build whatever we like, though it would be nice if the focus is ipfs/javascript. I will probably either build a small react-app that uses js-ipfs, or dive further into the js-ipfs by solving some of the github-issue. Let’s also do some pair programming for knowledge sharing.

If you want to join, send me a mail (rasmuserik@solsort.com) or sms. The hackathon happens in my living room here, and we will be at most 8-10 people.

Rasmus Erik 🙂

PS. feel free to share this to people that might be interested.

React Material Design

Material Design with React

Trying to get an overview of different material-design frameworks for use with react.

Currently Material-UI still looks as the best bet, even though it feels a bit slow/bloated.

Mainstream code

I am focussing more
on mainstream technologies
at the moment.

For many projects
a large community of developers,
outweights the quality of technology.

There are two major reasons:

1) when delivering solutions,
it will be easier for the client
to find other developers that
can work on / maintain the code
in the later on.

2) when making libraries
and tools for developers,
there is a larger market 
and potential userbase.


The platform I focus on is still HTML5.
While ClojureScript is a better technology,
JavaScript / ES7 have become Good Enough™
and is much more mainstream.

Code infrastructure

Code infrastructure

The last couple of weeks, I have worked a bit on my JavaScript HTML5/app development tooling. I now have minimal configuration for getting new projects up and running. A new project just needs:

  • package.json with package name
  • $NAME_OF_PACKAGE.js the source code as literate code.

and then documentation, web-site, browser-bundle, npm module etc. is generated from this.

The steps I go though when creating a new project is:

  • simple-javascript create $PACKAGE_NAME which creates the
  • create github repository, and enable webpage from master branch.
  • travis enable
  • optionally travis setup npm, if I want to release it as a module.
  • optionally add Dockerfile and enable automatic build on hub.docker.com, if I want it to be installable on the server.

During development I just yarn dev and yarn release, and commit and push to github.


I have also simplified my server setup.

  • CouchDB is my database of choice, – it is generic / easy to use from HTML5/apps, so you do not need additional server code to talk with it.
  • A simple pubsub server that allows HTML5/apps to communicate with eachother (and signal webrtc-p2p connections).
  • A simple service runner, that runs HTML5/apps as services, based on a dynamic configuration in CouchDB. This means that I have the same APIs, and developer experience, when making services as when I write apps.

Easy Publish

Recently I have not
gotten around to
release my projects,
nor write much.

To improve this,
I revised my publishing flow:

Now: new code projects on github
are now automatically added
to solsort.com,
and shows a dead icon,
until probably set up.

Now: new writings / blog posts,
are just made by creating / 
writing a markdown file,
in the writings-repository.

A good way to make sure
something gets done
is to automate it,
so you do not have 
to do anything :)

Generic backend server

What would be good generic backend services to run, for making (web)apps?

Based on functionality/need, maturity, standardization, and ease of maintenance, this would be my plan for a generic backend-server:

Service Protocol Implementations
pubsub STOMP RabbitMQ, ActiveMQ, …
database CouchDB CouchDB, pouchdb-server, CouchBase
filesystem WebDAV ownCloud, seafile, …
reverse https/cors proxy HTTPS Caddy, nginx, apache, …
cron’ed webapps HTML5 electron, nwjs, …
(email) SMTP haraka + export to couchdb, …
(instant messaging) matrix synapse, ..
(dev environment) https+git gitlab, ..
(distributed filesystem) IPFS go-ipfs, js-ipfs
(search) elastic-search

Future Proof Apps

Will you be able to easily run your apps 20 years from now, without any maintenance?

  • Android – very unlikely.
  • iOS – very unlikely.
  • HTML5 – probably, if they are self-contained.

An app is self-contained if it does not references any external resources. That means no reliance on proprietary APIs, no loading of resources from CDNs, etc.

If a backend, API, or other service is needed, it should be possible for the user to set up their own version, and enter the url in the app. The service should be open, generic, stable, easy to set up, and have a large user base at the time of writing. There should be no custom backend code / schemas outside of the app itself. Examples of such services could be CouchDB, STOMP, and in the future maybe matrix and IPFS.

The easy test is to open index.html of the project on an offline computer with different browsers with wiped caches, and check if everything works. If it depends on services, – they should be able to run on the same offline computer.