Skip to content

Instantly share code, notes, and snippets.

@realattila
realattila / commit-template-checker.js
Last active October 7, 2023 10:31
Git Commit Message Validation Tool for Ensuring Template Adherence, Designed for Husky Git Hooks
/**
WARNING: AFTER READING THIS SECTION REMOVE THIS COMMENT SECTION FROM commit-template-checker.js file
after adding this script to your project, your commit message should contain on of this format, if not, you can not commit.
const correctCommitMsgFormat = [
"👌 IMPROVE: {Your message}",
"🚀 RELEASE: {Your message}",
"🗑 REMOVE: {Your message}",
"🐛 FIX: {Your message}",
@ds1371dani
ds1371dani / gridify.ts
Last active September 21, 2022 03:14
Gridify query builder for typescript
import { GridifyConditionEnum, GridifyLogicalEnum, GridifyOrderEnum, FilterType, OperatorType, FiltersType } from "./types.ts";
function trimEnds(query: string): string {
let result = query;
// There should not be any starting or ending operator
if (result.startsWith(GridifyLogicalEnum.And)) result = result.slice(GridifyLogicalEnum.And.length);
if (result.startsWith(GridifyLogicalEnum.Or)) result = result.slice(GridifyLogicalEnum.Or.length);
if (result.endsWith(GridifyLogicalEnum.And)) result = result.slice(0, -GridifyLogicalEnum.And.length);
if (result.endsWith(GridifyLogicalEnum.Or)) result = result.slice(0, -GridifyLogicalEnum.Or.length);
return result;