Skip to content

Instantly share code, notes, and snippets.

View haskellcamargo's full-sized avatar
🪲
Everything is terrible

Marcelo Camargo haskellcamargo

🪲
Everything is terrible
View GitHub Profile
#include 'protheus.ch'
Class Endereco
Data CEP As Character
Data Estado As Character
Data Cidade As Character
Data Bairro As Character
Data TipoLogradouro As Character
Data Logradouro As Character
open ReasonReact;
open String;
type error = {status: int};
type action =
| ChangeEmail(string)
| ChangePassword(string)
| PressEnterOnEmail
| PressEnterOnPassword
class Monad m where
(>>=) :: m a -> (a -> m b) -> m b
(>>) :: m a -> m b -> m b
return :: a -> m a
def main():
name = input("What is your name? ")
print("Welcome to Fantasy Land, " + name + "!")
[1 + 1, 2 + 2, 3 + 3, 4 + 4]
@haskellcamargo
haskellcamargo / ramda.js
Last active November 6, 2017 16:07
Ramda rules Eslint
cond([a, b]) = ifElse | either | both
merge(__, { x: y }) = assoc(x, y)
import { __, reject, contains, either } from 'ramda'
const words = [
'oi', 'como', 'vai', 'você', 'seu', 'idiota'
]
const blacklist = [
'idiota', 'babaca', 'fdp'
]
Stmt = _ 'function'i _ name:Name _ '(' ')' _ EOL _ body:Stmt+ _ {
return 'var name ' + name + ' = function () {' + body + '}'
} / _ 'return' _ e:Expression _ {
return 'return ' + e
}
Expression
= head:Term tail:(_ ("+" / "-") _ Term)* {
return tail.reduce(function(result, element) {
if (element[1] === "+") { return result + element[3]; }
const _effect = evaluator => ({ type: 'effect', evaluator });
const _mut = evaluator => ({ type: 'mut', evaluator });
const _while = (condition, body) => env => {
if (condition(env)) {
const state = body.reduce((env, elem) => {
if (elem.type === 'effect') {
void elem.evaluator(env);
return env;
} else if (elem.type === 'mut') {
#include <stdio.h>
#include <stdbool.h>
#include <stdlib.h>
#include <termios.h>
#include <unistd.h>
#include <ctype.h>
#include <string.h>
#define FG_MAGENTA "\x1B[35m"
#define FG_RESET "\x1B[0m"