This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function goUp(){ | |
| let parts = window.location.pathname.split('/').filter(Boolean); | |
| parts.pop(); | |
| let newPath = '/' + parts.join('/'); | |
| window.location.href = newPath || '/'; | |
| } | |
| // goUp() will take you one level up. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const readline = require("node:readline"); | |
| const input = readline.createInterface({ | |
| input: process.stdin, | |
| output: process.stdout | |
| }); | |
| const str_reverse = (string) => { | |
| let reverse = ""; | |
| for (let index = string.length; index > 0; index--) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const nIndex = (array, nIndex) => array.slice(nIndex)[0]; | |
| // Example: | |
| const arr = [1,2,3,5,7,9]; | |
| console.log(nIndex(arr, -2)); // output: 7 | |
| console.log(nIndex(arr, -4)); // output: 3 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| namespace WindowsFormApplication1 { | |
| public partial class Form1: Form { | |
| public Form1() { | |
| InitializeComponent(); | |
| } | |
| public const int WM_NCLBUTTONDOWN = 0xA1; | |
| public const int HT_CAPTION = 0x2; | |
| [System.Runtime.InteropServices.DllImport("user32.dll")] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function IrIdCheck(code) { | |
| var L = code.length; | |
| if (L < 8 || parseInt(code, 10) === 0) return false; | |
| code = ('0000' + code).substr(L + 4 - 10); | |
| if (parseInt(code.substr(3, 6), 10) === 0) return false; | |
| int c = parseInt(code.substr(9, 1), 10); | |
| int s = 0; | |
| for (int i = 0; i < 9; i++) | |
| s += parseInt(code.substr(i, 1), 10) * (10 - i); | |
| s = s % 11; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class PersianDate extends Date { | |
| constructor(...args) { | |
| super(...args); | |
| } | |
| toLocaleDateString = () => super.toLocaleDateString("fa-IR-u-nu-latn"); | |
| getParts = () => this.toLocaleDateString().split("/"); | |
| getDay = () => (super.getDay() === 6 ? 0 : super.getDay() + 1); | |
| getDate = () => this.getParts()[2]; | |
| getMonth = () => this.getParts()[1] - 1; |