Skip to content

Instantly share code, notes, and snippets.

View ihorkatkov's full-sized avatar

Ihor Katkov ihorkatkov

View GitHub Profile
@ihorkatkov
ihorkatkov / README.md
Created October 12, 2017 14:23 — forked from int128/README.md
Watching build mode on Create React App

Create React App does not provide watching build mode oficially (#1070).

This script provides watching build mode for an external tool such as Chrome Extensions or Firebase app.

How to Use

Create a React app.

Put the script into scripts/watch.js.

Application.load(:instafoto)
for app <- Application.spec(:instafoto, :applications) do
Application.ensure_all_started(app)
end
ExUnit.configure(exclude: [skip: true], timeout: 60_000_000)
ExUnit.start
Ecto.Adapters.SQL.Sandbox.mode(Instafoto.Repo, :manual)
defmodule Example do
defp plug_address_chunk(addr, nil), do: addr
defp plug_address_chunk(addr, key), when String.length(addr) > 0 and String.length(key) > 0 do: addr <> ", " <> city
defp plug_address_chunk(addr, key), do: addr <> city
def get_address() do
street = …
city = …
state = …
zip = …
@ihorkatkov
ihorkatkov / auth.ex
Last active May 3, 2018 14:21
Absinthe Auth modules
defmodule Auth.Plug do
@moduledoc """
Absinthe authentication plug
"""
use Phauxth.Authenticate.Base
@doc """
Sets current user variable
"""
@ihorkatkov
ihorkatkov / test_task.md
Last active September 5, 2018 15:41
Test task for Fullstack Developer (Elixir, GraphQL, JS, React)

Описание

По ссылке ниже можно найти эксель таблицу личного финансового плана. Ваша задача перенести первую вкладку (финансовые цели) в веб приложение. UI создается по своему вкусу, все элементы логики должны быть на одном скрине (странице).

Стек: Elixir, GraphQL, React. Все остальные билблиотеки по вашему усмотрению

Решение опубликовать на гитхабе с инструкцией по запуску

Задача минимум:

  • Пользователь умеет добавлять, изменять, удалять финансовые цели.
@ihorkatkov
ihorkatkov / RecentEvent.js
Created September 19, 2018 08:52
Small react component example
// @flow
import React from 'react'
import moment from 'moment'
import capitalize from '@/utils/capitalize'
import type { Event } from '@/modules/types/event'
type Props = {
event: Event,
}
@ihorkatkov
ihorkatkov / RecentEvents.js
Created September 19, 2018 08:56
Small component example usage with GQL
// @flow
import React from 'react'
import { identity } from 'ramda'
import { Query } from 'react-apollo'
import { createSelector } from 'reselect'
import RecentEvent from '@/pages/photographerDashboard/app/recentEvents/RecentEvent'
import meQuery from '@/modules/query/me'
import Loader from '@/components/Loader'
import pathOrDefaultValue from '@/utils/pathOrDefaultValue'
import type { Event } from '@/modules/types/event'
@ihorkatkov
ihorkatkov / Uploader.js
Created September 19, 2018 09:00
Example with file uploader component
import React from 'react'
import { graphql } from 'react-apollo'
import gql from 'graphql-tag'
import { pipe, prop } from 'ramda'
type FileInputProps = {
label: string,
onChange: Function,
required: boolean,
dataCy: string,
@ihorkatkov
ihorkatkov / story.js
Last active September 19, 2018 09:04
Story example
import React from 'react'
import { storiesOf, action } from '@storybook/react'
import Component from '../../../src/components/MunicipalitySelect/index'
import Provider from '../../../src/test/MockedApolloProvider'
const defaultValue = {
id: 'TG9jYXRpb246MzA=',
name: 'Vestby',
slug: 'vestby_akershus_municipality',
__typename: 'Location',
@ihorkatkov
ihorkatkov / genserver.ex
Created January 28, 2019 07:57
Genserver example
defmodule Spread.Pulser.Worker do
@moduledoc """
This module manages the flow of opportunities and trades
"""
use GenServer
alias Spread.Pulser.Logic, as: PulserLogic
alias Spread.TradingPair.Manager
## Client API