Skip to content

Commit ab47ac3

Browse files
authored
Merge branch 'main' into 48-font-converter
2 parents a8cdc72 + e7a7590 commit ab47ac3

File tree

9 files changed

+219
-7
lines changed

9 files changed

+219
-7
lines changed

Frontend/package-lock.json

Lines changed: 27 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Frontend/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
"rxjs": "~7.8.0",
3434
"smol-toml": "^1.3.1",
3535
"tslib": "^2.3.0",
36+
"uuid": "^11.0.5",
3637
"yamljs": "^0.3.0",
3738
"zone.js": "~0.14.10"
3839
},
@@ -43,6 +44,7 @@
4344
"@types/express": "^4.17.17",
4445
"@types/jasmine": "~5.1.0",
4546
"@types/node": "^18.18.0",
47+
"@types/uuid": "^10.0.0",
4648
"@types/yamljs": "^0.2.34",
4749
"jasmine-core": "~5.2.0",
4850
"karma": "~6.4.0",

Frontend/src/app/app.routes.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import { SerializedToolComponent } from './serialized-tool/serialized-tool.compo
77
import { MssqlScaffolderComponent } from './mssql-scaffolder/mssql-scaffolder.component';
88
import { DownloadsComponent } from './downloads/downloads.component';
99
import { FontConverterComponent } from './font-converter/font-converter.component';
10+
import { IdGeneratorComponent } from './id-generator/id-generator.component';
1011

1112
export const routes: Routes = [
1213
{ path: '', title: "CodeChef", component: HomeComponent, data: { header: false } },
@@ -15,6 +16,7 @@ export const routes: Routes = [
1516
{ path: 'serialized', title: "Serialized Tool • CodeChef", component: SerializedToolComponent },
1617
{ path: 'mssqlscaffold', title: "MSSQL Scaffolder • CodeChef", component: MssqlScaffolderComponent },
1718
{ path: 'fonts', title: "Font Converter • CodeChef", component: FontConverterComponent },
19+
{ path: 'id', title: "ID Generator • CodeChef", component: IdGeneratorComponent },
1820
{ path: 'downloads', title: "Downloads • CodeChef", component: DownloadsComponent },
1921

2022
{ path: '**', title: "Not Found • CodeChef", component: NotFoundComponent },

Frontend/src/app/header/header.component.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,11 @@ <h1 class="fs-3 m-0">CodeChef</h1>
3030
</a>
3131
<ul class="dropdown-menu" aria-labelledby="dropdownMenuLink">
3232
<li><a role="button" class="dropdown-item" [routerLink]="['/cs2ts']">C# to TS Converter</a></li>
33-
<li><a role="button" class="dropdown-item" [routerLink]="['/md2html']">Markdown to HTML
34-
Converter</a></li>
33+
<li><a role="button" class="dropdown-item" [routerLink]="['/md2html']">Markdown to HTML Converter</a></li>
3534
<li><a role="button" class="dropdown-item" [routerLink]="['/serialized']">Serialized Tool</a></li>
3635
<li><a role="button" class="dropdown-item" [routerLink]="['/mssqlscaffold']">MSSQL Scaffolder</a></li>
3736
<li><a role="button" class="dropdown-item" [routerLink]="['/fonts']">Font Converter</a></li>
37+
<li><a role="button" class="dropdown-item" [routerLink]="['/id']">ID Generator</a></li>
3838
</ul>
3939
</div>
4040
<a role="button" class="btn-header btn-hover" [routerLink]="['/downloads']"><i class="bi bi-download"></i>

Frontend/src/app/home/home.component.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ <h1>CodeChef</h1>
3131
<a role="button" class="btn btn-outline-success" [routerLink]="['/serialized']">Serialized Tool</a>
3232
<a role="button" class="btn btn-outline-success" [routerLink]="['/mssqlscaffold']">MSSQL Scaffolder</a>
3333
<a role="button" class="btn btn-outline-success" [routerLink]="['/fonts']">Font Converter</a>
34+
<a role="button" class="btn btn-outline-success" [routerLink]="['/id']">ID Generator</a>
3435
</div>
3536
</div>
3637
<br />
Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
<div class="container-fluid page p-4">
2+
<div class="row mb-3">
3+
<h2>ID Generator</h2>
4+
<p>You can easily generate GUID/UUID or NanoID using this tool.<br />
5+
Just configure the tool and keep generating as many valid IDs as you like!</p>
6+
</div>
7+
8+
<div class="row mb-3">
9+
<div class="col-sm-6 d-flex gap-2">
10+
<div class="form-check">
11+
<input class="form-check-input" type="radio" name="idTypeRadio" id="guid" [value]="true"
12+
[(ngModel)]="isGuid" (change)="generate()">
13+
<label class="form-check-label" for="guid">GUID / UUID</label>
14+
</div>
15+
<div class="form-check">
16+
<input class="form-check-input" type="radio" name="idTypeRadio" id="nanoid" [value]="false"
17+
[(ngModel)]="isGuid" (change)="generate()">
18+
<label class="form-check-label" for="nanoid">NanoID</label>
19+
</div>
20+
</div>
21+
<div class="col-sm-6 d-flex gap-2">
22+
<label class="form-label d-block me-2">Options:</label>
23+
<div class="form-check">
24+
<input class="form-check-input" type="checkbox" id="hyphens" [disabled]="!isGuid" [(ngModel)]="hyphen"
25+
(change)="generate()" />
26+
<label class="form-check-label" for="hyphens">Hyphens</label>
27+
</div>
28+
<div class="form-check">
29+
<input class="form-check-input" type="checkbox" id="uppercase" [(ngModel)]="uppercase"
30+
(change)="generate()" />
31+
<label class="form-check-label" for="uppercase">Uppercase</label>
32+
</div>
33+
</div>
34+
</div>
35+
36+
<div class="row mb-3">
37+
<div class="col-sm-4">
38+
<label for="idCount" class="form-label">ID Count</label>
39+
<input type="number" class="form-control" id="idCount" [(ngModel)]="count" (change)="generate()" />
40+
</div>
41+
<div class="col-sm-4">
42+
<label for="prependText" class="form-label">Prepend Text</label>
43+
<input type="text" class="form-control" id="prependText" [(ngModel)]="prepend" (change)="generate()" />
44+
</div>
45+
<div class="col-sm-4">
46+
<label for="appendText" class="form-label">Append Text</label>
47+
<input type="text" class="form-control" id="appendText" [(ngModel)]="append" (change)="generate()" />
48+
</div>
49+
</div>
50+
51+
<div class="row mb-3">
52+
<div class="col d-flex gap-2">
53+
<label class="form-label d-block me-2">Encoding:</label>
54+
<div class="form-check">
55+
<input class="form-check-input" type="checkbox" id="base64" [(ngModel)]="base64"
56+
(change)="generate()" />
57+
<label class="form-check-label" for="base64">Base64</label>
58+
</div>
59+
<div class="form-check">
60+
<input class="form-check-input" type="checkbox" id="rfc7515" [disabled]="!base64" [(ngModel)]="rfc7515" (change)="generate()" />
61+
<label class="form-check-label" for="rfc7515">RFC7515</label>
62+
</div>
63+
<div class="form-check">
64+
<input class="form-check-input" type="checkbox" id="urlEncode" [disabled]="!base64"
65+
[(ngModel)]="urlEncode" (change)="generate()" />
66+
<label class="form-check-label" for="urlEncode">URL Encode</label>
67+
</div>
68+
</div>
69+
</div>
70+
71+
72+
<div class="row">
73+
<div class="col-12">
74+
<label for="csharp-code" class="form-label">Generated IDs:</label>
75+
<div class="code-border" [@valueChangeAnim]="status">
76+
<code-area innerStyle="min-height:300px;" [(code)]="idsCode" language="typescript" readonly="true" />
77+
</div>
78+
<br />
79+
</div>
80+
</div>
81+
82+
<div class="row">
83+
<div class="col-12 d-flex justify-content-center">
84+
<button class="btn btn-success" (click)="generate()">Generate <i class="bi bi-stars"></i></button>
85+
</div>
86+
</div>
87+
88+
<br />
89+
90+
<div class="row">
91+
<div class="col-12">
92+
<p><strong>GUID &amp; UUID</strong><br>GUID (Globally Unique Identifier) and UUID (Universally Unique
93+
Identifier) are 128-bit unique IDs widely used in databases, distributed systems, and APIs. These
94+
alphanumeric strings (like <code>550e8400-e29b-41d4-a716-446655440000</code>) ensure uniqueness across
95+
systems. UUIDs follow the <strong>RFC 4122</strong> standard and come in versions like <strong>v1
96+
(time-based)</strong> or <strong>v4 (random)</strong>, making them perfect for decentralized setups
97+
where collisions must be avoided.</p>
98+
<p><strong>NanoID</strong><br>NanoID is the sleek, modern alternative to UUIDs. It’s
99+
<strong>faster</strong>, <strong>customizable</strong>, and <strong>shorter</strong>—ideal for use cases
100+
like short URLs, user sessions, or SPAs. With adjustable lengths and character sets, NanoID gives
101+
developers full control while staying efficient and secure. Need a compact, unique ID that’s easy to
102+
work with? NanoID has you covered.</p>
103+
</div>
104+
</div>
105+
</div>
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import { ComponentFixture, TestBed } from '@angular/core/testing';
2+
3+
import { IdGeneratorComponent } from './id-generator.component';
4+
import { provideAnimations } from '@angular/platform-browser/animations';
5+
6+
describe('IdGeneratorComponent', () => {
7+
let component: IdGeneratorComponent;
8+
let fixture: ComponentFixture<IdGeneratorComponent>;
9+
10+
beforeEach(async () => {
11+
await TestBed.configureTestingModule({
12+
imports: [IdGeneratorComponent],
13+
providers: [
14+
provideAnimations(),
15+
]
16+
})
17+
.compileComponents();
18+
19+
fixture = TestBed.createComponent(IdGeneratorComponent);
20+
component = fixture.componentInstance;
21+
fixture.detectChanges();
22+
});
23+
24+
it('should create', () => {
25+
expect(component).toBeTruthy();
26+
});
27+
});
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
import { Component } from '@angular/core';
2+
import { CodeAreaComponent } from "../code-area/code-area.component";
3+
import { valueChangeAnim } from '../../animations/common-animations';
4+
import { Meta } from '@angular/platform-browser';
5+
import { FormsModule } from '@angular/forms';
6+
import { v4 as uuidv4 } from 'uuid';
7+
import { nanoid } from 'nanoid';
8+
9+
@Component({
10+
selector: 'app-id-generator',
11+
standalone: true,
12+
imports: [FormsModule, CodeAreaComponent],
13+
templateUrl: './id-generator.component.html',
14+
animations: [valueChangeAnim]
15+
})
16+
export class IdGeneratorComponent {
17+
protected status: boolean = false;
18+
protected idsCode: string = "";
19+
protected isGuid: boolean = true;
20+
protected uppercase: boolean = false;
21+
protected hyphen: boolean = true;
22+
protected base64: boolean = false;
23+
protected rfc7515: boolean = false;
24+
protected urlEncode: boolean = false;
25+
protected count: number = 7;
26+
protected prepend: string = "{\"";
27+
protected append: string = "\"},";
28+
29+
constructor(meta: Meta) {
30+
meta.addTags([
31+
{ name: "description", content: "Generates GUID/UUID or NanoIDs with advanced settings." },
32+
{ name: "keywords", content: "generate, generator, ID, GUID, UUID, nanoID, free, online, advanced, setting, code, encode, encoder, encoding, base64, base, 64, url, url encode, RFC7515, RFC, 7515" },
33+
]);
34+
35+
this.generate();
36+
}
37+
38+
protected generate() {
39+
this.idsCode = "";
40+
for (let i = 0; i < this.count; i++) {
41+
let id = this.isGuid ? uuidv4().toString() : nanoid().toString();
42+
if (this.uppercase) id = id.toUpperCase();
43+
if (this.isGuid) if (!this.hyphen) id = id.replaceAll("-", "");
44+
if (this.base64) id = btoa(id);
45+
if (this.base64) if (this.rfc7515) id = id.replaceAll("+", "-").replaceAll("/", "_").replaceAll("=", "");
46+
if (this.base64) if (this.urlEncode) id = encodeURIComponent(id);
47+
this.idsCode += this.prepend + id + this.append + "\n";
48+
}
49+
50+
this.status = !this.status;
51+
}
52+
}

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ CodeChef is an online developer tool that aims to eliminate repetitive developer
1616
- **Serialized tool**<br/>Converts serialized objects between different formats(JSON, XML, YAML, TOML).
1717
- **MSSQL Scaffolder**<br/>Scaffolds C# Models from MSSQL Tables and Stored Procedures.
1818
- **Font Converter**<br/>Converts different Font formats to each other(.ttf, .woff, .woff2, .eot, .svg, .otf).
19+
- **ID Generator**<br/>Generates GUID/UUID and NanoIDs with code formating and encoding.
1920
- **Need more tools?**<br/><a href="#Contribution">Open issue/pull request</a>, Everyone is welcome for contribution.
2021

2122
You can [**Go to Live Website**](https://codechef.ipdotsetaf.ir) or Run the website locally.

0 commit comments

Comments
 (0)