This file contains 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); |
This file contains 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 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 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 class SmartCursor { | |
private _cur: number; | |
private _memorized: number; | |
constructor(i: number = 0) { | |
this._cur = i; | |
this._memorized = i; | |
} |
This file contains 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 class Bitwise { | |
private _i: number; | |
constructor(value: number) { | |
this._i = value; | |
} | |
test(mask = 0x01) { | |
return (mask ^ this._i) === 0; |
This file contains 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 { Mixin } from './mixin'; | |
import { EventEmitter } from 'events'; | |
// Define .h | |
export declare class EventEmittable { | |
protected events: EventEmitter; | |
} | |
// Implement .cpp | |
export const EventEmittableMixin = (mixin: Mixin) => class extends mixin { |
This file contains 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 * as deepMerge from 'deepmerge'; | |
import * as deepFreeze from 'deep-freeze'; | |
function sealed(constructor: Function) { | |
Object.seal(constructor); | |
Object.seal(constructor.prototype); | |
} | |
@sealed | |
export class StateObject<T> { |
This file contains 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 React from 'react'; | |
import { Field, reduxForm } from 'redux-form'; | |
import { AutoComplete, FlatButton } from 'material-ui'; | |
// Component | |
const mapError = ( | |
{ | |
meta: { touched, error, warning } = {}, | |
input, |
This file contains 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
/* eslint-disable react/prefer-stateless-function */ | |
import React from 'react'; | |
import { reduxForm, FieldArray, Field, FormSection } from 'redux-form'; | |
import { TextField } from 'redux-form-material-ui'; | |
const getDepth = (name) => { | |
if (name) { | |
const match = name.match(/children\[\d\]/g); | |
if (match) { |
This file contains 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
.loader { | |
color: inherit; | |
display: inline-block; | |
cursor: wait; | |
} | |
.loader > span { | |
animation-name: blink; | |
animation-duration: 1.4s; | |
animation-iteration-count: infinite; |
OlderNewer