Skip to content

Instantly share code, notes, and snippets.

View themathmagician's full-sized avatar

themathmagician

View GitHub Profile
@themathmagician
themathmagician / keybase.md
Created October 22, 2018 17:03
Keybase verifier

Keybase proof

I hereby claim:

  • I am themathmagician on github.
  • I am themathmagician (https://keybase.io/themathmagician) on keybase.
  • I have a public key ASBFhB5F3Wo5pZRW2-hXSx7BR3ST7DEoqwZNlma9erqANgo

To claim this, I am signing this object:

@themathmagician
themathmagician / readme.md
Last active September 20, 2018 21:52
Postgresql + Docker

Runs a docker container with default postgres image

--name sets name to purposedb,

-e injecting the env variable POSTGRES_PASSWORD

-d run the container in the background

-p maps containerport to localhost port

$docker run --name purposedb -e POSTGRES_PASSWORD=mysecretpassword -d -p 5432:5432 postgres

Check that container is running

$docker ps

// Map a list to a frequency list by using groupBy with identity and mapValues
val chars = "Peace and harmony"
chars.groupBy(identity).mapValues(_.size).toList
//Use a tupple: type to pass in two arguments for pattern matching, like goldilocks("porridge", "Mama")
def goldilocks(tuple: (String, String)) = tuple match {
case ("porridge", "Papa") ⇒ "Papa eating porridge"
case ("porridge", "Mama") ⇒ "Mama eating porridge"
case ("porridge", "Baby") ⇒ "Baby eating porridge"
case _ ⇒ "what?"
@themathmagician
themathmagician / 0_reuse_code.js
Created September 5, 2017 11:50
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console