Skip to content

Instantly share code, notes, and snippets.

@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.
@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 / 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 / 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 / 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 / Birds.scala
Created April 3, 2013 12:58
Walk the line example from 'http://learnyouahaskell.com/a-fistful-of-monads#walk-the-line' in scala. Birds using plain scala BirdZ using scalaz
package com.logikujo.scalazrepl
import scalaz._
import Scalaz._
object BirdsCommon {
type Pole = (Int, Int)
trait Direction
case object Left extends Direction
case object Right extends Direction
@AitorATuin
AitorATuin / gist:5977350
Created July 11, 2013 17:16
generate checksums for blocks of a video stream in reverse order
package com.logikujo.CryptoI
import scala.annotation.tailrec
import Implicits._
import MessageDigest.JSHA256._
import scalaz._
import Scalaz._
import java.io.{FileInputStream => FIStream, BufferedInputStream => BFStream, RandomAccessFile}
import java.nio.file.{Paths, Path}

Using Yeoman and Jade

Getting started

  • Make sure you have yo installed: npm install -g yo
  • Run: yo webapp
  • Install grunt-contrib-jade: npm install grunt-contrib-jade --save-dev

Customization

@AitorATuin
AitorATuin / ParamsReplaceTest.scala
Last active December 21, 2015 18:19
ParamsReplacer example
/**
*
* spores / LogiDev - [Fun Functional] / Logikujo.com
*
* com.logikujo.Spore 25/08/13 :: 20:06 :: eof
*
*/
import com.logikujo.Spore._
import scalaz._
@AitorATuin
AitorATuin / CreateNGinxChroot.sh
Last active October 1, 2015 19:25
Little script based on ArchWiki [https://wiki.archlinux.org/index.php/nginx#Installation_in_a_chroot] that aims to create a chroot environment for nginx
#!/bin/sh
function usage() {
echo -e "Little script to create a chroot environment for nginx installations (under archlinux)."
echo -e "\t ATuin"
echo -e "\t GNU GPL 3.0 . No warranties at all. Use at your own risk."
echo -e
echo -e "" echo usage: $0 [directory]
echo -e "\n\t\t --help :: show detailed help on how to setup the chroot environment"
exit 1;