Skip to content

Instantly share code, notes, and snippets.

View rlbisbe's full-sized avatar

Roberto Luis Bisbe rlbisbe

View GitHub Profile
@rlbisbe
rlbisbe / gist:264cd17f85cb014cb46c
Last active October 22, 2015 10:50
Calendar parser for codemotion
var fs = require('fs');
var obj = JSON.parse(fs.readFileSync('data.json', 'utf8'));
var result = "";
var writer = {
log : function(params){
result += params + "\r\n";
BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//hacksw/handcal//NONSGML v1.0//EN
BEGIN:VEVENT
SUMMARY:Coffee break
DTSTART:20151127T104500Z
DTEND:20151127T113000Z
END:VEVENT
BEGIN:VEVENT
SUMMARY:Registro
abstract class Employee {
def salary: Int
}
trait InOffice {
def desk: String
}
trait Remote {
def location: String
class Intern (salary_param: Int, desk_param: String, startDate_param: Int) extends Employee with InOffice with Temporary {
val salary = salary_param
val desk = desk_param
val stay = 6
val startDate = startDate_param
}
class Developer (salary_param: Int, desk_param: String) extends Employee with InOffice {
val salary = salary_param
val desk = desk_param
abstract class Employee
case class Manager(startYear: Int, direct: Array[Employee]) extends Employee
case class Dev(startYear: Int) extends Employee
case class Intern(stay: Int) extends Employee
object Payroll {
def printSalary(employee: Employee) {
val currentYeay = 2001
employee match {
case Intern(stay) =>
println(stay * 300)
case Dev(startYear) =>
println(1000 + (currentYeay - startYear) * 500)
case Manager(startYear, direct) =>
println(1000 + (currentYeay - startYear) * 500 + direct.length * 20)