repo_name
stringlengths
5
122
path
stringlengths
3
232
text
stringlengths
6
1.05M
hugleMr/Eazax-cases
assets/eazax-ccc/utils/StorageUtil.ts
<reponame>hugleMr/Eazax-cases<gh_stars>0 /** * 本地储存工具 * @author 陈皮皮 (ifaswind) * @version 20201206 * @see StorageUtil.ts https://gitee.com/ifaswind/eazax-ccc/blob/master/utils/StorageUtil.ts */ export default class StorageUtil { /** * 保存数据到本地 * @param key 键 * @param value 值 */ public s...
hugleMr/Eazax-cases
assets/eazax-ccc/extensions/extension.ts
// 类型扩展 // @see extension.ts https://gitee.com/ifaswind/eazax-ccc/blob/master/extensions/extension.ts String.prototype.clamp = function (start, threshold, suffix = '...') { if (this.replace(/[^\x00-\xff]/g, 'xx').length <= threshold) return this; let charCount = 0; let result = ''; for (let i = ...
hugleMr/Eazax-cases
assets/eazax-ccc/components/localization/LocalizationBase.ts
import EventManager from "../../core/EventManager"; /** 语言更改事件 */ export const LANG_CHANGED = 'lang-change'; /** 语言 */ export enum Lang { /** 中文 */ Cn = 'cn', /** 英语 */ Eng = 'eng' } /** 默认语言 */ export enum DefaultLang { /** 中文 */ cn = 1, /** 英语 */ eng, } const {...
hugleMr/Eazax-cases
assets/eazax-ccc/components/effects/Mosaic.ts
<gh_stars>0 import EditorAsset from "../../misc/EditorAsset"; const { ccclass, property, requireComponent, executeInEditMode, disallowMultiple } = cc._decorator; /** * 马赛克 Shader 组件,该组件需要对应的 Effect 才能正常使用! * @author 陈皮皮 (ifaswind) * @version 20211205 * @see Mosaic.ts https://gitee.com/ifaswind/eazax-ccc/b...
hugleMr/Eazax-cases
assets/eazax-ccc/extensions/eazax.ts
/** * Eazax 全局命名空间 * @see eazax.ts https://gitee.com/ifaswind/eazax-ccc/blob/master/extensions/eazax.ts */ namespace eazax { /** * 打出光彩夺目的日志(黑蓝白配色) * @param title 标题 * @param msg 信息 */ export function log(title: any, msg?: any): void { if (msg) { console....
hugleMr/Eazax-cases
assets/eazax-ccc/utils/RegexUtil.ts
/** * 正则工具 * @author 陈皮皮 (ifaswind) * @version 20200928 * @see RegexUtil.ts https://gitee.com/ifaswind/eazax-ccc/blob/master/utils/RegexUtil.ts */ export default class RegexUtil { /** * 判断字符是否为双字节字符(如中文字符) * @param string 原字符串 */ public static isDWORD(string: string): boolean { ...
hugleMr/Eazax-cases
assets/eazax-ccc/components/remote/RemoteTexture.ts
import RemoteLoader from "../../core/remote/RemoteLoader"; import RemoteAsset from "./RemoteAsset"; const { ccclass, property, executeInEditMode, help } = cc._decorator; /** * 远程图像 * @author 陈皮皮 (ifaswind) * @version 20211201 * @see RemoteTexture.ts https://gitee.com/ifaswind/eazax-ccc/blob/master/components/remo...
hugleMr/Eazax-cases
assets/test/multiPassKawaseBlur/scripts/KawaseBlur.ts
import EditorAsset from "../../../eazax-ccc/misc/EditorAsset"; const { ccclass, property, requireComponent, executeInEditMode, disallowMultiple } = cc._decorator; @ccclass @requireComponent(cc.Sprite) @executeInEditMode @disallowMultiple export default class KawaseBlur extends cc.Component { @property ...
hugleMr/Eazax-cases
assets/scripts/common/components/global/Toast.ts
<gh_stars>0 const { ccclass, property, executionOrder } = cc._decorator; /** * Toast */ @ccclass @executionOrder(-101) export default class Toast extends cc.Component { @property({ type: cc.Node, displayName: CC_DEV && '主节点' }) protected main: cc.Node = null; @property({ type: cc.Label, displayName: CC...
hugleMr/Eazax-cases
assets/eazax-ccc/utils/TweenUtil.ts
<filename>assets/eazax-ccc/utils/TweenUtil.ts /** * Tween 工具 * @author 陈皮皮 (ifaswind) * @version 20210320 * @see TweenUtil.ts https://gitee.com/ifaswind/eazax-ccc/blob/master/utils/TweenUtil.ts */ export default class TweenUtil { /** * 水平翻转(卡片翻转) * @param node 节点 * @param duration 总时...
Paraboly/react-apexcharts-dynamic-config
src/components/FontSize.tsx
import { ApexOptions } from 'apexcharts'; import React from 'react'; import { Props, TranslationsContext } from '..'; const fontTextToInteger = (font: string | undefined) => { if (font) return font.slice(0, font.length - 2); else return 0; }; const getUpdatedOptions = ( options: ApexOptions, fontSize: string,...
Paraboly/react-apexcharts-dynamic-config
src/components/AxisLabelSize.tsx
<gh_stars>0 import { ApexOptions } from 'apexcharts'; import React from 'react'; import { Props, TranslationsContext } from '..'; const getUpdatedOptions = ( options: ApexOptions, axisLabelSize: string, axis: 'xaxis' | 'yaxis' = 'xaxis' ): ApexOptions => { const axisOpt = options[axis] as ApexXAxis; const op...
Paraboly/react-apexcharts-dynamic-config
test/ReactApexDynamicConfig.test.tsx
<filename>test/ReactApexDynamicConfig.test.tsx import React from 'react'; import * as ReactDOM from 'react-dom'; import { Default as ReactApexDynamicConfig } from '../stories/ReactApexDynamicConfig.stories'; const options = { title: { text: 'This is Chart', }, chart: { type: 'bar' as 'bar', height: 3...
Paraboly/react-apexcharts-dynamic-config
src/index.tsx
import ApexCharts from 'apexcharts'; import React, { FC, useEffect, useState } from 'react'; import AxisLabelSize from './components/AxisLabelSize'; import DataLabels from './components/DataLabels'; import FontSize from './components/FontSize'; import LegendPosition from './components/LegendPosition'; import TitleVisib...
Paraboly/react-apexcharts-dynamic-config
stories/ReactApexDynamicConfig.stories.tsx
import React, { useState } from 'react'; import Chart from "react-apexcharts"; import { Meta, Story } from '@storybook/react'; import ReactApexDynamicConfig, { Props } from '../src'; const meta: Meta = { title: 'ReactApexDynamicConfig', component: ReactApexDynamicConfig, }; export default meta; const Template: S...
Paraboly/react-apexcharts-dynamic-config
example/index.tsx
import 'react-app-polyfill/ie11'; import * as React from 'react'; import * as ReactDOM from 'react-dom'; import Chart from 'react-apexcharts'; import ReactApexDynamicConfig from '../.'; import './index.css'; import charts from './charts'; const App = () => { const [chartType, setChartType] = React.useState("horizont...
Paraboly/react-apexcharts-dynamic-config
src/translations.ts
const translations = { reset: 'Reset', show: 'Show', hide: 'Hide', none: 'None', number: 'Number', percent: 'Percent', all: 'All', top: 'Top', right: 'Right', bottom: 'Bottom', left: 'Left', xaxis: 'X-Axis', yaxis: 'Y-Axis', legendPosition: 'Legend Position', titleVisibility: 'Title Visibi...
Paraboly/react-apexcharts-dynamic-config
example/charts.ts
const charts: { [key: string]: { options: ApexCharts.ApexOptions; series: any }; } = { pie: { options: { chart: { type: 'pie', }, title: { text: 'Chart Title', }, labels: ['Team A', 'Team B', 'Team C', 'Team D', 'Team E'], legend: { position: 'bottom' ...
Paraboly/react-apexcharts-dynamic-config
src/components/TitleVisibility.tsx
import React from 'react'; import { Props, TranslationsContext } from '..'; const TitleVisibility = ({ options, onChange }: Props) => { const translations = React.useContext(TranslationsContext); const titleVisible = !!options.title?.text; const subtitleVisible = !!options.subtitle?.text; const getTitleObject...
Paraboly/react-apexcharts-dynamic-config
src/components/LegendPosition.tsx
<reponame>Paraboly/react-apexcharts-dynamic-config import React from 'react'; import { Props, TranslationsContext } from '..'; type Position = 'top' | 'right' | 'bottom' | 'left'; const positions = ['top', 'right', 'bottom', 'left']; const LegendPosition = ({ options, onChange }: Props) => { const translations = Re...
Paraboly/react-apexcharts-dynamic-config
src/components/DataLabels.tsx
<filename>src/components/DataLabels.tsx import React from 'react'; import { Props, TranslationsContext } from '..'; type LabelType = 'none' | 'number' | 'percent' | 'all'; const types = ['none', 'number', 'percent', 'all']; const getUpdatedOptions = ( options: ApexCharts.ApexOptions, labelType: LabelType ) => { ...
GoryMoon/aoc
src/2020/07.test.ts
import { Puzzle202007, parseInput } from './07'; let day: Puzzle202007; describe('202007', () => { beforeEach(() => { day = new Puzzle202007('202006'); }); test('parseInput', () => { const input = `light red bags contain 1 bright white bag, 2 muted yellow bags. dark orange bags contain 3 bright whi...
GoryMoon/aoc
src/2020/01.ts
import { splitLines } from '../helpers'; import { PuzzleDay } from '../puzzleDay'; export const parseInput = (input: string): number[] => { const lines = splitLines(input); return lines.map((line) => parseInt(line, 10)); }; const findSum2val = (input: number[]): number[] => { input.sort((a, b) => a - b); for ...
GoryMoon/aoc
src/2020/06.test.ts
import { Puzzle202006, parseInputOld, parseInput } from './06'; let day: Puzzle202006; describe('202006', () => { beforeEach(() => { day = new Puzzle202006('202006'); }); test('parseInput', () => { const input = `abc a b c ab ac a a a a b`; const result =...
GoryMoon/aoc
src/2020/14.test.ts
import { Puzzle202014, parseInput } from './14'; let day: Puzzle202014; describe('202014', () => { beforeEach(() => { day = new Puzzle202014('202014'); }); test('parseInput', () => { const input = `mask = XXXXXXXXXXXXXXXXXXXXXXXXXXXXX1XXXX0X mem[8] = 11 mem[7] = 101 mem[8] = 0`; const r...
GoryMoon/aoc
src/readFile.ts
import * as fs from 'fs'; const asyncReadFile = (filename: string): Promise<Buffer> => new Promise((resolve, reject) => { fs.readFile(filename, (error, result) => { if (error) { reject(error); } resolve(result); }); }); export const getData = async (filename: string) => { try {...
GoryMoon/aoc
src/2020/11.ts
import { splitLines } from '../helpers'; import { PuzzleDay } from '../puzzleDay'; interface Seating { occupied: boolean; seat: boolean; } interface Change { x: number; y: number; occupied: boolean; } export const parseInput = (input: string): Seating[][] => { return splitLines(input).reduce<Seating[][]>...
GoryMoon/aoc
src/2020/03.ts
import { splitLines } from '../helpers'; import { PuzzleDay } from '../puzzleDay'; const countTrees = (rows: string[], right: number, down: number): number => { const width = rows[0].length; let count: number = 0; let x: number = right; for (let y = down; y < rows.length; y += down) { if (rows[y][x % widt...
GoryMoon/aoc
src/2020/07.ts
<filename>src/2020/07.ts import { splitLines } from '../helpers'; import { PuzzleDay } from '../puzzleDay'; // Got a bit stuck, heavily inspired of code from where this structure is based on type BagRules = { [key: string]: { color: string; quantity: number; }[]; }; export const parseInput = (input: stri...
GoryMoon/aoc
src/2020/01.test.ts
import { parseInput, Puzzle202001 } from './01'; let day: Puzzle202001; describe('202001', () => { beforeEach(() => { day = new Puzzle202001('202001'); }); test('parseInput', () => { const input = `1721 979 366 299 675 1456`; const result = parseInput(input); expect(result)....
GoryMoon/aoc
src/helpers.ts
<reponame>GoryMoon/aoc export const splitLines = (text: string): string[] => { return text.split(/\r?\n/).map((line) => line.trim()); }; export const sum = (a: number, b: number): number => { return a + b; };
GoryMoon/aoc
src/2020/08.test.ts
<gh_stars>0 import { Puzzle202008, parseInput } from './08'; let day: Puzzle202008; describe('202008', () => { beforeEach(() => { day = new Puzzle202008('202008'); }); test('parseInput', () => { const ops = `nop +0 acc +1 jpm -4;`; const result = parseInput(ops); expect(result).toEqual(...
GoryMoon/aoc
src/2020/03.test.ts
import { Puzzle202003 } from './03'; let day: Puzzle202003; describe('202003', () => { beforeEach(() => { day = new Puzzle202003('202003'); }); test('Part 1 example 1', () => { day.loadData(`..##....... #...#...#.. .#....#..#. ..#.#...#.# .#...##..#. ..#.##..... .#.#.#....# ...
GoryMoon/aoc
src/2020/15.test.ts
import { Puzzle202015, parseInput } from './15'; let day: Puzzle202015; describe('202015', () => { beforeEach(() => { day = new Puzzle202015('202015'); }); test('parseInput', () => { const input = `0,3,6`; const result = parseInput(input); expect(result).toEqual([0, 3, 6]); }); test('Part ...
GoryMoon/aoc
src/2020/09.test.ts
import { Puzzle202009, parseInput } from './09'; let day: Puzzle202009; describe('202009', () => { beforeEach(() => { day = new Puzzle202009('202009'); }); test('parseInput', () => { const input = `35 20 15 25 47 40 62 55 65 95`; const result = parseInput(input);...
GoryMoon/aoc
src/2020/02.test.ts
<reponame>GoryMoon/aoc<filename>src/2020/02.test.ts import { parseInput, Puzzle202002 } from './02'; let day: Puzzle202002; describe('202002', () => { beforeEach(() => { day = new Puzzle202002('202002'); }); test('parseInput', () => { const input = `1-3 a: abcde 1-3 b: cdefg 2-9 c: ccccccccc`; ...
GoryMoon/aoc
src/2020/14.ts
import { splitLines, sum } from '../helpers'; import { PuzzleDay } from '../puzzleDay'; type Program = { maskString: string; setMask: bigint; clearMask: bigint; instructions: { k: number; v: number; }[]; }; /* tslint:disable:no-bitwise */ export const parseInput = (input: string): Program[] => { c...
GoryMoon/aoc
src/puzzleDay.ts
<gh_stars>0 import { getData } from './readFile'; export abstract class PuzzleDay { inputFile: string; input: string; abstract part1(): string; abstract part2(): string; constructor(inputFile: string) { this.inputFile = inputFile; this.input = ''; } async loadData(input?: string): Promise<void...
GoryMoon/aoc
src/2020/05.ts
import { splitLines } from '../helpers'; import { PuzzleDay } from '../puzzleDay'; interface Seat { row: number; col: number; } const bspSplit = (input: string[], bottomVal: string, topVal: number) => { const split = (bottom: number, top: number): number => { if (input.length > 0) { const val = input....
GoryMoon/aoc
src/2020/13.test.ts
<filename>src/2020/13.test.ts import { Puzzle202013, parseInput } from './13'; let day: Puzzle202013; describe('202013', () => { beforeEach(() => { day = new Puzzle202013('202013'); }); test('parseInput', () => { const input = `939 7,13,x,x,59`; const result = parseInput(input); expect(resu...
GoryMoon/aoc
src/2020/09.ts
<gh_stars>0 import { splitLines } from '../helpers'; import { PuzzleDay } from '../puzzleDay'; export const parseInput = (input: string): number[] => { return splitLines(input).map((v) => parseInt(v, 10)); }; const firstInvalid = (input: number[], preambleLength: number): number => { let result = 0; for (let i ...
GoryMoon/aoc
src/2020/04.ts
<reponame>GoryMoon/aoc import { splitLines } from '../helpers'; import { PuzzleDay } from '../puzzleDay'; type Passport = { [key: string]: string; }; const requiredKeys = ['byr', 'iyr', 'eyr', 'hgt', 'hcl', 'ecl', 'pid']; const parseRow = (row: string): Passport => { return row .trimStart() .split(/ /) ...
GoryMoon/aoc
src/2020/12.test.ts
<filename>src/2020/12.test.ts import { Puzzle202012, parseInput } from './12'; let day: Puzzle202012; describe('202012', () => { beforeEach(() => { day = new Puzzle202012('202012'); }); test('parseInput', () => { const input = `F10 N3 F7 R90 F11`; const result = parseInput(input); ...
GoryMoon/aoc
src/2020/11.test.ts
import { Puzzle202011, parseInput } from './11'; let day: Puzzle202011; describe('202011', () => { beforeEach(() => { day = new Puzzle202011('202011'); }); test('parseInput', () => { const input = `L.LL. LLLLL`; const result = parseInput(input); expect(result).toEqual([ [ { oc...
GoryMoon/aoc
src/index.ts
<gh_stars>0 import * as yargs from 'yargs'; import { PuzzleDay } from './puzzleDay'; import prettyTime from 'pretty-time'; import { Puzzle202001 } from './2020/01'; import { Puzzle202002 } from './2020/02'; import { Puzzle202003 } from './2020/03'; import { Puzzle202004 } from './2020/04'; import { Puzzle202005 } from...
GoryMoon/aoc
src/2020/04.test.ts
<filename>src/2020/04.test.ts import { Puzzle202004, parseInput } from './04'; let day: Puzzle202004; describe('202004', () => { beforeEach(() => { day = new Puzzle202004('202004'); }); test('parseInput', () => { const input = `ecl:gry pid:860033327 eyr:2020 hcl:#fffffd byr:1937 iyr:2017 cid:147 hg...
GoryMoon/aoc
src/2020/15.ts
import { PuzzleDay } from '../puzzleDay'; export const parseInput = (input: string): number[] => { return input.split(',').map(v => parseInt(v, 10)).filter(v => !isNaN(v)); }; const getNumberOnTurn = (starting: number[], turn: number): number => { let next: number = starting.pop() ?? 0; const cache = new Map<nu...
GoryMoon/aoc
src/puzzleDay.test.ts
import { PuzzleDay } from './puzzleDay'; export class PuzzleTest extends PuzzleDay { part1(): string { return ''; } part2(): string { return this.input.split(/\r?\n/).join(' '); } } let day: PuzzleTest; describe('PuzzleTest', () => { beforeEach(() => { day = new PuzzleTest('./inputs/test.txt')...
GoryMoon/aoc
src/readFile.test.ts
<gh_stars>0 import { getData } from './readFile'; describe('ReadFile', () => { test('Load file', async () => { const result = await getData('./inputs/test.txt'); expect(result).toBe(`1 2 3 4 5 6`); }); test('Invalid file', async () => { console.log = jest.fn(); const result = await getData('./in...
GoryMoon/aoc
src/2020/12.ts
<reponame>GoryMoon/aoc<filename>src/2020/12.ts import { splitLines } from '../helpers'; import { PuzzleDay } from '../puzzleDay'; interface Action { action: string; amount: number; } export const parseInput = (input: string): Action[] => { return splitLines(input).map<Action>((v) => { return { action:...
GoryMoon/aoc
src/2020/02.ts
<reponame>GoryMoon/aoc import { splitLines } from '../helpers'; import { PuzzleDay } from '../puzzleDay'; interface PasswordData { firstRule: number; secondRule: number; letter: string; password: string; } export const parseInput = (input: string): PasswordData[] => { return splitLines(input).map((row) => {...
GoryMoon/aoc
src/2020/05.test.ts
import { Puzzle202005, parseInput, findEmpty } from './05'; let day: Puzzle202005; describe('202004', () => { beforeEach(() => { day = new Puzzle202005('202005'); }); test('parseInput example 1', () => { const input = `BFFFBBFRRR`; const result = parseInput(input); expect(result).toMatchObject(...
GoryMoon/aoc
src/2020/10.test.ts
<gh_stars>0 import { Puzzle202010, parseInput } from './10'; let day: Puzzle202010; describe('202010', () => { beforeEach(() => { day = new Puzzle202010('202010'); }); test('parseInput', () => { const input = `16 10 15 5 1 11 7 19 6 12 4`; const result = pars...
GoryMoon/aoc
src/2020/10.ts
import { splitLines, sum } from '../helpers'; import { PuzzleDay } from '../puzzleDay'; export const parseInput = (input: string): number[] => { return splitLines(input).map((v) => parseInt(v, 10)); }; const countJoltDifferences = (input: number[]): number[] => { const result = [0, 0, 1]; let currentJolt = 0; ...
GoryMoon/aoc
src/2020/08.ts
import { splitLines } from '../helpers'; import { PuzzleDay } from '../puzzleDay'; interface Op { type: string; arg: number; } export const parseInput = (input: string): Op[] => { return splitLines(input).map((line) => { const [type, arg] = line.split(' '); return { type, arg: parseInt(arg, ...
GoryMoon/aoc
src/2020/06.ts
<reponame>GoryMoon/aoc import { splitLines, sum } from '../helpers'; import { PuzzleDay } from '../puzzleDay'; // Old parser, looked at some others afterwards and tested with regex below to learn it some more export const parseInputOld = (input: string): string[][] => { const lines = splitLines(input); const resul...
GoryMoon/aoc
src/2020/13.ts
<reponame>GoryMoon/aoc import { splitLines } from '../helpers'; import { PuzzleDay } from '../puzzleDay'; interface TimeTable { valid: boolean; interval: number; } interface Closest { interval: number; closest: number; } export const parseInput = (input: string): { time: number; timetable: TimeTable[] } => {...
bcheidemann/nx
packages/angular/src/builders/delegate-build/schema.d.ts
export interface DelegateBuildExecutorSchema { buildTarget: string; outputPath: string; tsConfig: string; }
bcheidemann/nx
packages/angular/src/builders/delegate-build/delegate-build.impl.ts
import { BuilderContext, BuilderOutput, createBuilder, } from '@angular-devkit/architect'; import { JsonObject } from '@angular-devkit/core'; import { joinPathFragments, parseTargetString } from '@nrwl/devkit'; import { createProjectGraph } from '@nrwl/workspace/src/core/project-graph'; import { calculateProjec...
hg8496/energyday-creator
lib/EnergyDayCreator.ts
import { janitza } from "@hg8496/definitions"; import { GridVisClient } from "@hg8496/gridvis-client"; import { ITimedValue } from "@hg8496/gridvis-client/dist/values/ITimedValue"; import { IValueDescription } from "@hg8496/gridvis-client/dist/values/IValueDescription"; import * as fs from "fs"; import { Moment } from ...
hg8496/energyday-creator
lib/mapper/InputMapper.ts
import { janitza } from "@hg8496/definitions"; import Input = janitza.values.Input; import Line = janitza.values.Line; import IInput = janitza.values.IInput; export function mapInputToProtoBuffer(input: string): IInput | null { let result = null; switch (input) { case "L1": result = new Inp...
hg8496/energyday-creator
lib/mapper/ValueMapper.ts
import { janitza } from "@hg8496/definitions"; import EnergyValueType = janitza.values.EnergyValueType; export function mapGridVisToProtoBuffer(value: string): EnergyValueType | null { let result = null; switch (value) { case "ActiveEnergy": result = EnergyValueType.ActiveEnergy; ...
hg8496/energyday-creator
lib/mapper/__tests__/ValueMapper.test.ts
<filename>lib/mapper/__tests__/ValueMapper.test.ts import { janitza } from "@hg8496/definitions"; import { mapGridVisToProtoBuffer, mapProtoBufferToGridVis } from "../ValueMapper"; import EnergyValueType = janitza.values.EnergyValueType; it("Expect to return null on unknown values", () => { const gridVisValue = "a...
hg8496/energyday-creator
lib/mapper/TimeBaseMapper.ts
<reponame>hg8496/energyday-creator import { janitza } from "@hg8496/definitions"; import TimeBase = janitza.values.TimeBase; export function mapSecondsToProtoBuffer(timebase: number): TimeBase | null { let result = null; switch (timebase) { case 10: result = TimeBase.Seconds10; ...
hg8496/energyday-creator
lib/cli.ts
<filename>lib/cli.ts #!/usr/bin/env node import { GridVisClient } from "@hg8496/gridvis-client"; import * as commander from "commander"; import * as moment from "moment"; import { EnergyDayCreator } from "./EnergyDayCreator"; import { findDevice, findNeededValues } from "./index"; commander .version("1.0.14") ...
hg8496/energyday-creator
lib/mapper/index.ts
import { janitza } from "@hg8496/definitions"; import { IValueDescription } from "@hg8496/gridvis-client/dist/values/IValueDescription"; import { mapInputToProtoBuffer } from "./InputMapper"; import { mapSecondsToProtoBuffer } from "./TimeBaseMapper"; import { mapGridVisToProtoBuffer } from "./ValueMapper"; import Valu...
hg8496/energyday-creator
lib/mapper/__tests__/TimeBaseMapper.test.ts
<filename>lib/mapper/__tests__/TimeBaseMapper.test.ts<gh_stars>0 import { janitza } from "@hg8496/definitions"; import { mapProtoBufferToSeconds, mapSecondsToProtoBuffer } from "../TimeBaseMapper"; import TimeBase = janitza.values.TimeBase; it("Expect to return null on unknown values", () => { expect(mapSecondsToP...
hg8496/energyday-creator
lib/index.ts
<filename>lib/index.ts import { GridVisClient, IDevice, IProject } from "@hg8496/gridvis-client"; import { IValueDescription } from "@hg8496/gridvis-client/dist/values/IValueDescription"; import { EnergyDayCreator } from "./EnergyDayCreator"; import { doesMap as DoesMapFilter } from "./mapper"; export interface IProje...
hg8496/energyday-creator
lib/mapper/__tests__/InputMapper.test.ts
import { janitza } from "@hg8496/definitions"; import { mapInputToProtoBuffer, mapProtoBufferToInput } from "../InputMapper"; import Input = janitza.values.Input; import Line = janitza.values.Line; it("Expect to return null on unknown values", () => { expect(mapInputToProtoBuffer("asdf")).toBe(null); }); [ { ...
hg8496/energyday-creator
lib/__tests__/EnergyDayCreator.test.ts
import { ITimedValue } from "@hg8496/gridvis-client/dist/values/ITimedValue"; import { mapITimedValueToNumber } from "../EnergyDayCreator"; it("Expect to return max if is correct value", () => { const max = 1.23; const avg = 1.2; const min = 1.1; const value = { min, avg, max } as ITimedValue; expe...
luisventurae/genepass
src/lib/chart.ts
<filename>src/lib/chart.ts type language = "symbol" | "es" | "en"; // enum languages { // "en" = "_abc_en", // "es" = "_abc_es", // } /** * English Alphabet * @type {Array<String>} */ const _abc_en: string[] = [ "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "...
luisventurae/genepass
src/lib/permuter.ts
<reponame>luisventurae/genepass<filename>src/lib/permuter.ts<gh_stars>1-10 /** * Text to permute charts * @param {String} word Word * @returns {String} */ const _shuffle_ = (word: string): string => { const _charts = word.split(""); let _currentIndex = _charts.length, _temporaryValue, _randomIndex; /...
luisventurae/genepass
src/main.ts
import _generator from "./bin/generator"; export = _generator;
luisventurae/genepass
src/bin/generator.ts
import { _getWordRandomc_, _getWordLowerc_, _getWordUpperc_, _getNumber_, _getSpecial_, } from "../lib/chart"; import { _shuffle_ } from "../lib/permuter"; interface options { length: number; lowercase?: boolean; uppercase?: boolean; number?: boolean; special?: boolean; } enum sizes { min = 0, ...
RJuall/haskell-for-everyone
server/src/handlers/VersionHandler.ts
<filename>server/src/handlers/VersionHandler.ts import { Request, Response } from "express"; import * as fs from "fs"; import { CORS } from "../utils/CORS"; import { JsonUtils } from './../utils/JsonUtils'; export class VersionHandler{ // cached copy of current version private static _version:string = null; ...
RJuall/haskell-for-everyone
server/src/rooms/OnlinePerson.ts
<reponame>RJuall/haskell-for-everyone<filename>server/src/rooms/OnlinePerson.ts import * as ws from "websocket"; import { EventEmitter } from "events"; import { ActionType, UpdatePosition } from "./CodeState"; import { OnlineRoom, RoomSummary } from "./OnlineRoom"; import { JsonUtils } from "../utils/JsonUtils"; import...
RJuall/haskell-for-everyone
server/src/handlers/ContactUsGetHandler.ts
<filename>server/src/handlers/ContactUsGetHandler.ts import { Request, Response } from "express"; import { DatabaseManager } from "../database/DatabaseManager"; export class ContactUsGetHandler{ // required query string (super secure, of course) private static readonly secretAuthCode:string = process.env.CONTA...
RJuall/haskell-for-everyone
server/src/Server.ts
import * as express from "express"; import * as http from "http"; import * as https from "https"; import * as path from "path"; import * as fs from "fs"; import { MongoClient } from "mongodb"; import * as websocket from "websocket"; import { ContactUsGetHandler } from "./handlers/ContactUsGetHandler"; import { ContactU...
RJuall/haskell-for-everyone
server/src/rooms/RoomsManager.ts
<filename>server/src/rooms/RoomsManager.ts<gh_stars>1-10 import * as ws from "websocket"; import { OnlineRoom, OnlineRoomOptions, RoomSummary, AccessType, EditType } from "./OnlineRoom"; import { OnlinePerson, SendType } from "./OnlinePerson"; import { VersionHandler } from "../handlers/VersionHandler"; import { CodeLi...
RJuall/haskell-for-everyone
server/src/handlers/RoomCodeResetHandler.ts
import { Request, Response } from "express"; import { RoomsManager } from "../rooms/RoomsManager"; export class RoomCodeResetHandler{ // required query string (super secure, of course) private static readonly secretAuthCode:string = process.env.API_SECRET || "lichKing33"; // rooms manager public stati...
RJuall/haskell-for-everyone
server/src/database/DatabaseManager.ts
<gh_stars>1-10 import { MongoClient, Db, Collection } from "mongodb"; // json schema for contact us info export interface ContactUsData{ name:string; email:string; comment:string; timestamp:string; viewed:boolean; } export class DatabaseManager{ private _mongoClient:MongoClient; // mongodb ...
RJuall/haskell-for-everyone
server/src/utils/PinGenerator.ts
<gh_stars>1-10 export class PinGenerator{ // all possible characters (alpha-numeric) private static readonly VALS:string[] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890".split(""); private _pinLength:number; private _pins:Map<string, boolean>; constructor(pinLength:number){ ...
RJuall/haskell-for-everyone
server/src/rooms/OnlineRoom.ts
<reponame>RJuall/haskell-for-everyone import { EventEmitter } from "events"; import { OnlinePerson } from "./OnlinePerson"; import { CodeState, ActionType, UpdatePosition, CodeLine } from "./CodeState"; export type AccessType = "public" | "private"; export type EditType = "owner-only" | "anyone"; export type AddCall...
RJuall/haskell-for-everyone
server/src/handlers/RoomCodeGetHandler.ts
<filename>server/src/handlers/RoomCodeGetHandler.ts<gh_stars>1-10 import { Request, Response } from "express"; import { RoomsManager } from "../rooms/RoomsManager"; import { JsonUtils } from "../utils/JsonUtils"; export class RoomCodeGetHandler{ // required query string private static readonly secretAuthCode:s...
RJuall/haskell-for-everyone
server/src/utils/CORS.ts
<filename>server/src/utils/CORS.ts import { OutgoingHttpHeaders } from "http"; export class CORS{ // cross-origin resource sharing headers private static readonly CORS_HEADER:OutgoingHttpHeaders = { "access-control-allow-origin": "*", "access-control-allow-headers": "content-type, access-contro...
RJuall/haskell-for-everyone
server/src/handlers/ContactUsSubmitHandler.ts
<gh_stars>1-10 import { Request, Response } from "express"; import { filterXSS } from "xss"; import { DatabaseManager } from "../database/DatabaseManager"; export class ContactUsSubmitHandler{ // database connection public static dbManager:DatabaseManager; // contact us form post endpoint public sta...
RJuall/haskell-for-everyone
server/src/rooms/CodeState.ts
<gh_stars>1-10 export type ActionType = "insert" | "remove"; export interface UpdatePosition{ row:number; column:number } export type CodeLineChars = string[][]; export type CodeLine = string[]; export class CodeState{ private _lines:CodeLineChars; constructor(){ this._lines = [[""]]; }...
RJuall/haskell-for-everyone
server/src/utils/JsonUtils.ts
export class JsonUtils{ // parses a string into an object // @param callback handler callback public static parse(str:string, callback:(err:Error, object:any)=>void):void{ let object:any; try{ object = JSON.parse(str); } catch(err){ callback(err, nu...
enescanaydemir/nestjs-API
src/users/users.service.ts
<reponame>enescanaydemir/nestjs-API import { Injectable } from '@nestjs/common'; import { CreateUserDto } from './dto/create-user.dto'; import { User } from './entities/user.entity'; @Injectable() export class UsersService { private users: User[] = [{ id: 0, name: 'Enes'}, { id: 1, name: 'Enes'}, { id: 2, name: 'D...
enescanaydemir/nestjs-API
src/users/users.controller.ts
<reponame>enescanaydemir/nestjs-API import { Body, Controller, Get, NotFoundException, Param, ParseIntPipe, Post, Query } from '@nestjs/common'; import { ApiBadRequestResponse, ApiCreatedResponse, ApiNotFoundResponse, ApiOkResponse, ApiQuery, ApiTags } from '@nestjs/swagger'; import { CreateUserDto } from './dto/create...
enescanaydemir/nestjs-API
src/app.service.ts
<filename>src/app.service.ts // 3 Katmanlı Mimari -> app.service.ts bu mimaride veri katmanını entegre edeceğimiz dosya. import { Injectable } from '@nestjs/common'; @Injectable() export class AppService { getHello(): string { return 'Hello World!'; } }
enescanaydemir/nestjs-API
src/users/dto/create-user.dto.ts
<filename>src/users/dto/create-user.dto.ts import { ApiProperty } from "@nestjs/swagger"; import { IsAlphanumeric, MaxLength } from "class-validator"; export class CreateUserDto { //ayrıca swagger üzerinde gözükmesini istediğimiz her property için başına @ApiProperty eklememiz gerekiyor yoksa gözükmez @ApiProp...
jplippi/xivanalysis
src/parser/jobs/drg/modules/LanceCharge.tsx
import {t} from '@lingui/macro' import {Trans} from '@lingui/react' import {ActionLink} from 'components/ui/DbLink' import {dependency} from 'parser/core/Injectable' import {BuffWindow, EvaluatedAction, ExpectedActionsEvaluator, ExpectedGcdCountEvaluator} from 'parser/core/modules/ActionWindow' import {HistoryEntry} fr...
jplippi/xivanalysis
src/parser/jobs/nin/modules/TrickAttackUsage.tsx
<filename>src/parser/jobs/nin/modules/TrickAttackUsage.tsx import {Trans, Plural} from '@lingui/react' import {ActionLink} from 'components/ui/DbLink' import {ActionKey} from 'data/ACTIONS' import {Event, Events} from 'event' import {Analyser} from 'parser/core/Analyser' import {EventHook} from 'parser/core/Dispatcher'...
jplippi/xivanalysis
src/parser/jobs/smn/modules/RadiantAegis.tsx
import {t, Trans} from '@lingui/macro' import {Event} from 'event' import {Analyser} from 'parser/core/Analyser' import {filter} from 'parser/core/filter' import {dependency} from 'parser/core/Injectable' import {CooldownDowntime} from 'parser/core/modules/CooldownDowntime' import {Data} from 'parser/core/modules/Data'...
jplippi/xivanalysis
src/parser/core/modules/ActionWindow/windows/ActionWindow.tsx
<reponame>jplippi/xivanalysis<filename>src/parser/core/modules/ActionWindow/windows/ActionWindow.tsx import {RotationTable, RotationTableNotesMap, RotationTableTargetData} from 'components/ui/RotationTable' import {Event, Events} from 'event' import {dependency} from 'parser/core/Injectable' import {Timeline} from 'par...
jplippi/xivanalysis
src/parser/jobs/nin/modules/Ninki.tsx
import {t} from '@lingui/macro' import {Trans, Plural} from '@lingui/react' import {ActionLink} from 'components/ui/DbLink' import {JOBS} from 'data/JOBS' import {Cause, Event, Events} from 'event' import {filter, oneOf} from 'parser/core/filter' import {dependency} from 'parser/core/Injectable' import {CounterGauge, G...
jplippi/xivanalysis
src/data/STATUSES/root/RPR.ts
<filename>src/data/STATUSES/root/RPR.ts import {ensureStatuses} from '../type' export const RPR = ensureStatuses({ DEATHS_DESIGN: { id: 2586, name: 'Death\'s Design', icon: 'https://xivapi.com/i/012000/012926.png', duration: 30000, }, // TODO: find out the duration on this, might be a pseudo-stance tho SO...
jplippi/xivanalysis
src/event.ts
import {Actor} from 'report' import {Compute} from 'utilities/typescript' /* Welcome to the *。・゚★。 magic ☆゚・。° event file! You're probably here to add your new fabricated event to the event type! Don't. I'm a big meanie and _will_ block your PR. Instead, you'll want to set it up from your module file, using declarati...
jplippi/xivanalysis
src/parser/jobs/mch/modules/Gauge.tsx
<filename>src/parser/jobs/mch/modules/Gauge.tsx import {t} from '@lingui/macro' import {Trans} from '@lingui/react' import Color from 'color' import {DataLink} from 'components/ui/DbLink' import {Cause, Event, Events} from 'event' import {filter, oneOf} from 'parser/core/filter' import {dependency} from 'parser/core/In...