repo_name
stringlengths
5
122
path
stringlengths
3
232
text
stringlengths
6
1.05M
giorgiofederici/giorgiofederici-frontend
src/app/admin/shared/services/skills/skills.service.ts
import { Injectable } from '@angular/core'; import { HttpClient, HttpHeaders } from '@angular/common/http'; // Rxjs import { Observable } from 'rxjs'; // Model import { Skill } from '../../models/skills/skill.model'; // Shared import { APIResponse } from '../../../../shared/models/api-response.model'; // Env import...
giorgiofederici/giorgiofederici-frontend
src/app/auth/shared/services/auth/auth.service.ts
<reponame>giorgiofederici/giorgiofederici-frontend<filename>src/app/auth/shared/services/auth/auth.service.ts import { Injectable } from '@angular/core'; import { HttpClient, HttpHeaders } from '@angular/common/http'; // RxJS import { Observable, from, of, Subject } from 'rxjs'; import { tap } from 'rxjs/operators'; ...
giorgiofederici/giorgiofederici-frontend
src/app/website/cv/components/nodejs/nodejs.component.ts
import { Component } from '@angular/core'; // CV import { SkillItem } from 'src/app/website/shared/models/skill-item.model'; @Component({ selector: 'website-cv-skills-nodejs', templateUrl: './nodejs.component.html', styleUrls: ['./nodejs.component.scss'] }) export class NodeJSComponent { items: SkillItem[]; ...
giorgiofederici/giorgiofederici-frontend
src/app/website/contact/contact.module.ts
<reponame>giorgiofederici/giorgiofederici-frontend import { NgModule } from '@angular/core'; import { CommonModule } from '@angular/common'; // Routing import { RouterModule, Routes } from '@angular/router'; // Forms import { ReactiveFormsModule } from '@angular/forms'; // Font Awesome import { FontAwesomeModule } f...
giorgiofederici/giorgiofederici-frontend
src/app/shared/models/api-response.model.ts
import { User } from 'src/app/auth/shared/models/user.model'; export interface APIResponse { status?: string; results?: number; data?: { data?: any | any[]; user?: User; }; }
giorgiofederici/giorgiofederici-frontend
src/environments/environment.prod.ts
<filename>src/environments/environment.prod.ts import { baseEnv } from './environment.base'; export const environment = { ...baseEnv, ...{ production: true, backendUrl: 'https://giorgiofederici.com:8443', // UIsUrl: '', domain: 'giorgiofederici.com' } };
giorgiofederici/giorgiofederici-frontend
src/app/admin/shared/actions/projects/projects.actions.ts
<gh_stars>0 // ngRx import { Action } from '@ngrx/store'; import { Update } from '@ngrx/entity'; // Shared import { Project } from '../../models/projects/project.model'; export enum ProjectsActionTypes { // Get All Projects GetAllProjects = '[Projects] Get All Projects', GetAllProjectsSuccess = '[Projects/API] ...
giorgiofederici/giorgiofederici-frontend
src/app/auth/shared/actions/logout.actions.ts
<reponame>giorgiofederici/giorgiofederici-frontend import { Action } from '@ngrx/store'; export enum LogoutActionTypes { Logout = '[Logout] Logout', LogoutConfirmation = '[Logout] Logout Confirmation', LogoutConfirmationDismiss = '[Logout] Logout Confirmation Dismiss' } export class Logout implements Action { ...
giorgiofederici/giorgiofederici-frontend
src/app/admin/root/components/admin-header/admin-header.component.ts
import { Component, Input, EventEmitter, Output } from '@angular/core'; // Auth import { User } from '../../../../auth/shared/models/user.model'; @Component({ selector: 'admin-header', templateUrl: './admin-header.component.html', styleUrls: ['./admin-header.component.scss'] }) export class AdminHeaderCom...
giorgiofederici/giorgiofederici-frontend
src/app/admin/shared/services/projects/projects.service.ts
import { Injectable } from '@angular/core'; import { HttpClient, HttpHeaders } from '@angular/common/http'; // Rxjs import { Observable } from 'rxjs'; // Model import { Project } from '../../models/projects/project.model'; // Shared import { APIResponse } from '../../../../shared/models/api-response.model'; // Env ...
giorgiofederici/giorgiofederici-frontend
src/app/website/portfolio/components/portfolio-item/portfolio-item.component.ts
<reponame>giorgiofederici/giorgiofederici-frontend<filename>src/app/website/portfolio/components/portfolio-item/portfolio-item.component.ts import { Component, Input } from '@angular/core'; // Models import { Project } from '../../../../admin/shared/models/projects/project.model'; @Component({ selector: 'website-po...
giorgiofederici/giorgiofederici-frontend
src/app/material/material.module.ts
<gh_stars>0 import { NgModule } from '@angular/core'; import { MatButtonModule, MatDialogModule } from '@angular/material'; @NgModule({ imports: [MatButtonModule, MatDialogModule], exports: [MatButtonModule, MatDialogModule] }) export class MaterialModule {}
giorgiofederici/giorgiofederici-frontend
src/app/admin/root/admin-root.module.ts
import { NgModule } from '@angular/core'; import { CommonModule } from '@angular/common'; // Routing import { RouterModule, Routes } from '@angular/router'; // Ng Bootstrap import { NgbCollapseModule } from '@ng-bootstrap/ng-bootstrap'; // Font Awesome import { FontAwesomeModule } from '@fortawesome/angular-fontawes...
giorgiofederici/giorgiofederici-frontend
src/app/admin/shared/effects/projects/projects.effects.ts
<filename>src/app/admin/shared/effects/projects/projects.effects.ts import { Injectable } from '@angular/core'; // Router import { Router } from '@angular/router'; // RxJs import { of } from 'rxjs'; import { catchError, map, switchMap, tap } from 'rxjs/operators'; // ngRx import { Actions, Effect, ofType } from '@ng...
giorgiofederici/giorgiofederici-frontend
src/app/auth/login/containers/login/login.component.ts
<gh_stars>0 import { Component } from '@angular/core'; // Forms import { FormGroup } from '@angular/forms'; // RxJS import { Store, select } from '@ngrx/store'; // Auth shared import { User } from '../../../shared/models/user.model'; import * as fromAuth from '../../../shared/reducers'; import { LoginActions } from ...
giorgiofederici/giorgiofederici-frontend
src/app/website/contact/components/contact-form/contact-form.component.ts
import { Component, Output, EventEmitter } from '@angular/core'; import { FormBuilder, FormGroup, Validators } from '@angular/forms'; import { ContactMessage } from '../../../shared/services/contact/contact.service'; @Component({ selector: 'website-contact-form', templateUrl: './contact-form.component.html',...
giorgiofederici/giorgiofederici-frontend
src/app/website/cv/containers/cv/cv.component.ts
import { Component, OnInit } from '@angular/core'; // Rxjs import { Observable } from 'rxjs'; // ngRx import { Store, select } from '@ngrx/store'; // Reducers import * as fromSkills from '../../../../admin/shared/reducers/skills/skills.reducer'; // Actions import { SkillsActions } from '../../../../admin/shared/act...
giorgiofederici/giorgiofederici-frontend
src/app/admin/skills/containers/skills/skills.component.ts
<gh_stars>0 import { Component, OnInit } from '@angular/core'; // Rxjs import { Observable } from 'rxjs'; // ngRx import { Store, select } from '@ngrx/store'; // Reducers import * as fromSkills from '../../../shared/reducers/skills/skills.reducer'; // Actions import { SkillsActions } from '../../../shared/actions/s...
giorgiofederici/giorgiofederici-frontend
src/app/admin/root/components/admin-nav-item/admin-nav-item.component.ts
<filename>src/app/admin/root/components/admin-nav-item/admin-nav-item.component.ts import { Component, Input, Output, EventEmitter, OnInit } from '@angular/core'; @Component({ selector: 'admin-nav-item', templateUrl: './admin-nav-item.component.html', styleUrls: ['./admin-nav-item.component.scss'] }) export clas...
giorgiofederici/giorgiofederici-frontend
src/app/website/home/components/home-presentation/home-presentation.component.ts
<reponame>giorgiofederici/giorgiofederici-frontend import { Component, ChangeDetectionStrategy, Output, EventEmitter } from '@angular/core'; @Component({ selector: 'website-home-presentation', changeDetection: ChangeDetectionStrategy.OnPush, templateUrl: './home-presentation.component.html', styleUrls:...
giorgiofederici/giorgiofederici-frontend
src/app/admin/shared/shared.module.ts
import { NgModule, ModuleWithProviders } from '@angular/core'; import { CommonModule } from '@angular/common'; import { RouterModule } from '@angular/router'; // ngRx import { StoreModule } from '@ngrx/store'; import { EffectsModule } from '@ngrx/effects'; // Components import { ListItemComponent } from './components...
giorgiofederici/giorgiofederici-frontend
src/app/admin/shared/effects/skills/skills.effects.ts
import { Injectable } from '@angular/core'; // Router import { Router } from '@angular/router'; // RxJs import { of } from 'rxjs'; import { catchError, map, switchMap, tap } from 'rxjs/operators'; // ngRx import { Actions, Effect, ofType } from '@ngrx/effects'; // Admin Shared import { SkillsActions } from '../../a...
giorgiofederici/giorgiofederici-frontend
src/app/website/portfolio/containers/portfolio/portfolio.component.ts
import { Component, OnInit } from '@angular/core'; // Rxjs import { Observable } from 'rxjs'; // ngRx import { Store, select } from '@ngrx/store'; // Reducers import * as fromProjects from '../../../../admin/shared/reducers/projects/projects.reducer'; // Actions import { ProjectsActions } from '../../../../admin/sh...
giorgiofederici/giorgiofederici-frontend
src/environments/environment.base.ts
export const baseEnv = { production: false, backendUrl: 'http://localhost:3000', // UIsUrl: 'http://localhost:4200', domain: 'localhost' };
giorgiofederici/giorgiofederici-frontend
src/app/auth/shared/reducers/auth.reducer.ts
<reponame>giorgiofederici/giorgiofederici-frontend // Shared import { LoginActions, LogoutActions, UserActions } from '../actions'; import { User } from '../models/user.model'; export interface State { user: User | null; } export const initialState: State = { user: null }; export function reducer( state = init...
giorgiofederici/giorgiofederici-frontend
src/app/admin/root/containers/admin-root/admin-root.component.ts
<reponame>giorgiofederici/giorgiofederici-frontend import { Component, OnInit } from '@angular/core'; // RxJS import { Observable } from 'rxjs'; // NgRx import { Store, select } from '@ngrx/store'; // Auth import * as fromAuth from '../../../../auth/shared/reducers'; import { User } from '../../../../auth/shared/mod...
giorgiofederici/giorgiofederici-frontend
src/app/website/cv/components/cv-timeline/cv-timeline.component.ts
import { Component } from '@angular/core'; @Component({ selector: 'website-cv-timeline', templateUrl: './cv-timeline.component.html', styleUrls: ['./cv-timeline.component.scss'] }) export class CVTimelineComponent { }
giorgiofederici/giorgiofederici-frontend
src/app/website/root/components/website-nav-item/website-nav-item.component.ts
<gh_stars>0 import { Component, Input, Output, EventEmitter } from '@angular/core'; @Component({ selector: 'website-nav-item', templateUrl: './website-nav-item.component.html', styleUrls: ['./website-nav-item.component.scss'] }) export class WebsiteNavItemComponent { @Input() routerLink: string | any[] = '/'; ...
giorgiofederici/giorgiofederici-frontend
src/app/website/contact/containers/contact/contact.component.ts
import { Component } from '@angular/core'; import { ContactService, ContactMessage } from 'src/app/website/shared/services/contact/contact.service'; @Component({ selector: 'website-contact', templateUrl: './contact.component.html', styleUrls: ['./contact.component.scss'] }) export class ContactComponent { ...
giorgiofederici/giorgiofederici-frontend
src/app/website/cv/cv.module.ts
import { NgModule } from '@angular/core'; import { CommonModule } from '@angular/common'; // Routing import { RouterModule, Routes } from '@angular/router'; // Font Awesome import { FontAwesomeModule } from '@fortawesome/angular-fontawesome'; import { library } from '@fortawesome/fontawesome-svg-core'; import { faB...
giorgiofederici/giorgiofederici-frontend
src/app/website/shared/shared.module.ts
<reponame>giorgiofederici/giorgiofederici-frontend<gh_stars>0 import { NgModule, ModuleWithProviders } from '@angular/core'; import { CommonModule } from '@angular/common'; // Router import { RouterModule } from '@angular/router'; // Contact import { ContactService } from './services/contact/contact.service'; // Com...
giorgiofederici/giorgiofederici-frontend
src/app/admin/shared/resolvers/projects/project.resolver.ts
import { Injectable } from '@angular/core'; import { ActivatedRouteSnapshot, Resolve, RouterStateSnapshot } from '@angular/router'; // RxJS import { Observable } from 'rxjs'; import { filter, first, tap } from 'rxjs/operators'; // ngRx import { select, Store } from '@ngrx/store'; // Reducer import * as fromPro...
giorgiofederici/giorgiofederici-frontend
src/app/auth/shared/effects/auth.effects.ts
<filename>src/app/auth/shared/effects/auth.effects.ts import { Injectable } from '@angular/core'; // Router import { Router } from '@angular/router'; // RxJs import { of } from 'rxjs'; import { catchError, exhaustMap, map, tap, switchMap } from 'rxjs/operators'; // ngRx import { Actions, Effect, ofType } from '@ngrx...
giorgiofederici/giorgiofederici-frontend
src/app/auth/shared/reducers/index.ts
<filename>src/app/auth/shared/reducers/index.ts // RxJS import { createSelector, createFeatureSelector, ActionReducerMap } from '@ngrx/store'; // Shared import * as fromRoot from '../../../root/reducers'; import * as fromAuth from '../reducers/auth.reducer'; import * as fromLogin from '../reducers/login.reducer'...
giorgiofederici/giorgiofederici-frontend
src/app/admin/root/components/admin-sidebar/admin-sidebar.component.ts
<filename>src/app/admin/root/components/admin-sidebar/admin-sidebar.component.ts import { Component } from '@angular/core'; @Component({ selector: 'admin-sidebar', templateUrl: './admin-sidebar.component.html', styleUrls: ['./admin-sidebar.component.scss'] }) export class AdminSidebarComponent { }
giorgiofederici/giorgiofederici-frontend
src/app/admin/skills/containers/skill/skill.component.ts
import { Component, OnInit, Input } from '@angular/core'; import { Router, ActivatedRoute } from '@angular/router'; // Rxjs import { Observable } from 'rxjs'; // ngRx import { Store, select } from '@ngrx/store'; // Reducers import * as fromSkills from '../../../shared/reducers/skills/skills.reducer'; // Actions imp...
giorgiofederici/giorgiofederici-frontend
src/app/website/website.module.ts
<gh_stars>0 import { NgModule } from '@angular/core'; // Routing import { RouterModule, Routes } from '@angular/router'; // Shared import { SharedModule } from './shared/shared.module'; export const ROUTES: Routes = [ { path: '', loadChildren: './root/website-root.module#WebsiteRootModule' } ]; @NgModule({ ...
giorgiofederici/giorgiofederici-frontend
src/app/root/root.module.ts
import { NgModule } from '@angular/core'; import { BrowserModule } from '@angular/platform-browser'; import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; import { HttpClientModule } from '@angular/common/http'; // NgRx import { StoreModule } from '@ngrx/store'; import { reducers, metaReducer...
giorgiofederici/giorgiofederici-frontend
src/app/admin/shared/models/skills/skill.model.ts
export interface Skill { _id: string; name: string; type: string; modifiedAt: Date; createdAt: Date; }
giorgiofederici/giorgiofederici-frontend
src/app/admin/shared/components/list-item/list-item.component.ts
<filename>src/app/admin/shared/components/list-item/list-item.component.ts import { Component, Input, ChangeDetectionStrategy, Output, EventEmitter } from '@angular/core'; @Component({ selector: 'admin-list-item', changeDetection: ChangeDetectionStrategy.OnPush, styleUrls: ['list-item.component.scss'],...
giorgiofederici/giorgiofederici-frontend
src/app/auth/shared/actions/user.actions.ts
// NgRx import { Action } from '@ngrx/store'; // Auth import { User } from '../models/user.model'; export enum UserActionTypes { GetUser = '[User] Get User', Authenticated = '[User] Authenticated', NotAuthenticated = '[User] Not Authenticated', AuthenticationError = '[User] Authentication Error', IsLoggedIn...
giorgiofederici/giorgiofederici-frontend
src/app/auth/shared/actions/index.ts
<reponame>giorgiofederici/giorgiofederici-frontend<gh_stars>0 import * as LoginActions from './login.actions'; import * as LogoutActions from './logout.actions'; import * as UserActions from './user.actions'; export { LoginActions, LogoutActions, UserActions };
giorgiofederici/giorgiofederici-frontend
src/app/admin/skills/components/skill-form/skill-form.component.ts
import { Component, OnChanges, SimpleChanges, Input, Output, EventEmitter, ChangeDetectionStrategy } from '@angular/core'; import { FormBuilder, Validators } from '@angular/forms'; // Shared import { Skill } from '../../../shared/models/skills/skill.model'; @Component({ selector: 'admin-skill-form', ...
giorgiofederici/giorgiofederici-frontend
src/app/website/root/containers/website-root/website-root.component.ts
import { Component } from '@angular/core'; @Component({ selector: 'website-root', templateUrl: './website-root.component.html', styleUrls: ['./website-root.component.scss'] }) export class WebsiteRootComponent { }
giorgiofederici/giorgiofederici-frontend
src/app/admin/skills/skills.module.ts
<gh_stars>0 import { NgModule, ModuleWithProviders } from '@angular/core'; import { CommonModule } from '@angular/common'; import { ReactiveFormsModule } from '@angular/forms'; import { RouterModule, Routes } from '@angular/router'; // Font Awesome import { FontAwesomeModule } from '@fortawesome/angular-fontawesome'; ...
giorgiofederici/giorgiofederici-frontend
src/app/admin/shared/actions/skills/index.ts
<filename>src/app/admin/shared/actions/skills/index.ts import * as SkillsActions from './skills.actions'; export { SkillsActions };
giorgiofederici/giorgiofederici-frontend
src/app/auth/shared/actions/login.actions.ts
// ngRx import { Action } from '@ngrx/store'; // Auth shared import { User } from '../models/user.model'; export enum LoginActionTypes { Login = '[Login] Login', LoginSuccess = '[Login] Login Success', LoginFailure = '[Login] Login Failure', LoginRedirect = '[Login] Login Redirect' } export class Login imple...
giorgiofederici/giorgiofederici-frontend
src/app/admin/shared/actions/projects/index.ts
<gh_stars>0 import * as ProjectsActions from './projects.actions'; export { ProjectsActions };
michalsvorc/next-auth-dynamodb-adapter
src/DynamoDBAdapter.ts
<reponame>michalsvorc/next-auth-dynamodb-adapter import {DynamoDBClient, DynamoDBClientConfig} from '@aws-sdk/client-dynamodb'; import {AppOptions, User} from 'next-auth'; import { Adapter, AdapterInstance, Profile, Session, VerificationRequest, } from 'next-auth/adapters'; import logger from 'next-auth/dist/...
michalsvorc/next-auth-dynamodb-adapter
src/methods/createVerificationRequest.ts
<reponame>michalsvorc/next-auth-dynamodb-adapter import {PutItemCommand} from '@aws-sdk/client-dynamodb'; import bcrypt from 'bcrypt'; import {AppOptions} from 'next-auth'; import {EmailSessionProvider, VerificationRequest} from 'next-auth/adapters'; import {VERIFICATION_TOKEN_MAX_AGE} from '../DynamoDBAdapter'; impor...
michalsvorc/next-auth-dynamodb-adapter
src/methods/createUser.ts
<reponame>michalsvorc/next-auth-dynamodb-adapter import {PutItemCommand} from '@aws-sdk/client-dynamodb'; import {User} from 'next-auth'; import {Profile} from 'next-auth/adapters'; import {DynamoDBAdapterInstance} from '../DynamoDBAdapter'; export const createUser = ({ client, logger, tableOptions, }: { read...
michalsvorc/next-auth-dynamodb-adapter
src/methods/createUser.spec.ts
import { DeleteItemCommand, DynamoDBClient, GetItemCommand, PutItemCommand, } from '@aws-sdk/client-dynamodb'; import {jest} from '@jest/globals'; import bcrypt from 'bcrypt'; import {AppOptions} from 'next-auth'; import {Profile} from 'next-auth/adapters'; // @ts-ignore declaration file import logger from 'nex...
michalsvorc/next-auth-dynamodb-adapter
src/methods/getVerificationRequest.ts
<reponame>michalsvorc/next-auth-dynamodb-adapter<filename>src/methods/getVerificationRequest.ts import {GetItemCommand} from '@aws-sdk/client-dynamodb'; import bcrypt from 'bcrypt'; import {VerificationRequest} from 'next-auth/adapters'; import {SessionProvider} from 'next-auth/client'; import { DynamoDBAdapterInsta...
michalsvorc/next-auth-dynamodb-adapter
src/DynamoDBAdapter.spec.ts
import {jest} from '@jest/globals'; import {Profile} from 'next-auth/adapters'; import {dynamoDBAdapterFactory} from '../__tests__/dynamoDBAdapterFactory'; import {mockUser} from '../__tests__/mockUser'; import {loggerFactory, mockSession} from './DynamoDBAdapter'; jest.mock('bcrypt'); jest.mock('@aws-sdk/client-dyn...
michalsvorc/next-auth-dynamodb-adapter
src/methods/deleteVerificationRequest.ts
import {DeleteItemCommand} from '@aws-sdk/client-dynamodb'; import {SessionProvider} from 'next-auth/client'; import {DynamoDBAdapterInstance} from '../DynamoDBAdapter'; export const deleteVerificationRequest = ({ client, logger, tableOptions, }: { readonly client: DynamoDBAdapterInstance['_client']; readon...
michalsvorc/next-auth-dynamodb-adapter
src/methods/getVerificationRequest.spec.ts
import {DynamoDBClient, GetItemCommand} from '@aws-sdk/client-dynamodb'; import {jest} from '@jest/globals'; import bcrypt from 'bcrypt'; import {AppOptions} from 'next-auth'; import {EmailSessionProvider} from 'next-auth/adapters'; // @ts-ignore declaration file import logger from 'next-auth/dist/lib/logger'; import {...
michalsvorc/next-auth-dynamodb-adapter
__tests__/dynamoDBAdapterFactory.ts
import {AppOptions, User} from 'next-auth'; import { AdapterInstance, Profile, Session, VerificationRequest, } from 'next-auth/adapters'; import {DynamoDBAdapter} from '../src/DynamoDBAdapter'; export const dynamoDBAdapterFactory = ( {debug} = {debug: false} ): Promise<AdapterInstance<User, Profile, Session...
michalsvorc/next-auth-dynamodb-adapter
__tests__/mockUser.ts
<filename>__tests__/mockUser.ts export const mockUser = { name: 'FirstName LastName', email: '<EMAIL>', image: 'https://mockdomain.com/first_last.png', };
michalsvorc/next-auth-dynamodb-adapter
src/methods/deleteVerificationRequest.spec.ts
import {DeleteItemCommand, DynamoDBClient} from '@aws-sdk/client-dynamodb'; import {jest} from '@jest/globals'; import {AppOptions} from 'next-auth'; import {EmailSessionProvider} from 'next-auth/adapters'; // @ts-ignore declaration file import logger from 'next-auth/dist/lib/logger'; import {mocked} from 'ts-jest/util...
michalsvorc/next-auth-dynamodb-adapter
src/logger.d.ts
declare module 'next-auth/dist/lib/logger';
michalsvorc/next-auth-dynamodb-adapter
src/methods/createVerificationRequest.spec.ts
import {DynamoDBClient, PutItemCommand} from '@aws-sdk/client-dynamodb'; import {jest} from '@jest/globals'; import bcrypt from 'bcrypt'; import {AppOptions} from 'next-auth'; import {EmailSessionProvider} from 'next-auth/adapters'; // @ts-ignore declaration file import logger from 'next-auth/dist/lib/logger'; import {...
yuanyu90221/task-management-system
src/auth/auth.service.spec.ts
<reponame>yuanyu90221/task-management-system<gh_stars>1-10 import { NotFoundException, UnauthorizedException } from '@nestjs/common'; import { JwtService } from '@nestjs/jwt'; import { Test } from '@nestjs/testing'; import { AuthService } from './auth.service'; import { UsersRepository } from './users.repository'; cons...
yuanyu90221/task-management-system
src/tasks/dto/delete-task.dto.ts
import { IsNotEmpty, IsUUID } from 'class-validator'; export class DeleteTaskDto { @IsUUID('4') @IsNotEmpty() id: string; }
rinsuki/cafy
src/types/boolean.ts
<reponame>rinsuki/cafy import Context from '../ctx'; export const isABoolean = x => typeof x == 'boolean'; export const isNotABoolean = x => !isABoolean(x); /** * Boolean */ export default class BooleanContext extends Context<boolean> { constructor() { super(); this.push(v => isNotABoolean(v) ? new Err...
rinsuki/cafy
test/index.ts
/** * Tests! */ import * as assert from 'assert'; import $, { Context } from '../'; it('デフォルトの値を設定できる', () => { const def = 'strawberry pasta'; const [val = def, err] = $.str.optional.get(undefined); assert.equal(val, def); assert.equal(err, null); }); it('使いまわせる', () => { const isValidGender = $.str.or('male...
rinsuki/cafy
src/ctx.ts
import autobind from './autobind'; import Validator from './validator'; /** * Context基底クラス */ abstract class Context<T = any> { public isOptional = false; public isNullable = false; public data: any; private validators: Validator<T>[] = []; /** * バリデーションを追加します * @param validator バリデータ * @param name バリデ...
rinsuki/cafy
src/index.ts
/** * cafy */ import AnyContext from './types/any'; import ArrayContext from './types/array'; import BooleanContext from './types/boolean'; import NumberContext from './types/number'; import ObjectContext, { Props } from './types/object'; import StringContext from './types/string'; import OrContext from './types/or'...
rinsuki/cafy
src/validator.ts
type Validator<T> = (value: T) => boolean | Error; export default Validator;
rinsuki/cafy
src/types/number.ts
<gh_stars>0 import Context from '../ctx'; export const isANumber = x => Number.isFinite(x); export const isNotANumber = x => !isANumber(x); /** * Number */ export default class NumberContext extends Context<number> { constructor() { super(); this.push(v => isNotANumber(v) ? new Error('must-be-a-number'...
rinsuki/cafy
src/types/array.ts
<reponame>rinsuki/cafy import Context from '../ctx'; import StringContext from './string'; import NumberContext from './number'; import AnyContext from './any'; import BooleanContext from './boolean'; import ObjectContext from './object'; import { TypeOf } from '.'; export const isAnArray = x => Array.isArray(x); expo...
rinsuki/cafy
src/types/object.ts
<gh_stars>0 import Context from '../ctx'; import { TypeOf } from '.'; export const isAnObject = x => typeof x == 'object' && !(x instanceof Array); export const isNotAnObject = x => !isAnObject(x); export type Props = { [key: string]: Context }; /** * Object */ export default class ObjectContext<Ps extends Props> ...
rinsuki/cafy
src/autobind.ts
export default function(target: any, key: string, descriptor: PropertyDescriptor) { const fn = descriptor.value || descriptor.get; return { configurable: true, get() { const bound = fn.bind(this); Object.defineProperty(this, key, { configurable: true, writable: true, value: bound }); ret...
rinsuki/cafy
src/types/or.ts
import Context from '../ctx'; import { TypeOf } from '.'; /** * Or */ export default class OrContext<CtxA extends Context, CtxB extends Context> extends Context<TypeOf<CtxA> | TypeOf<CtxB>> { private ctxA: Context; private ctxB: Context; constructor(ctxA: Context, ctxB: Context) { super(); this.ctxA = ctxA;...
rinsuki/cafy
src/types/string.ts
<gh_stars>0 import Context from '../ctx'; export const isAString = x => typeof x == 'string'; export const isNotAString = x => !isAString(x); function stringToArray(str) { return str.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\uD800-\uDFFF]/g) || []; } /** * String */ export default class StringContext extends Conte...
rinsuki/cafy
src/types/any.ts
<reponame>rinsuki/cafy<gh_stars>0 import Context from '../ctx'; /** * Any */ export default class AnyContext<T = any> extends Context<T> { public getType(): string { return super.getType('any'); } }
dev-rish/rishtickets-common
src/events/order-created-event.ts
import { Subjects } from "./subjects"; import { OrderStatus } from "./types/order-status"; export interface OrderCreatedEvent { subject: Subjects.OrderCreated; data: { id: string; version: number; status: OrderStatus; userId: string; expiresAt: string; ticket: { id: string; pri...
dev-rish/rishtickets-common
src/errors/database-connection-error.ts
import { CustomError } from "./custom-error"; export class DatabaseConnectionError extends CustomError { statusCode = 500; reason = "Error connecting to database"; constructor() { super("Error connecting to database"); // NOTE: Required when extending a built in class Object.setPrototypeOf(this, Dat...
dev-rish/rishtickets-common
src/errors/request-validation-error.ts
import { ValidationError } from "express-validator"; import { CustomError } from "./custom-error"; export class RequestValidationError extends CustomError { statusCode = 400; constructor(public errors: ValidationError[]) { super("Invalid request parameters"); // NOTE: Required when extending a built in c...
dev-rish/rishtickets-common
src/errors/unauthorized-error.ts
<filename>src/errors/unauthorized-error.ts import { CustomError } from "./custom-error"; export class UnauthorizedError extends CustomError { statusCode = 401; constructor() { super("Not authorized"); Object.setPrototypeOf(this, UnauthorizedError.prototype); } serializeError() { return [{ messag...
dev-rish/rishtickets-common
src/events/types/order-status.ts
export enum OrderStatus { /** * 1. When the order has been created but the associated * ticket has not been reserved */ Created = "created", /** * 1. Associated ticket is already reserved * 2. User cancelled the order * 3. Order expires before payment */ Cancelled = "cancelled", /** ...
vsomasvr/ng-orderby-pipe
src/order-by.module.ts
import { NgModule } from '@angular/core'; import { OrderByPipe } from './order-by.pipe'; @NgModule({ declarations:[OrderByPipe], exports:[OrderByPipe], providers:[OrderByPipe] }) export class OrderByModule { }
vsomasvr/ng-orderby-pipe
index.ts
<filename>index.ts export * from './src/order-by.module' export * from './src/order-by.pipe';
vsomasvr/ng-orderby-pipe
src/order-by.pipe.ts
<gh_stars>0 import { Pipe, PipeTransform } from '@angular/core'; @Pipe({ name: 'orderBy' }) export class OrderByPipe implements PipeTransform { transform(values: any[], objectKeyWithPath: string = '', order: string = 'asc'): any { const predicatePathValues: string[] = objectKeyWithPath.split('.'); ...
vsomasvr/ng-orderby-pipe
tests/order-by.pipe.spec.ts
<gh_stars>0 import {OrderByPipe} from '../src/order-by.pipe'; describe('OrderByPipe Tests', () => { let pipe: OrderByPipe; beforeEach(() => { pipe = new OrderByPipe(); }); it('Should order an array of strings', () => { const values = ['Think Pad', 'Macbook Pro', 'Galago Pro', 'XPS']; ...
ffrancesc/absurdle.cat
src/lib/words.ts
import { WORDS } from "../constants/words"; import { Hint } from "./game"; export const isWordInWordList = (word: string) => { return WORDS.includes(word.toLowerCase()); }; export const getHints = ({ word, guess }: { word: string, guess: string }): Hint[] => { return Array.from(guess).map((char, i) => { if (w...
ffrancesc/absurdle.cat
src/components/grid/Row.tsx
<filename>src/components/grid/Row.tsx import { Hint } from "../../lib/game"; import { Cell } from "./Cell"; type Props = { innerRef?: React.MutableRefObject<HTMLDivElement | null>; guess: string; hints?: Hint[]; }; export const Row = ({ guess, hints, innerRef }: Props) => { const letters = Array.from(guess.pa...
ffrancesc/absurdle.cat
src/components/mini-grid/MiniGrid.tsx
<filename>src/components/mini-grid/MiniGrid.tsx import { Hint } from "../../lib/game"; import { MiniRow } from "./MiniRow"; type Props = { hints: Hint[][]; }; export const MiniGrid = ({ hints }: Props) => { return ( <div className="pb-6"> {hints.map((hint, i) => ( <MiniRow key={i} hints={hint} ...
ffrancesc/absurdle.cat
src/components/keyboard/Keyboard.tsx
import { Char, chars, KeyValue } from "../../lib/keyboard"; import { Key } from "./Key"; import { ReactNode, useEffect } from "react"; import { BackspaceIcon } from "@heroicons/react/outline"; type Props = { onChar: (value: Char) => void; onDelete: () => void; onEnter: () => void; disabledKeys: Set<Key...
ffrancesc/absurdle.cat
src/components/mini-grid/MiniRow.tsx
import { Hint } from "../../lib/game"; import { MiniCell } from "./MiniCell"; type Props = { hints: Hint[]; }; export const MiniRow = ({ hints }: Props) => { return ( <div className="flex justify-center mb-1"> {hints.map((hint, i) => ( <MiniCell key={i} hint={hint} /> ))} </div> ); ...
ffrancesc/absurdle.cat
src/App.tsx
<filename>src/App.tsx<gh_stars>0 import { InformationCircleIcon, UserIcon } from "@heroicons/react/outline"; import { useState, useEffect } from "react"; import { Alert } from "./components/alerts/Alert"; import { Grid } from "./components/grid/Grid"; import { Keyboard } from "./components/keyboard/Keyboard"; import { ...
ffrancesc/absurdle.cat
src/constants/words.ts
<gh_stars>0 export const WORDS = [ "canot", "gerna", "unira", "mogol", "floco", "valem", "apomo", "color", "forat", "vides", "tibar", "batan", "actiu", "ondos", "gorra", "poema", "crear", "ocult", "oblit", "legal", "trama", "culpa", "rugir", "farao", "pedra", "hiats",...
ffrancesc/absurdle.cat
src/components/modals/InfoModal.tsx
<gh_stars>0 import { Fragment } from "react"; import { Dialog, Transition } from "@headlessui/react"; import { Cell } from "../grid/Cell"; type Props = { isOpen: boolean; handleClose: () => void; }; export const InfoModal = ({ isOpen, handleClose }: Props) => { return ( <Transition.Root show={isOpen} as={Fr...
ffrancesc/absurdle.cat
src/lib/game.ts
export type Hint = "absent" | "correct" | "present"; export interface Guess {guess: string, hints: Hint[]};
ffrancesc/absurdle.cat
src/lib/share.ts
<reponame>ffrancesc/absurdle.cat import { Hint } from "./game"; export const shareStatus = (hints: Hint[][]) => { navigator.clipboard.writeText( `Absurdle en ${hints.length} intents:\n\n` + generateEmojiGrid(hints) ); }; const showHint = (hint: Hint): string => { switch (hint) { case "correct": ...
ffrancesc/absurdle.cat
src/components/keyboard/Key.tsx
<reponame>ffrancesc/absurdle.cat import { ReactNode } from "react"; import classnames from "classnames"; import { KeyValue } from "../../lib/keyboard"; type Props = { children?: ReactNode; value: KeyValue; disabled: boolean; className?: String; onClick: (value: KeyValue) => void; }; export const Key = ({ ...
ffrancesc/absurdle.cat
src/lib/keyboard.ts
<filename>src/lib/keyboard.ts export type KeyValue = Char | "Enter" | "Backspace"; export const chars = [ "Q", "W", "E", "R", "T", "Y", "U", "I", "O", "P", "A", "S", "D", "F", "G", "H", "J", "K", "L", "Ç", "Z", "X", "C", "V", "B", "N", "M"] as const; export type Char = typeof chars[number];
ffrancesc/absurdle.cat
src/components/grid/Cell.tsx
import { Hint } from "../../lib/game"; import classnames from "classnames"; import { Transition } from "@headlessui/react"; import './Cell.css'; type Props = { value?: string; hint?: Hint; index?: number; }; export const Cell = ({ value, hint, index = 0 }: Props) => { const color = classnames( { "bg...
ffrancesc/absurdle.cat
src/components/grid/Grid.tsx
<reponame>ffrancesc/absurdle.cat import React, { useRef, useEffect } from "react"; import { Hint } from "../../lib/game"; import { Row } from "./Row"; type Props = { guesses: { guess: string, hints: Hint[] }[]; currentGuess: string; }; export const Grid = ({ guesses, currentGuess }: Props) => { const currentRow...
jmfirth/design-test-harness
src/components/grid.ts
<filename>src/components/grid.ts import { TemplateResult } from 'lit-html' import { html } from 'lit-html/lib/lit-extended' import * as colors from '../colors' import { rgba } from '../common' import { Breakpoints, Grid } from '../config' export const grid = (breakpoints: Breakpoints, grid: Grid) => html` <div class...
jmfirth/design-test-harness
src/config.ts
<filename>src/config.ts import * as t from 'io-ts' export const Breakpoints = t.interface({ mobile: t.number, tablet: t.number, smallDesktop: t.number, largeDesktop: t.number }) export interface Breakpoints extends t.TypeOf<typeof Breakpoints> {} export type Breakpoint = keyof Breakpoints export const breakp...