Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@erichgess
erichgess / Cassandra Schemas
Last active June 1, 2018 13:31
Planet Cassandra Spark Blog
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 );
// 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 )
;; 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 January 2, 2016 08:19
A Sample of F# Code
// 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) =