Skip to content

Instantly share code, notes, and snippets.

@gl2748
Created March 22, 2019 18:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gl2748/fba3c402fb9f62871aee5bc9ea833011 to your computer and use it in GitHub Desktop.
Save gl2748/fba3c402fb9f62871aee5bc9ea833011 to your computer and use it in GitHub Desktop.
Notes from CH7. Poäng club.
Last login: Fri Mar 22 11:13:13 on ttys003
Hello, / /\ / /\/
~
👺 curl -X GET https://x5cbx9cqs8.execute-api.us-west-2.amazonaws.com/development/posts
Internal Server Error~
🐸 curl -X GET https://x5cbx9cqs8.execute-api.us-west-2.amazonaws.com/development/posts
Internal Server Error~
🐸 curl -X GET https://x5cbx9cqs8.execute-api.us-west-2.amazonaws.com/development/posts
[{"id":"ab7c7876-fb47-4ac8-a4bd-b2ff0ad3a2cf","author":"alice","permlink":"hello-world","originalID":"1","tag":"funny","createdAt":"2019-03-22T05:13:42.093Z","updatedAt":"2019-03-22T05:13:42.093Z"},{"id":"f756c1f7-2a8f-4830-9763-47cf88629602","author":"bob","permlink":"foobar","originalID":"2","tag":"funny","createdAt":"2019-03-22T05:13:42.093Z","updatedAt":"2019-03-22T05:13:42.093Z"}]~
👺 curl -X GET https://x5cbx9cqs8.execute-api.us-west-2.amazonaws.com/development/posts
[{"id":"ab7c7876-fb47-4ac8-a4bd-b2ff0ad3a2cf","author":"alice","permlink":"hello-world","originalID":"1","tag":"funny","createdAt":"2019-03-22T05:13:42.093Z","updatedAt":"2019-03-22T05:13:42.093Z"},{"id":"f756c1f7-2a8f-4830-9763-47cf88629602","author":"bob","permlink":"foobar","originalID":"2","tag":"funny","createdAt":"2019-03-22T05:13:42.093Z","updatedAt":"2019-03-22T05:13:42.093Z"}]~
🐸 curl -X GET https://x5cbx9cqs8.execute-api.us-west-2.amazonaws.com/development/posts
[{"id":"ab7c7876-fb47-4ac8-a4bd-b2ff0ad3a2cf","author":"alice","permlink":"hello-world","originalID":"1","tag":"funny","createdAt":"2019-03-22T05:13:42.093Z","updatedAt":"2019-03-22T05:13:42.093Z"},{"id":"f756c1f7-2a8f-4830-9763-47cf88629602","author":"bob","permlink":"foobar","originalID":"2","tag":"funny","createdAt":"2019-03-22T05:13:42.093Z","updatedAt":"2019-03-22T05:13:42.093Z"}]~
🐸 curl -X GET https://x5cbx9cqs8.execute-api.us-west-2.amazonaws.com/development/posts
Internal Server Error~
🏺 curl -X GET https://x5cbx9cqs8.execute-api.us-west-2.amazonaws.com/development/posts
Internal Server Error~
🏺 curl -X GET https://x5cbx9cqs8.execute-api.us-west-2.amazonaws.com/development/posts
[{"id":"ab7c7876-fb47-4ac8-a4bd-b2ff0ad3a2cf","author":"alice","permlink":"hello-world","originalID":"1","tag":"funny","createdAt":"2019-03-22T05:13:42.093Z","updatedAt":"2019-03-22T05:13:42.093Z"},{"id":"f756c1f7-2a8f-4830-9763-47cf88629602","author":"bob","permlink":"foobar","originalID":"2","tag":"funny","createdAt":"2019-03-22T05:13:42.093Z","updatedAt":"2019-03-22T05:13:42.093Z"}]~
🐸 curl -X GET https://x5cbx9cqs8.execute-api.us-west-2.amazonaws.com/development/posts
[{"id":"ab7c7876-fb47-4ac8-a4bd-b2ff0ad3a2cf","author":"alice","permlink":"hello-world","originalID":"1","tag":"funny","createdAt":"2019-03-22T05:13:42.093Z","updatedAt":"2019-03-22T05:13:42.093Z"},{"id":"f756c1f7-2a8f-4830-9763-47cf88629602","author":"bob","permlink":"foobar","originalID":"2","tag":"funny","createdAt":"2019-03-22T05:13:42.093Z","updatedAt":"2019-03-22T05:13:42.093Z"}]~
👺 curl -X GET https://x5cbx9cqs8.execute-api.us-west-2.amazonaws.com/development/posts
[{"id":"ab7c7876-fb47-4ac8-a4bd-b2ff0ad3a2cf","author":"alice","permlink":"hello-world","originalID":"1","tag":"funny","createdAt":"2019-03-22T05:13:42.093Z","updatedAt":"2019-03-22T05:13:42.093Z"},{"id":"f756c1f7-2a8f-4830-9763-47cf88629602","author":"bob","permlink":"foobar","originalID":"2","tag":"funny","createdAt":"2019-03-22T05:13:42.093Z","updatedAt":"2019-03-22T05:13:42.093Z"}]~
🐸 curl -X GET https://x5cbx9cqs8.execute-api.us-west-2.amazonaws.com/development/posts
[{"id":"ab7c7876-fb47-4ac8-a4bd-b2ff0ad3a2cf","author":"alice","permlink":"hello-world","originalID":"1","tag":"funny","createdAt":"2019-03-22T05:13:42.093Z","updatedAt":"2019-03-22T05:13:42.093Z"},{"id":"f756c1f7-2a8f-4830-9763-47cf88629602","author":"bob","permlink":"foobar","originalID":"2","tag":"funny","createdAt":"2019-03-22T05:13:42.093Z","updatedAt":"2019-03-22T05:13:42.093Z"}]~
👺 curl -X GET https://x5cbx9cqs8.execute-api.us-west-2.amazonaws.com/development/posts
[{"id":"ab7c7876-fb47-4ac8-a4bd-b2ff0ad3a2cf","author":"alice","permlink":"hello-world","originalID":"1","tag":"funny","createdAt":"2019-03-22T05:13:42.093Z","updatedAt":"2019-03-22T05:13:42.093Z"},{"id":"f756c1f7-2a8f-4830-9763-47cf88629602","author":"bob","permlink":"foobar","originalID":"2","tag":"funny","createdAt":"2019-03-22T05:13:42.093Z","updatedAt":"2019-03-22T05:13:42.093Z"}]~
🐸 curl -X GET https://x5cbx9cqs8.execute-api.us-west-2.amazonaws.com/development/posts
[{"id":"ab7c7876-fb47-4ac8-a4bd-b2ff0ad3a2cf","author":"alice","permlink":"hello-world","originalID":"1","tag":"funny","createdAt":"2019-03-22T05:13:42.093Z","updatedAt":"2019-03-22T05:13:42.093Z"},{"id":"f756c1f7-2a8f-4830-9763-47cf88629602","author":"bob","permlink":"foobar","originalID":"2","tag":"funny","createdAt":"2019-03-22T05:13:42.093Z","updatedAt":"2019-03-22T05:13:42.093Z"}]~
🐸 curl -X GET https://x5cbx9cqs8.execute-api.us-west-2.amazonaws.com/development/posts
[{"id":"ab7c7876-fb47-4ac8-a4bd-b2ff0ad3a2cf","author":"alice","permlink":"hello-world","originalID":"1","tag":"funny","createdAt":"2019-03-22T05:13:42.093Z","updatedAt":"2019-03-22T05:13:42.093Z"},{"id":"f756c1f7-2a8f-4830-9763-47cf88629602","author":"bob","permlink":"foobar","originalID":"2","tag":"funny","createdAt":"2019-03-22T05:13:42.093Z","updatedAt":"2019-03-22T05:13:42.093Z"}]~
🐸 curl -X GET https://x5cbx9cqs8.execute-api.us-west-2.amazonaws.com/development/posts
[{"id":"ab7c7876-fb47-4ac8-a4bd-b2ff0ad3a2cf","author":"alice","permlink":"hello-world","originalID":"1","tag":"funny","createdAt":"2019-03-22T05:13:42.093Z","updatedAt":"2019-03-22T05:13:42.093Z"},{"id":"f756c1f7-2a8f-4830-9763-47cf88629602","author":"bob","permlink":"foobar","originalID":"2","tag":"funny","createdAt":"2019-03-22T05:13:42.093Z","updatedAt":"2019-03-22T05:13:42.093Z"}]~
🏺 curl -X GET https://x5cbx9cqs8.execute-api.us-west-2.amazonaws.com/development/posts
[{"id":"ab7c7876-fb47-4ac8-a4bd-b2ff0ad3a2cf","author":"alice","permlink":"hello-world","originalID":"1","tag":"funny","createdAt":"2019-03-22T05:13:42.093Z","updatedAt":"2019-03-22T05:13:42.093Z"},{"id":"f756c1f7-2a8f-4830-9763-47cf88629602","author":"bob","permlink":"foobar","originalID":"2","tag":"funny","createdAt":"2019-03-22T05:13:42.093Z","updatedAt":"2019-03-22T05:13:42.093Z"}]~
🐸 curl -X GET https://x5cbx9cqs8.execute-api.us-west-2.amazonaws.com/development/posts
[{"id":"ab7c7876-fb47-4ac8-a4bd-b2ff0ad3a2cf","author":"alice","permlink":"hello-world","originalID":"1","tag":"funny","createdAt":"2019-03-22T05:13:42.093Z","updatedAt":"2019-03-22T05:13:42.093Z"},{"id":"f756c1f7-2a8f-4830-9763-47cf88629602","author":"bob","permlink":"foobar","originalID":"2","tag":"funny","createdAt":"2019-03-22T05:13:42.093Z","updatedAt":"2019-03-22T05:13:42.093Z"}]~
🏺 curl -X GET https://x5cbx9cqs8.execute-api.us-west-2.amazonaws.com/development/user
Internal Server Error~
👺 curl -X GET https://x5cbx9cqs8.execute-api.us-west-2.amazonaws.com/development/users
[{"id":1,"name":"Michael"},{"id":2,"name":"Louise"},{"id":3,"name":"Mary"}]~
🏺 curl -X GET https://x5cbx9cqs8.execute-api.us-west-2.amazonaws.com/development/users
[{"id":1,"name":"Michael"},{"id":2,"name":"Louise"},{"id":3,"name":"Mary"}]~
👺 curl -X GET https://x5cbx9cqs8.execute-api.us-west-2.amazonaws.com/development/posts
[{"id":"ab7c7876-fb47-4ac8-a4bd-b2ff0ad3a2cf","author":"alice","permlink":"hello-world","originalID":"1","tag":"funny","createdAt":"2019-03-22T05:13:42.093Z","updatedAt":"2019-03-22T05:13:42.093Z"},{"id":"f756c1f7-2a8f-4830-9763-47cf88629602","author":"bob","permlink":"foobar","originalID":"2","tag":"funny","createdAt":"2019-03-22T05:13:42.093Z","updatedAt":"2019-03-22T05:13:42.093Z"}]~
🏺 curl -X GET https://x5cbx9cqs8.execute-api.us-west-2.amazonaws.com/development/posts
[{"id":"ab7c7876-fb47-4ac8-a4bd-b2ff0ad3a2cf","author":"alice","permlink":"hello-world","originalID":"1","tag":"funny","createdAt":"2019-03-22T05:13:42.093Z","updatedAt":"2019-03-22T05:13:42.093Z"},{"id":"f756c1f7-2a8f-4830-9763-47cf88629602","author":"bob","permlink":"foobar","originalID":"2","tag":"funny","createdAt":"2019-03-22T05:13:42.093Z","updatedAt":"2019-03-22T05:13:42.093Z"}]~
👺 curl -X GET https://x5cbx9cqs8.execute-api.us-west-2.amazonaws.com/development/posts
[{"id":"ab7c7876-fb47-4ac8-a4bd-b2ff0ad3a2cf","author":"alice","permlink":"hello-world","originalID":"1","tag":"funny","createdAt":"2019-03-22T05:13:42.093Z","updatedAt":"2019-03-22T05:13:42.093Z"},{"id":"f756c1f7-2a8f-4830-9763-47cf88629602","author":"bob","permlink":"foobar","originalID":"2","tag":"funny","createdAt":"2019-03-22T05:13:42.093Z","updatedAt":"2019-03-22T05:13:42.093Z"}]~
🐸 curl -X GET https://x5cbx9cqs8.execute-api.us-west-2.amazonaws.com/development/posts
[{"id":"ab7c7876-fb47-4ac8-a4bd-b2ff0ad3a2cf","author":"alice","permlink":"hello-world","originalID":"1","tag":"funny","createdAt":"2019-03-22T05:13:42.093Z","updatedAt":"2019-03-22T05:13:42.093Z"},{"id":"f756c1f7-2a8f-4830-9763-47cf88629602","author":"bob","permlink":"foobar","originalID":"2","tag":"funny","createdAt":"2019-03-22T05:13:42.093Z","updatedAt":"2019-03-22T05:13:42.093Z"}]~
🐸 curl -X GET https://x5cbx9cqs8.execute-api.us-west-2.amazonaws.com/development/posts
[{"id":"ab7c7876-fb47-4ac8-a4bd-b2ff0ad3a2cf","author":"alice","permlink":"hello-world","originalID":"1","tag":"funny","createdAt":"2019-03-22T05:13:42.093Z","updatedAt":"2019-03-22T05:13:42.093Z"},{"id":"f756c1f7-2a8f-4830-9763-47cf88629602","author":"bob","permlink":"foobar","originalID":"2","tag":"funny","createdAt":"2019-03-22T05:13:42.093Z","updatedAt":"2019-03-22T05:13:42.093Z"}]~
🏺 curl -X GET https://x5cbx9cqs8.execute-api.us-west-2.amazonaws.com/development/posts
[{"id":"ab7c7876-fb47-4ac8-a4bd-b2ff0ad3a2cf","author":"alice","permlink":"hello-world","originalID":"1","tag":"funny","createdAt":"2019-03-22T05:13:42.093Z","updatedAt":"2019-03-22T05:13:42.093Z"},{"id":"f756c1f7-2a8f-4830-9763-47cf88629602","author":"bob","permlink":"foobar","originalID":"2","tag":"funny","createdAt":"2019-03-22T05:13:42.093Z","updatedAt":"2019-03-22T05:13:42.093Z"}]~
🏺 curl -X GET https://x5cbx9cqs8.execute-api.us-west-2.amazonaws.com/development/posts
[{"id":"ab7c7876-fb47-4ac8-a4bd-b2ff0ad3a2cf","author":"alice","permlink":"hello-world","originalID":"1","tag":"funny","createdAt":"2019-03-22T05:13:42.093Z","updatedAt":"2019-03-22T05:13:42.093Z"},{"id":"f756c1f7-2a8f-4830-9763-47cf88629602","author":"bob","permlink":"foobar","originalID":"2","tag":"funny","createdAt":"2019-03-22T05:13:42.093Z","updatedAt":"2019-03-22T05:13:42.093Z"}]~
🏺 curl -X GET https://x5cbx9cqs8.execute-api.us-west-2.amazonaws.com/development/posts
[{"id":"ab7c7876-fb47-4ac8-a4bd-b2ff0ad3a2cf","author":"alice","permlink":"hello-world","originalID":"1","tag":"funny","createdAt":"2019-03-22T05:13:42.093Z","updatedAt":"2019-03-22T05:13:42.093Z"},{"id":"f756c1f7-2a8f-4830-9763-47cf88629602","author":"bob","permlink":"foobar","originalID":"2","tag":"funny","createdAt":"2019-03-22T05:13:42.093Z","updatedAt":"2019-03-22T05:13:42.093Z"}]~
👺 curl -X GET https://x5cbx9cqs8.execute-api.us-west-2.amazonaws.com/development/users
[{"id":1,"name":"Michael"},{"id":2,"name":"Louise"},{"id":3,"name":"Mary"}]~
🐸 curl -X GET https://x5cbx9cqs8.execute-api.us-west-2.amazonaws.com/development/users
[{"id":1,"name":"Michael"},{"id":2,"name":"Louise"},{"id":3,"name":"Mary"}]~
🏺 curl -X GET https://x5cbx9cqs8.execute-api.us-west-2.amazonaws.com/development/posts
[{"id":"ab7c7876-fb47-4ac8-a4bd-b2ff0ad3a2cf","author":"alice","permlink":"hello-world","originalID":"1","tag":"funny","createdAt":"2019-03-22T05:13:42.093Z","updatedAt":"2019-03-22T05:13:42.093Z"},{"id":"f756c1f7-2a8f-4830-9763-47cf88629602","author":"bob","permlink":"foobar","originalID":"2","tag":"funny","createdAt":"2019-03-22T05:13:42.093Z","updatedAt":"2019-03-22T05:13:42.093Z"}]~
🏺 curl -X GET https://x5cbx9cqs8.execute-api.us-west-2.amazonaws.com/development/posts
[{"id":"ab7c7876-fb47-4ac8-a4bd-b2ff0ad3a2cf","author":"alice","permlink":"hello-world","originalID":"1","tag":"funny","createdAt":"2019-03-22T05:13:42.093Z","updatedAt":"2019-03-22T05:13:42.093Z"},{"id":"f756c1f7-2a8f-4830-9763-47cf88629602","author":"bob","permlink":"foobar","originalID":"2","tag":"funny","createdAt":"2019-03-22T05:13:42.093Z","updatedAt":"2019-03-22T05:13:42.093Z"}]~
🏺 curl -X GET https://x5cbx9cqs8.execute-api.us-west-2.amazonaws.com/development/users
[{"id":1,"name":"Michael"},{"id":2,"name":"Louise"},{"id":3,"name":"Mary"}]~
👺 curl -X GET https://x5cbx9cqs8.execute-api.us-west-2.amazonaws.com/development/users
Internal Server Error~
👺 curl -X GET https://x5cbx9cqs8.execute-api.us-west-2.amazonaws.com/development/users
Internal Server Error~
👺 curl -X GET https://x5cbx9cqs8.execute-api.us-west-2.amazonaws.com/development/users
[{"id":1,"name":"Michael"},{"id":2,"name":"Louise"},{"id":3,"name":"Mary"}]~
🐸 curl -X GET https://x5cbx9cqs8.execute-api.us-west-2.amazonaws.com/development/posts
[{"id":"ab7c7876-fb47-4ac8-a4bd-b2ff0ad3a2cf","author":"alice","permlink":"hello-world","originalID":"1","tag":"funny","createdAt":"2019-03-22T05:13:42.093Z","updatedAt":"2019-03-22T05:13:42.093Z"},{"id":"f756c1f7-2a8f-4830-9763-47cf88629602","author":"bob","permlink":"foobar","originalID":"2","tag":"funny","createdAt":"2019-03-22T05:13:42.093Z","updatedAt":"2019-03-22T05:13:42.093Z"}]~
🐸 curl -X GET https://x5cbx9cqs8.execute-api.us-west-2.amazonaws.com/development/posts
[{"id":"ab7c7876-fb47-4ac8-a4bd-b2ff0ad3a2cf","author":"alice","permlink":"hello-world","originalID":"1","tag":"funny","createdAt":"2019-03-22T05:13:42.093Z","updatedAt":"2019-03-22T05:13:42.093Z"},{"id":"f756c1f7-2a8f-4830-9763-47cf88629602","author":"bob","permlink":"foobar","originalID":"2","tag":"funny","createdAt":"2019-03-22T05:13:42.093Z","updatedAt":"2019-03-22T05:13:42.093Z"}]~
type Die = One | Two | Three | Four | Five | Six
class Add a b where
add :: a -> a -> b
add :: Die -> Die -> Number
const add = d0 => d1 => toNumber(d0) + toNumber(d1)
const add = d0 => d1 => d0 + d1
toNumber :: Die -> Number
toNumber x = case x of
One -> 1
Two -> 2
...
add(One)(Three)
map :: forall a c. (a -> c) -> List a -> [c]
const map = curry((f, xs) => xs.map(f));
map :: (Int -> String) -> List Int -> [String]
map :: (Int -> Float) -> List Int -> [Float]
head :: [a] -> a
const head = xs => xs[0];
type Maybe a = {hasValue :: Bool, value :: a}
type Maybe a = Just a | Nothing
headSafe :: [b] -> Maybe b
const headSafe = xs => xs.length > 0 ? {hasValue: true, value: xs[0]} : {hasValue: false}
findFirst :: (b -> Bool) -> [b] -> b
filter :: (b -> Bool) -> [b] -> [b]
const filter = curry((f, xs) => xs.filter(f));
class Eq a where
(==) :: a -> a -> Bool
(!=) :: a -> a -> Bool
(!=) x y = not (x == y)
class Ord a where
(>) :: a -> a -> Bool
(<) :: a -> a -> Bool
(<=) :: a -> a -> Bool
(>=) :: a -> a -> Bool
ch7.something 1,1 Top
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment