Skip to content

Instantly share code, notes, and snippets.

@elclanrs
elclanrs / Transient.cont.hs
Created April 26, 2023 08:00 — forked from agocorona/Transient.cont.hs
Optimized, simplified continuation monad that implement all the Transient effects (except Web, logging and distributed computing) with mock up implementation of some of them (https://github.com/transient-haskell/transient) Parallelism, concurrency, reactive, streaming, non-determinism, backtracking exceptions, state, early termination
{-# LANGUAGE MultiParamTypeClasses, ExistentialQuantification, ScopedTypeVariables, FlexibleInstances, FlexibleContexts, UndecidableInstances #-}
module TransientCont where
-- some imports
import Control.Applicative
import Control.Monad.IO.Class
import Control.Monad.Trans
@elclanrs
elclanrs / 1-easy.js
Created December 25, 2017 23:32 — forked from nybblr/1-easy.js
3 examples of using Async Generators and Async Iteration in JavaScript!
// Create a Promise that resolves after ms time
var timer = function(ms) {
return new Promise(resolve => {
setTimeout(resolve, ms);
});
};
// Repeatedly generate a number starting
// from 0 after a random amount of time
var source = async function*() {
@elclanrs
elclanrs / README.md
Last active December 10, 2017 02:38
Web Component Simple Wrapper
@elclanrs
elclanrs / README.md
Last active May 21, 2024 22:10
VanillaJS popover with autoposition
  1. Install dependencies
apt update
apt install -y lamp-server^
apt install -y phpmyadmin
a2enmod rewrite # to use permalinks and htaccess
service apache2 restart
adduser vagrant www-data
var deepObjMap = function(f, obj) {
return Object.keys(obj).reduce(function(acc, k) {
if ({}.toString.call(obj[k]) == '[object Object]') {
acc[k] = deepMap(f, obj[k])
} else {
acc[k] = f(obj[k], k)
}
return acc
},{})
}
\documentclass[oneside,12pt]{article}
\usepackage[english]{babel}
\usepackage[T1]{fontenc}
\usepackage{
listings,titlesec,sectsty,setspace,caption,
enumerate,tabularx,
graphicx,fancyhdr,framed,
microtype,ragged2e,
\documentclass[oneside,12pt]{article}
%\usepackage[margin=1.55in]{geometry}
\usepackage[english]{babel}
\usepackage[T1]{fontenc}
\usepackage{
listings,titlesec,sectsty,setspace,
enumerate,tabularx,
graphicx,fancyhdr,framed,
@elclanrs
elclanrs / retext.css
Last active September 13, 2021 10:25
Markdown theme for ReText
body {
color: #333;
font: normal 16px/1.3 Arial, sans-serif;
max-width: 6.5in;
margin: 0 auto;
}
a:link, a:visited {
color: #1B70D1;
text-decoration: none;
var add,all,andF,any,apply,builtin,capitalize,compact,compose,concat,concatF,countBy,curry,curryN,difference,div,drop,dups,each,even,extend,filter,find,first,flatMap,flatten,flip,flip3,flipN,fold,foldr,forOwn,gmatch,groupBy,gt,gte,has,id,inArray,initial,instanceOf,intersection,isF,isType,isntF,join,keys,last,lt,lte,map,match,max,memo,merge,min,mod,mul,nop,notF,odd,orF,pairs,partial,partition,pluck,pluckF,pluckR,reject,replace,rest,reverse,search,sequence,shuffle,size,slice,sort,sortBy,split,sub,substr,take,toArray,toLower,toObject,toUpper,trim,union,unique,unwords,unzipObject,values,variadic,where,withF,words,zip,zipObject,zipWith,_,__slice=[].slice,__indexOf=[].indexOf||function(e){for(var t=0,n=this.length;t<n;t++){if(t in this&&this[t]===e)return t}return-1},__hasProp={}.hasOwnProperty;_={};nop=function(){};id=function(e){return e};builtin=function(e){return nop.call.bind(e)};variadic=function(){var e;e=1<=arguments.length?__slice.call(arguments,0):[];return e};apply=function(){var e,t;t=arguments[0],e=2<=