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
@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 ?>
function curry$(f, bound){
var context,
_curry = function(args) {
return f.length > 1 ? function(){
var params = args ? args.concat() : [];
context = bound ? context || this : this;
return params.push.apply(params, arguments) <
f.length && arguments.length ?
_curry.call(context, params) : f.apply(context, params);
} : f;
@haskellcamargo
haskellcamargo / TableParser.php
Last active August 29, 2015 14:22
HOLY SHIT DON'T USE THIS WORKAROUND
<?php
/**
* @package unilsc
* @author Marcelo Camargo
* @since 2015/06/08
* @license GNU GPL v3
* P.S.: NMTBR => Not Meant To Be Readable.
*/
ini_set('display_startup_errors',1);
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<textarea cols="50" rows="10" id="ide"></textarea>
</body>
<script type="text/javascript">
/**
@haskellcamargo
haskellcamargo / frankenstein.php
Last active August 31, 2017 18:46
Frankenstein - TypeScript Preprocessor
<?php
function parse($file)
{
$result_stack = [];
$tokens = token_get_all("<?php " . file_get_contents($file));
for ($i = 0, $l = sizeof($tokens); $i < $l; $i++) {
// T_OPEN
if (is_open($tokens[$i])) {
{-# LANGUAGE UnicodeSyntax #-}
module Proof where
import System.Console.ANSI
import Prelude.Unicode
import Control.Monad.Unicode
{-
Calculations and mathematical proofs of circular computations.
@author Marcelo Camargo
-}
@haskellcamargo
haskellcamargo / Mortivacional.hs
Last active October 25, 2015 01:17
Mortivacional.hs
module Mortivacional where
import System.Console.ANSI
drawLine :: IO ()
drawLine = putStrLn $ replicate 23 '-'
turnRed :: IO ()
turnRed = setSGR [ SetConsoleIntensity BoldIntensity
, SetColor Foreground Vivid Red
]
@haskellcamargo
haskellcamargo / packing.clj
Created August 19, 2015 17:09
Circle packing
(ns pack.core)
(enable-console-print!)
; Circle packing automator
; @author Marcelo Camargo
(defn translate [x y]
(str "translate(" x "," y ")"))
(def diameter 960)
(ns pack.updatedata)
; Set the dimensions of the canvas / graph
(def margin (
js-obj "top" 30
"right" 20
"bottom" 30
"left" 50))
(def width (reduce - [600 (.-left margin) (.-right margin)]))
(def height (reduce - [270 (.-top margin) (.-right margin)]))
(ns json.core)
(def data JSONData)
(def format
(.. js/d3
-time
(format "%a %b %d %Y")))
(def amount-fn (fn [d]
(.-amount d)))
(def date-fn (fn [d]