- Side by side terminology of Future and JS Promises to show similarity. This could be setup earlier when Futures abstraction is introduced. The code examples can then instead use JS Promises which should be familiar to frontend programmers.
- References to Finagle are ad-hoc at best in the current draft. Make it clear to the reader how Finagle is relevant to the paper under discussion, and the goals of the project.
- Fix signature difference between Future.t and Js.Promise.t in code examples
- Add an introduction section which sets the context for this narrative. Building a modern web framework which can apply the principles used in building Finagle. Such a web framework written a statically typed language can provide safety guarantees at compile time. The functional style emphasizing immutability, composition, isolation of side effects etc improves our ability to reason about behaviour.
- Rewrite conclusion section.
- Include accidental vs essential complexity quote from out of the
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
<!-- | |
When an input element gets focused, iOS Safari tries to put it in the center by scrolling (and zooming.) | |
Zooming can be easily disabled using a meta tag, but the scrolling hasn't been quite easy. | |
The main quirk (I think) is that iOS Safari changes viewport when scrolling; i.e., toolbars shrink. | |
Since the viewport _should_ change, it thinks the input _will_ move, so it _should_ scroll, always. | |
Even times when it doesn't need to scroll—the input is fixed, all we need is the keyboard— | |
the window always scrolls _up and down_ resulting in some janky animation. | |
However, iOS Safari doesn't scroll when the input **has opacity of 0 or is completely clipped.** |
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
/* | |
https://fullstack.pupilfirst.org | |
https://github.com/nseadlc-2020/package-todo-cli-task/tree/master/shared | |
*/ | |
const EOL = require('os').EOL | |
const fs = require('fs') | |
const PENDING_TODOS_FILE = 'todo.txt' | |
const COMPLETED_TODOS_FILE = 'done.txt' |
CSS is simple: you have a .css file, you include it in your HTML, and all the styling gets applied to it.
However: CSS evolves rapidly and browsers often can’t keep up..
For example the current box-shadow
property was first implemented only in Chrome, and that property was called -webkit-box-shadow
. This is a convention that browser vendors follow when they implement their own browser-specific CSS properties.
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
# To execute: | |
# ruby ar_sample_impl.rb | |
require 'pp' | |
class ActiveRecord | |
class Migration | |
# See original implementation of `create_table` in ActiveRecord: | |
# https://github.com/rails/rails/blob/main/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb#L296 | |
def self.create_table(table_name) |
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
# Two alternative approaches for https://gist.github.com/peeyush14goyal/506689c0227ff7d7a6071c30f1166a27 | |
todos = [ | |
["Send invoice", "money"], | |
["Clean room", "organize"], | |
["Pay rent", "money"], | |
["Arrange books", "organize"], | |
["Pay taxes", "money"], | |
["Buy groceries", "food"] | |
] |
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
-- to be used in init.lua | |
-- based on https://github.com/fikovnik/ShiftIt/wiki/The-Hammerspoon-Alternative | |
-- replicates ShiftIt functionality | |
function setScreenPrimary() | |
local currentScreen = hs.screen.mainScreen() | |
currentScreen:setPrimary() | |
end | |
function moveToNextScreen() |
“Why Functional Programming Matters” by John Hughes.
https://www.cs.kent.ac.uk/people/staff/dat/miranda/whyfp90.pdf.
https://blog.acolyer.org/2016/09/14/why-functional-programming-matters/
“The Design of a Pretty-printing Library” by John Hughes.
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
/* This example demonstrates how to use bs-express to receive a Json POST request and emit a Json response. */ | |
let myJsonHandler = incoming => | |
/* This is the application-level request handler. It is a pure function that takes a string and returns a Json. | |
In this example, Express doesn't parse the incoming string. We leave it to the application handler so that it has | |
more control (deal with parsing errors in its own way for example) | |
*/ | |
incoming |> Json.parseOrRaise |> MyApplication.doSomething; | |
open Express; |
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
type json = Js.Json.t; | |
let x: json = [%bs.raw {|{"a": [1, "hello", 2, {"b": {"c": [100,200, "d", [10,20,30]]}}]}|}]; | |
let rec json_to_string json => { | |
let array_to_string a => a |> Array.to_list |> String.concat ","; | |
let emitObject o => | |
"{" ^ | |
{ | |
let emitKV (key, value) => key ^ ": " ^ json_to_string value; |
NewerOlder