Skip to content

Instantly share code, notes, and snippets.

@erichgess
erichgess / Cassandra Schemas
Last active Jun 1, 2018
Planet Cassandra Spark Blog
View Cassandra Schemas
create KEYSPACE spark_demo WITH replication = {'class': 'SimpleStrategy', 'replication_factor': '1'};
create table spark_demo.raw_files (filename text,line int, contents text, PRIMARY KEY(filename,line));
create table spark_demo.users (id int PRIMARY KEY );
create table spark_demo.movies (id int PRIMARY KEY, name text, year int);
create table spark_demo.ratings (id int PRIMARY KEY, user_id int, movie_id int, rating float );
View kindling_spark_demo.scala
// First Example:
val first_example = sc.cassandraTable("spark_demo", "first_example")
first_example.first
first_example.first.get[Int]("id")
//---
case class FirstExample(Id: Int, Value: Int )
View firstClojure.clj
;; this will map the regular expression used to match a token type to a code for that token type.
;; For example, the regex for an integer token is "^\d+" and this will map that pattern to 0.
;; Unfortunately, I can't seem to get this to work with matching the regex pattern type with the string keys of the map.
(def TokenTypes { "^\\d+" 0
"^[a-zA-Z]+" 1
"^\\+" 2
"^\\*" 3
"^\\^" 4})
;; This will take a token and a regular expression and return a vecor with the code for the token type
@erichgess
erichgess / testGist6.fs
Last active Jan 2, 2016
A Sample of F# Code
View testGist6.fs
// Adding a comment
module Light
open Point
open System.Drawing
type Light ( position: Point3, color: Color ) =
member this.Position = position
member this.Color = color
let AddColors (c1: Color) (c2: Color) =
You can’t perform that action at this time.