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
import type { NodePath } from '@babel/traverse';
/**
* Finds dependencies of a declaration and removes the ones that are used exclusively
* by this declaration.
*
* NOTE: this only works for runtime bindings. Type bindings are excluded as I'd need to patch
* Babel to keep track of type bindings in the context of a declaration, and ain't nobody got
* time for that for now.
*
@haskellcamargo
haskellcamargo / Just.java
Last active July 18, 2022 06:53
Maybe monad implementation in Java 7
package br.com.ngi.monad;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
public class Just<T> extends Maybe<T> {
private T mValue;
@haskellcamargo
haskellcamargo / ParseWhile.hs
Created February 26, 2015 02:21
A While parser for Haskell with Parsec
module ParseWhile where
-- Import necessary libraries
import System.IO
import Control.Monad
import Text.ParserCombinators.Parsec
import Text.ParserCombinators.Parsec.Expr
import Text.ParserCombinators.Parsec.Language
import qualified Text.ParserCombinators.Parsec.Token as Token
@haskellcamargo
haskellcamargo / VarDump.prw
Created June 6, 2015 00:57
Expressions analyzer - AdvPL
#include "protheus.ch"
/**
* Gramatica formal da analise de expressoes, dentro do parser, levando em conta
* a geracao de tokens.
* @author Marcelo Camargo
* @since 17/04/2015
*
* expr := string | number | array | nil | codeblock | date | object
* string := <? T_STRING ?>
@haskellcamargo
haskellcamargo / Function.java
Last active May 5, 2020 12:16
Java maybe monad
package br.com.ngi.ginga.business.util.seq;
/**
* Copyright (C) 2015 - NG Informática
*
* @author Marcelo Camargo
* @since 08/12/2015
*/
public interface Function<Ret, Arg> {
Ret call(Arg arg);
set nocompatible
filetype off
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'VundleVim/Vundle.vim'
" Nerdtree
Plugin 'scrooloose/nerdtree'
#include 'protheus.ch'
// ANSI/VT-100 sequences for console formatting
#define ANSI_BOLD Chr( 27 ) + '[1m'
#define ANSI_LIGHT_RED Chr( 27 ) + '[91m'
#define ANSI_LIGHT_GREEN Chr( 27 ) + '[92m'
#define ANSI_LIGHT_YELLOW Chr( 27 ) + '[93m'
#define ANSI_CYAN Chr( 27 ) + '[36m'
#define ANSI_LIGHT_GRAY Chr( 27 ) + '[37m'
#define ANSI_LIGHT_MAGENTA Chr( 27 ) + '[95m'
#ifdef __HARBOUR__
#include 'hbclass.ch'
#else
#include 'protheus.ch'
#endif
#define CRLF Chr( 13 ) + Chr( 10 )
#define OP_SELECT 1
#define OP_ORDER 2
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
String.prototype.chunkBy = function(len) {
var current = len;
var previous = 0;
var stack = [];
while (this[current]) {
if (this[current++].match(/s+/)) {
stack.push(this.substring(previous, current));
previous = current;
current += len;