Skip to content

Instantly share code, notes, and snippets.

# Si las relaciones son contínuas (ej. pueden ser expresadas por una función real),
# una ANN puede aproximarla de forma precisa:
#
# https://en.wikipedia.org/wiki/Universal_approximation_theorem
# Install
# $ python --version
# Python 3.8.5
# $ pip --version
# pip 20.1.1 from /usr/lib/python3.8/site-packages/pip (python 3.8)
@josejuan
josejuan / hide.user
Last active September 6, 2020 18:08
// la consola javascript suele abrirse con F12, copiar, pegar, ENTER:
[].slice.call(document.querySelectorAll("li.comment"))
.filter(x => x.querySelector("b.fn").innerText == "David B")
.forEach(x => x.style.display = 'none')
// Antonio (AKA "Un físico")
[].slice.call(document.querySelectorAll("li.comment"))
.filter(x => x.querySelector("b.fn").innerText == 'Antonio (AKA "Un físico")')
.forEach(x => x.style.display = 'none')
class ToFrom f where
to :: List2 a -> f a
from :: f a -> List2 a
instance ToFrom Maybe where
to End = Nothing
to (Elem x _) = Just x
from Nothing = End
from (Just x) = Elem x End
import Test.QuickCheck
import Algorithm.Search
...
-- conversion util
to :: List2 a -> [a]
to End = []
to (Elem x xs) = x: to xs
package com.foo;
import com.htravel.fp.Either;
import io.reactivex.Observable;
import static com.htravel.fp.Either.left;
import static com.htravel.fp.Either.right;
public class Bar {
private static NodeList<Statement> reduceDoExpression(final NodeList<Statement> xs) {
final NodeList<Statement> rs = new NodeList<>();
int i = 0;
while (i < xs.size()) {
final Statement s = xs.get(i);
if (s.isExpressionStmt()) {
final Expression e = s.asExpressionStmt().getExpression();
if (e.isVariableDeclarationExpr()) {
final VariableDeclarationExpr vde = e.asVariableDeclarationExpr();
if (vde.getVariables().size() == 1) {
package foo.bar;
import static com.htravel.fp.Parsers.maybeInt;
import static java.util.stream.Collectors.toList;
import com.htravel.fp.Either;
import java.util.stream.IntStream;
import rx.Observable;
public class Observar {
package man;
import static com.xxx.fp.Either.left;
import static com.xxx.fp.Either.right;
import static java.lang.String.format;
import com.xxx.fp.Either;
import java.util.function.Function;
public class Main {
> :set -XGeneralizedNewtypeDeriving
> instance (Num a, Num b) => Num (a, b) where (a, b) + (c, d) = (a+c,b+d)
> newtype Z = Z (Int, Int) deriving (Eq, Ord, Show, Num)
> Z (3, 4) + Z (5, 6)
Z (8,10)
frequencyCounterSpec _ctCode _cCode =
describe "FrequencyCounter actions" $ do
let rq action auth = action $ CounterReq (CounterTypeReq auth _ctCode) _cCode
speed milliseconds times msg sat = do
it ("Running " ++ show times ++ " times every " ++ show milliseconds ++ " mS should " ++ msg) $ rq $ \r -> do
forM_ [1..times] $ \_ -> do
void $ cli $ counterPost r 1
liftIO $ threadDelay (1000 * milliseconds)
rs <- cli $ counterPost r 1
rs `shouldSatisfy` sat