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 ipv42num(ipString: string) { | |
| const ipNumber = ipString.split('.'); | |
| return ((((((+ipNumber[0]) * 256) + (+ipNumber[1])) * 256) + (+ipNumber[2])) * 256) + (+ipNumber[3]); | |
| } | |
| function num2ipv4(ipNumber: number) { | |
| let ipString = (ipNumber % 256).toString(); | |
| for (let i = 3; i > 0; i--) { | |
| ipNumber = Math.floor(ipNumber / 256); | |
| ipString = ipNumber % 256 + '.' + ipString; |
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
| export const resolveClasses = (rules: { | |
| [className: string]: () => boolean | |
| }, ...persistedClasses: string[]): string => { | |
| let classes: string[] = []; | |
| Object.keys(rules).forEach((className) => { | |
| const isResolved = rules[className](); | |
| if (isResolved) { | |
| classes.push(className); | |
| } else { | |
| // should remove it |
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
| import java.util.Arrays; | |
| public class HelloWorld { | |
| public static String calcBase(final String value, final int fromBase, final int toBase) { | |
| // схема по всех возможных цифр для любой системы счистелния (максимальная 64) | |
| final char[] charArray = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".toCharArray(); | |
| // схема цифр для изначальной системы счителния | |
| final char[] fromRange = Arrays.copyOfRange(charArray, 0, fromBase); |
NewerOlder