Skip to content

Instantly share code, notes, and snippets.

View zerobias's full-sized avatar
💭
Set your status

Dmitry zerobias

💭
Set your status
View GitHub Profile
@zerobias
zerobias / safe-padding.css
Last active March 9, 2020 12:12
Safe body paddings with env() and max() support
/* size variables */
:root {
--md: 8px;
--md-2: calc(var(--md) * 2);
--md-3: calc(var(--md) * 3);
--md-4: calc(var(--md) * 4);
}
/* safe area defaults */
@zerobias
zerobias / bar.f12f7610.js
Created February 26, 2020 15:43
parcel 2 dynamic import
parcelRequire.registerBundle('e1095da0325446888ed16378b7e22c16', function() {
var e =
'undefined' != typeof globalThis
? globalThis
: 'undefined' != typeof self
? self
: 'undefined' != typeof window
? window
: 'undefined' != typeof global
? global
@zerobias
zerobias / decompress.js
Created December 27, 2019 10:17
decompress effector repl sources
const keyStrUriSafe =
'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-$'
const baseReverseDic = {}
const charAt = (str, i) => str.charAt(i)
for (let i = 0; i < keyStrUriSafe.length; i++) {
baseReverseDic[charAt(keyStrUriSafe, i)] = i
}
console.log(decompress(localStorage.getItem('code-compressed')))
@zerobias
zerobias / lsdb.ts
Created November 27, 2019 12:27
Reactive database with localStorage and effector
import {
createEvent,
createStore,
createEffect,
combine,
forward,
Effect,
Store,
Event,
step
@zerobias
zerobias / .babelrc.js
Created December 10, 2017 22:19
Node.js microservice as single file w/o dependencies with babel 7 and rollup
//@flow
module.exports = {
"presets": [
"@babel/preset-flow",
["@babel/preset-env", {
"targets": {
"node": "8.9"
},
// "shippedProposals": true,
@zerobias
zerobias / raf.js
Created April 8, 2019 04:58
requestAnimationFrame
const root = function () {
if (typeof window !== 'undefined') return window
if (typeof self !== 'undefined') return self
if (typeof globalThis !== 'undefined') return globalThis
if (typeof global !== 'undefined') return global
if (typeof this !== 'undefined') return this
}()
export const requestAnimationFrame =
@zerobias
zerobias / proposal_tasks.md
Last active July 18, 2019 22:07
effector proposal: tasks

Tasks

try it

Current effect behavior

const fx = createEffect({
  handler(params) {
    console.log(params)
  },
{
"type": "root",
"children": [
{
"type": "thematicBreak",
"position": {
"start": {
"line": 1,
"column": 1,
"offset": 0
import React from 'react'
import ReactDOM from 'react-dom'
function iterate(unit) {
const source = createEvent()
const begin = createEvent()
const end = createEvent()
const iteration = createEvent()
const item = iteration.map(({value}) => value)
import {createEvent, createStore, Event, forward, Store} from 'effector'
export class Iteration<T> {
index: number
item: T
list: T[]
constructor(index: number, item: T, list: T[]) {
this.index = index
this.item = item
this.list = list