Skip to content

Instantly share code, notes, and snippets.

Avatar
:octocat:

Shelomanov Dmitry dmitryshelomanov

:octocat:
View GitHub Profile
View test.js
import { createCharacter } from "@lib/pixi"
import { AnimatedIcons } from "@lib/pixi/icons"
import { root } from "@lib/root"
import { merge } from "effector"
import * as PIXI from "pixi.js"
import { GROUND_Y, HERO_X, TARGET_X } from "../constants"
import { attachEffect } from "../lib"
const { createEvent } = root
View alg.js
function isPrime(num) {
for (let i = 2; i < num; i++) {
if (num % i === 0 && num !== 2 ) {
return false;
}
}
return true;
}
// Тут понятно найти простые
View rx-effect.js
// @flow
import { of, Subject, defer, Observable } from "rxjs"
import { map, catchError, flatMap, switchMap } from "rxjs/operators"
import {
type Event,
type Store,
createEvent,
createStore,
merge,
View model.js
// @flow
import { type Store, combine, forward } from "effector"
import { createGate } from "effector-react"
import { mapTo, createListFetching } from "@lib/effector-extend"
import type { GeoPoint, Event as CardEvent, Place } from "@lib/ws"
import {
wsSearchForPlacecEvents,
$likes,
combineEventsWithLikesState,
View 1.js
// @flow
import {
type Store,
type Effect,
type Event,
sample,
guard,
combine,
restore,
View snake.js
import { createEvent, createStore } from "effector";
const canvas = document.querySelector("canvas");
const ctx = canvas.getContext("2d");
const scoreElement = document.querySelector("#score");
const DIRECTIONS = {
LEFT: 37,
RIGHT: 39,
TOP: 38,
View test.js
const LEFT = 65;
const RIGHT = 68;
function keyCodeToString(keyCode) {
const validSceme = [LEFT, RIGHT].includes(keyCode);
if (validSceme) {
const str = {
[LEFT]: "left",
[RIGHT]: "right"
View with-form.js
import React, { Component } from 'react'
import validatejs from 'validate.js'
const validate = (fieldName, value, rule) => {
const result = validatejs({ [fieldName]: value }, { [fieldName]: rule })
if (result) {
return result[fieldName][0]
}
View map_screen.js
import React from 'react'
import { StyleSheet, Text, TouchableOpacity } from 'react-native'
import { Card, CardItem } from 'native-base'
import { nest, compose, withPropsOnChange } from 'recompose'
import * as Animatable from 'react-native-animatable-unmountable'
import { FlatListWithError } from 'features/common'
import { withLocalFetch } from 'react-local-fetch'
import { H3, Loader } from 'ui'
import { colors } from 'ui/colors'
import { Distance } from './distance'
View function-calcaulating.js
function buildNumber (number) {
return (op) => {
if (typeof op === 'function') {
return op(number)
}
return number
}
}