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
#ifndef __CONFIGURATION_H | |
#define __CONFIGURATION_H | |
// This determines the communication speed of the printer | |
//#define BAUDRATE 250000 | |
#define BAUDRATE 115200 | |
//#define BAUDRATE 230400 |
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
switch(temp_state) { | |
case 0: // Prepare TEMP_0 | |
#ifdef NORMAL_OP | |
#if (TEMP_0_PIN > -1) | |
#if TEMP_0_PIN > 7 | |
ADCSRB = 1<<MUX5; | |
#endif | |
ADMUX = ((1 << REFS0) | (TEMP_0_PIN & 0x07)); | |
ADCSRA |= 1<<ADSC; // Start conversion | |
#endif |
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
INCLUDE_PATH=/opt/local/include | |
LIBRARY_PATH=/opt/local/lib | |
CC_OPTS=-O2 | |
all: | |
gcc test.c -o test $(CC_OPTS) -I$(INCLUDE_PATH) -L$(LIBRARY_PATH) -lbeagleboneio |
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
package scalaio | |
import shapeless._, poly._ | |
object list extends (Id ~> List) { | |
def apply[T](t : T) = List(t) | |
} | |
object headOption extends (List ~> Option) { | |
def apply[T](l : List[T]) = l.headOption |
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
package controllers | |
import scala.concurrent.duration._ | |
import scala.concurrent.ExecutionContext.Implicits._ | |
import play.api.Play.current | |
import play.api.libs.concurrent.Akka | |
import play.api.mvc._ | |
import akka.actor._ |
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 ChainedValidation[E,A](val x : A, val validationResult: ValidationNel[E,A]) { | |
def andThen(f: A => ValidationNel[E, A])(implicit s1: Semigroup[E]) : ChainedValidation[E,A] = { | |
// calculate new validation | |
val newResult = f(x) | |
validationResult match { | |
// (success & newResult) => | |
case Success(_) => | |
newResult match { |
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
/** | |
* Original source: | |
* [[https://gist.github.com/oxbowlakes/970717]] | |
* | |
* Modifications: | |
* - use scala 7.0.5 | |
* - use toValidationNel | |
* - use sequenceU and traverseU instead of the lambda trick | |
* | |
* Part Zero : 10:15 Saturday Night |
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
package functional | |
trait Functor[F[_]] { | |
def fmap[A, B](fa: F[A])(f: A => B): F[B] | |
} | |
final class FunctorOps[F[_], A](val self: F[A])(implicit val F: Functor[F]) { | |
final def fmap[B](f: A => B) = F.fmap(self)(f) | |
} |
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
trait NaturalTransformation[-F[_], +G[_]] { | |
self => | |
def apply[A](fa: F[A]): G[A] | |
def compose[E[_]](f: E ~> F): E ~> G = new (E ~> G) { | |
def apply[A](ea: E[A]) = self(f(ea)) | |
} | |
def or[H[_]](f: H ~> G): ({type f[x] = Coproduct[F, H, x]})#f ~> G = | |
new (({type f[x] = Coproduct[F, H, x]})#f ~> G) { |
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
package optionStuff | |
import scalaz._ | |
import Scalaz._ | |
object optionStuff extends App { | |
case class Test(a: Option[String], b: Option[String]) | |
case object Error | |
implicit val errorInstance = new Monoid[Error.type] { |
OlderNewer