Skip to content

Instantly share code, notes, and snippets.

View smashercosmo's full-sized avatar

Vladislav Shkodin smashercosmo

View GitHub Profile
const set = new Set()
if (typeof window !== 'undefined') {
window.addEventListener('scroll', () => {
Array.from(set).forEach(fn => fn())
})
}
class ItemsListCursorTracker extends Component {
constructor(props) {
const route = require('koa-route')
const request = require('request')
const got = require('got')
const {
UMBRA_APS_CLIENT_SECRET,
UMBRA_API_EXTERNALURL,
UMBRA_AUTH_URI,
} = process.env
@smashercosmo
smashercosmo / rule.js
Created December 10, 2018 22:46
redux action eslint rule
function hasNotOnlyTypePayloadAndMetaProps(node) {
return node.properties.some(
prop =>
prop.key.name !== 'type' &&
prop.key.name !== 'payload' &&
prop.key.name !== 'meta',
)
}
function isReduxActionTypePropertyValue(value) {
import * as React from 'react'
import { Heading } from '../Heading/Heading'
import { TasksStatus } from '../TasksStatus/TasksStatus'
import { Section } from '../Section/Section'
import { VerticalStack } from '../VerticalStack/VerticalStack'
import { TasksGroupsList } from '../TasksGroupsList/TasksGroupsList'
import { TaskNodesList } from '../TaskNodesList/TaskNodesList'
import {
import React from 'react'
class Pure extends React.PureComponent {
render() {
return <div>1</div>
}
}
class Page extends React.Component {
render() {
@smashercosmo
smashercosmo / VerticalStack.css
Last active October 1, 2018 09:00
VerticalStack
.root {
display: grid;
}
.gap10 {
grid-gap: 10px;
}
.gap20 {
import React from 'react'
import PropTypes from 'prop-types'
import withRouter from 'react-router-dom/es/withRouter'
class ScrollManager extends React.Component {
static propTypes = {
history: PropTypes.object.isRequired,
location: PropTypes.object.isRequired,
}
import React from 'react'
import ExternalLinkIcon from './link.svg'
import HeaderNavigationItem from '../HeaderNavigationItem/HeaderNavigationItem'
import { TutorialContext } from '../Tutorial/TutorialProvider'
import style from './HeaderNavigation.scss'
function HeaderNavigation() {
return (
const propTypes = {
history: PropTypes.object.isRequired,
}
const NewProjectRoute = props => (
<Subscribe
to={[
OrganizationsContainer,
UserContainer,
UsersContainer,
async function handlePasswordChange({ currentPassword, newPassword }) {
await this.props.userState.changePassword({ currentPassword, newPassword })
this.props.messageState.add({
type: 'ok',
text: 'Password changed.',
})
}
async function handleUserUpdate({ firstName, lastName }) {
await this.props.userState.update({ firstName, lastName })