Skip to content

Instantly share code, notes, and snippets.

View farithadnan's full-sized avatar

Farith farithadnan

  • MZM Sdn. Bhd.
  • Malaysia
  • 22:05 (UTC +08:00)
View GitHub Profile
farithadnan / emoji.css
Created December 22, 2023 01:47
Rotating and Shrinking Emoji
View emoji.css
.rotating-emoji {
display: inline-block;
transition: transform 0.3s ease-in-out;
.rotating-emoji:hover {
animation: rotateAndShrink 2s ease-in-out infinite;
transform: scale(0.8);
farithadnan / image2text.cs
Last active September 21, 2023 04:50
How to use extract text from multiple image using Tesseract OCR in C#?
View image2text.cs
/// <summary>
/// Method to extract text from an image.
/// </summary>
/// <param name="imagePaths">A path to entire images.</param>
/// <returns>Returns a list of strings.</returns>
private static List<List<string>> ExtractTextFromImage(List<string> imagePaths)
List<List<string>> allTexts = new();
// Initialize the Tesseract engine
farithadnan / gist:cfc963678c329bd9a1342aef7c4615a3
Created January 26, 2022 08:23 — forked from chad3814/gist:2924672
deleting array items in javascript with forEach() and splice()
View gist:cfc963678c329bd9a1342aef7c4615a3
// This is from my comment here:
* How to delete items from an Array in JavaScript, an exhaustive guide
// DON'T use the delete operator, it leaves a hole in the array:
var arr = [4, 5, 6];
delete arr[1]; // arr now: [4, undefined, 6]
farithadnan / patchingAsDefault.js
Created December 7, 2021 04:28
Patching form group value into an Array
View patchingAsDefault.js
// Patch value to default
displayData: string[];
patchCreateAsDefault(mainControl: FormGroup): void {
// Check if the formgroup is valid or not first
if (mainControl.valid) {
// Get raw value of formgroup, for nested form
const formObj = mainControl.getRawValue();
farithadnan / loop.js
Created October 12, 2021 06:10
Loop for formArray
View loop.js
// Check whether the serial length is equal with the quantity
for (const control of this.productForm.controls) {
if (control.get('serialLengthCheck').value !== control.get('quantity').value) {
console.log('Total of Serial Must be Equal with Quantity!');
farithadnan / validity.js
Created October 12, 2021 05:55
validate the form validity
View validity.js
// Check Validation status inside FormGroup/FromArray
const invalidControls: string[] = [];
const recursiveFunc = (form: FormGroup|FormArray) => {
Object.keys(form.controls).forEach(field => {
const control = form.get(field);
if (control.invalid) { invalidControls.push(field); }
if (control instanceof FormGroup) {
} else if (control instanceof FormArray) {
farithadnan / NoScrolling.js
Created October 12, 2021 03:29
Preventing scrolling when Input's focus is triggerred
View NoScrolling.js
// To prevent page scrolling whenever the input's focus is triggered
preventScroll: true
// Souces:
farithadnan / blur.css
Created September 30, 2021 04:29
Blur effect on a div element
View blur.css
div.blur {
-webkit-filter: blur(5px);
-moz-filter: blur(5px);
-o-filter: blur(5px);
-ms-filter: blur(5px);
filter: blur(5px);
width: 100px;
height: 100px;
background-color: #ccc;
View directive.component.html
1. Add button that will be named as Display Details, will toggling secret message on and
2. paragraph will display the secret if the secret havent display yet, and
vise versa
3. Will display count of the evertime the button is click (Timestamp stored into an array), and save the timestamp to an array using loop
4. if the content is more than five. index wise, it will give blue background color and white as its font
<div class="container">
farithadnan / input.component.html
Created May 9, 2021 07:26
Data Binding Exercise
View input.component.html
1. input, that use two way binding to
2. paragraph that will detect the update in name using string interpolation
3. button only clickable if the name is not empty, if its empty if will disable (use property binding)
4. button that can reset the string for variable, name
<div class="container">