Skip to content

Instantly share code, notes, and snippets.

View liberium's full-sized avatar
🤓
Learning CV, NLP, RL

Sergey Filkin liberium

🤓
Learning CV, NLP, RL
View GitHub Profile
<template>
<div class="list row">
<div class="col-md-8">
<div class="input-group mb-3">
<input
type="text"
class="form-control"
placeholder="Search by title"
v-model="title"
/>
@liberium
liberium / js-react-coding-rules.md
Created October 22, 2019 08:54
JS/React Coding rules

Module structure

ES module is a .js file with at least one export or folder containing index.js with at least one export.
The guiding module structure design principle is: you should imagine that any module might be extracted to its own package some day.

index.js of a module contains import-export statements only

In index.js we define a module interface, its exported object. This file should not contain business logic.
Placing business logic in index.js leads to following inconveniences, making code reading harder:

  • If components/Compo/index.js is opened in a tab in IDE, in many of them name of the tab would be "index.js", which is non-descriptive. There are addons in most IDEs that allow to show "Compo/index.js" instead of just "index.js" in tab name, but "Compo.js" is still more succinct yet descriptive.
@liberium
liberium / coding_codex.md
Last active December 5, 2018 11:12
JS/React Coding Codex

JS/React Coding Codex

Module structure

ES module is a .js file with at least one export or folder containing index.js with at least one export.
The guiding module structure design principle is: you should imagine that any module might be extracted to its own package some day.

Module names are in kebab-case

First, file paths in MacOS and Windows are case-insesitive. Developer on MacOS could misspell a component module named SignUpForm as components/SignupForm/ then import {SignUpForm} from '@app/components' and not to get an error. After changes are pushed to the CI, it will crash with an error if being run on GNU/Linux, where file paths are case-sensitive.
Second, see the guiding principle. Package name [cannot][1] contain uppercase letters. Therefore, camelCase should never be used. This leaves snake_case and kebab-case.
kebab-case is by far the most common convention today. The only use of underscores is for internal node packages, and this is simply a convention from the ear

@liberium
liberium / Tickets proposals.md
Last active October 25, 2018 11:35
Refactoring proposals for Tickets

The reference app could be found here.

General proposals

Infrastructure

  • Place the front-end code in a separate repo.
  • Create a boilerplate with create-react-app.
  • Keep .env in the root of the front-end repo, not in src/API/.
  • Use boilerplate generator like one from https://github.com/react-boilerplate/react-boilerplate.
    $ npm run generate container Foo
    will create a bunch of files and directories that otherwise you would be creating manually (all with contents!):
@liberium
liberium / proposals.md
Last active October 7, 2018 18:32
Code review test task for Spdload

Module structure

  • Webpack path alias should be added for top-level modules: components, screens, store, etc.

    Justification:

    import { Scale } from 'components' is more succinct than import Scale from './../../components/Scale'.

  • components/ should be a Node module: contain index.js with import-export statement for each component submodule.

Justification: this way, we would be able to import { A, B, C } from 'components' instead of writing three statements.

/**
clientDurations = [1,2,3]
numTicketWindows = 2
getTimeToComplete(clientDurations, numTicketWindows) // 3
*/
function getTimeToServeClients(clientDurations, numTicketWindows) {
/* Array of durations clients have spent in each ticket window. */
const cumulativeDurations = new Array(numTicketWindows).fill(0)
import React, { Component } from 'react'
import PropTypes from 'prop-types'
import { reduxForm } from 'redux-form'
import { validate as validateEmail } from 'email-validator'
import QuickAddPersonForm from './QuickAddPersonForm'
import ExpandedAddContactForm from './ExpandedAddContactForm'
import CollapsedAddContactForm from './CollapsedAddContactForm'
class AddContactForm extends Component {
@liberium
liberium / mtdv-coc.txt
Created May 10, 2017 13:08
Metadevelopment Slack Channel Code of Conduct
Hi there,
Here is some explanation on what is this Community about to make it a bit more clear.
It's called Metadevelopment (mtdv for short): we are exploring Life through the prism of Software Development.
You can think of it as a community, where people are interested in finding and engineering a sustainable personal lifestyle with the help of various tools: technologies, science, psychology and well-being, to mention some.
We discuss a bunch of topics here apart software development: mentoring, career, happiness, lifehacking.
@liberium
liberium / styles.less
Created March 13, 2017 07:35
Using Fira Code for operators only in Atom
atom-workspace {
font-family: "Helvetica Neue";
}
atom-panel.tool-panel {
// font-size: 0.95em;
}
atom-text-editor.editor {
font-size: 16px;

Как подавать заявки в вузы США

Процесс подачи заявок проходит примерно так:

  • Сначала надо предварительно выбрать вузы, в которые вы будете подавать заявку.
  • В августе-сентябре надо зарегистрироваться на три стандартных экзамена и оплатить их ($255 + $150 + $195). Отправка результатов в четыре вуза бесплатно, но их надо будет выбирать между регистрацией и днем экзамена.
  • Где-то к концу октября их всех нужно уже сдать. Потом можно за дополнительные деньги рассылать результаты в другие вузы.
  • Где-нибудь в середине ноября попросить трех людей написать вам рекомендации.
  • В начале декабря заняться заполнением анкет в вузах.
  • Написать Statement of Purpose.