Skip to content

Instantly share code, notes, and snippets.

View cindywu's full-sized avatar
🍍
i do not want to turn into dust, but into ashes instead

Cindy Wu cindywu

🍍
i do not want to turn into dust, but into ashes instead
View GitHub Profile
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="next-head" content="1" />
<script>
document.documentElement.classList.add("__variable_20951f");
</script>
<meta name="next-head" content="1" />
<script>
@cindywu
cindywu / globals.css
Last active May 14, 2023 17:26
globals.css + tailwind
@tailwind base;
@tailwind components;
@tailwind utilities;
html,
body {
padding: 0;
margin: 0;
font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Oxygen,
Ubuntu, Cantarell, Fira Sans, Droid Sans, Helvetica Neue, sans-serif;
@cindywu
cindywu / next-tailwind-ts.md
Created May 13, 2023 21:29
set up next tailwind ts

mkdir [name] cd [name] echo "{}" > package.json npm install next react react-dom

// add "scripts" to package.json // // "scripts": { // "dev": "next dev", // "build": "next build",

@cindywu
cindywu / minHeapify.ts
Created April 13, 2023 02:24
minHeapify an array
// stones = [2,7,4,1,8,1]
function minHeapify(arr: number[]): number[]{
// push 0-th position to the end
arr.push(arr[0]) // [2, 7, 4, 1, 8, 1, 2]
// we will ignore arr[0] for math purposes
let heap = arr
let cur = Math.floor(heap.length - 1)/2 // (7-1)/2 = 6/2 = 3
/*
7(1)
@cindywu
cindywu / maxHeapify.ts
Created April 13, 2023 02:24
maxHeapify an array
function maxHeapify(arr: any): any {
arr.push(arr[0]) // push 0th position to end
let heap = arr
let cur = Math.floor(heap.length - 1)/2
while (cur > 0) { // ignore the 0th index bc we pushed that value to the end
// go from the half way mark down to 1
let i = cur // start a the half way and work back up to 1
// while left child position is less than length of heap
while (2 * i < heap.length) { // while cur has a left child
if (2 * i + 1 < heap.length && // if cur has a right child too
@cindywu
cindywu / package.json
Created January 30, 2023 23:35
roman numeral package.json
{
"name": "leet-live",
"version": "1.0.0",
"description": "",
"main": "solution.js",
"scripts": {
"test": "jest"
},
"keywords": [],
"author": "",
@cindywu
cindywu / solution.test.js
Created January 30, 2023 23:34
roman numeral test file
const romanToInt = require("./solution");
test("III to equal 3", () => {
expect(romanToInt("III")).toBe(3);
});
test("IV to equal 4", () => {
expect(romanToInt("IV")).toBe(4);
});
@cindywu
cindywu / problem.md
Created January 30, 2023 23:34
roman numeral problem

Roman numerals

Roman numerals are represented by seven different symbols: I, V, X, L, C, D and M.

Symbol       Value
I             1
V             5
X 10
@cindywu
cindywu / soution.js
Created January 30, 2023 23:33
roman numeral solution
const romanNumeralKey = [
["I", 1],
["V", 5],
];
const romanNumeralLookup = {
I: 1,
V: 5,
X: 10,
L: 50,
@cindywu
cindywu / time-in-color.tsx
Created January 25, 2023 21:59
time-in-color.tsx
import React, { useState } from 'react'
export default function Home() {
const colors : string[] = ["bg-emerald-500", "bg-red-500", "bg-yellow-500", "bg-emerald-800", "bg-emerald-900"]
return (
<div className={"h-screen"}>
<ColorBox
colors={colors}
/>