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 <mcp_can.h> | |
#include <SPI.h> | |
#define lo8(x) (uint8_t)((x) & 0xFF) | |
#define hi8(x) (uint8_t)(((x)>>8) & 0xFF) | |
const int SPI_CS_PIN = 17; // CANBed V1 | |
MCP_CAN CAN(SPI_CS_PIN); // Set CS pin | |
uint8_t checkSum = 0xE2; |
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 MyPhase extends PluginPhase { | |
import tpd._ | |
val phaseName = "overrider" | |
override val runsAfter = Set(Pickler.name) | |
override def transformTypeDef(tree: TypeDef)(implicit ctx: Context): Tree = | |
if tree.isClassDef && !tree.rhs.symbol.isStatic then // only look at classes & traits, not objects | |
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 ReflectionWorker extends StandardPlugin { | |
val name: String = "reflectionWorker" | |
override val description: String = "heavy-lift reflection worker" | |
def init(options: List[String]): List[PluginPhase] = | |
new ReflectionWorkerPhase :: Nil | |
} | |
class ReflectionWorkerPhase extends PluginPhase { | |
import tpd._ |
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 co.blocke.reflect | |
import scala.tasty.file._ | |
import scala.tasty.Reflection | |
object Main extends App { | |
val p = Person("Fred", 53) | |
ReflectClass.showInfo(p) |
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 PrimaryFlow extends App { | |
implicit val system = ActorSystem() | |
implicit val materializer = ActorMaterializer() | |
val sj = ScalaJack() | |
val graph = FlowGraph.closed() { implicit builder: FlowGraph.Builder[Unit] => | |
import FlowGraph.Implicits._ | |
val in = Source(List.empty[String]) // hook this up to RabbitMQ | |
val out = Sink.foreach( (mc:Command) => println("Command:" +mc) ) |
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
case class SpeedGraphRC(system: ActorSystem, host: String, groupId: String, topic: String) extends GraphHolder[String] { | |
val count = new LinkedBlockingQueue[Int]() | |
val flow = RunnableGraph.fromGraph(GraphDSL.create() { implicit builder: GraphDSL.Builder[akka.NotUsed] => | |
import GraphDSL.Implicits._ | |
type In = CommittableMessage[Array[Byte], String] | |
val consumerSettings = ConsumerSettings(system, new ByteArrayDeserializer, new StringDeserializer) | |
.withBootstrapServers(host) |
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 com.cof.kafka | |
import org.apache.kafka.common.serialization.{ ByteArrayDeserializer, Deserializer, StringDeserializer } | |
import java.util.concurrent.LinkedBlockingQueue | |
import org.apache.kafka.common.TopicPartition | |
import org.apache.kafka.clients.consumer.{ ConsumerRebalanceListener, OffsetCommitCallback, ConsumerRecord, KafkaConsumer, OffsetAndMetadata } | |
import scala.concurrent.Promise | |
import java.util.concurrent.TimeUnit | |
import scala.collection.JavaConversions._ | |
import scala.concurrent.Await |
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 com.cof.kafka | |
import scala.collection.JavaConversions._ | |
import org.apache.kafka.clients.producer.{ ProducerRecord, KafkaProducer, Callback, RecordMetadata } | |
import kafka.admin.AdminUtils | |
import kafka.utils.ZkUtils | |
case class LateProducer() { | |
def populate(num: Int, host: String, topic: String) { |
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
//---------------------------- build.gradle (Project: gcm) | |
// Top-level build file where you can add configuration options common to all sub-projects/modules. | |
buildscript { | |
repositories { | |
jcenter() | |
} | |
dependencies { | |
classpath 'com.android.tools.build:gradle:1.5.0' |
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
val c = new GzipCompressor | |
val s = """{"baseServiceURL":"http://www.acme.com","endpoints":{"assetSearchURL":"/search","showsURL":"/shows","mediaContainerDetailURL":"/container","featuredTapeURL":"/tape","assetDetailURL":"/asset","moviesURL":"/movies","recentlyAddedURL":"/recent","topicsURL":"/topics","scheduleURL":"/schedule"},"urls":{"aboutAweURL":"www.foobar.com"},"channelName":"Cool Stuff","networkId":"netId","slotProfile":"slot_1","brag":{"launchesUntilPrompt":10,"daysUntilPrompt":5,"launchesUntilReminder":5,"daysUntilReminder":2},"feedbackEmailAddress":"feedback@acme.com","feedbackEmailSubject":"Commends from User","splashSponsor":[],"adProvider":{"adProviderProfile":"","adProviderProfileAndroid":"","adProviderNetworkID":0,"adProviderSiteSectionNetworkID":0,"adProviderVideoAssetNetworkID":0,"adProviderSiteSectionCustomID":{},"adProviderServerURL":"","adProviderLiveVideoAssetID":""},"update":[{"forPlatform":"ios","store":{"iTunes":"www.something.com"},"minVer":"1.2.3","notificationVer":"1.2.5"},{ |
NewerOlder