Skip to content

Instantly share code, notes, and snippets.

View roman's full-sized avatar

Roman Gonzalez roman

View GitHub Profile
@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 / 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 / free.clj
Last active August 29, 2015 14:24
Implementation of Free Monads using bwo's Monads library
(ns util.monads.free
(:require [monads.core :refer :all]
[monads.types :as types]
[clojure.core.match :refer [match]]
[clojure.algo.generic.functor :refer [fmap]]))
(defrecord Free [type functor-value])
(defn pure [val]
@roman
roman / edgar
Created November 13, 2008 15:59
~ Started request handling: Thu Nov 13 14:35:57 +0000 2008
~ Routed to: {"user"=>{"password_confirmation"=>"******", "openid_url"=>"edgar.gonzalez.net.ve", "username"=>"", "password"=>"******", "email"=>""}, "format"=>nil, "x"=>"74", "y"=>"12", "age_confirmation"=>"1", "action"=>"create", "controller"=>"users"}
~ Params: {"user"=>{"password_confirmation"=>"******", "openid_url"=>"edgar.gonzalez.net.ve", "username"=>"", "password"=>"******", "email"=>""}, "format"=>nil, "x"=>"74", "y"=>"12", "age_confirmation"=>"1", "action"=>"create", "controller"=>"users"}
~ Redirecting to: http://www.myopenid.com/server?openid.assoc_handle=%7BHMAC-SHA1%7D%7B491c37a5%7D%7BI5qdAQ%3D%3D%7D&openid.identity=http%3A%2F%2Fedgargonzalez.myopenid.com%2F&openid.mode=checkid_setup&openid.return_to=http%3A%2F%2Fgreenwala.integralstaging.com%2Fusers%2Fopenid_completion%3Fopenid1_claimed_id%3Dhttp%253A%252F%252Fedgar.gonzalez.net.ve%252F%26openid_complete%3D1%26rp_nonce%3D2008-11-13T14%253A35%253A58ZNOws6X&openid.sreg.optional=ful
~ 550 relay not permitted
- (Net::SMTPFatalError)
/opt/local/lib/ruby/1.8/net/smtp.rb:680:in `check_response'
/opt/local/lib/ruby/1.8/net/smtp.rb:653:in `getok'
/opt/local/lib/ruby/1.8/net/smtp.rb:635:in `rcptto'
/opt/local/lib/ruby/1.8/net/smtp.rb:546:in `send0'
/opt/local/lib/ruby/1.8/net/smtp.rb:545:in `each'
/opt/local/lib/ruby/1.8/net/smtp.rb:545:in `send0'
/opt/local/lib/ruby/1.8/net/smtp.rb:472:in `send_message'
/opt/local/lib/ruby/gems/1.8/gems/merb-mailer-0.9.4/lib/merb-mailer/mailer.rb:59:in `net_smtp'
~ Request OpenID:
======
#<OpenID::Consumer::CheckIDRequest:0x7fe7a6ab1270 @return_to_args={"rp_nonce"=>"2008-11-13T21:48:41ZSItFtj",
"openid1_claimed_id"=>"http://romanandreg.myopenid.com/"}, @endpoint=#<OpenID::OpenIDServiceEndpoint:0x7fe7a6bbebe0
@local_id="http://romanandreg.myopenid.com/", @display_identifier=nil, @type_uris=["http://openid.net/signon/1.0",
"http://openid.net/sreg/1.0", "http://openid.net/extensions/sreg/1.1",
"http://schemas.openid.net/pape/policies/2007/06/phishing-resistant", "http://openid.net/srv/ax/1.0"], @used_yadis=true,
@server_url="http://www.myopenid.com/server", @canonical_id=nil, @claimed_id="http://romanandreg.myopenid.com/">,
@message=#<OpenID::Message:0x7fe7a6a38b40 @openid_ns_uri="http://openid.net/signon/1.0",
@namespaces=#<OpenID::NamespaceMap:0x7fe7a6a38a78 @namespace_to_alias={"http://openid.net/extensions/sreg/1.1"=>"sreg",
~ Named route not found: default - (Merb::Router::GenerationError)
/Users/roman/Documents/trabajo/personal/merb-project/gems/gems/merb-core-1.0/lib/merb-core/dispatch/router.rb:231:in `url'
/Users/roman/Documents/trabajo/personal/merb-project/gems/gems/merb-core-1.0/lib/merb-core/controller/merb_controller.rb:289:in `url'
/Users/roman/Documents/trabajo/personal/merb-project/gems/gems/merb-helpers-1.0/lib/merb-helpers/form/builder.rb:399:in `process_form_attrs'
/Users/roman/Documents/trabajo/personal/merb-project/gems/gems/merb-helpers-1.0/lib/merb-helpers/form/builder.rb:15:in `form'
/Users/roman/Documents/trabajo/personal/merb-project/gems/gems/merb-helpers-1.0/lib/merb-helpers/form/helpers.rb:95:in `form_for'
/Users/roman/Documents/trabajo/personal/merb-project/gems/gems/merb-helpers-1.0/lib/merb-helpers/form/helpers.rb:31:in `with_form_context'
/Users/roman/Documents/trabajo/personal/merb-project/gems/gems/merb-helpers-1.0/lib/merb-helpers/form/helpers.rb:94:in `form_for'
/Users/roman/Documents/tra
migration 8, :add_projects_users do
up do
create_table :projects_users do
column :user_id, Integer, :key => true
column :project_id, Integer, :key => true
end
end
down do
mysql> describe projects_users;
+------------+---------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+------------+---------+------+-----+---------+-------+
| user_id | int(11) | YES | | NULL | |
| project_id | int(11) | YES | | NULL | |
+------------+---------+------+-----+---------+-------+
this.suggestionFiller = this.fireEvent.delay(500, this, ['inputChanged', possibleSuggestions]);