Skip to content

Instantly share code, notes, and snippets.

{
"_id": "california",
"type": "Feature",
"properties": {
"name": "California",
"abbreviation": "CA",
"capital": "Sacramento",
"city": "Los Angeles",
"population": 38332521,
"area": 423968,

Organise your Node Node.js versions!

Requirements:

  • Zshell
  • NVM
  1. Just place a .nvmrc file inside the root of you project directory and add the version to be used inside

Basics to setup a Postgres Database

Check if you have installed postgres on your machine first.

# CREATE A PHYSICAL POSTGRESQL DATABASE

initdb /usr/local/var/postgres

How to deploy the headless cms strapi on your uberspace 7

This summary describes the collection of necessary tutorials to host strapy on your uberspace

1. Install mongodb on your uberspace

just follow this well written tutorial.

2. Install strapi and pm2 within a subdirectory of your public html folder on your uberspace

take just a segment of this tutorial. be sure to use the before defined credentials (like, ip address, port, username e.g. of your freshly created database)

How to create a minial Headless CMS and REST API with Kirby 3

  1. Get the plain Kirby Kit
  2. Download and install the Better Rest Plugin
  3. For local development create the config folder under /site/ and create a config.php
  4. Add the following:
<?php

return [
@fdnklg
fdnklg / React-App-Setup.md
Last active September 17, 2019 22:58
Some useful tutorials on how to setup a react app.

How to setup your react app

  1. create a new react app with the create-react-app CLI
npx create-react-app folder-name-of-app
  1. Add scss support to your react app by following this tutorial

  2. Setup redux support by following this tutorial

How to handle a sqlite database

A list a basic tutorials which helped to accomplish basic transformations of a sqlite db

How to request your rest API in a paginated way with parallel promises

  1. In your API backend count all documents included in your mongodb and create a handler function for it. A detailed view about the API code can be found here.
db.collection.find({ you db query here }).count()
  1. In the frontend split your requests in smaller bits of requests and while following this design pattern:

If you’re interested to execute a script more often at a specific time you might be interested to setup a cron job. Now I want to briefly summarise the most basic how to about setting up a cronjob for a node script on a linux web server.

What is cron?

Cron is a service that executes scripts at a given time. Each cron job is following this syntax:

* * * * * auszuführender Befehl
┬ ┬ ┬ ┬ ┬
│ │ │ │ │
│ │ │ │ └──── weekday (0-7, Sonntag ist 0 oder 7)

How to setup a docker container on an aws elastic beanstalk environment as a single node container

  1. prepare a docker image which runs locally. (You can find a docker image of the routing service here)
  2. setup aws account and create organization with required roles
    • elasticloadbalancing
    • aws-elasticbeanstalk-service-role
  3. Install EB-CLI (Command line interface) and AWS CLI
brew install awscli