Skip to content

Instantly share code, notes, and snippets.

Avatar

Roberto Luis Bisbe rlbisbe

View GitHub Profile
View payroll.scala
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)
View case_classes.scala
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
View traits_impl.scala
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
View traits.scala
abstract class Employee {
def salary: Int
}
trait InOffice {
def desk: String
}
trait Remote {
def location: String
View codemotion.ics
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
@rlbisbe
rlbisbe / gist:264cd17f85cb014cb46c
Last active Oct 22, 2015
Calendar parser for codemotion
View gist:264cd17f85cb014cb46c
var fs = require('fs');
var obj = JSON.parse(fs.readFileSync('data.json', 'utf8'));
var result = "";
var writer = {
log : function(params){
result += params + "\r\n";
View testcases-chop.scala
def main(args: Array[String]){
test(-1, 2, Array.emptyIntArray)
test(0, 1, Array(1,2,3,4,5))
test(2, 3, Array(1,2,3,4,5))
test(2, 3, Array(1,2,3))
test(0, 1, Array(1))
test(4, 5, Array(1,2,3,4,5))
test(3, 4, Array(1,2,3,4,5))
test(1, 2, Array(1,2,3,4,5))
test(-1, 0, Array(1,2,3,4,5))
View assert-chop.scala
def assert(expected: Int, actual: Int){
if(expected == actual){
println("OK");
}
else {
println("Error, expected: " + expected + " actual: "+ actual);
}
}
View chop.scala
def chop (target: Int, searchBox: Array[Int]) : Int = {
val size = searchBox.size
if (size == 0) {
return -1
}
if (size == 1){
if(searchBox(0) == target){
return 0
} else {
View gist:ffc26609273713187340
Set-ExplorerOptions -showHidenFilesFoldersDrives -showProtectedOSFiles -showFileExtensions
Disable-InternetExplorerESC
Install-WindowsUpdate
Disable-MicrosoftUpdate
cinst IIS-WebServerRole -source windowsfeatures