Skip to content

Instantly share code, notes, and snippets.

View alpavlove's full-sized avatar

Alexey Pavlov alpavlove

View GitHub Profile
@alpavlove
alpavlove / index.ts
Created September 22, 2016 10:13
hide ngrx action log in production mode
let META_REDUCERS = [
combineReducers
];
if (ENV === 'development') {
META_REDUCERS.unshift(storeLogger());
}
export default compose(...META_REDUCERS)({
auth,
import * as _ from 'lodash';
function writeColumns(input) {
const processedInput = _(input)
.map(item => ` ${item} `)
.chunk(5)
.map((item, ind, array) => {
return item.map((i, index) => {
const filteredColumn = _(array)
.map((chunk) => chunk[index])
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { NO_ERRORS_SCHEMA } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { Observable, BehaviorSubject } from 'rxjs';
import { isEqual } from 'lodash';
import * as uuid from 'uuid/v1';
import { DocumentsPageComponent } from './documents.page.component';
import { DocumentsService } from '@documents-core/services/documents.service';
import { DocumentsFiltersService } from '@documents-core/services/document-filters.service';
{
"total": 3,
"totalReturned": 3,
"response": [
{
"services": [
{
"itemId": 590716,
"initialPrice": 0,
"computedPrice": 0,
@alpavlove
alpavlove / SearchInput.tsx
Created May 23, 2022 10:00
Query parameters - SearchInput.tsx
import React, { ChangeEvent, useEffect, useState } from "react"
const SearchInput: React.FC = () => {
const [query, setQuery] = useState("")
function onChange(e: ChangeEvent<HTMLInputElement>) {
setQuery(e.target.value)
}
return <input type="text" value={query} onChange={onChange} />
@alpavlove
alpavlove / useParams.tsx
Created May 23, 2022 10:18
Query parameters - useParams hook
import { useParams } from 'react-router-dom'
const { params } = useParams()
@alpavlove
alpavlove / SearchInput.tsx
Created May 23, 2022 10:20
Query parameters - SearchInput with useHistory
import React, { ChangeEvent, useEffect, useState } from "react"
import { useHistory } from "react-router-dom"
const SearchInput: React.FC = () => {
const [query, setQuery] = useState("")
const history = useHistory()
function onChange(e: ChangeEvent<HTMLInputElement>) {
setQuery(e.target.value)
}
@alpavlove
alpavlove / Tabs.tsx
Created May 23, 2022 10:52
Basic Tabs component - Tabs.tsx
import React, { ReactElement } from "react"
import TabTitle from "./TabTitle"
type Props = {
children: ReactElement[]
}
const Tabs: React.FC<Props> = ({ children }) => {
return (
@alpavlove
alpavlove / Tab.tsx
Created May 23, 2022 10:53
Basic Tabs component - Tab.tsx
import React from 'react'
type Props = {
title: string
}
const Tab: React.FC<Props> = ({ children }) => {
return <div>{children}</div>
}
@alpavlove
alpavlove / TabTitle.tsx
Last active May 23, 2022 10:59
Basic Tabs component - TabTitle.tsx
import React from "react"
type Props = {
title: string
}
const TabTitle: React.FC<Props> = ({ title}) => {
return (
<li>