Sign in

Software Engineer 💀☠👽 | Building applications for health industry | Work with JavaScript, Typescript, PHP

Regular expressions are cryptic and hard to understand and build one from scratch.
But don’t panic with those cryptic symbols, the dev community can help.
Here i am writing 3 password regular expressions to use it at your next JavaScript front end app or your next NodeJS back end application.

// PASSWORD REGEX FOR YOUR NEXT JAVASCRIPT APP

// regex for a basic password must be
// more than 8 chars
const PASSWORD_REGEX_1= ^[A-Za-z0-9]\w{8,}$/;

// more secure regex password must be
// more than 8 chars
// at least one number
const PASSWORD_REGEX_2 = /^(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{8,}$/; …


SQLite database is a tiny giant in the SQL area with a fully-featured SQL database engine and billions of deployments.

5 Reasons to Use SQLite for your Next Project
Photo by Biljana Martinic on Unsplash

1. Server-less and Cross-Platform

SQLite database is implemented on a single file with no additional server process or the need for complicated RDBMS to install. All the reads and writes operations are taking place directly on a single file.

Since the database is a self-contained file you can move or copy your database on every platform you like Linux, UNIX, windows and work perfectly with zero-configuration.

2. Maintenance

Maintenance, tuning, and setting up backup routines for enterprise RDBMS is hard and takes tons of money and working hours. SQLite comes with zero server-side software installation and minimum maintenance.

SQLite database needs an API, disk space to…


In this lesson, we are going to learn about how to interact with our nodejs app to an SQLite database.

SQLite is a powerful database that lives in a single file or in memory and gives us all the basic operations (queries, views, triggers, indexes, etc) that have big enterprise databases such as MySQL, Postgress, etc…

In nodejs, we have a sqlite3 module that gives us all the features we need to interact with an SQLite database.

1. Install sqlite3 and connect with the database

In this section, we will create users.db database, establish, and close a connection with users.db.

Create a new nodejs project

cd sqliteBasics
npm init -y
npm i sqlite3

Now create an ./index.js file

./index.js


Photo by Bimata Prathama on Unsplash

Objects in JavaScript are reference values and can store complex key-value properties.

let story = {
title: 'Proper Ways to Copy(Clone) an Object in JavaScript',
author:{
name:'pkoulianos',
email:'petran@pkoulianos.com'
},
tags:['Javascript','programming']
};

Copying an object can be a little tricky. But don’t worry about in this story we’ll cover how to copy an object in proper ways.

1. The Fatal 😡 Way to Copy an Object

A fatal way to try copying an object is to use the assign = operator. The reason is that the assign operator will only pass the reference to the new variable.

Let’s see a simple example

let car1 = { color:’white’, type:’4X4' };// fatal…


Install a GitHub alternative for your team super easy and painless.

image from https://try.gitea.io

Dev teams often have to work in closed secure network areas with no access to the internet and consequentially giant git services like GitHub, GitLab, and more aren’t available. This is a huge problem, version control systems are part of the development process we must find a solution.

Don’t worry community has built gitea.io for you.

Gitea is an open-source solution under MIT license for self-hosted Git service.

Why Gitea:

  1. Gitea is supported by major companies
  2. Updated regularly by an active community
  3. Has 19.6k stars at GitHub
  4. Run in any OS…


Automate your tasks with Cron Jobs from Node.js

Photo by Fabrice Villard on Unsplash

1.Introduction

Cron Jobs are made to make our life easier and detach us from running tasks at certain times.

Let’s dive in

Node.js Libraries that support Cron Jobs are cron and node-cron.

Node Cron

  1. Less popular than cron
  2. Simple usage
  3. Fewer options
  4. No control over the cron job process

Cron

  1. More popular than node-cron
  2. Has more enhanced options for scheduling tasks
  3. Has better control over the cron job process

In this story, we’ll use the cron module.

Cron Patterns

Cron Jobs schedule tasks with Cron Patterns and these patterns have a format such as (* * 1 *…


Learn how to build a flush messages middleware system with node.js and express.js from scratch

Photo by Octavian Rosca on Unsplash

1.Introduction

In this story, we’ll learn how to build a flush message middleware from scratch with node.js and express.js.

But what is flush messages?

Flush messages are small messages with information that inform the user-client about various cases, such as unsuccessful login, invalid input on a form field etc …

Start by cloning the project repository

git clone https://github.com/petranb2/flushMessages.git

2. Install and discover

cd flushMessages/startFlushMessages

Install the dependencies:

npm install

Your directory:


A detailed story to learn, write and execute regular expressions easily

Photo by Gábor Molnár on Unsplash

1. Introduction

Regular expressions are a topic that confuses and struggles a lot of developers due to its crypt syntax.

A regular expression is a string that contains a search pattern (ex. \[0–9]{2}\ this pattern accepts a 2 digit number), and we use it to find those patterns into texts.

2. How to Create a RegExp

In javascript we can create RegExp with 2 ways:

// a string with a format /<RegExp>/;
var twoDigitRegExp = /[0–9]{2}/;
// Construct a new RegExp object
var twoDigitRegExp = new RegExp(‘[0–9]{2}’);

3. RegExp Building Blocks

Quantifiers

p* --> The * will match the previous p char for 0 or more times. 
Example /js*/ will accept j (s…


Stack is one of the most important data structures in programming, but how can we implement a stack in javascript? Let’s dig in.

Photo by Nathan Dumlao on Unsplash

1.Introduction

The stack is a fundamental abstract data structure for computer science that serves a collection of elements with the LIFO method and two main operations:

  • push (add a new element to stack)
  • pop (remove the top element)

Stacks are used mainly by algorithms(Backtracking,depth-first search,…), OS(operational systems), programming languages(memory management, call stack,… ), frameworks and many more applications.

2.Implementation

We’ll implement a stack with an array and we going to create a class with the following functions:

  • isEmpty (print…


How to validate our data before saving it into MongoDB with mongoose library

Photo by fabio on Unsplash

1.Introduction

Hello, my dev friends !!!!

Creating functions and procedures to save data into databases is an everyday task for software developers, but how we are sure about the actual stored data has the form that we want ???

Saving clean and proper formatted data increases the overall data quality plus our application is more secure.

In this story, we’ll learn how to validate our data before storing it into MongoDB with mongoose library.

Mongoose is a great object modeling tool for MongoDB and node.js, it is trusted by millions of developers, has nearly 800,000 weakly downloads at npm and 20.4k…

Petros Koulianos 💀☠👽

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store