Skip to content

Instantly share code, notes, and snippets.

@Lcfvs
Lcfvs / complex-etched-type-demo.md
Last active May 18, 2021 01:48
Extend the etched types

How to run this script?

Into a terminal: npx https://gist.github.com/Lcfvs/4b1523653bfe54605b82113170299f61

@Lcfvs
Lcfvs / emitter.js
Created March 14, 2021 11:17
A simple event emitter, without any lib dedicated to.
import * as etched from 'https://unpkg.com/@etchedjs/etched@latest/etched.min.js'
const emitter = etched.model({
set event (value) {
console.log('event `event` emitted on `emitter` with value', value)
}
})
const emitter2 = etched.model(emitter, {
set event (value) {
const Async = async function(){}.constructor
const AsyncGenerator = async function*(){}.constructor
const Generator = function(){}.constructor
const isAsync = fn => fn instanceof Async
const isAsyncGenerator = fn => fn instanceof AsyncGenerator
const isGenerator = fn => fn instanceof Generator
((d, s = d.createElement('style')) => (s.textContent = '.contenu {left: unset}') && d.body.appendChild(s))(document)
(function(n,t,r,u,e,c,o){return t=String.fromCharCode,r=function(n,u){return u=c.length,n.replace(/./g,function(n){return c.indexOf(n).toString(u)}).replace(r.n,function(n){return t(parseInt(n,u))})},u=function(n,e){return e=function(n,t){return t=[],r.f(n)[r.a]("")[r.i](function(n,u,e){return!(1&u)&&t[r.j](e[u][r.b](0)*r.d+e[u+1][r.b](0))}),t}(n),function(n){return n[r.a]("")[r.h](function(n){return n[r.b](0)})}(r("⁢‬‬‬‫‫‫⁢⁡‫‫‫⁢‬‫‫‫⁢‫‫‫‫‫‫‫⁢‬‬‬⁢‬‬‬‫‫‫‫‫‫‫⁢‫‫‫‬⁢‬‬‬‫‫‫⁤‬⁢‬‬‬‫‫‫‬‫‫‫‫‫⁡‫‫‫⁡‫‫‫‫⁢‬‬‬⁢‬‬‬⁢‬‬‬⁢‬‬‬‫‫‫⁢‬‬‬‫‫‫⁡‫‫‫⁢⁢‬‬‬⁢‬‬‬‫‫‫‫⁢⁢‬‬‬⁢‬‬‬‫‫‫⁡⁢‫‫‫⁢‬‬‬‫‫‫‫⁢‬‬‬‫‫‫‫‫‫⁣‫‫‫‫‬⁢‬‬‬‫‫‫‫⁤‫‫‫‫‫‬⁢‬‬‬‫‫‫⁡⁢‬‬‬‫‫‫‬⁢‬‬‬‫‫‫"))[r.c]()[r.i](function(n,t){return t=n,e=function(n,t){return 1&(n[r.k](function(n,t){return t>n?n:t},0)^n[r.k](function(n,t){return n>t?n:t},0)^t)&&n[r.c](),n}(e,n)[r.h](function(u){return t=((u^n)-t+r.e)%r.e})}),r.g(e,t),u},r.t=n,e=r.constructor,c="‫‬⁡⁢⁣⁤",r.n=/.{2}/g,o=e("e",r("⁤⁢‬⁤‬⁡⁣‫⁡⁢⁤⁢⁡⁤‬⁡⁢‬⁤⁢⁣⁤⁤⁤⁡⁢⁤⁢⁢⁤‬⁡
/**
* Usage:
* function fn([{a, b}, out], c) {
* out.c = c
* out.d = a + b + c
* }
*
* const obj = {a: 1, b: 2}
* io(fn, obj, 3)
* console.log(obj) // obj = {a: 1, b: 2, c: 3, d: 6}
@Lcfvs
Lcfvs / full-ajax-navigation.js
Last active January 28, 2019 07:14
Create a complete AJAX navigation in 3 generic lines of code. Demo: https://lcfvs.github.io/anticore-quick-start/
import {anticore} from 'anticore'
import 'anticore/middleware/main/mono'
anticore.defaults().populate()
@Lcfvs
Lcfvs / spinner.css
Created January 26, 2019 04:47
CSS spinner
.fetching {
pointer-events: none;
}
.fetching::after {
content: '';
border-radius: 100%;
border-top: .2em solid rgba(255, 255, 255, .9);
border-left: .2em double rgba(255, 255, 255, .6);
border-bottom: .2em dotted rgba(255, 255, 255, .3);
@Lcfvs
Lcfvs / assets\js\dev\exception.md.js
Created January 17, 2019 20:13
Simple server exception manager, for anticore. Try it with https://github.com/Lcfvs/anticore-default-project
// create this file
import { anticore } from 'anticore'
import { one } from 'anticore/dom/query/one'
import { replace } from 'anticore/dom/tree/replace'
anticore.on('main.exception', function (element, next, loaded) {
loaded && replace(element, one('body > main'))
next()
})
@Lcfvs
Lcfvs / flat-webpack-banner.json
Created September 25, 2017 12:41
flat-webpack-banner.json
/* {
"name": "localhost",
"version": "1.0.3",
"author": "lcf.vs <[email protected]>",
"license": "MIT",
"dependencies": {
"URL": {
"name": "js-polyfills",
"version": "0.1.34",
"author": "Joshua Bell",