Skip to content

Instantly share code, notes, and snippets.

View juanbono's full-sized avatar
:shipit:

Juan Bono juanbono

:shipit:
View GitHub Profile
@juanbono
juanbono / steps.txt
Created April 10, 2018 00:11 — forked from softprops/steps.txt
Steps to build an awesome ecosystem
1. have a brilliant idea for something you want to use
2. Stop! Don't start building it.
3. Find a project that does something similar. (This likely exists)
4. Read it's documentation.
* If it has none, learn the project and create some.
* If it does, try to build something with it and document what wasn't clear.
5. If it feels broke. Write some failing tests,
* If possible, fix them, then open a pr
* If not, open a pr with failing tests and get the maintainer to teach you how to fix them
6. Document your process for contributing in a file called CONTIBUTING.md
@juanbono
juanbono / thinkingInReact.re
Created February 11, 2018 14:22 — forked from broerjuang/thinkingInReact.re
This is the implementation of thinking in react using reason
type product = {
category: string,
price: string,
stocked: bool,
name: string
};
type products = list(product);
let products = [
type copyOpts;
[@bs.obj] external makeCopyOpts : (~overwrite: bool=?, ~errorOnExist: bool=?, ~dereference: bool=?, ~preserveTimestamps: bool=?, ~filter: (string=>bool)=?, unit) => copyOpts = "";
/* copySync(src, dest, [options]) */
/* https://github.com/jprichardson/node-fs-extra/blob/master/docs/copy-sync.md */
[@bs.module "fs-extra"] external copySyncExternal : (string, string, copyOpts) => unit = "copySync";
let copySync = (~overwrite=?, ~errorOnExist=?, ~dereference=?, ~preserveTimestamps=?, ~filter:option(string => bool)=?,
src: string, dest: string) =>
@juanbono
juanbono / Preorders.agda
Created January 19, 2018 17:17 — forked from rntz/Preorders.agda
Some simple order/category theory
{-# OPTIONS --postfix-projections #-}
module Preorders where
open import Level
open import Data.Unit hiding (_≤_)
open import Data.Product hiding (map)
open import Function hiding (id)
open import Relation.Binary public using (Reflexive; Transitive; Symmetric; _=[_]⇒_)
import Relation.Binary.PropositionalEquality as Eq
open Eq using (_≡_)
@juanbono
juanbono / CBNLambdaEff.hs
Created January 12, 2018 22:09 — forked from dorchard/CBNLambdaEff.hs
A Haskell implementation of the categorical semantics for the effectful CBN lambda calculus
{-# LANGUAGE GADTs, TypeFamilies, EmptyDataDecls #-}
{-
A Haskell-based implementation of the monadic semantics for the
simply-typed Call-By-Name computational lambda calculus, following
Moggi's 'Computational lambda-calculus and monads' (1989) (technical report version)
but for the typed calculus (rather than untyped as in this paper).
Category theory seminar, Programming Languages and Systems group,
@juanbono
juanbono / BasicServer.re
Created January 2, 2018 07:58 — forked from jaredly/BasicServer.re
Simple Static File Server in Reason/OCaml
let recv = (client, maxlen) => {
let bytes = Bytes.create(maxlen);
let len = Unix.recv(client, bytes, 0, maxlen, []);
Bytes.sub_string(bytes, 0, len)
};
let parse_top = top => {
let parts = Str.split(Str.regexp("[ \t]+"), top);
switch (parts) {
@juanbono
juanbono / html-cleanup.hs
Created December 27, 2017 07:48 — forked from snoyberg/html-cleanup.hs
Small example of xml-conduit for cleaning up some HTML: remove unneeded <span>s and convert <br>s to \n
#!/usr/bin/env stack
-- stack --resolver lts-10.0 script
{-# LANGUAGE OverloadedStrings #-}
import Text.XML
import qualified Data.Map.Strict as Map
main :: IO ()
main = do
Document x (Element n a nodes) y <- Text.XML.readFile def "foo.html"
Text.XML.writeFile def "foo2.html" $ Document x (Element n a $ concatMap goN nodes) y
@juanbono
juanbono / promises.re
Created December 15, 2017 22:15 — forked from lilactown/promises.re
Notes on using JavaScript Promises in ReasonML/BuckleScript
/**
* Making promises
*/
let okPromise = Js.Promise.make((~resolve, ~reject as _) => [@bs] resolve("ok"));
/* Simpler promise creation for static values */
Js.Promise.resolve("easy");
Js.Promise.reject(Invalid_argument("too easy"));
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE OverloadedStrings #-}
module Main where
import Data.Foldable (for_)
import Data.Traversable (for)
import Control.Monad.IO.Class
-- build-depends: base, haskeline, optparse-applicative
-- -- for example parser