Skip to content

Instantly share code, notes, and snippets.

View codersidprogrammer's full-sized avatar

codersidprogrammer

View GitHub Profile
@codersidprogrammer
codersidprogrammer / role.validator.ts
Created March 19, 2025 01:52
Sample of usage role as interface. So that we can generate class for every role
/**
*
[
{
"name": "VP",
"permissions": ["view_all_projects", "edit_all_projects"]
},
{
"name": "Manager",
"permissions": ["view_team_projects", "edit_team_projects"]
@codersidprogrammer
codersidprogrammer / app.module.ts
Created October 9, 2024 04:12
Make deactivate default log for NestJS Eureka Connector
...
EurekaModule.forRoot({
disable: false,
disableDiscovery: false,
eureka: {
host: process.env.EUREKA_HOST || 'localhost',
port: Number(process.env.EUREKA_PORT) || 8761,
registryFetchInterval: Number(process.env.EUREKA_INTERVAL) || 1000,
servicePath: '/eureka/apps',
maxRetries: 3,
import { Injectable } from '@nestjs/common';
import { EventEmitter2 } from '@nestjs/event-emitter';
import {
$Enums,
StopReason,
Teams,
TransactionActiveJob,
TransactionStopJob,
} from '@prisma/client';
import { plainToClass } from 'class-transformer';
@codersidprogrammer
codersidprogrammer / change_type.sql
Created August 5, 2024 08:35
Change ENUM Type for PostgreSQL
-- Mochammad Dimas Editya
-- https://youtube.com/codersindonesia
--
-- Bukan orang GMF
-- Change ENUM Type in PostgreSQL
--
-- 1. Change enum name into another. So no one will use it
ALTER TYPE public."BudgetEnum" RENAME TO budgetenum;
-- 2. Create new enum type as you wish
// Part 1
let kota:string;
let tahun:number;
let isActive: boolean;
kota = 'bandung';
tahun = 2024;
isActive = true;
// Part 2

XOPS Logo

Description

XOPS API Built on NestJS. It use as backend service for XOPS Environment. XOPS is application that built for recording manhours of work. So you can write and log all activity while you work.

@codersidprogrammer
codersidprogrammer / ObjectMapperUtil.java
Created December 29, 2023 06:45
Convert plain object into POJO
package com.gmf.tms.utils;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.modelmapper.ModelMapper;
import org.modelmapper.convention.MatchingStrategies;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.Collection;
import java.util.List;
@codersidprogrammer
codersidprogrammer / app.module.ts
Created November 21, 2023 01:45
Inteceptor untuk setiap request di elasticsearch. sesuaikan alamat host ELASTIC dan PORT nya
import { BullModule } from '@nestjs/bull';
import { Module } from '@nestjs/common';
import { ConfigModule, ConfigService } from '@nestjs/config';
import { APP_FILTER, APP_INTERCEPTOR } from '@nestjs/core';
import { AppController } from './app.controller';
import { RedisConfig } from './config/redis.config';
import { ElasticsearchLoggerInterceptor } from './core/interceptor/elasticlog.interceptor';
import { ElasticService } from './core/services/elastic.service';
import { CrmModule } from './modules/crm/crm.module';
import { JobBookmarkModule } from './modules/job-bookmark/job-bookmark.module';
@codersidprogrammer
codersidprogrammer / gaus_seidel.m
Last active September 3, 2023 03:21
Cuplikan kode MATLAB yg digunankan untuk melakukan analisa pada sistem 3 bus
% TUGAS PRAKTIKUM KONVERSI ENERGI
% STUDI ALIRAN DAYA PADA SISTEM 3 BUS
% METODE GAUSS-SEIDEL
% -------------------------------------
% TEKNIK ELEKTRO
% UNIVERSITAS MUHAMMADIYAH TANGERANG
% -------------------------------------
% MOCHAMMAD DIMAS EDITIYA - 2220201067
% ARYA HAFIZH ALFARIZI - 2120201003
% TEGAR JUNI KADIYANTO - 2120201023
import { Injectable } from '@nestjs/common';
import ffmpeg from 'fluent-ffmpeg';
@Injectable()
export class VideoSplitService {
splitVideo(inputPath: string, outputPath: string): void {
ffmpeg(inputPath, {
timeout: 4320000,
})
.addOption([