Skip to content

Instantly share code, notes, and snippets.

View Super-Chama's full-sized avatar
🍊
Back to office

Chamara Abesinghe Super-Chama

🍊
Back to office
View GitHub Profile

Date format in OHRM Application

Date format for the application can be configured within Admin - Localisation screen via a Admin user. this format is universal for the application and once changed all places should be updated. This format is only used for the display purposes and all the communication between BE/FE via API is carried out via single date format that is not user changeable. (Hence the distinction display format and io format)

Difference between BE/FE date format.

The tokens (symbols) that is used between PHP and JavaScript languages are different when using date format.

Consider date with format 2022-05-11 (Year-month-date)

  • PHP Format - Y-m-d
@Super-Chama
Super-Chama / stats.js
Created July 19, 2023 05:50
Analyse all ES6 imports inside directory
const fs = require("fs");
const path = require("path");
const glob = require("glob");
function traverseAndWriteImports(directory, outputFile) {
const filePattern = path.join(directory, "**/*.{js,ts}");
const files = glob.sync(filePattern, {
ignore: "**/node_modules/**",
nodir: true,
});
const faker = {
name: {
firstName() {
// array containing 100 random first names
const firstNames = [
"Tim",
"John",
"Jane",
"Jack",
"Jill",
class SuppressWarningsPlugin {
warning;
maxWarnings;
constructor(maxWarnings = 0) {
this.maxWarnings = maxWarnings;
}
apply(compiler) {
compiler.hooks.emit.tap("SuppressWarningsPlugin", (compilation) => {
if (!Array.isArray(compilation.warnings)) return;
@Super-Chama
Super-Chama / counter.controller.js
Created March 3, 2023 04:32
Basic Vuex (Flux) pattern for Angular.js (1x)
(function () {
"use strict";
angular.module("app").controller("CounterController", CounterController);
CounterController.$inject = ["$scope", "storeService"];
function CounterController($scope, storeService) {
var vm = this;

1.X Folder structure

├── components
│   ├── package.json
│   └── src
│       ├── core
│       │   └── components
│       │      └── Alert
│       │         ├── alert.scss
│       │         ├── Alert.vue
@Super-Chama
Super-Chama / autoshutdown.sh
Created January 1, 2023 19:41
Shell script to schedule shutdown if web service is not reachable
#!/bin/bash
IP='192.168.1.1'
DELAY=5
DATE=$(date '+%d/%m/%Y %H:%M:%S')
ping -c 1 $IP &> /dev/null
if [[ $? -ne 0 ]];
then

Check latest changes
git fetch upstream

Switch to latest 5.2 branch
git checkout upstream/5.2

Create and switch to your local branch
replace [JIRA_ID] with your ticket ID
git checkout -b [JIRA_ID]

@Super-Chama
Super-Chama / debain.motd
Last active June 26, 2022 02:14 — forked from rojenzaman/dynmotd
RHEL (Centos/Fedora) dynamic motd
#!/bin/bash
# config
USER=`whoami`
HOSTNAME=`uname -n`
ROOT=`df -Ph / | grep / | awk '{print $4}' | tr -d '\n'`
HOME=`df -Ph | grep home | awk '{print $4}' | tr -d '\n'`
BACKUP=`df -Ph | grep backup | awk '{print $4}' | tr -d '\n'`
MNT=`df -Ph | grep mnt | awk '{print $4}' | tr -d '\n'`
@Super-Chama
Super-Chama / blob.svg
Created June 15, 2022 11:37
OrangeHRM Dark Theme
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.