- Theory about Big O: https://www.learnhowtoprogram.com/computer-science/big-o-notation-and-binary-trees/big-o-notation
- Practice Big O: https://www.learnhowtoprogram.com/computer-science/big-o-notation-and-binary-trees/big-o-practice
- Big O Cheatsheet: https://www.bigocheatsheet.com/
- Know about Runtime complexity and Space complexity
- Common Big O runtimes
- Efficient
- O(1): Constant time
- Efficient
- O(log(N)): Logarithmic time
This file contains hidden or 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 EventEmitter = require('events'); | |
class MyEmitter extends EventEmitter { | |
constructor() { | |
super(); | |
// use nextTick to emit the event once a handler is assigned | |
process.nextTick(() => { | |
this.emit('event'); | |
}); |
This file contains hidden or 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
import { useContext, createContext } from 'react'; | |
const BorderContext = createContext(1); | |
function Button({ children }) { | |
const borderWidth = useContext(BorderContext); | |
const style = { | |
border: `${borderWidth}px solid black`, | |
background: 'transparent', | |
}; |
This file contains hidden or 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
package main | |
import ( | |
"fmt" | |
"sync" | |
) | |
type Store struct { | |
mu sync.Mutex | |
urls map[string]bool |
This file contains hidden or 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
function parseStrNumber(input) { | |
if (typeof input === 'number') return input; | |
if (typeof input !== 'string' || !input) return NaN; | |
let out = 0; | |
const l = input.length; | |
let pointIndex = input.length - 1; | |
let isNegative = false; |
This file contains hidden or 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
terraform { | |
required_providers { | |
aws = { | |
source = "hashicorp/aws" | |
version = "~> 3.0" | |
} | |
} | |
} | |
# Configure the AWS Provider |
- Latency Numbers Every Programmer Should Know: https://gist.github.com/jboner/2841832
This file contains hidden or 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 "aws_s3_bucket" "b" { | |
bucket = "my-app-test" | |
} | |
resource "aws_s3_bucket_policy" "b" { | |
bucket = aws_s3_bucket.b.id | |
# Terraform's "jsonencode" function converts a | |
# Terraform expression's result to valid JSON syntax. | |
policy = jsonencode({ |
This file contains hidden or 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
# Init the project after create main.tf | |
terrform init | |
# To validate the syntax | |
terrform validate | |
# Run without effect the real world | |
# Use to see how the configs effect the world | |
terrform plan |
This file contains hidden or 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
select | |
table_name, | |
table_type, | |
table_schema | |
from | |
information_schema.tables | |
where | |
table_type = 'BASE TABLE' | |
and table_schema = 'public' |