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
set nocompatible
filetype off
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
set rtp+=/usr/local/lib/python2.7/dist-packages/powerline/bindings/vim/
" Always show statusline
set laststatus=2

Estatísticas

Modelagem

data AnalyticsType
    = Install
    | Uninstall

data Analytics = {
console.log(y(fact => n =>
n === 0 ? 1 : n * fact(n - 1)
)(5)); // 120
function fact(n) {
if (n === 0) {
return 1;
}
return n * fact(n - 1);
}
console.log(fact(5)); // 120

Quack: The state of the art adorable compiler

What is Quack?

Quack is a compiler infrastructure and multi-paradigm programming language that helps you to write legible, extensible and secure code, avoiding runtime errors with it is powerful and sound type system.

Features

Type inference

module Puzzle where
import Data.List
import System.IO
{- Reading and parsing the sample file -}
readSample :: IO String
readSample = openFile "sample.txt" ReadMode >>= hGetContents
splitWhen :: (Char -> Bool) -> String -> [String]
splitWhen pred str = case dropWhile pred str of
@haskellcamargo
haskellcamargo / io.c
Created July 10, 2017 20:36
Brain show tape
int number_size(int number) {
return floor(log10(abs(number))) + 1;
}
void b_show_tape(int idx, int *cells) {
char *tape = (char *) malloc(sizeof(char));
int tape_idx = 0;
int brain_idx = 0;
int idx_position = 0;
int idx_length = 0;
@haskellcamargo
haskellcamargo / tape.c
Created July 10, 2017 14:22
Brain tape
#include <stdio.h>
void b_show_tape(int idx, int *cells, int size)
{
char tape[100] = "";
char str[2];
int i;
int tape_idx = 0;
for (i = 0; i < size * 4 + 1; i++) {
@haskellcamargo
haskellcamargo / map.cc
Created July 10, 2017 13:30
Node and C++ interop
#include <node.h>
namespace demo {
using v8::FunctionCallbackInfo;
using v8::Isolate;
using v8::Local;
using v8::Object;
using v8::String;
using v8::Value;
type
= literal
| instance
| function
| list
| map
| tuple
| object
| generic
| union