Creating a Chatbot for Slack with Node.js in 17 lines

Creating a chatbot for Slack, the easy to setup group chat for teams was surprisingly easy. In this post we’re going to go over creating a chat bot that can reply to queries and take an action on simple keywords.

We’re going to use a node module called BotKit, which will enable us to connect to Slack easily. Actually Botkit offers a GUI (paid plans) and also connects to Microsoft Teams, Spark, Twilio and even Facebook.

One of the things I like the most about it is that you can kind of build a bot once and then re-use components across different platforms, which is super cool.

This post is written with

  • node 9.3.0

but will probably be up and downwards compatible fairly far since the dependency has been around for a while.

Continue reading “Creating a Chatbot for Slack with Node.js in 17 lines”

Managing Dependencies with Govendor (Heroku, Dokku)

govendor is a dependency manager for Go. Go get gets you pretty far when it comes to installing dependencies at first, but when you want to deploy your project or when you want to pin the right version of your dependency it’s not necessarily appropriate to use.

With govendor you can, like with npm or other tools specify which version of your dependency your project uses, which is a huge benefit for systems that are required to be somewhat stable.

Continue reading “Managing Dependencies with Govendor (Heroku, Dokku)”

Typescript and Node.js Tutorial for the Backend (Beginner)

Typescript has become a popular tool to reduce errors when writing JavaScript. It was developed by Microsoft and gained a lot of popularity when Angular adopted it as a first level citizen. When Angular 2 was nearing completion, the only docs available were for Typescript.

Typescript doesn’t only work for browser or frontend code, you can also choose to write your backend applications in it if you want to use Node.js but have some additional type safety and the other abstraction that the language brings.

Typescript and Node Starter

Continue reading “Typescript and Node.js Tutorial for the Backend (Beginner)”

How long does it take to mine one Monero?

It’s been a couple of weeks since I tried out different Monero mining strategies. Both with a consentual mining popup on this very blog and having an 8 core server mining Monero 24/7 (and having my desktop machine at home help out a bit when online).

So far I’ve mined 463,692,596 H (Hashes) which translates to 0.0403166853 XMR (Monero) with the mining pool approach, which you can read more about here:

Continue reading “How long does it take to mine one Monero?”

WordPress: Which Plugin Loads Script? (Contact Form 7, jQuery)

Recently I was benchmarking a site and wondering why jQuery (no offense) was loaded on every page when I was very sure I did not include it in the custom written theme for that site.

As it turns out Contact Form 7 requires jQuery. On every load.

When you know that you only provide a contact form on one page of your entire website, it might be overkill to load jQuery on every page, even though it’s not a requirement for any of the other JavaScript code on your website.

Conditionally Loading JavaScript Code with WordPress

Continue reading “WordPress: Which Plugin Loads Script? (Contact Form 7, jQuery)”

Using Coinhive with any Mining Pool

I recently tried out of it was possible to use browser visitors with the coinhive webassembly miner with any mining pool and it works with projects like coin-hive-stratum.

Disclaimer: I don’t know if that’s intended by the coinhive developers, since they’re basically being profitable with people using their miner with their pool, but I was curious if it worked 😉

Continue reading “Using Coinhive with any Mining Pool”

Using Preact with WordPress Themes, Plugins and more

Preact is a faster and smaller alternative to React and I have come to like it for building interactive components into WordPress themes and plugins. In this post we’ll go through how to write a Preact Component and how to inject it into an existing WordPress theme.

On my blog, at the time of writing, I’m using the twentysixteen theme with a few minor changes, one of those is the related posts that show up at the bottom of each blog post, which is a tiny plugin exposing an API and rendering through Preact.

If you’re used to React, you’ll feel right at home with Preact straight away.

This is what my related posts plugin looks like at the moment:

Continue reading “Using Preact with WordPress Themes, Plugins and more”

Parcel.js and PostCSS Rule Nesting

I’m trying our Parcel.js for one of my more recent endeavours and I must say I’m quite liking it so far. The zero-config approach doesn’t leave you with a lot of control, but at least you don’t have to adopt a boiler plate that you only use half the features of or write a 200 line webpack config by hand first.

One thing I really, really dearly missed when I just started out building a recent project with PostCSS is nesting rules. Usually I use SASS/SCSS for most of my CSS needs.

Nesting rules in SCSS looks like the following:

Continue reading “Parcel.js and PostCSS Rule Nesting”

Whitelines Paper Review

Whitelines is an easily scannable college (A4) paper that usually comes which squares or lines and an iOS or Android app. Its goal is to allow you to easily scan your notes to an image or directly upload to Evernote or Dropbox.

I’ve written a bit on it and want to let you know what I think, because the bridge between analog and digital is yet far from perfect and digital tablets or viable sketching or drawing methods still have not saturated the market appropriately, so this seems like a great “in between” solution.

I’ve previously eyeballed remarkable but it comes at a bit of a price tag and it’s not real paper after all.

Continue reading “Whitelines Paper Review”

Heroku Alternative: Dokku

Dokku is advertising itself as a self hosted Platform as a service and it lives up to its promise. You can fairly easily deploy a range of applications like Ruby, Node.js, Go and so on. Basically everything beyond your standard PHP CMS like WordPress (but also that ;)).

Dokku is easy to install and maintain. Under the hood it uses docker containers to run your apps. Dokku also comes as a pre-built app as a one click installer on Digital Ocean*. Since Dokku is very easy to install, there’s a couple of alternatives for you, for example Linode* or Vultr*.

Note: Dokku recommends at least 1GB or RAM.

Continue reading “Heroku Alternative: Dokku”