version: 1
frontend:
phases:
preBuild:
commands:
- npm ci
build:
commands:
- npm run build
artifacts:
# IMPORTANT - Please verify your build output directory
baseDirectory: build
files:
- '**/*'
cache:
paths:
- node_modules/**/*
version: 1
frontend:
phases:
preBuild:
commands:
- npm ci
build:
commands:
- npm run build
artifacts:
# IMPORTANT - Please verify your build output directory
baseDirectory: build
files:
- '**/*'
cache:
paths:
- node_modules/**/*
To build APK without Metro server, use below command:
react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res/
Do create folder: android/app/src/main/assets/index.android.bundle
Use Lombok to avoid boilerplate code:
https://projectlombok.org/
@Builder
@Data
@AllArgsConstructor
public class AddCouponRequest {
TO convert stream of stream to only stream...use flatMap
Mono.zip().flatMap(s1->s1)
How to auto upgrade package.json dependency version
Use below trick:
Simply change every dependency's version to *, then run npm update --save
How to Start multiple Byobu process through shell script:
Below is sample code:
byobu new-session -d -s "onreboot"
byobu new-window -t "onreboot":1 -n "web app" "sh ./webapp-build.sh" >/home/ubuntu/scripts/web_launch.log 2>&1
byobu new-window -t "onreboot":2 -n "api app" "sh ./api-build.sh" >/home/ubuntu/scripts/api_launch.log 2>&1
Very useful tool for keeping right contrast in text:
https://dequeuniversity.com/rules/axe/4.4/color-contrast?utm_source=lighthouse&utm_medium=devtools
Below is very good div tag mapper tool:
https://www.tormus.com/tools/div_checker#show_div_map
Dear Users,
We have provided way to practice Spoken English via website now. You will get 73 days of English Conversations. This helps in start talking in English. Similarly , four levels of daily life conversations (Starter, Basic, Intermediate and Advance) sentences are provided.
For information , checkout our Spoken English page at Spoken English
Sample code for: Working with multiple Reactive MongoDB reactive having different Databases
package com.hk.webapp.config;
import com.mongodb.reactivestreams.client.MongoClient;
import com.mongodb.reactivestreams.client.MongoClients;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.mongodb.config.AbstractReactiveMongoConfiguration;
import org.springframework.data.mongodb.core.ReactiveMongoTemplate;
import org.springframework.data.mongodb.repository.config.EnableReactiveMongoRepositories;
import java.util.Collection;
import java.util.Collections;
@Configuration
@EnableReactiveMongoRepositories(basePackages = "com.xy.dao",reactiveMongoTemplateRef = "xdbReactiveMongoTemplate")
public class XDbConfig extends AbstractReactiveMongoConfiguration
{
@Value("${mongo.connection_uri}")
private String connectionUri;
private String dbName="x_db";
@Override
public MongoClient reactiveMongoClient() {
return MongoClients.create(connectionUri);
}
@Override
protected String getDatabaseName() {
return dbName;
}
@Bean(name="xdbReactiveMongoTemplate")
public ReactiveMongoTemplate xdbReactiveMongoTemplate()
{
return new ReactiveMongoTemplate(reactiveMongoClient(), getDatabaseName());
}
}
Follow below example for Embedded youtube video:
<div style="position: relative; padding-bottom: 56.25%; padding-top: 30px; height: 0; overflow: hidden;"><iframe style="position: absolute; top: 0; left: 0; width: 100%; height: 100%;" title="YouTube video player" src="https://www.youtube.com/embed/Svxm-tBOI9s" frameborder="0" allowfullscreen="allowfullscreen"></iframe></div>
Use below steps to install custom maven on Ubuntu:
wget https://www-us.apache.org/dist/maven/maven-3/3.6.3/binaries/apache-maven-3.6.3-bin.tar.gz -P tmp
sudo tar xf tmp/apache-maven-*.tar.gz -C /opt
sudo ln -s /opt/apache-maven-3.6.3 /opt/maven
sudo nano /etc/profile.d/maven.sh
add below to maven.sh file
export JAVA_HOME=/usr/lib/jvm/default-java
export M2_HOME=/opt/maven
export MAVEN_HOME=/opt/maven
export PATH=${M2_HOME}/bin:${PATH}
sudo chmod +x /etc/profile.d/maven.sh
source /etc/profile.d/maven.sh
Use below:
RewriteRule ^(.{1,75})$ https://xyz.com$1 [L,R=permanent,QSA
Use Maven to add dependency:
<dependency>
<groupId>org.apache.poi</groupId> <artifactId>poi-ooxml</artifactId> <version>4.1.2</version> </dependency>module.exports={ getDisplayDate,}
function getDisplayDate(dateObj){ const months = [ 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December' ]; let monthNumber=dateObj.getMonth() return dateObj.getDate()+"/"+months[monthNumber]+"/"+dateObj.getFullYear();}
var options = { weekday: 'long', year: 'numeric', month: 'long', day: 'numeric' };
var today = new Date();
console.log(today.toLocaleDateString("en-US")); // 9/17/2016
console.log(today.toLocaleDateString("en-US", options)); // Saturday, September 17, 2016
console.log(today.toLocaleDateString("hi-IN", options));
date. toLocaleDateString("en-US", options)
Option # 2
Use the date.format library:
var dateFormat = require('dateformat');
var now = new Date();
dateFormat(now, "dddd, mmmm dS, yyyy, h:MM:ss TT");Using Moment.js
var moment = require('moment'); // require
moment().format();For Node.js
var format = require('date-format'); format.asString(); // defaults to ISO8601 format and current date format.asString(new Date()); // defaults to ISO8601 format format.asString('hh:mm:ss.SSS', new Date());
a) Install:
sudo npm install pm2 -g
b) Start Node api in cluster mode
pm2 --name <apiname> start index.js -i 2
c) Save Pm2 job
pm2 save
d) auto start at reboot
pm2 startup
e) reload without downtime
pm2 reload all
byobu new-session -d -s "onreboot"
byobu new-window -t "onreboot" "sudo sh ./build.sh" >/home/ubuntu/logs/api_launch.log 2>&1
Better approach at:
https://bholameena.blogspot.com/2022/10/starting-multiple-byobu-process-through.html
sudo update-alternatives --config java
JDK 8
apt install openjdk-8-jdk
This is very useful code to remove unused css in HTML
https://uncss-online.com/