Skip to content

Instantly share code, notes, and snippets.

View smashercosmo's full-sized avatar

Vladislav Shkodin smashercosmo

View GitHub Profile
import cx from 'classnames'
import React from 'react'
import { Link as ReactRouterLink } from 'react-router-dom'
import type { LinkProps as ReactRouterLinkProps } from 'react-router-dom'
import { ButtonSpinner } from '../ButtonSpinner/ButtonSpinner'
import styles from './Button.css'
type CommonProps = {
* {
--pl: initial;
--pr: initial;
--pt: initial;
--pb: initial;
--ml: initial;
--mr: initial;
--mt: initial;
--mb: initial;
--c: initial;
@smashercosmo
smashercosmo / Example.ts
Last active January 27, 2020 14:02
VerticalStackV2
import React from 'react'
import { VerticalStack } from '../VerticalStack2/VerticalStack2'
export function App() {
return (
<VerticalStack gap={10} passthrough skipLast>
<h1>Hello world</h1>
<p>Bla bla bla</p>
<p>Bla bla bla</p>
import React, { useEffect, useRef } from 'react'
import videoAV1 from '../../../static/video/video.av1.mp4'
import videoH264 from '../../../static/video/video.h264.mp4'
import styles from './VideoBackground.module.css'
function VideoBackground() {
const videoRef = useRef<HTMLVideoElement | null>(null)
const videoSrcAV1ref = useRef<HTMLSourceElement | null>(null)
@smashercosmo
smashercosmo / generate.js
Created May 22, 2019 12:45
Generate fake data out of TypeScript types
const execa = require('execa')
const jsf = require('json-schema-faker')
;(async () => {
const { stdout } = await execa(
'./node_modules/.bin/ts-json-schema-generator',
[
'--path',
'./organizations.ts',
'--type',
@smashercosmo
smashercosmo / Box.tsx
Last active May 29, 2019 12:09
tailwind
import React from 'react'
type ResponsiveType<T> =
| T
| [T]
| [T, T]
| [T, T, T]
| [T, T, T, T]
| [T, T, T, T, T]
type SpacingType = 0 | 5 | 10 | 15 | 20 | 25 | 30 | 35 | 40 | 45 | 50
type MarginSpacingType = SpacingType | 'auto'
@smashercosmo
smashercosmo / logger.js
Last active April 17, 2019 13:06
Batch actions logger
import createLogger from 'redux-logger';
const actionTransformer = action => {
if (action.type === 'BATCHING_REDUCER.BATCH') {
action.payload.type = action.payload.reduce((result, next) => {
const prefix = result ? result + ' => ' : '';
return prefix + next.type;
}, '');
return action.payload;
const { StaticRouter } = require('react-router-dom')
const https = require('https')
const http = require('http')
const express = require('express')
const bodyParser = require('body-parser')
const React = require('react')
const { renderToString } = require('react-dom/server')
const path = require('path')
const fs = require('fs')
@smashercosmo
smashercosmo / proxy.js
Created February 28, 2019 11:58
proxy
const api = route.all('/api/(.*)', async (ctx, next) => {
ctx.respond = false
const { res, req, url, method, headers } = ctx
const proxyUrl = new URL(
BASE_URL + url.replace(/^\/api/, '/api/v2'),
)
const proxyReq = makeProxyRequest({
url: proxyUrl,
const route = require('koa-route')
const http = require('http')
const https = require('https')
const got = require('got')
const {
UMBRA_APS_CLIENT_SECRET,
UMBRA_API_EXTERNALURL,
UMBRA_AUTH_URI,
} = process.env