Skip to content

Instantly share code, notes, and snippets.

View txominpelu's full-sized avatar

Inigo Mediavilla Saiz txominpelu

View GitHub Profile
@txominpelu
txominpelu / gen.py
Created July 24, 2015 14:31
generator
lines = 30000
types = {
"date" : "01-04-2015",
"string" : "hello",
"number" : "10000"
}
class Column(object):
def __init__(self, name, t):
@txominpelu
txominpelu / log
Last active August 29, 2015 14:19
Log
#<Gem::Version "2.2.0">
D, [2015-04-14T17:08:28.311546 #11332] DEBUG -- : HTTPI GET request to webservice.exacttarget.com (net_http)
I, [2015-04-14T17:08:29.677913 #11332] INFO -- : SOAP request: https://webservice.exacttarget.com/Service.asmx
I, [2015-04-14T17:08:29.677983 #11332] INFO -- : SOAPAction: "Create", Content-Type: text/xml;charset=UTF-8, Content-Length: 895
D, [2015-04-14T17:08:29.678013 #11332] DEBUG -- : <?xml version="1.0" encoding="UTF-8"?><env:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tns="http://exacttarget.com/wsdl/partnerAPI" xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"><env:Header><wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"><wsse:UsernameToken wsu:Id="UsernameToken-1" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"><wsse:Username></wsse:Username><wsse:Password Type="http://docs.oasis-open.org/ws
#!/usr/bin/env bash
set -o nounset
set -o errexit
set -o pipefail
declare -r max=2
declare i=0
function wrap() {
#lang scheme
(define (convert char)
(cond
[(char=? char #\<)
"&lt;"]
[(char=? char #\>)
"&gt;"]
[else (string char)]))
@txominpelu
txominpelu / ReadKeys.scala
Created December 18, 2013 13:21
Retrieving rates from json object
import play.api.libs.json._
import play.api.libs.ws.WS
import scala.concurrent.ExecutionContext.Implicits._
import scala.concurrent.Await
import scala.concurrent.duration._
// Just for the example in the console - Await is WRONG
val result = WS.url("http://openexchangerates.org/api/latest.json?app_id=47b18507ef684bfd859ad93e21f3a226").get()
val json = Await.result(result, DurationInt(5).seconds).json
@txominpelu
txominpelu / Glossary-FunctPAndTypeS.md
Last active December 29, 2015 14:19
Glossary - Functional programming and type systems

Principal typings

The process of type inference is the fact of guessing, given an user-written program, what the type of this program is. In general, there may be several correct types for a given program. For example, the program fun x -> x can be given the types int -> int and bool -> bool.

Given a program, a type for this program is principal if it is the most general type that can be given to this program, in the sense that all other psosible types are specialization (instances) of this type. With my fun x -> x example, the polymorphic 'a -> 'a is a principal type.

A type system has the property of principal typing if for every term in the system, there's a principal type that subsumes (is a more general version, or a "supertype") all the other possible typings of the term.

Type systems with principal typing: ML, System F

@txominpelu
txominpelu / traverse-validation
Created August 9, 2013 07:22
How to traverse a list of validation
import scalaz._
import scalaz.syntax.validation._
import scalaz.syntax.traverse._
import scalaz.std.list._
scala> List("1".successNel[String], "2".failNel[String], "3".failNel[String]).sequenceU
res5: scalaz.Validation[scalaz.NonEmptyList[String],List[String]] = Failure(NonEmptyList(2, 3))
@txominpelu
txominpelu / index.html
Created August 22, 2012 22:12
Full code for the tutorial on ember.js states
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<title>Playing with ember states</title>
<script src="http://code.jquery.com/jquery-1.8.0.min.js" type="text/javascript" charset="utf-8"></script>
<script src="handlebars.js" type="text/javascript" charset="utf-8"></script>
<script src="ember-1.0.pre.debug.js" type="text/javascript" charset="utf-8"></script>
</head>
<body>
<script type="text/x-handlebars" data-template-name="master">
@txominpelu
txominpelu / Catalog.java
Created January 19, 2011 18:49
Interfaz del catalogo de refactorizaciones
package dynamicrefactoring.domain.metadata.interfaces;
import java.util.List;
import com.google.common.base.Predicate;
public interface ClassifiedFilterableCatalog<K> {
/**
* Agrega un condicion al filtro actual que se esta aplicando al catalogo.
//Clase original:
package com.proyecto.prueba;
import java.util.*;
public class HolaMundo {
/**
* @param args