repo_name stringlengths 5 122 | path stringlengths 3 232 | text stringlengths 6 1.05M |
|---|---|---|
usualoma/mt-plugin-BlurHash | mt-static/plugins/BlurHash/src/demo.ts | import { decode } from "blurhash";
function isLoaded(img: HTMLImageElement): boolean {
if (!img.complete) {
return false;
}
if (img.naturalWidth === 0) {
return false;
}
return true;
}
const imgs = document.querySelectorAll("img[data-hash]");
for (let i = 0; i < imgs.length; i++) {
const img = i... |
Choups/alexandre-peyrichout.com | src/components/header/header.tsx | <filename>src/components/header/header.tsx<gh_stars>0
import { Link, useStaticQuery, graphql } from "gatsby"
import React from "react"
// styled-components
import { NavbarList } from "./header.styles"
import { NavbarItem } from "./header.styles"
const Header = () => {
const data = useStaticQuery(graphql`
query g... |
Choups/alexandre-peyrichout.com | src/components/frontend-flip/frontend.tsx | import React, { useState } from "react"
import { Wrapper } from "./frontend.styles"
import ReactCardFlip from "react-card-flip"
type Props = {
bgColorFront: string
bgColorBack: string
title: string
}
const Frontend = ({ bgColorFront, bgColorBack, title }: Props) => {
const [isFlipped, setIsFlipped] = useState... |
Choups/alexandre-peyrichout.com | src/components/layout/layout.tsx | <filename>src/components/layout/layout.tsx
/**
* Layout component that queries for data
* with Gatsby's useStaticQuery component
*
* See: https://www.gatsbyjs.org/docs/use-static-query/
*/
import React, { ReactNode } from "react"
import Header from "../header/header"
import Footer from "../footer/footer"
import... |
Choups/alexandre-peyrichout.com | src/pages/index.tsx | <filename>src/pages/index.tsx
import React from "react"
import { graphql, PageProps } from "gatsby"
import { Grid, Cell } from "styled-css-grid"
import Layout from "../components/layout/layout"
import SEO from "../components/seo/seo"
import Terminal from "../components/terminal/terminal"
import Portrait from "../comp... |
Choups/alexandre-peyrichout.com | src/components/terminal/terminal.tsx | <filename>src/components/terminal/terminal.tsx
import React from "react"
import Terminal from "react-animated-term"
import "react-animated-term/dist/react-animated-term.css"
import { TerminalWrapper } from "./terminal.styles"
const spinnerFrames = ["⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"]
let date = new Date... |
Choups/alexandre-peyrichout.com | src/components/layout/layout.styles.ts | import styled from "styled-components"
import img from "../../images/tenor.gif"
export const LayoutWrapper = styled.div`
margin: 0 auto;
min-height: 100vh;
padding: 0;
background-image: url(${img});
background-repeat: repeat;
`
|
Choups/alexandre-peyrichout.com | src/components/frontend-flip/frontend.styles.ts | <reponame>Choups/alexandre-peyrichout.com
import styled from "styled-components"
type Props = {
bg_color: string
}
export const Wrapper = styled.div`
width: 100%;
height: 100%;
background-color: ${(props: Props) =>
props.bg_color ? props.bg_color : null};
color: white;
display: flex;
justify-content... |
Choups/alexandre-peyrichout.com | src/components/image/image.tsx | import React from "react"
import { useStaticQuery, graphql } from "gatsby"
import Img from "gatsby-image"
const Image = () => {
const data = useStaticQuery(graphql`
query {
placeholderImage: file(relativePath: { eq: "test2.png" }) {
childImageSharp {
fluid(maxWidth: 1000) {
..... |
Choups/alexandre-peyrichout.com | src/components/portrait/portrait.styles.ts | import styled from "styled-components"
import { Theme } from "../../global-styles/theme"
export const PortraitWrapper = styled.div`
width: 100%;
overflow: hidden;
height: 100%;
background-color: ${Theme.colors.portrait};
color: white;
display: flex;
justify-content: center;
align-items: center;
`
|
Choups/alexandre-peyrichout.com | src/components/portrait/portrait.tsx | import React from "react"
import { PortraitWrapper } from "./portrait.styles"
import Image from "../image/image"
const Portrait = () => {
return (
<PortraitWrapper>
<Image />
</PortraitWrapper>
)
}
export default Portrait
|
Choups/alexandre-peyrichout.com | src/components/background/background.tsx | <gh_stars>0
import React, { ReactNode } from "react"
import { graphql, StaticQuery } from "gatsby"
import styled from "styled-components"
import BackgroundImage from "gatsby-background-image"
type Props = {
children: ReactNode
className?: string
}
const BackgroundSection = ({ className, children }: Props) => (
... |
Choups/alexandre-peyrichout.com | src/components/header/header.styles.ts | import styled from "styled-components"
export const NavbarList = styled.ul`
display: flex;
list-style-type: none;
margin: 0;
padding: 0;
`
export const NavbarItem = styled.li`
padding: 5px;
` |
Choups/alexandre-peyrichout.com | src/components/terminal/terminal.styles.ts | <reponame>Choups/alexandre-peyrichout.com
import styled from "styled-components"
import { Theme } from "../../global-styles/theme"
export const TerminalWrapper = styled.div`
width: 100%;
overflow: auto;
height: 100%;
color: white;
.Terminal-prompt {
color: ${Theme.colors.main};
}
.Terminal-body {
... |
adamsrsen/watchinsync | lib/verify.ts | const MIN_PASSWORD_LEN = 8
const MAX_PASSWORD_LEN = 24
export const checkUsername = (username: string) => {
return username && username.length > 0
}
export const checkEmail = (email: string) => {
return email && email.match(/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5... |
adamsrsen/watchinsync | objects/User.ts | <reponame>adamsrsen/watchinsync<gh_stars>0
import {UserRole} from './UserRole'
export default class User {
id: number
username: string
email: string
role?: UserRole
} |
adamsrsen/watchinsync | components/Modal.tsx | <filename>components/Modal.tsx
import {Component, MouseEventHandler} from 'react'
import {motion} from 'framer-motion'
import styles from './Modal.module.scss'
import CenteredContent from './CenteredContent'
interface Props {
width?: number
close: MouseEventHandler<HTMLDivElement>
open: boolean
}
export default... |
adamsrsen/watchinsync | components/Dropdown.tsx | import {Component, MouseEventHandler, ReactNode} from 'react'
import {motion} from 'framer-motion'
import Link from 'next/link'
import styles from './Dropdown.module.scss'
import List from './List'
import Item from './Item'
interface Props {
options: {
title: string,
href?: string,
onClick?: MouseEventHa... |
adamsrsen/watchinsync | components/Checkbox.tsx | import {ChangeEventHandler, Component, ReactNode} from 'react'
import styles from './Checkbox.module.scss'
export default class Checkbox extends Component {
props: {
onChange: ChangeEventHandler<HTMLInputElement>
checked: boolean
children?: ReactNode
}
render() {
const classes = [styles['checkbo... |
adamsrsen/watchinsync | pages/api/user/change_password.ts | <filename>pages/api/user/change_password.ts
import {NextApiRequest, NextApiResponse} from 'next'
import bodyParser from 'body-parser'
import {promisify} from 'util'
import getConnection from '../../../lib/db'
import Users from '../../../entity/Users'
import bcrypt from 'bcrypt'
import {sessionOptions} from '../../../li... |
adamsrsen/watchinsync | components/Tabs.tsx | import {Component, ReactNode} from 'react'
import styles from './Tabs.module.scss'
import FadeAnimation from './FadeAnimation'
import {AnimatePresence} from 'framer-motion'
export class Tab {
title: string
content: ReactNode
constructor({title, content}) {
this.title = title
this.content = content
}
... |
adamsrsen/watchinsync | pages/api/room/playlist/index.ts | import {NextApiRequest, NextApiResponse} from 'next'
import getConnection from '../../../../lib/db'
import Videos from '../../../../entity/Videos'
import {decodeRoomId} from '../../../../lib/util'
export default async function handler(req: NextApiRequest, res: NextApiResponse) {
if(req.method === 'GET') {
const ... |
adamsrsen/watchinsync | pages/404.tsx | <reponame>adamsrsen/watchinsync<filename>pages/404.tsx
import {Component} from 'react'
import Head from 'next/head'
import CenteredContent from '../components/CenteredContent'
import Header from '../components/Header'
import User from '../objects/User'
import FadeAnimation from '../components/FadeAnimation'
interface ... |
adamsrsen/watchinsync | components/players/Vimeo.tsx | <gh_stars>0
import Player, {PlaybackState} from './Player'
import styles from './Vimeo.module.scss'
export default class Vimeo extends Player {
componentDidMount() {
// @ts-ignore
if(!window.Vimeo) {
const tag = document.createElement('script')
tag.src = 'https://player.vimeo.com/api/player.js'
... |
adamsrsen/watchinsync | pages/api/room/update.ts | import {NextApiRequest, NextApiResponse} from 'next'
import bodyParser from 'body-parser'
import {promisify} from 'util'
import getConnection from '../../../lib/db'
import {sessionOptions} from '../../../lib/session'
import {withIronSessionApiRoute} from 'iron-session/next'
import Rooms from '../../../entity/Rooms'
imp... |
adamsrsen/watchinsync | components/players/Twitch.tsx | <filename>components/players/Twitch.tsx<gh_stars>0
import Player, {PlaybackState} from './Player'
import styles from './Twitch.module.scss'
export default class Twitch extends Player {
componentDidMount() {
// @ts-ignore
if(!window.Twitch) {
const tag = document.createElement('script')
tag.src = ... |
adamsrsen/watchinsync | objects/NextApiResponseSocketIO.ts | import { Server as HttpServer, OutgoingMessage } from 'http'
import { NextApiResponse } from 'next'
import { Server as SocketIOServer } from 'socket.io'
export type NextApiResponseSocketIO = NextApiResponse & {
socket: OutgoingMessage['socket'] & {
server: HttpServer & {
io: SocketIOServer
}
}
} |
adamsrsen/watchinsync | pages/index.tsx | <filename>pages/index.tsx
import {Component} from 'react'
import Head from 'next/head'
import Link from 'next/link'
import Header from '../components/Header'
import User from '../objects/User'
import CenteredContent from '../components/CenteredContent'
import Button, {ButtonColor, ButtonSize, ButtonWidth} from '../comp... |
adamsrsen/watchinsync | components/RoomHeader.tsx | import {Component} from 'react'
import Link from 'next/link'
import Image from 'next/image'
import styles from './RoomHeader.module.scss'
import Room from '../objects/Room'
import axios from 'axios'
import {preventDefault} from '../lib/util'
import {toast} from 'react-hot-toast'
import Modal from './Modal'
import Tabs,... |
adamsrsen/watchinsync | pages/api/room/playlist/add.ts | import {NextApiRequest} from 'next'
import bodyParser from 'body-parser'
import {promisify} from 'util'
import getConnection from '../../../../lib/db'
import Videos, {VideoType} from '../../../../entity/Videos'
import {decodeRoomId} from '../../../../lib/util'
import {NextApiResponseSocketIO} from '../../../../objects/... |
adamsrsen/watchinsync | objects/Permission.ts | export default class Permission {
play_pause: boolean
seek: boolean
playback_speed: boolean
add_video: boolean
skip_video: boolean
remove_video: boolean
chat: boolean
video_chat: boolean
change_role: boolean
} |
adamsrsen/watchinsync | components/Header.tsx | import {Component} from 'react'
import Image from 'next/image'
import Link from 'next/link'
import User from '../objects/User'
import styles from './Header.module.scss'
import axios from 'axios'
interface Props {
user?: User
setUser?: Function
}
export default class Header extends Component<Props> {
logout() {
... |
adamsrsen/watchinsync | entity/Roles.ts | import {Column, Entity, ManyToOne} from 'typeorm'
import Users from './Users'
import Rooms from './Rooms'
import {UserRole} from '../objects/UserRole'
@Entity()
export default class Roles {
@ManyToOne(() => Users, (user) => user.joined_rooms, {primary: true, onDelete: 'CASCADE'})
user: Partial<Users>
@ManyToOne... |
adamsrsen/watchinsync | pages/api/room/delete.ts | <reponame>adamsrsen/watchinsync<gh_stars>0
import {NextApiRequest, NextApiResponse} from 'next'
import bodyParser from 'body-parser'
import {promisify} from 'util'
import getConnection from '../../../lib/db'
import {decodeRoomId} from '../../../lib/util'
import Rooms from '../../../entity/Rooms'
import {withIronSession... |
adamsrsen/watchinsync | objects/UserRole.ts | export enum UserRole {
OWNER,
ADMIN,
MODERATOR,
MEMBER
} |
adamsrsen/watchinsync | pages/api/user/login.ts | import {NextApiRequest, NextApiResponse} from 'next'
import bodyParser from 'body-parser'
import {promisify} from 'util'
import getConnection from '../../../lib/db'
import Users from '../../../entity/Users'
import bcrypt from 'bcrypt'
import {sessionOptions} from '../../../lib/session'
import {withIronSessionApiRoute} ... |
adamsrsen/watchinsync | lib/db.ts | import 'ts-node/register'
import 'reflect-metadata'
import {ConnectionOptions, getConnectionManager} from 'typeorm'
import * as db_options from '../ormconfig.json'
import Messages from '../entity/Messages'
import Permissions from '../entity/Permissions'
import Roles from '../entity/Roles'
import Rooms from '../entity/R... |
adamsrsen/watchinsync | components/players/Facebook.tsx | import Player, {PlaybackState} from './Player'
export default class Facebook extends Player {
interval: any
ready: Function
constructor(props) {
super(props)
this.ready = (msg) => {
if (msg.type === 'video') {
this.player = msg.instance
// Listen to play event and send socket if ... |
adamsrsen/watchinsync | migration/1652015153214-chat.ts | <filename>migration/1652015153214-chat.ts<gh_stars>0
import {MigrationInterface, QueryRunner} from "typeorm";
export class chat1652015153214 implements MigrationInterface {
name = 'chat1652015153214'
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE "roles... |
adamsrsen/watchinsync | objects/Message.ts | <reponame>adamsrsen/watchinsync
import User from './User'
export default class Message {
user: User
texts: {
text: string,
date: Date
}[]
} |
adamsrsen/watchinsync | pages/sign_up.tsx | import {Component} from 'react'
import Head from 'next/head'
import Link from 'next/link'
import Header from '../components/Header'
import User from '../objects/User'
import CenteredContent from '../components/CenteredContent'
import Input from '../components/Input'
import Button, {ButtonColor, ButtonSize, ButtonWidth}... |
adamsrsen/watchinsync | pages/rooms/page/[page].tsx | <reponame>adamsrsen/watchinsync
import {Component} from 'react'
import Head from 'next/head'
import Link from 'next/link'
import Header from '../../../components/Header'
import User from '../../../objects/User'
import Container from '../../../components/Container'
import List from '../../../components/List'
import Item... |
adamsrsen/watchinsync | pages/change_password.tsx | import {Component} from 'react'
import Head from 'next/head'
import Header from '../components/Header'
import CenteredContent from '../components/CenteredContent'
import Input from '../components/Input'
import Button, {ButtonColor, ButtonSize, ButtonWidth} from '../components/Button'
import User from '../objects/User'
... |
adamsrsen/watchinsync | pages/api/user/create.ts | <filename>pages/api/user/create.ts
import {NextApiRequest, NextApiResponse} from 'next'
import bodyParser from 'body-parser'
import {promisify} from 'util'
import getConnection from '../../../lib/db'
import Users from '../../../entity/Users'
import bcrypt from 'bcrypt'
import {checkEmail, checkPassword, checkPasswords,... |
adamsrsen/watchinsync | pages/api/room/permissions.ts | <gh_stars>0
import {NextApiRequest, NextApiResponse} from 'next'
import bodyParser from 'body-parser'
import {promisify} from 'util'
import getConnection from '../../../lib/db'
import {sessionOptions} from '../../../lib/session'
import {withIronSessionApiRoute} from 'iron-session/next'
import Rooms from '../../../entit... |
adamsrsen/watchinsync | entity/Users.ts | <reponame>adamsrsen/watchinsync
import {Column, Entity, OneToMany, PrimaryGeneratedColumn} from 'typeorm'
import Roles from './Roles'
@Entity()
export default class Users {
@PrimaryGeneratedColumn()
id: number
@Column({unique: true})
username: string
@Column({unique: true})
email: string
@Column()
p... |
adamsrsen/watchinsync | components/Playlist.tsx | <reponame>adamsrsen/watchinsync
import {Component} from 'react'
import Image from 'next/image'
import List from './List'
import Video from '../objects/Video'
import Item from './Item'
import styles from './Playlist.module.scss'
import Room from '../objects/Room'
import axios from 'axios'
import Dropdown from './Dropdow... |
adamsrsen/watchinsync | entity/Permissions.ts | import {Column, Entity, PrimaryGeneratedColumn} from 'typeorm'
@Entity()
export default class Permissions {
@PrimaryGeneratedColumn()
id: number
@Column()
play_pause: boolean
@Column()
seek: boolean
@Column()
playback_speed: boolean
@Column()
add_video: boolean
@Column()
skip_video: boolea... |
adamsrsen/watchinsync | pages/room/create.tsx | import {Component} from 'react'
import Head from 'next/head'
import {NextRouter, withRouter} from 'next/router'
import Header from '../../components/Header'
import CenteredContent from '../../components/CenteredContent'
import Button, {ButtonColor, ButtonSize, ButtonWidth} from '../../components/Button'
import User fro... |
adamsrsen/watchinsync | components/CenteredContent.tsx | <gh_stars>0
import {Component, ReactNode} from 'react'
import styles from './CenteredContent.module.scss'
import Container from './Container'
export default class CenteredContent extends Component {
props: {
width?: number
height?: string
children: ReactNode
}
render() {
return (
<Containe... |
adamsrsen/watchinsync | objects/Room.ts | export default class Room {
id: string
name: string
public: boolean
} |
adamsrsen/watchinsync | components/Container.tsx | import {Component, ReactNode} from 'react'
import styles from './Container.module.scss'
export default class Container extends Component {
props: {
width?: number
children: ReactNode
}
render() {
return (
<div className={styles.container} style={this.props.width && {
maxWidth: `${this... |
adamsrsen/watchinsync | migration/1648134462236-rooms.ts | import {MigrationInterface, QueryRunner} from "typeorm";
export class rooms1648134462236 implements MigrationInterface {
name = 'rooms1648134462236'
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE "rooms" ADD "public" boolean NOT NULL`);
}
publi... |
adamsrsen/watchinsync | components/FadeAnimation.tsx | import {Component} from 'react'
import {motion} from 'framer-motion'
export default class FadeAnimation extends Component {
render() {
const variants = {
hidden: {opacity: 0},
enter: {opacity: 1},
exit: {opacity: 0}
}
return (
<motion.div variants={variants} initial="hidden" animate="enter... |
adamsrsen/watchinsync | entity/Messages.ts | <reponame>adamsrsen/watchinsync
import {Column, Entity, ManyToOne, PrimaryGeneratedColumn} from 'typeorm'
import Users from './Users'
import Rooms from './Rooms'
@Entity()
export default class Messages {
@PrimaryGeneratedColumn()
id: number
@Column()
text: string
@Column({type: 'timestamptz'})
timestamp:... |
adamsrsen/watchinsync | pages/api/room/messages.ts | <filename>pages/api/room/messages.ts
import {NextApiRequest} from 'next'
import {sessionOptions, verifyPermission} from '../../../lib/session'
import {withIronSessionApiRoute} from 'iron-session/next'
import {decodeRoomId} from '../../../lib/util'
import getConnection from '../../../lib/db'
import Messages from '../../... |
adamsrsen/watchinsync | lib/session.ts | <gh_stars>0
import type { IronSessionOptions } from 'iron-session'
import type User from '../objects/User'
import getConnection from './db'
import Roles from '../entity/Roles'
import {UserRole} from '../objects/UserRole'
import Rooms from '../entity/Rooms'
export const sessionOptions: IronSessionOptions = {
password... |
adamsrsen/watchinsync | pages/api/room/playlist/remove.ts | <reponame>adamsrsen/watchinsync
import {NextApiRequest} from 'next'
import bodyParser from 'body-parser'
import {promisify} from 'util'
import getConnection from '../../../../lib/db'
import Videos from '../../../../entity/Videos'
import {decodeRoomId} from '../../../../lib/util'
import {NextApiResponseSocketIO} from '.... |
adamsrsen/watchinsync | pages/api/room/users.ts | import {NextApiRequest, NextApiResponse} from 'next'
import {sessionOptions} from '../../../lib/session'
import {withIronSessionApiRoute} from 'iron-session/next'
import {decodeRoomId} from '../../../lib/util'
import getConnection from '../../../lib/db'
import Roles from '../../../entity/Roles'
const login = async fun... |
adamsrsen/watchinsync | pages/api/user/logout.ts | import {NextApiRequest, NextApiResponse} from 'next'
import {sessionOptions} from '../../../lib/session'
import {withIronSessionApiRoute} from 'iron-session/next'
const login = async function(req: NextApiRequest, res: NextApiResponse) {
if(req.method === 'GET') {
req.session.destroy()
res.end()
}
else {
... |
adamsrsen/watchinsync | pages/api/room/create.ts | <reponame>adamsrsen/watchinsync
import {NextApiRequest, NextApiResponse} from 'next'
import bodyParser from 'body-parser'
import {promisify} from 'util'
import {v4 as uuidv4} from 'uuid'
import getConnection from '../../../lib/db'
import Rooms from '../../../entity/Rooms'
import {encode} from 'uuid-base64-ts'
import {w... |
adamsrsen/watchinsync | pages/rooms/my/[page].tsx | import {Component} from 'react'
import Head from 'next/head'
import Link from 'next/link'
import Header from '../../../components/Header'
import User from '../../../objects/User'
import Container from '../../../components/Container'
import List from '../../../components/List'
import Item from '../../../components/Item'... |
adamsrsen/watchinsync | entity/Videos.ts | import {Column, Entity, ManyToOne, PrimaryGeneratedColumn} from 'typeorm'
import Users from './Users'
import Rooms from './Rooms'
export enum VideoType {
YOUTUBE = 'youtube',
VIMEO = 'vimeo',
TWITCH = 'twitch',
FACEBOOK = 'facebook',
DIRECT = 'direct'
}
@Entity()
export default class Videos {
@PrimaryGene... |
adamsrsen/watchinsync | pages/_app.tsx | import '../styles/globals.scss'
import {Toaster} from 'react-hot-toast'
import {useEffect, useState} from 'react'
import axios from 'axios'
import {AnimatePresence} from 'framer-motion'
import NextProgress from 'next-progress'
import Router from 'next/router'
function MyApp({ Component, pageProps, router }) {
const ... |
adamsrsen/watchinsync | components/Chat.tsx | import {Component} from 'react'
import styles from './Chat.module.scss'
import Room from '../objects/Room'
import Message from '../objects/Message'
import {preventDefault} from '../lib/util'
import Input from './Input'
import axios from 'axios'
import ScrollToBottom, {StateContext, FunctionContext} from 'react-scroll-t... |
adamsrsen/watchinsync | pages/api/room/index.ts | import {NextApiRequest, NextApiResponse} from 'next'
import {sessionOptions} from '../../../lib/session'
import {withIronSessionApiRoute} from 'iron-session/next'
import {decodeRoomId} from '../../../lib/util'
import getConnection from '../../../lib/db'
import Rooms from '../../../entity/Rooms'
const login = async fun... |
adamsrsen/watchinsync | components/Button.tsx | import {Component, MouseEventHandler, ReactNode} from 'react'
import Link from 'next/link'
import styles from './Button.module.scss'
type ButtonSize = typeof ButtonSize[keyof typeof ButtonSize]
export const ButtonSize = {
small: styles['button-small'],
large: styles['button-large'],
} as const
type ButtonWidth = ... |
adamsrsen/watchinsync | migration/1648376623845-videos.ts | import {MigrationInterface, QueryRunner} from "typeorm";
export class videos1648376623845 implements MigrationInterface {
name = 'videos1648376623845'
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE "videos" DROP CONSTRAINT "FK_009df165edbdd06fa78e3bb186... |
adamsrsen/watchinsync | lib/util.tsx | import {decode, encode} from 'uuid-base64-ts'
import Head from 'next/head'
import Header from '../components/Header'
import CenteredContent from '../components/CenteredContent'
export const decodeRoomId = (id) => {
const roomId = decode(id)
if(id !== encode(roomId)){
throw Error()
}
return roomId
}
expor... |
adamsrsen/watchinsync | components/players/YouTube.tsx | <gh_stars>0
import Player, {PlaybackState} from './Player'
import styles from './YouTube.module.scss'
export default class Youtube extends Player {
interval: any
componentDidMount() {
// @ts-ignore
if(!window.YT) {
const tag = document.createElement('script')
tag.src = 'https://www.youtube.com... |
adamsrsen/watchinsync | pages/api/user/update.ts | <reponame>adamsrsen/watchinsync<filename>pages/api/user/update.ts<gh_stars>0
import {NextApiRequest, NextApiResponse} from 'next'
import bodyParser from 'body-parser'
import {promisify} from 'util'
import getConnection from '../../../lib/db'
import Users from '../../../entity/Users'
import {sessionOptions} from '../../... |
adamsrsen/watchinsync | components/Divider.tsx | import {Component} from 'react'
import styles from './Divider.module.scss'
export default class Divider extends Component {
render() {
return (
<span className={styles.divider} />
)
}
} |
adamsrsen/watchinsync | pages/api/room/role.ts | <filename>pages/api/room/role.ts
import {NextApiRequest} from 'next'
import bodyParser from 'body-parser'
import {promisify} from 'util'
import getConnection from '../../../lib/db'
import {sessionOptions, verifyPermission} from '../../../lib/session'
import {withIronSessionApiRoute} from 'iron-session/next'
import {dec... |
adamsrsen/watchinsync | pages/sign_in.tsx | <filename>pages/sign_in.tsx
import {Component} from 'react'
import Head from 'next/head'
import Link from 'next/link'
import Header from '../components/Header'
import User from '../objects/User'
import CenteredContent from '../components/CenteredContent'
import Input from '../components/Input'
import Button, {ButtonCol... |
adamsrsen/watchinsync | pages/room/[roomId].tsx | import {Component, createRef, RefObject} from 'react'
import Head from 'next/head'
import io, {Socket} from 'socket.io-client'
import RoomHeader from '../../components/RoomHeader'
import Room from '../../objects/Room'
import Player from '../../components/players/Player'
import getConnection from '../../lib/db'
import R... |
adamsrsen/watchinsync | components/List.tsx | <gh_stars>0
import {Component} from 'react'
import styles from './List.module.scss'
export default class List extends Component {
render() {
return (
<ul className={styles.list}>
{this.props.children}
</ul>
)
}
} |
adamsrsen/watchinsync | components/UserList.tsx | import {Component} from 'react'
import Image from 'next/image'
import List from './List'
import Item from './Item'
import styles from './UserList.module.scss'
import Room from '../objects/Room'
import Dropdown from './Dropdown'
import Permission from '../objects/Permission'
import {UserRole} from '../objects/UserRole'
... |
adamsrsen/watchinsync | entity/Rooms.ts | <gh_stars>0
import {Column, Entity, JoinColumn, ManyToOne, OneToMany, OneToOne, PrimaryColumn} from 'typeorm'
import Users from './Users'
import Roles from './Roles'
import Permissions from './Permissions'
import Videos from './Videos'
import Messages from './Messages'
@Entity()
export default class Rooms {
@Primary... |
adamsrsen/watchinsync | components/Input.tsx | <filename>components/Input.tsx
import {ChangeEventHandler, Component} from 'react'
import styles from './Input.module.scss'
interface Props {
type: string
placeholder?: string
value?: string
error?: string
forceError?: boolean
onChange?: ChangeEventHandler<HTMLInputElement>
}
export default class Input ex... |
adamsrsen/watchinsync | components/players/Player.tsx | <reponame>adamsrsen/watchinsync
import {Component} from 'react'
import styles from './Player.module.scss'
import {Socket} from 'socket.io-client'
import axios from 'axios'
import _ from 'lodash'
interface Props {
roomId: number
videoId: number
link: string
socket: Socket
}
export enum PlaybackState {
playi... |
adamsrsen/watchinsync | pages/api/room/leave.ts | import {NextApiRequest, NextApiResponse} from 'next'
import bodyParser from 'body-parser'
import {promisify} from 'util'
import getConnection from '../../../lib/db'
import {decodeRoomId} from '../../../lib/util'
import {withIronSessionApiRoute} from 'iron-session/next'
import {sessionOptions} from '../../../lib/session... |
adamsrsen/watchinsync | pages/profile.tsx | import {Component} from 'react'
import Head from 'next/head'
import Header from '../components/Header'
import CenteredContent from '../components/CenteredContent'
import Input from '../components/Input'
import Button, {ButtonColor, ButtonSize, ButtonWidth} from '../components/Button'
import User from '../objects/User'
... |
adamsrsen/watchinsync | components/Paginator.tsx | <reponame>adamsrsen/watchinsync<gh_stars>0
import {Component} from 'react'
import styles from './Paginator.module.scss'
import Link from 'next/link'
interface Props {
page: number
totalPages: number
baseUrl: string
}
export default class Paginator extends Component<Props> {
render() {
const pages = []
... |
adamsrsen/watchinsync | components/Item.tsx | <gh_stars>0
import {Component} from 'react'
import {motion} from 'framer-motion'
import styles from './Item.module.scss'
interface Props {
index: number
}
export default class Item extends Component<Props> {
render() {
const variants = {
enter: (i) => ({
opacity: 1,
transition: {
... |
adamsrsen/watchinsync | objects/Video.ts | <gh_stars>0
export default class Video {
id: number
name: string
link: string
type: string
} |
adamsrsen/watchinsync | pages/api/socketio.ts | import {NextApiRequest} from 'next'
import {Server} from 'socket.io'
import {NextApiResponseSocketIO} from '../../objects/NextApiResponseSocketIO'
import * as http from 'http'
import {ironSession} from 'iron-session/express'
import {sessionOptions} from '../../lib/session'
import Permission from '../../objects/Permissi... |
adamsrsen/watchinsync | components/players/VideoJS.tsx | import videojs from 'video.js'
import 'video.js/dist/video-js.css'
import Player, {PlaybackState} from './Player'
import {createRef, RefObject} from 'react'
export default class VideoJS extends Player {
videoRef: RefObject<any>
constructor(props) {
super(props)
this.videoRef = createRef()
}
componen... |
plusultralabs/mercure-client | src/utils/providers.ts | import email from './email'
import sms from './sms'
import Formater from './Formater'
import * as cryptium from "cryptium"
import { getPubKey } from './keyProvider';
export enum Action{
EMAIL = 'EMAIL',
SMS = 'SMS',
URLTYPE = 'URL'
}
export interface GetPayload{
async (to:string, content:string):{
... |
plusultralabs/mercure-client | src/utils/notify.ts | import * as cryptium from "cryptium";
import getWeb3 from './getWeb3'
interface MercureContract {
getPrice():Number,
sendNotification(email:string,content:string,iv:string,config:any):void
}
const mercureContract = require('../../contracts/Mercure.json')
async function loadContract(_web3?:any){
let web3... |
plusultralabs/mercure-client | src/utils/sms.ts | // format the message for an email
// destinatary email(<EMAIL>)
// content txt(blablablblablablabalblabla)
import Formater from './Formater'
function getFormatedTo(email:string){
return `sms(${email})`
}
function getFormatedContent(content:string){
if (content.length > 150) throw new Error("Sms conte... |
plusultralabs/mercure-client | src/utils/keyProvider.ts | import keysConfig = require( "../../config/pub.json");
export function getPubKey(_index?:number){
let index;
if (typeof _index === 'undefined' || _index > (<any> keysConfig).latest ){
// use the latest available
index = (<any> keysConfig).latest
} else {
index = _index
}
re... |
plusultralabs/mercure-client | src/__tests__/mercure-client.ts | <filename>src/__tests__/mercure-client.ts<gh_stars>0
import getWeb3 from '../utils/getWeb3'
it('gets a web3 instance',async ()=>{
const web3 = await getWeb3();
let web3Type = typeof web3;
expect(web3Type).toEqual('object')
}) |
plusultralabs/mercure-client | src/utils/getWeb3.ts |
import * as Web3 from 'web3'
declare global {
interface Window { web3: Web3 | undefined; }
}
let getWeb3 = (localUrl = 'http://127.0.0.1:7545' )=>(new Promise<any>(function(resolve, reject) {
// Wait for loading completion to avoid race conditions with web3 injection timing.
if (typeof process === 'undefined')... |
plusultralabs/mercure-client | src/index.ts | import loadContract from "./utils/notify"
import getWeb3 from './utils/getWeb3'
import { getProvider , Action} from "./utils/providers";
const PHONENUMBER = /^(?:(?:\+?1\s*(?:[.-]\s*)?)?(?:\(\s*([2-9]1[02-9]|[2-9][02-8]1|[2-9][02-8][02-9])\s*\)|([2-9]1[02-9]|[2-9][02-8]1|[2-9][02-8][02-9]))\s*(?:[.-]\s*)?)?([2-9]1[02-... |
plusultralabs/mercure-client | src/__tests__/mercure.ts | import {prepareEmailNotification,prepareSmsNotification} from '../index'
const BASE64 =/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/
const BASE64WITHIV =/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?\.(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/
it('Prepares ... |
plusultralabs/mercure-client | src/__tests__/keyProviders.ts | import {getPubKey} from '../utils/keyProvider'
it('provides the default key', ()=>{
const pubKEy = getPubKey()
expect(typeof pubKEy).toEqual('string')
}) |
plusultralabs/mercure-client | src/utils/Formater.ts | export default interface Formater {
getFormatedContent (content:string) : string,
getFormatedTo(to:string):string
} |
mochi-x/wom | src/router/index.ts | <reponame>mochi-x/wom
import Vue from 'vue';
import VueRouter, { RouteConfig } from 'vue-router';
import Top from '../views/Top.vue';
Vue.use(VueRouter);
const routes: Array<RouteConfig> = [
{
path: '/',
name: 'Top',
component: Top,
},
];
const router = new VueRouter({
base: process.env.BASE_URL,
... |
arielorn/goalert | web/src/cypress/integration/services.ts | import { Chance } from 'chance'
import { testScreen } from '../support'
const c = new Chance()
testScreen('Services', testServices)
function testServices(screen: ScreenFormat) {
beforeEach(() => {
window.localStorage.setItem('show_services_new_feature_popup', 'false')
})
describe('List Page', () => {
le... |
blrhc/apps | packages/ui-params/src/Param/Tuple.tsx | <reponame>blrhc/apps<filename>packages/ui-params/src/Param/Tuple.tsx
// Copyright 2017-2019 @polkadot/ui-app authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
import { TypeDef } from '@polkadot/types';
import { Props,... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.