Tag Archive for: Bash

Best way to update Node

Make things easy with package n.

n latest

Simulate different times/dates in your app

If you want to test your app with different times you don’t need to change your computer time (what can lead to unexpected consequences), instead you can simple open a terminal and launch your app with faketime.

faketime -f "@2049-01-11 17:50:00" firefox

Replace all your files indented with 4 spaces to 2 spaces

sed -e 's/^/~/' -e ': r' -e 's/^\( *\)~    /\1  ~/' -e 't r' -e 's/~//' -i *

CordovaError: Requirements check failed for JDK 1.8 or greater

If you have a Cordova Error after updating to Ubuntu 18.04, the easiest way to resolve this issue is removing openjdk-11 and reinstalling openjdk-8.

sudo apt purge openjdk-11-jdk-headless openjdk-11-jre-headless
sudo apt install openjdk-8-jdk

There is not support for the new java versions yet in Cordova/Android (at the post date)

Simple local development environment for web apps

  1. Open your app working directory
    • There you should have at least index.html
  2. Launch http-server in your terminal
    • If you haven’t installed it yet: npm install http-server -g
  3. Launch chromium-browser --disable-web-security --user-data-dir=/tmp/something in your terminal to allow all origins (temporary ignore  CORS mechanism )
    • Make sure you don’t have other instances open: pkill -f chromium
  4. Type in the address bar one of the address from your http-server info to access to your app

Note: Use Chromium without security just with your own code for testing and development, do not browse with it and beware about using third-party software in your code.