View payroll.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
abstract class Employee { | |
def salary: Int | |
} | |
trait InOffice { | |
def desk: String | |
} | |
trait Remote { | |
def location: String |
View codemotion.ics
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
View gist:264cd17f85cb014cb46c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def assert(expected: Int, actual: Int){ | |
if(expected == actual){ | |
println("OK"); | |
} | |
else { | |
println("Error, expected: " + expected + " actual: "+ actual); | |
} | |
} |
View chop.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Set-ExplorerOptions -showHidenFilesFoldersDrives -showProtectedOSFiles -showFileExtensions | |
Disable-InternetExplorerESC | |
Install-WindowsUpdate | |
Disable-MicrosoftUpdate | |
cinst IIS-WebServerRole -source windowsfeatures | |
NewerOlder