Skip to content

Instantly share code, notes, and snippets.

View scottweaver's full-sized avatar

Scott T Weaver scottweaver

  • Ziverge
  • Austin, TX
View GitHub Profile
@scottweaver
scottweaver / ReverseList.scala
Last active December 2, 2021 19:55
Recursive List Reverse
package axoni
import scala.annotation.tailrec
object ReverseList {
val list0 = List(1, 2, 3)
@tailrec
def revRec(list: List[Int], tsil: List[Int]): List[Int] =
list match {
@scottweaver
scottweaver / HasColumnNames.scala
Last active July 19, 2019 15:05
This is an example of how to extract field names generically using Shapeless's LabelledGeneric.
package vyze.funding.dwr
import simulacrum.typeclass
import shapeless._
import shapeless.ops.hlist.ToTraversable
import shapeless.ops.record._
@typeclass
trait HasColumnNames[T] {
@scottweaver
scottweaver / Problem 1
Last active August 29, 2015 14:25
Scala Problems
/*
* SUMMARY
* You have two case classes: One of the case classes, Settlement, may (via Option) contain
* the other one, TransactionInfo and TransactionInfo may contain a String.
*
* PROBLEM
* Provide a solution for checking whether or not the TransactionInfo's typeCode contained within
* the Settlement is one any one of the follwoing values "271", "272", "1", "0". In the case that either TransactionInfo or
* typeCode is None, the result should be false.
*
2013-02-18 13:22:26 startup archives unpack
2013-02-18 13:22:33 upgrade libpciaccess0 0.12.902-1 0.12.902-1ubuntu0.1
2013-02-18 13:22:33 status half-configured libpciaccess0 0.12.902-1
2013-02-18 13:22:33 status unpacked libpciaccess0 0.12.902-1
2013-02-18 13:22:33 status half-installed libpciaccess0 0.12.902-1
2013-02-18 13:22:33 status half-installed libpciaccess0 0.12.902-1
2013-02-18 13:22:33 status unpacked libpciaccess0 0.12.902-1ubuntu0.1
2013-02-18 13:22:33 status unpacked libpciaccess0 0.12.902-1ubuntu0.1
2013-02-18 13:22:34 upgrade language-selector-gnome 0.79 0.79.1
2013-02-18 13:22:34 status half-configured language-selector-gnome 0.79
#Refernece: https://wiki.archlinux.org/index.php/Color_Bash_Prompt
# Reset
Color_Off='\[\e[0m\]' # Text Reset
# Regular Colors
Black='\[\e[0;30m\]' # Black
Red='\[\e[0;31m\]' # Red
Green='\[\e[0;32m\]' # Green
Yellow='\[\e[0;33m\]' # Yellow