Skip to content

Instantly share code, notes, and snippets.

View krfong916's full-sized avatar
🦁
Organizing for a brighter future

Kyle Fong krfong916

🦁
Organizing for a brighter future
  • University of California, Santa Cruz
View GitHub Profile
@krfong916
krfong916 / ddd.md
Last active March 20, 2024 08:39
Notes on Clean, MVC, and DDD

DDD and Object Oriented: Concepts, Analysis, Heuristics

Points

Why do we move logic from a controller?

If we make a change, like add a property to the domain model, we have to make the same change for every use case of that model, and there could be n more use cases. We would also add m validations for that property - so one change could result in n x m changes.

What roles do factories play? What do we put in them? When do we use them?

The Fundamentals

box-shadows

  • Soft inset: box-shadow: inset 0 2px 4px 0 hsla(0,0%,0%,.2)
  • Transparent: box-shadow: inset 0 0 0 1px hsla(0,0%,0%,.1)
  • Soft shadow 1: box-shadow: 0 1px 3px hsla(0, 0%, 0%, 0.2), 0 4px 12px rgba(0, 0, 0, 0.08);
  • Soft shadow 2: box-shadow: 0 5px 15px 0 hsla(0,0%,0%,0.15)

position basics

  • By default, all elements are position:static. This means the element will be positioned according to the order in the HTML structure.
@krfong916
krfong916 / what-forces-layout.md
Created September 30, 2021 19:05 — forked from paulirish/what-forces-layout.md
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.

Element APIs

Getting box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
//
// Regular Expression for URL validation
//
// Author: Diego Perini
// Created: 2010/12/05
// Updated: 2018/09/12
// License: MIT
//
// Copyright (c) 2010-2018 Diego Perini (http://www.iport.it)
//
@krfong916
krfong916 / notes.md
Last active August 26, 2021 02:51
The Bottomline Editor

Piece Table

  • Inventor of Piece Table == J Strother Moore, the inventor of the boyer-moore string search algorithm

Summaries

Atom Editor Experience Post

Big Idea: Piece Table encoded as a Splay tree for large file edits

A splay tree is useful because it provides efficient lookup for workloads with high locality.

Demonstrates the tradeoffs of representing edits as a list v. as a splay tree

@krfong916
krfong916 / framework-sizes.md
Created July 19, 2021 06:01 — forked from Restuta/framework-sizes.md
Sizes of JS frameworks, just minified + minified and gzipped, (React, Angular 2, Vue, Ember)

Below is the list of modern JS frameworks and almost frameworks – React, Vue, Angular, Ember and others.

All files were downloaded from https://cdnjs.com and named accordingly. Output from ls command is stripped out (irrelevant stuff)

As-is (minified)

$ ls -lhS
566K Jan 4 22:03 angular2.min.js

Architecture

Cloudfront

  • a Content Delivery Network (CDN). A CDN delivers content through nodes (data centers) that are globally distributed
  • When a user requests content that we're serving from CloudFront (our application), the user is routed to the edge location that provides the lowest latency
  • User requests content and is routed to the nearest CDN -> low latency, best performance
  • If the content is not at the edge location (content DNE at node) CloudFront retrieves the content from the origin we define (our S3 bucket)

Lambda@Edge

  1. For headers
@krfong916
krfong916 / rabbitmq_notes.md
Created March 24, 2021 20:04 — forked from Dev-Dipesh/rabbitmq_notes.md
Why RabbitMQ is better over Redis and notes on RabbitMq.

Redis is Database whereas RabbitMQ was designed as a message router or message-orientated-middleware (mom), so I'm sure if you look for benchmarks, you'll find that RabbitMQ will outperform Redis when it comes to message routing.

RabbitMQ is written in Erlang which was specifically designed by the telecom industry to route messages, you get clustering out of the box due to it being written in Erlang which means in a clustered environment, RabbitMQ will outperform Redis even further.

Furthermore, you get guaranteed delivery of messages due to the AMQP protocol, in other words, if the network drops while consuming the message, the consumer won't be able to say thanks for the message, so the consumer will drop the message and Rabbit will requeue the message, if you publish a message and the queue didn't say thanks to the publisher due to network problems or timeouts, Rabbit will drop the message and the publisher will keep on trying to publish the message. You can have publish retries with backoff policies, so