- what is a closure?
- what is a function declaration?
- what is an anonymous function?
- what is a fat arrow function?
- what is Object Oriented Programming?
- what is inheritance?
- What is Object Prototype?
- What is Object.assign?
- What is Object.freeze?
- What is list comprehension?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var aws = require('aws-sdk'); | |
var sfn = new aws.StepFunctions(); | |
exports.handler = function(event, context, callback) { | |
console.log("event:", event) | |
console.log("context:", context) | |
console.log("callback:", callback) | |
let StateMachineArn = event.restart.StateMachineArn; | |
event.restart.executionCount -= 1; | |
event.AWS_STEP_FUNCTIONS_STARTED_BY_EXECUTION_ID = event.executionID |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const getPartsAssemblerStream = s3 => bucket => key => uploadID => { | |
const parts = [] | |
return new stream.Writable({ | |
objectMode: true, | |
write(part, encoding, callback) { | |
if(getOr(false, 'isLast', part) === false) { | |
parts.push(part) | |
callback() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# I always hated Either's name, so changed to Result becuase I like Folktale's better. | |
from pymonad.Monad import * | |
from pydash import map_, some, filter_, head, every | |
class Result(Monad): | |
""" | |
Represents a calculation that may either fail or succeed. | |
An alternative to using exceptions. 'Result' is an abstract type and should not | |
be instantiated directly. Instead use 'Ok' (or its alias 'Ok') and | |
'Error' (or its alias 'Error') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,400,500"> | |
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons"> | |
<link rel="stylesheet" href="material-components-web-elm.min.css"> | |
<style> | |
@font-face { | |
font-family: 'Roboto'; | |
src: url('Roboto-ThinItalic-webfont.eot'); | |
src: url('Roboto-ThinItalic-webfont.eot?#iefix') format('embedded-opentype'), | |
url('Roboto-ThinItalic-webfont.woff') format('woff'), | |
url('Roboto-ThinItalic-webfont.ttf') format('truetype'), |
Elm Tutorial & Guide https://guide.elm-lang.org/
Installing https://guide.elm-lang.org/install.html
Elm Examples
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// JavaScript | |
const fizzAndOrNotBuzz = i => { | |
switch(true) { | |
case i % 15 === 0: return 'FizzBuzz' | |
case i % 5 === 0: return 'Buzz' | |
case i % 3 === 0: return 'Fizz' | |
default: return i | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ resource: '/test-delete-me', | |
path: '/test-delete-me', | |
httpMethod: 'GET', | |
headers: | |
{ accept: 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8', | |
'accept-encoding': 'gzip, deflate, br', | |
'accept-language': 'en-US,en;q=0.9,es;q=0.8', | |
'cache-control': 'max-age=0', | |
Host: 'o8ai4pej00.execute-api.us-east-1.amazonaws.com', | |
'upgrade-insecure-requests': '1', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict' | |
const Validation = require('folktale/validation') | |
const { Success, Failure } = Validation | |
const { | |
isString, | |
some, | |
identity, | |
inRange, |
Hard to understand without mastering pure functions, but ok.
Partial Application is a function where some or all of the arguments are packed inside, ready to go and it's just waiting for a few more before the main function is invoked. They're like functions that have default arguments, but are pure functions with a fixed amount of parameters.
The function below pings google.com:
const pingGoogle = () => fetch('http://google.com')
. If it resolves, Google is there and your computer can talk to the internets. If it throws an error, your computer is probably having wireless trouble.