Skip to content

Instantly share code, notes, and snippets.

View yozaam's full-sized avatar
🦍
dev

Yohaan Vakil yozaam

🦍
dev
View GitHub Profile
@yozaam
yozaam / einsteintributepage.markdown
Last active February 2, 2020 06:30
EinsteinTributePage
@yozaam
yozaam / grokkingLeetcode.md
Last active May 3, 2020 13:40
This is a mapping from the syllabus of Grokking the Coding Interview to their respective Leetcode Problems
@yozaam
yozaam / express-server-side-rendering.md
Created October 26, 2020 09:02 — forked from joepie91/express-server-side-rendering.md
Rendering pages server-side with Express (and Pug)

Terminology

  • View: Also called a "template", a file that contains markup (like HTML) and optionally additional instructions on how to generate snippets of HTML, such as text interpolation, loops, conditionals, includes, and so on.
  • View engine: Also called a "template library" or "templater", ie. a library that implements view functionality, and potentially also a custom language for specifying it (like Pug does).
  • HTML templater: A template library that's designed specifically for generating HTML. It understands document structure and thus can provide useful advanced tools like mixins, as well as more secure output escaping (since it can determine the right escaping approach from the context in which a value is used), but it also means that the templater is not useful for anything other than HTML.
  • String-based templater: A template library that implements templating logic, but that has no understanding of the content it is generating - it simply concatenates together strings, potenti
@yozaam
yozaam / LeetcodePythonTemplates.py
Created June 5, 2021 10:50
Template classes like DSU for Leetcode Problems
class DSU:
def __init__(self, n = 1000000000):
self.parent = [i for i in range(n)]
self.rank = [1] * n
def make_set(self,u):
self.parent[u] = u
self.rank[u] = 1
def find_set(self,u):
if self.parent[u] == u:
return u