Skip to content

Instantly share code, notes, and snippets.

View kdichev's full-sized avatar
⚛️
useEffect(() => { setWorking(true) }, [])

Konstantin Dichev kdichev

⚛️
useEffect(() => { setWorking(true) }, [])
View GitHub Profile
dfds-kd:bench-app kdichev$ yarn run build
yarn run v1.17.3
$ gatsby build
success open and validate gatsby-configs - 0.038s
success load plugins - 0.682s
Loaded gatsby-source-contentful
Loaded gatsby-starter-plugin
success onPreInit - 0.022s
success delete html and css files from previous builds - 0.733s
success initialize cache - 0.019s
@kdichev
kdichev / master
Created March 17, 2020 10:36
this is our latest master build under our infrastructure.
2020-03-17T08:26:02.8640112Z yarn run v1.19.1
2020-03-17T08:26:02.9055760Z $ yarn validate:schema
2020-03-17T08:26:03.1232878Z $ node ./scripts/validate-local-schema.js
2020-03-17T08:26:03.3995455Z $ gatsby build
2020-03-17T08:26:04.7039219Z success open and validate gatsby-configs - 0.076s
2020-03-17T08:26:05.4198376Z success load plugins - 0.702s
2020-03-17T08:26:05.4353014Z success onPreInit - 0.004s
2020-03-17T08:26:05.4545610Z success delete html and css files from previous builds - 0.009s
2020-03-17T08:26:05.4693152Z success initialize cache - 0.005s
2020-03-17T08:26:05.5002112Z success copy gatsby files - 0.022s
@kdichev
kdichev / test.js
Last active January 30, 2019 10:55
// bad
<div
className={`miniBook__tab miniBook__tabOneWay${oneWay ? ' miniBook__tab--active' : ''}`}
onClick={() => this.tabOnClick(oneWay)}
>
{children}
</div>
// better
<div
@kdichev
kdichev / data.js
Created September 4, 2018 16:33
example
// that needs to become something readable for a pathfinding algorithm like
// [
// [0, 0, 0, 1, 0],
// [1, 0, 0, 0, 1],
// [0, 0, 1, 0, 0],
// ]
const apiData = [
[
"west",
@kdichev
kdichev / grid.js
Last active August 30, 2018 18:21
// data contains width * height walkable path entries
// each entry has at most two walls "west" | "north"
// to find all walkable directions from X use the array entries X, X+1 and X+width to construct walls
// grid is 15x15 blocks
const data = [["west","north"],["north"],["west","north"],["north"],["north"],["west","north"],["north"],["north"],["west","north"],["north"],["north"],["north"],["west","north"],["north"],["north"],["west","north"],["west"],["west"],["north"],["west"],["west"],["west"],["west"],["north"],["north"],[],["west"],["north"],["north"],[],["west"],[],["west"],["west"],["north"],[],["west"],["north"],["north"],["west","north"],["north"],[],["west","north"],["north"],["west"],["west"],["north"],["north"],["west"],["north"],["north"],["north"],["north"],["west"],["north"],["north"],["north"],["west"],["west"],["west"],["west","north"],["north"],["west"],["west"],["west","north"],["north"],["north"],["west"],["west","north"],["north"],["west"],["west"],[],["west"],["north"],["west"],["west
const data = [
[
'west',
'north'
],
[
'north'
],
[
'north'
@kdichev
kdichev / endpoints.graphql
Created June 19, 2018 20:17
Car endpoints
mutation {
createCar(
name: "car"
carBrand: "Mercedes-Benz"
carMode: "C63 AMG"
carYear: "2018-06-19T19:51:13.701Z"
) {
id
carBrand
}
const asyncAction = (dataMaybe) => async (dispatch, getState) => {
// u can dispatch all kinds of actions here according to outcome
dispatch({type: "FETCHING_START"}
// if u need to use store data but can be passed as arg from react component when invoking
const store = getState().theReducer
const response = await myFetchFunction()
if (response) {
dispatch({type: "FETCHING_SUCCESS", payload: {response}}
import { connect } from "react-redux";
const mapStateToProps = ({
theReducer: { city, humidity, temperature, wind }
}) => ({
city,
humidity,
temperature,
wind
});
@kdichev
kdichev / js
Created April 8, 2018 10:04
reducers.js
import { combineReducers } from "redux";
const initialState = {
hi: "hi"
};
export const theReducer = (state = initialState, action) => {
switch (action.type) {
case "SOMETHING_HAPPENING":
return { ...state, hi: "bye" };