Skip to content

Instantly share code, notes, and snippets.

View roman's full-sized avatar

Roman Gonzalez roman

View GitHub Profile
@roman
roman / CircuitBreaker.hs
Last active August 29, 2015 14:23
Prototype of CircuitBreaker interface using Type Families to compile valid transations of a CircuitBreaker state
{-# LANGUAGE GADTs #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE KindSignatures #-}
{-# LANGUAGE TypeFamilies #-}
module Main where
import Data.Time (UTCTime, getCurrentTime)
data CircuitData = CircuitData {}
@roman
roman / Example.hs
Created June 11, 2015 20:35
Example on how to create constrained functions for particular ADT constructors in Haskell using GADTs, DataKinds and KindSignatures extension
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE KindSignatures #-}
{-# LANGUAGE GADTs #-}
module Main where
data UserType
= VirtualUser
| RealUser
data User (userType :: UserType) where
@roman
roman / Observable.hs
Created June 5, 2015 00:05
Experiments with a Cont Monad approach for Observables
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE KindSignatures #-}
{-# LANGUAGE RecursiveDo #-}
module Main where
import Control.Concurrent (myThreadId)
import Control.Exception (SomeException)
import Control.Applicative (Alternative(..))
import Control.Monad (liftM, ap, unless, foldM_)
import Data.IORef (newIORef, atomicModifyIORef', readIORef)
@roman
roman / core.clj
Created April 10, 2015 18:03
Hystrix-clj hello world
(ns hystrix-hello-world.core
(:require
;; hystrix
[com.netflix.hystrix.core :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 [com.netflix.hystrix
@roman
roman / schedulers.clj
Last active April 25, 2018 15:47
Simplest example of concurrency with Schedulers
(ns rx.example.schedulers
(:require
[monads.core :refer [Monad] :as monad]
[clojure.core.match :refer [match]]
[disposables.core :as disposable]
[com.unbounce.treajure.io :as tio]
[rx.lang.clojure.core :as rx]
[clj-http.client :as http])
(:import
[java.util.concurrent Executors]
(defvar navorski-packages
'(navorski))
(defun navorski/terminal-line-mode ()
(interactive)
(when (term-in-char-mode)
(term-line-mode)
(linum-mode 1))
(when (evil-emacs-state-p)
(evil-normal-state)))
@roman
roman / packages.el
Created January 8, 2015 22:52
Clocker's packages.el
(defvar clocker-packages
'(powerline
dash))
(defface clocker/mode-line-clock-in-face
'((t (:foreground "white" :background "#F2686C" :inherit mode-line)))
"Clocker's face for CLOCK-IN mode-line message."
:group 'clocker)
(defun clocker/org-clocking-p ()
@roman
roman / debug.el
Last active August 29, 2015 14:13
spacemacs tooltip-error (without X support)
Debugger entered--Lisp error: (void-function tooltip-mode)
(tooltip-mode -1)
eval-buffer(#<buffer *load*-146703> nil "/home/vagrant/.emacs.d/spacemacs/config.el" nil t) ; Reading at buffer position 5784
load-with-code-conversion("/home/vagrant/.emacs.d/spacemacs/config.el" "/home/vagrant/.emacs.d/spacemacs/config.el" nil nil)
load("/home/vagrant/.emacs.d/spacemacs/config.el")
(if (file-exists-p file) (load file))
(let ((file (concat dir file))) (if (file-exists-p file) (load file)))
(while --dolist-tail-- (setq file (car --dolist-tail--)) (let ((file (concat dir file))) (if (file-exists-p file) (load file))) (setq --dolist-tail-- (cdr --dolist-tail--)))
(let ((--dolist-tail-- files) file) (while --dolist-tail-- (setq file (car --dolist-tail--)) (let ((file (concat dir file))) (if (file-exists-p file) (load file))) (setq --dolist-tail-- (cdr --dolist-tail--))))
(progn (let ((--dolist-tail-- files) file) (while --dolist-tail-- (setq file (car --dolist-tail--)) (let ((file (concat dir file)))
module Diplomat.WebSocket (
Url()
, parseUrl
, AttemptCount()
, MsDelay()
, Connection()
, PendingConnection()
, WebSocketEvent(..)
, WebSocketOptions()
@roman
roman / RxPlayground.purs
Created November 19, 2014 00:09
Purescript + rxjs playground
module RxPlayground where
import Debug.Trace (trace, print)
import Control.Monad.Eff
import Data.Array ((..))
foreign import data Observable :: * -> *
foreign import data Subject :: * -> *
foreign import data Observer :: * -> *