Skip to content

Instantly share code, notes, and snippets.

View davegurnell's full-sized avatar
🐱

Dave Pereira-Gurnell davegurnell

🐱
View GitHub Profile

Scala Course

Dave Pereira-Gurnell

Objectives

Things that enable a "functional style" in Scala:

  • Scala Language Features
  • Higher Level Theory
points = script.Parent
--[[
This script creates 100 cubes representing "points" on a graph.
It loops through the values of x from 0 to 100, and calculates the correct y value at each position.
For each pair of values, it creates a cube at position x,y.
]]
-- Create a variable called "x" and set it to 0
x = 0
@davegurnell
davegurnell / functional-brighton-code-of-conduct
Last active January 20, 2022 13:13 — forked from didichanoch/sample-discord-coc.md
A sample code of conduct for discord servers.
Functional Brighton Code of Conduct
===================================
Welcome!
--------
Functional Brighton is a Brighton UK based meetup group that aims to bring together people interested in functional programming. We hope that it will complement London-based groups (eg. the London Scala User Group, Hoodlums, F#unctional Londoners, etc.), giving Londoners an excuse for a trip to the seaside and Brightonians some relief from the train.
The current admins are:
* Dave Pereira-Gurnell (@davepg)
@davegurnell
davegurnell / MapControl.stores.tsx
Last active August 30, 2021 12:52
Experiment with custom controls in react-native-mapbox-gl/maps
import MapboxGL from "@react-native-mapbox-gl/maps";
import { storiesOf } from "@storybook/react-native";
import React from "react";
import { StyleSheet, Text, TouchableNativeFeedback, View } from "react-native";
/*
Gist to demonstrate an issue I had with @react-native-mapbox-gl/maps.
I'm trying to display a button over a map and allow the user to click it without
the event bubbling up to the map. However, calls to stopPropagation and preventDefault
package sandbox
import cats.data.Kleisli
import cats.implicits._
case class User(username: String, avatarUrl: String, profileId: Int)
case class Avatar(url: String, monochrome: Boolean)
case class Profile(id: Int, age: Int)
object ComposingStuff extends App {
We can't make this file beautiful and searchable because it's too large.
"ApplicationID","UCASCourse","RouteCode","StudentID","UCASID","UCASChoice","Surname","Forename1","Forename2","Forename3","ContactTelephone","ApplicationCategory","ApplicationStatus","Adjustment","CourseBlock","Decision1","Response1","Decision2","Response2","Decision3","Response3","ChangeCourse","DateOfBirth","HomeEmail","ApplicationCreated"
"428215997106144","L2LW","UJECNFINA","568857580","3621037886","2","Moose","Jared","","","555-1008","HHP","A-RPL","","11","R","","","","","","N","2001-01-02","imye@example.com","2021-01-28"
"528576159287913","V301","USIHF","291416942","5700883392","0","Goldfish","Jamaal","","","555-0317","HHP","A-ZM","","11","","","","","R","","N","2004-01-01","lzdk@example.com","2021-01-04"
"713368803847975","H4N2","UMAERMAN","010983536","1840011905","3","Octopus","Krysta","","","555-0697","","","","11","C","D","","","","","N","2004-01-02","brdt@example.com",""
"839009020641917","F302","USPWH","219697781","6913718958","0","Goat","Yolonda","","","555-1430","OOP","A-RPL","","11","","","","",
case class Color(red: Double, green: Double, blue: Double) {
def isLight: Boolean =
(red + green + blue) / 3.0 >= 0.5
def toGreyscale: Color = {
val avg = (red + green + blue) / 3.0
Color(avg, avg, avg)
}
}
package basics
import org.scalatest.matchers.should.Matchers
import org.scalatest.wordspec.AnyWordSpec
import org.scalatestplus.scalacheck.ScalaCheckDrivenPropertyChecks
import org.scalacheck.Gen
import org.scalacheck.Arbitrary
class MathSpec extends AnyWordSpec with Matchers with ScalaCheckDrivenPropertyChecks {
// OBJECTS --------------------------------------
object iceCream {
val name = "Sundae"
val inCone = false
val numCherries = 1
def inGlass: Boolean =
!inCone
@davegurnell
davegurnell / conway.md
Created October 7, 2019 08:09
Conway's Game of Life Case Study

Case Study: Conway's Game of Life

Rules of Mob Programming

  • One keyboard, one screen
  • One driver, many navigators
  • Rotate driver every 15 minutes
  • Everyone gets time at the keyboard
  • Complete each story (plan, code, test) before moving on
  • Take breaks when you need to