Skip to content

Instantly share code, notes, and snippets.

Avatar
🐱

Dave Pereira-Gurnell davegurnell

🐱
View GitHub Profile
@davegurnell
davegurnell / MapControl.stores.tsx
Last active Aug 30, 2021
Experiment with custom controls in react-native-mapbox-gl/maps
View MapControl.stores.tsx
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
View KleisliExample.scala
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 {
View testselectorlist.csv
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","","","","",
View ColorAndShape.scala
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)
}
}
View PropertyBasedTestingExample.scala
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 {
View IceCream.scala
// OBJECTS --------------------------------------
object iceCream {
val name = "Sundae"
val inCone = false
val numCherries = 1
def inGlass: Boolean =
!inCone
@davegurnell
davegurnell / conway.md
Created Oct 7, 2019
Conway's Game of Life Case Study
View conway.md

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
View Dinner.scala
package code
import cats.implicits._
// Main.scala
object Main extends App {
val database = PersonDatabase.createTestDatabase
// 1. Write code to:
@davegurnell
davegurnell / copy-responses-to-choices.js
Last active Nov 7, 2021
Script to copy the responses from a text field in one Google Form as choices in a multiple choice field in another Google Form
View copy-responses-to-choices.js
/*
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
START OF CONFIGURATION
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~
Configuration: Form URLs
~~~~~~~~~~~~~~~~~~~~~~~~
You can get these from the address bar
@davegurnell
davegurnell / karabiner.json
Created Jun 8, 2018
Karabiner Elements config file for British Microsoft Sculpt keyboard
View karabiner.json
{
"global": {
"check_for_updates_on_startup": true,
"show_in_menu_bar": true,
"show_profile_name_in_menu_bar": false
},
"profiles": [
{
"complex_modifications": {
"parameters": {