Skip to content

Instantly share code, notes, and snippets.

View nabeghe's full-sized avatar
🫠

Hadi Akbarzadeh nabeghe

🫠
View GitHub Profile
@nabeghe
nabeghe / reverse.js
Created December 2, 2022 14:02
JavaScript Reverse Function
function reverse(value) {
if (!Array.isArray(value)) value = [...value.toString()]
return value.reverse().join('')
}
@nabeghe
nabeghe / convert-numeric-string-to-int-without-using-the-parseInt.js
Last active December 1, 2022 15:37
Convert Numberic String To Int without using the parseInt functioin in JavaScript
const getZeroLevel = (digitLevel) => {
if (digitLevel < 1) return 1
let output = 10
for (let i = 1; i < digitLevel; i++) {
output *= 10
}
return output
}
@nabeghe
nabeghe / reverse-integer.js
Created December 1, 2022 15:26
Reverse Integer in JavaScript
/**
* @param {number} x
* @return {number}
*/
var reverse = function(x) {
if (x === 0) return 0
const isNegative = x < 0
if (isNegative) x *= -1
let output = ""
while (x > 0) {
@nabeghe
nabeghe / romanToInt.js
Created November 14, 2022 10:49
Javascript romans number to integer
/**
* @param {string} s
* @return {number}
*/
var romanToInt = function(s) {
s = s.toUpperCase()
const chars = s.split('')
const romans = {
I: 1,
V: 5,
@nabeghe
nabeghe / get-dragged-path.bat
Created August 3, 2022 18:55
Get dragged path in batch script
@echo off
ECHO "%~1"
pause > nul
@nabeghe
nabeghe / FormMover.cs
Created June 26, 2022 19:35
C# .Net FormMover Class (Draging form by custom controls)
using System;
using System.Runtime.InteropServices;
using System.Windows.Forms;
namespace Example
{
public class FormMover
{
private const int WM_NCLBUTTONDOWN = 0xA1;
private const int HT_CAPTION = 0x2;
@nabeghe
nabeghe / StringLength.bat
Last active June 26, 2022 19:38
Get the string length in a batch script
@ECHO off
SET domain=FuLLKade.COM
CALL :strLength domain domainLength
ECHO Domains length is %domainLength%.
PAUSE
:strLength
SETLOCAL enabledelayedexpansion
@nabeghe
nabeghe / Arraylength.bat
Last active June 26, 2022 19:39
Get the array length in abatch script
@ECHO off
SET numbers[0]=1
SET numbers[1]=2
SET numbers[2]=3
SET numbers[3]=4
CALL :arrayLength numbers arrayLength
ECHO The array length is %arrayLength%.
PAUSE