Skip to content

Instantly share code, notes, and snippets.

title air_date doctor
The Eleventh Hour 3 April 2010 11
The Doctor's Wife 14 May 2011 11
Horror of Fang Rock 3 September 1977 4
An Unearthly Child 23 November 1963 1
The Mysterious Planet 6 September 1986 6
Rose 26 March 2005 9
The Power of the Daleks 5 November 1966 2
Castrolava 4 January 1982 5
import gallia.*;
import scala.Symbol;
// ===========================================================================
class GalliaJava { // 220301145258; ~/lib/java$ javac -cp /tmp/gallia-core-assembly-0.3.2.jar:. Gallia.java && java -cp /tmp/gallia-core-assembly-0.3.2.jar:. Gallia
public static void main(String args[]) {
String data = "{\"name\": \"tony\", \"age\": 39, \"obsolete\": true}";
gallia.heads.HeadU headu0 = gallia.package$.MODULE$.InputString__(data).read();
gallia.heads.HeadU headu1 = (gallia.heads.HeadU)headu0.toUpperCase(RPathW.to("name"));
object MediumArticle extends App { // reproducing example from https://medium.com/@thijser/doing-cool-data-science-in-java-how-3-dataframe-libraries-stack-up-5e6ccb7b437#
import gallia._ // see https://github.com/galliaproject/gallia-core/blob/init/README.md#dependencies
// ---------------------------------------------------------------------------
/*
for reference, pandas way provided in the article:
data = pd.read_csv('urb_cpop1_1_Data.csv')
filtered = data.drop(data[data.Value == ":"].index)
filtered['key'] = filtered['CITIES'] + ':' + filtered['INDIC_UR']
import gallia._
import aptus._ // for divideBy and significantFigures utilities
// ===========================================================================
object ReshapingDataWithPivotInSparkArticle {
// reproduces first query in https://databricks.com/blog/2016/02/09/reshaping-data-with-pivot-in-apache-spark.html
// ---------------------------------------------------------------------------
// t210224102310 - not actually implemented yet, but will also use
// https://github.com/galliaproject/gallia-core/blob/init/src/main/scala/gallia/atoms/AtomsIX.scala#L110 for local runs
import gallia._ // see https://github.com/galliaproject/gallia-core/blob/init/README.md#dependencies
// ===========================================================================
object DataFramesAndTablesInScalaArticle {
// https://darrenjw.wordpress.com/2015/08/21/data-frames-and-tables-in-scala/
// ---------------------------------------------------------------------------
def main(args: Array[String]): Unit = {
"/data/misc/cars93.csv".stream()
.filterBy("EngineSize").matches(_ <= 4.0)
import gallia._ // see https://github.com/galliaproject/gallia-core/blob/init/README.md#dependencies
// ===========================================================================
object StartUsingSparkWithScala { // see https://towardsdatascience.com/stop-using-pandas-and-start-using-spark-with-scala-f7364077c2e0 by Chloe Connor
// test meta
case class FootballTeam(
name : String,
league : String,
matches_played : Int,
@anthony-cros
anthony-cros / WordCount.scala
Created February 23, 2021 19:33
Reproduces go-to Word Count example
import gallia._
// ===========================================================================
object WordCount { // see http://spark.apache.org/examples.html and https://hadoop.apache.org/docs/current/hadoop-mapreduce-client/hadoop-mapreduce-client-core/MapReduceTutorial.html
def main(args: Array[String]): Unit = {
// INPUT: "Hello World Bye World\nHello Hadoop Goodbye Hadoop"
// ---------------------------------------------------------------------------
package minimal
import org.scalajs.dom
import scala.scalajs.js
object App {
def main(args: Array[String]): Unit = {
// prints to console as expected
package minimal
import scala.scalajs.js
import scala.scalajs.js.annotation.JSImport
object Bindings {
// ===========================================================================
// ReactDOM
import React, { Component } from 'react';
import logo from './logo.svg';
import './App.css';
class App extends Component {
render() {
return (
<div className="App">
<header className="App-header">
<img src={logo} className="App-logo" alt="logo" />