Skip to content

Instantly share code, notes, and snippets.

let UserContext = React.createContext();
class App extends React.Component {
state = {
user: null,
setUser: user => {
this.setState({ user });
}
};
@ivan-hilckov
ivan-hilckov / option1.py
Created November 5, 2018 23:09 — forked from douglasmiranda/option1.py
Fix: Django Debug Toolbar not showing when using with Docker.
# If you don't do this you will have to add the host IP in INTERNAL_IPS = ('127.0.0.1',)
# And it will change, then you will have to change INTERNAL_IPS again.
def show_toolbar(request):
if request.is_ajax():
return False
return True
DEBUG_TOOLBAR_CONFIG = {
'SHOW_TOOLBAR_CALLBACK': 'config.local.show_toolbar',
@ivan-hilckov
ivan-hilckov / yarn.unlock.md
Created November 4, 2018 03:45 — forked from RadValentin/yarn.unlock.md
Solve `yarn.lock` or `package.json` conflicts without losing your mind

NOTE: This guide is ONLY for devs who don't want to edit their yarn.lock file by hand. If you don't care about that please carry on.


So you've pulled the latest master

git checkout master
git pull
@ivan-hilckov
ivan-hilckov / commands.js
Created October 25, 2018 15:22
Общие куски для всех тестов
import { URLS, PATH_NAME } from '../../src/constants/path'
import ENDPOINTS from '../../src/constants/endpoints'
// ***********************************************
// This example commands.js shows you how to
// create various custom commands and overwrite
// existing commands.
//
// For more comprehensive examples of custom
// commands please read more here:
// https://on.cypress.io/custom-commands
@ivan-hilckov
ivan-hilckov / project.spec.js
Created October 25, 2018 15:18
Спека для страницы /project/:projectId
/// <reference types="Cypress" />
import { URLS, PATH_NAME } from '../../src/constants/path'
const projectId = 3
const ids = {
layer: 'layer-add',
}
describe('Project', () => {
@ivan-hilckov
ivan-hilckov / layer.spec.js
Created October 25, 2018 15:17
Спека для страницы /project/:projectId/layer
/// <reference types="Cypress" />
import { URLS, PATH_NAME } from '../../src/constants/path'
const projectId = 3
const notExistProjectId = 9999
const ids = {
close: 'close',
title: 'form-title',
subtitle: 'form-subtitle',
@ivan-hilckov
ivan-hilckov / testId.js
Created October 25, 2018 15:14
айдишки для cypress
import get from 'lodash/get'
import { isDevelopment } from 'utils/isDevelopment'
export const TEST_ID = {
components: {
LayerCard: {
image: 'components.LayerCard.image',
vector: 'components.LayerCard.vector',
cad: 'components.LayerCard.cad',
xyz: 'components.LayerCard.xyz',
{
"version": "0.2.0",
"configurations": [
{
"name": "Chrome Canary",
"type": "chrome",
"request": "launch",
"url": "http://localhost:3000",
"webRoot": "${workspaceRoot}/src",
"sourceMapPathOverrides": {
@ivan-hilckov
ivan-hilckov / cheng-lou-spectrum-of-abstraction.md
Created September 17, 2018 23:20 — forked from markerikson/cheng-lou-spectrum-of-abstraction.md
Cheng Lou - "On the Spectrum of Abstraction" summarized transcript (React Europe 2016)

Cheng Lou - On the Spectrum of Abstraction

Cheng Lou, a former member of the React team, gave an incredible talk at React Europe 2016 entitled "On the Spectrum of Abstraction". That talk is available for viewing here: https://www.youtube.com/watch?v=mVVNJKv9esE

It's only a half-hour, but it is mind-blowing. It's worth re-watching two or three times, to let the ideas sink in.

I just rewatched the talk for some research, and wrote down a summary that's semi-transcript-ish. I didn't see any other transcripts for this talk, other than the auto-generated closed captions, so I wanted to share for reference.

Summary

// моожет быть либо id либо layer_id
// id может быть {'layer_id': 2} или {'label_id': 2}
// сунуть первым в лейбл с -- top_id (всегда int) - label_id; либо null (или вообще не приходит) - чтобы сунуть в корень на самый верх
// left_id может быть {'layer_id': 2} или {'label_id': 2} - узел с left_id будет НАД узлом с передаваемым id
// rename
/api/labels/5/ PATCH {'id': 1, 'name': 'NEW NAME AHAHA'} // новое имя
//move
/api/labels/5/ PUT {'id': {'layer_id': 2}, 'top_id': 3}