Skip to content

Instantly share code, notes, and snippets.

View juanbono's full-sized avatar
:shipit:

Juan Bono juanbono

:shipit:
View GitHub Profile
import requests
r = requests.get('https://resultados2019.gob.ar/assets/data/totalized_results/regions/5/5589.json').json()
fit = float([x for x in r['rp'] if x['pc'] == 144 and x['cc'] == 1026][0]['v'])
fdt = float([x for x in r['rp'] if x['pc'] == 109 and x['cc'] == 1026][0]['v'])
jxc = float([x for x in r['rp'] if x['pc'] == 145 and x['cc'] == 1026][0]['v'])
print('FIT', fit / 1)
print('FDT', fdt / 5)
print('JxC', jxc / 8)
@kayceesrk
kayceesrk / stlc.prolog
Last active November 22, 2019 14:05
Type inference and program synthesis from simply typed lambda calculus type checking rules
?- set_prolog_flag(occurs_check,true).
lookup([(X,A)|_],X,A).
lookup([(Y,_)|T],X,A) :- \+ X = Y, lookup(T,X,A).
/* Rules from the STLC lecture */
pred(D,DD) :- D >= 0, DD is D - 1.
type(_,u,unit,D) :- pred(D,_).
@sasa1977
sasa1977 / sql_parser.exs
Created October 13, 2019 08:56
Basic SQL parser developed at WebCamp Zagreb, 2019
defmodule SqlParser do
def run() do
input = "select col1 from (
select col2, col3 from (
select col4, col5, col6 from some_table
)
)
"
IO.puts("input: #{inspect(input)}\n")
IO.inspect(parse(input))
@softprops
softprops / steps.txt
Created April 9, 2018 05:41
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
@broerjuang
broerjuang / thinkingInReact.re
Created February 9, 2018 18:39
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 = [
/*:::::::::: copySync(src, dest, [options]) ::::::::::*/
/* https://github.com/jprichardson/node-fs-extra/blob/master/docs/copy-sync.md */
let optBoolToJS = (optBool: option(bool)) =>
switch (optBool) {
| None => None
| Some(b) => Some(Js.Boolean.to_js_boolean(b));
};
type copyOpts;
@taktoa
taktoa / haskell-pain-points.md
Last active October 26, 2019 04:18
A rant about pain points in Haskell, written as a response to https://redd.it/7rwuxb

I started writing this polemic to answer your question, but I ended up touching on most of my gripes with Haskell in general, not just in a corporate context.

GHC

GHC is a modern compiler with an amazing RTS and tons of features, but I have some issues with it.

Monolithic and Hard to Contribute To

@rntz
rntz / Preorders.agda
Last active January 19, 2018 17:17
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 (_≡_)
@dorchard
dorchard / CBNLambdaEff.hs
Last active November 15, 2018 20:40
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,

Steven Ramsay: Higher-Order Constrained Horn Clauses for Verification

https://arxiv.org/abs/1705.06216

Currently, he's pitching horn-clauses, saying there's already plenty of horn-clause solvers.

Most people prefer higher order logic for writing stuff, but what if we could lift Horn-clauses into a basis for higher-order program verification.