Notes From Steve Kinney's "React Performance" Frontend Masters Course
re: optimizations: "Start with a problem first, then solve it. dont go looking for problems."
"measure first before you optimize for performance. And then measure again."
| // | |
| // MatrixEffect.swift | |
| // | |
| // Created by J.T on 9/8/24. | |
| // | |
| import SwiftUI | |
| import Combine | |
| class MatrixEffectModel: ObservableObject { |
| const multiplyMatrices = (A, B) => { | |
| return [ | |
| A[0]*B[0] + A[1]*B[1] + A[2]*B[2], | |
| A[3]*B[0] + A[4]*B[1] + A[5]*B[2], | |
| A[6]*B[0] + A[7]*B[1] + A[8]*B[2] | |
| ]; | |
| } | |
| const oklch2oklab = ([l, c, h]) => [ | |
| l, |
| import SwiftUI | |
| struct ChatGPTTextField: View { | |
| // MARK: - State | |
| /// State to hold our `TextField` query. | |
| @State private var queryMessage: String = "" | |
| /// Focus state for our `TextField`. |
| // | |
| // AlertItem.swift | |
| // | |
| // Created by Brett Bauman on 7/25/23. | |
| import Foundation | |
| import SwiftUI | |
| struct AlertItem: Identifiable { |
| CREATE TABLE public.artists ( | |
| title character varying NOT NULL, | |
| slug character varying NOT NULL, | |
| id SERIAL PRIMARY KEY -- I use a different ID technique | |
| ); | |
| ALTER TABLE public.artists OWNER TO postgres; | |
| CREATE TABLE public.tracks ( |
Notes From Steve Kinney's "React Performance" Frontend Masters Course
re: optimizations: "Start with a problem first, then solve it. dont go looking for problems."
"measure first before you optimize for performance. And then measure again."
| // | |
| // Created by Adam Whitcroft on 2023-01-23. | |
| // | |
| import SwiftUI | |
| struct SimpleDragGesture: View { | |
| @State private var focussedItem: String = "middle" | |
| @State private var offset = CGSize.zero | |
| @State private var accumulatedOffset = CGSize.zero |
| // | |
| // ContentView.swift | |
| // LiquidCircles | |
| // | |
| // Created by Paul Stamatiou on 10/10/22. | |
| // | |
| import SwiftUI | |
| struct ContentView: View { |
| import { NextResponse } from 'next/server' | |
| import type { NextRequest } from 'next/server' | |
| export function middleware(req: NextRequest) { | |
| // get cookie token | |
| const hasToken = req.cookies.get('token') | |
| // protected routes (admin routes) | |
| if (req.nextUrl.pathname.startsWith('/admin')) { | |
| if (hasToken) { |