Skip to content

Instantly share code, notes, and snippets.

Baabyyy Shark tu tu ru tu tu tu

Roman Gonzalez roman

Baabyyy Shark tu tu ru tu tu tu
View GitHub Profile
roman /
Created Aug 18, 2019
Fun exercise of implementing Haskell's MVar in Rust
use std::sync::{Condvar, Mutex};
pub struct MVar<T> {
locked_value: Mutex<Option<T>>,
empty_cond: Condvar,
full_cond: Condvar,
// Methods of MVar that need the Clone type constraint
impl<T> MVar<T>
roman /
Created May 22, 2012
Heap Implementation in Java [shivers]...
import java.util.ArrayList;
// This is a min heap
public class Heap {
protected int[] data = new int[1000];
public Heap() {[0] = 0;
roman / Github.hs
Created Sep 16, 2011
Experiments with Github + Redis + Haskell
View Github.hs
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE OverloadedStrings #-}
module Main where
import Control.Failure (Failure(..))
import Control.Monad.Trans (MonadIO, liftIO, lift)
import Control.Monad.IO.Control (MonadControlIO)
View golang_sprintf_luxury.go
package main
import (
// "fmt"
// type Greeter interface {
roman / core.clj
Created Apr 10, 2015
Hystrix-clj hello world
View core.clj
(ns hystrix-hello-world.core
;; hystrix
[ :as hystrix]
[hystrix-event-stream-clj.core :as hystrix-event]
;; http
[aleph.http :refer [start-http-server wrap-ring-handler]]
[clj-http.client :as http])
(:import [
roman /
Last active May 13, 2018
Proof for keybase to prove my identity on github

Keybase proof

I hereby claim:

  • I am roman on github.
  • I am romanandreg ( on keybase.
  • I have a public key ASAvDKNxvV3MbARSw0PrDLl-EggvvoUXWuOeXOm1igAWbQo

To claim this, I am signing this object:

roman / schedulers.clj
Last active Apr 25, 2018
Simplest example of concurrency with Schedulers
View schedulers.clj
(ns rx.example.schedulers
[monads.core :refer [Monad] :as monad]
[clojure.core.match :refer [match]]
[disposables.core :as disposable]
[ :as tio]
[rx.lang.clojure.core :as rx]
[clj-http.client :as http])
[java.util.concurrent Executors]
roman / Example.lhs
Last active Feb 10, 2018
Playing around with Type families and Constraint kinds
View Example.lhs
In this example we are using both *TypeFamilies* and *ConstraintKinds* to create a monadic
interface that keeps track of valid state transitions.
This is an evolution from @pittma experiments from the #haskell channel on the Functional Programming slack
> {-# LANGUAGE GADTs #-}
> {-# LANGUAGE DataKinds #-}
> {-# LANGUAGE StandaloneDeriving #-}
> {-# LANGUAGE MultiParamTypeClasses #-}
> {-# LANGUAGE RankNTypes #-}
roman / lib.hsfiles
Last active Jan 9, 2018
Snapshot of library skeleton for Haskell Projects
View lib.hsfiles
{-# START_FILE #-}
# {{name}}
> Description of what this library does
## Table Of Contents
* [Raison d'etre](#raison-detre)
* [Library Usage](#library-usage)
* [Installation](#installation)
* [Development Notes](#development)
roman / throttle.hs
Last active Dec 7, 2017
Implementation of throttle in Conduit 0.5.x
View throttle.hs
import Control.Concurrent (forkIO, killThread,
threadDelay, newEmptyMVar,
tryTakeMVar, putMVar)
import Control.Monad (void, forever)
import Control.Concurrent.STM (atomically)
import Control.Monad.Trans (MonadIO(..))
import Control.Monad.Trans.Resource (MonadResource, allocate)
import Data.Conduit (GInfConduit, awaitE)
throttle :: (MonadResource m) => Int -> GInfConduit a m a