Skip to content

Instantly share code, notes, and snippets.

Nadav Samet thesamet

View GitHub Profile
View EnumEncoder.scala
case class DeserializeEnumExpression[T](child: Expression)(implicit clsTag: ClassTag[T]) extends UnaryExpression with NonSQLExpression {
override def nullable: Boolean = true
override protected def doGenCode(ctx: CodegenContext,
ev: ExprCode): ExprCode = {
val inputObject = child.genCode(ctx)
val javaType = ctx.javaType(dataType)
val code =
View scalapb.proto
syntax = "proto3";
package scalapb;
option java_package = "com.trueaccord.scalapb";
import "google/protobuf/descriptor.proto";
message ScalaPbOptions {
// If set then it overrides the java_package and package.
thesamet / ScalaPbSerializer.scala
Last active Aug 30, 2019
Akka serializer for ScalaPB messages
View ScalaPbSerializer.scala
package protoser
import java.util.concurrent.atomic.AtomicReference
import akka.serialization.BaseSerializer
import com.trueaccord.scalapb.GeneratedMessageCompanion
class ScalaPbSerializer(val system: ExtendedActorSystem) extends BaseSerializer {
private val classToCompanionMapRef = new AtomicReference[Map[Class[_], GeneratedMessageCompanion[_]]](Map.empty)
thesamet / lvm-raid-ephemeral.yaml
Last active Mar 7, 2020
Create raid0 LVM on EC2 ephemeral storage with Ansible.
View lvm-raid-ephemeral.yaml
# Create a RAID0 LVM through all ephemeral devices and mounts it.
- hosts: all
gather_facts: false
become: true
- apt: name=lvm2 state=present
# On ubuntu, sometimes first ephemeral is already mounted in /mnt.
- mount: name=/mnt src=/dev/xvdb fstype=ext4 state=absent
thesamet / bay-scala-jobs
Last active Jun 29, 2016 — forked from ymasory/bay-scala-jobs
Companies hiring Scala developers in the Bay Area.
View bay-scala-jobs
Companies hiring Scala developers in the Bay Area.
Created in response to a thread on scala-base.
My favorites:
- CloudPhysics
- Wordnik
Unbiased list:
- 10Gen
- Audax Health
thesamet / ReverseProxy.scala
Created Nov 5, 2014
Reverse-proxy in Play!
View ReverseProxy.scala
def reverseProxy = Action.async(parse.raw) {
request: Request[RawBuffer] =>
// Create the request to the upstream server:
val proxyRequest =
WS.url("http://localhost:8887" + request.path)
.withHeaders(flattenMultiMap(request.headers.toMap): _*)
.withQueryString(request.queryString.mapValues(_.head).toSeq: _*)
thesamet / gist:8104952
Created Dec 23, 2013
Angular directive that notifies when it detects element size change.
View gist:8104952
// Calls a function when a change in an element size is detected.
// Uses polling, since there is currently no way to detect resize
// events with CSS flow (without resorting to JQuery UI Resize)
.directive('taOnResize', function($interval) {
return {
restrict: 'A',
link: function(scope, element, attrs) {
var oldWidth = undefined;
var oldHeight = undefined;
var stop = $interval(function() {
thesamet / gist:7419702
Created Nov 11, 2013
Filter JS serialization
View gist:7419702
package controllers
import play.api.libs.json.Json
class Test {
case class Filter(id: Int, table: String, name: String, Type: String, structure: String)
implicit val filterWrites = Json.writes[Filter]
You can’t perform that action at this time.