Skip to content

Instantly share code, notes, and snippets.

// CAUTION
// - Avoid dynamic factories calls
// - Generic factories are not supported in `useModel`and `modelView` components
// Usage:
// const Root = modelView(factory, () => { ... })
// const model = useModel(factory)
// ... const $$instance = invoke(createSome, {someParams})
'use client';
@7iomka
7iomka / unlimited_trials_babeledit.txt
Created January 5, 2020 04:31
Activate BabelEdit temporarily / Unlimited trial
Obviously for educative purposes only.
Furthermore, this DOESN'T activate BabelEdit permanently.
If you like the software, buy it, the devs deserve it.
Since I have no money to buy it, I discovered a workaround for unlimited trials.
It's quite a annoying workaround, but ... it works!
Firstly go to "c:\windows\system32\drivers\etc\" and open the "hosts" file in Notepad/Notepad++/VSCode/Sublime/Atom/whatever as admin (if you don't open it as admin, it won't let you save it).
Add this line at the end of the file:
@7iomka
7iomka / interval.js
Created December 29, 2019 00:26 — forked from jasdeepkhalsa/interval.js
setTimeout and setInterval with pause and resume
// http://stackoverflow.com/questions/7279567/how-do-i-pause-a-window-setinterval-in-javascript
function RecurringTimer(callback, delay) {
var timerId, start, remaining = delay;
this.pause = function() {
window.clearTimeout(timerId);
remaining -= new Date() - start;
};
@7iomka
7iomka / fetch-js.md
Created November 7, 2019 13:07 — forked from Nothing-Works/fetch-js.md
js-fetch
@7iomka
7iomka / .js
Created November 10, 2018 03:39
Nuxt + axios (service pattern style)
// ~/services/axiosClient.js
import axios from 'axios';
// If you need transformRequest and/or transformResponse
// These default transformers should actually be inside the create function
// so they can be overriden but there is an issue why it will not work with axios.create()
// Link: https://github.com/axios/axios/issues/430
//
// Just make it global especially if you only use your own API
@7iomka
7iomka / index.html
Created October 18, 2018 13:04 — forked from rye761/index.html
<!DOCTYPE html>
<html>
<head>
<title>Fireside Chat</title>
<link rel="stylesheet" href="/style/style.css">
</head>
<body>
<h1>Fireside Chat</h1>
<div id="app">
<div v-if="state == 0">
@7iomka
7iomka / gist:d8a65ddd088fecb942d3259f27fc5de0
Created September 7, 2018 19:02 — forked from ayamflow/gist:b602ab436ac9f05660d9c15190f4fd7b
Safari border-radius + overflow: hidden + CSS transform fix
// Add on element with overflow
-webkit-mask-image: -webkit-radial-gradient(white, black);
@7iomka
7iomka / shaurma.js
Created February 2, 2018 18:13 — forked from akella/shaurma.js
Plural intl
let items = new Intl.PluralRules('ru-RU');
let result,word;
for(var i = 0;i<25;i++){
if(items.select(i)=='one'){
word = 'шаурма';
}
if(items.select(i)=='few'){
word = 'шаурмы';
}
if(items.select(i)=='many'){
@7iomka
7iomka / _bem-block.scss
Created September 1, 2017 12:44
Sass helper function to get the block in the current selector
@function b() {
$selector: str-slice(inspect(&), 2, -2);
@each $type in '__', '--' {
@if str-index($selector, $type) {
$selector: str-slice($selector, 0, str-index($selector, $type) - 1);
}
}
@return $selector;
}
@7iomka
7iomka / _bem-block.scss
Created September 1, 2017 12:44
Sass helper function to get the block in the current selector
@function b() {
$selector: str-slice(inspect(&), 2, -2);
@each $type in '__', '--' {
@if str-index($selector, $type) {
$selector: str-slice($selector, 0, str-index($selector, $type) - 1);
}
}
@return $selector;
}