Skip to content

Instantly share code, notes, and snippets.

@AitorATuin
AitorATuin / AccountTest.scala
Last active December 15, 2015 05:29
Validator and Validables in Scala
package com.logikujo.form
import com.logikujo.Validator._
import scalaz._
import Scalaz._
object Form extends App {
def toInt(s:String) = try {
s.toInt.some
@AitorATuin
AitorATuin / gist:4718038
Created February 5, 2013 21:45
takeN in coffeescript. Take n elements from array
n = [1..3]
takeN = (n) -> (arr) ->
_add = (arr1,arr2) -> (i) -> arr1[i] = arr2[i]
arr1 = []
(_add arr1, arr) i for i in [0..n-1]
test = ["a","b","c","d","e"]
res = (takeN 2) test
@AitorATuin
AitorATuin / MontyHall.lua
Created December 19, 2012 00:29
MontyHall en lua
#!/usr/bin/lua
--
-- Monty Hall
--
--
local chooseDoor = function ()
return math.random(1,3)
end
@AitorATuin
AitorATuin / LoserishOraculus.scala
Created October 13, 2012 21:55
Enabling Pimp Types on abstract methods in trait
package com.sbs.oraculus.loserishoraculus
trait LoserishOraculus {
def showMeTheAnswer:String
}
@AitorATuin
AitorATuin / EightQueens.scala
Created August 26, 2012 10:38
Eight Queens in scala
package org.noisesOfHill.exercises.EightQueens
import scalaz._
import Scalaz._
/**
* User: AitorATuin
* Date: 13/06/12
* Time: 19:56
* Little program to solve the epic problem of the Eight Queens.