Skip to content

Instantly share code, notes, and snippets.

View Tauka's full-sized avatar
🎯
Focusing

Tauyekel Kunzhol Tauka

🎯
Focusing
  • Nazarbayev University
  • Astana, Kazakhstan
View GitHub Profile
@Tauka
Tauka / envDate.js
Created February 11, 2020 06:41
Script that writes today's date in .env file
const fs = require('fs');
const path = require('path');
const today = new Date();
const dd = String(today.getDate()).padStart(2, '0');
const mm = String(today.getMonth() + 1).padStart(2, '0'); //January is 0!
const yyyy = today.getFullYear();
const dateString = `${dd}.${mm}.${yyyy}`;
fs.writeFileSync(path.join(__dirname, '.env'), `VERSION=${dateString}`);
@Tauka
Tauka / loose-coupling-effector-eng.md
Last active December 26, 2019 11:16
Loose coupling features with `effector`

Loosely coupled features with effector

Motivation

Loose coupling and high reusability of view + businesss logic

Достоинства

  • High reusability of BL
    Several disconnected features can utilize another feature with all it has inside. We can compose features on effector level
@Tauka
Tauka / loose-coupling-effector.md
Last active November 22, 2019 09:59
Слабосвязные фичи в effector

Слабосвязные фичи в effector

Мотивация

Слабая связность и высокая переиспользуемость представлений + логики

Достоинства

  • Высокая переиспользуемость БЛ
    Несколько безсвязных фич, могут использовать внутри себя другую фичу со всеми ее вытекающими. Композиция фич на уровне effector
  • Абстракция БЛ
@Tauka
Tauka / effector-store-structure.js
Created July 22, 2019 09:06
Example structuring store in one file
import { createStore, createEvent, createEffect } from 'effector';
import { $problemId } from './problem';
import { createApiStore } from 'utils/store';
import { submitApi, runCodeApi } from 'api';
import { batchCombine } from 'utils/effector';
/**
* EVENTS, EFFECTS
* ----------------------------------------------------------------------------

Bilimland platform/constructor Manifesto

  1. Platform doesn't know anything about Constructor
  2. Constructor doesn't know anything about Platform
  3. Modules are stand-alone. They do not know anything about neither Platform nor Constructor
    • Modules can be used in any kind of Platform, since it does not depend on it
    • Platform has to expose specific api to Modules, so if one builds such new Platform, it has to provide some properties

There is a contract between Platform and Modules, so in order to co-operate they both must follow some rules.

@Tauka
Tauka / bmg-content-instruction.md
Last active April 23, 2019 06:01
[BMG]: Инструкция по составлению контента

Инструкция по составлению контента

Данный документ содержит общие правила и рекомендации по составлению контента

Таблицы

  1. Не вкладывать таблицы в таблицы

Формулы

  1. Предпочитать [v][\v] (если возможно)
  2. При использовании LaTeX, разбивать длинные формулы на несколько строк с помощью \\ чтобы на мобильниках хорошо выглядело
@Tauka
Tauka / weakMemoizeOne.js
Last active February 11, 2019 03:33
Elegant way to memoize js objects
// allows to memoize function by its first argument
// this is only partial implementation (can be extended to memoize all arguments though)
const weakMemoizeOne = fn =>
{
const wmap = new WeakMap();
const wfn = arg =>
{
if(!wmap.has(arg))
wmap.set(arg, fn(arg));
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
const MIN_BASE = 10;
const LIMIT = .7;
const GROW_SCALE = 2;
class HashMap
{
constructor(base = MIN_BASE)
{
Object.assign(this, this._genNew(base));
}
function Mutilator(data, name, context) {
this.n = name || `mutilation-${+new Date()}`;
this.d = data;
this.c = context || window;
this.isArr = function(p) {
return this.d[p].constructor == Array;
};
this.dispatch = function(p, v, t) {
this.c.dispatchEvent(
new CustomEvent(this.n, {