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
@cindywu
cindywu / home.html
Created January 6, 2023 19:23
react components nesting components
<!-- index.html -->
<html>
<body>
<div>
<div id="app">
</div>
<script src="https://unpkg.com/react@17/umd/react.development.js"></script>
<script src="https://unpkg.com/react-dom@17/umd/react-dom.development.js"></script>
<script src="https://unpkg.com/@babel/standalone/babel.min.js"></script>
@cindywu
cindywu / home.html
Created January 6, 2023 19:11
react react-dom babel render a thing
<!-- index.html -->
<html>
<body>
<div>
<div id="app">
</div>
<script src="https://unpkg.com/react@17/umd/react.development.js"></script>
<script src="https://unpkg.com/react-dom@17/umd/react-dom.development.js"></script>
<script src="https://unpkg.com/@babel/standalone/babel.min.js"></script>
@cindywu
cindywu / gist:a8fa623b2e8a7728420e6b8524bacb31
Created January 6, 2023 18:26
nextjs-foundations.html
<!-- index.html -->
<html>
<body>
<div>
<div id="app"></div>
<script type="text/javascript">
const app = document.getElementById('app')
const header = document.createElement('h1')
@cindywu
cindywu / mastermind.js
Created January 4, 2023 18:05
mastermind
// cli or react? cli!
// start game
// make a guess
// see past guesses (if any)
// recieve response for guess
// colors: red, yellow, blue, green, purple, orange
@cindywu
cindywu / ttt.js
Last active December 29, 2022 18:55
tic tac toe in javascript
console.log('tic tac toe, three in a row...')
const readline = require('readline').createInterface({
input: process.stdin,
output: process.stdout
});
const printBoard = (board) => {
console.log(
`\n`,
@cindywu
cindywu / contributions.txs
Created September 24, 2022 04:03
contributions
function Contributions({items, handleSetShowContributions} : {items: any, handleSetShowContributions: (state: boolean) => void}) {
const yearArray = Array.from(Array(365).keys())
// console.log('yearArray', yearArray)
// loop through items and create an array of days of the year with the number of items created on that day
const contributions = yearArray.map((day: number) => {
const date = new Date()
date.setDate(date.getDate() - day)
const dateString = date.toISOString().substring(0, 10)
const itemsCreatedOnDate = items.filter((item: any) => {
return item.createdAt.toISOString().substring(0, 10) === dateString
.container {
/* z-index: -1; */
position: absolute;
margin: 0 auto;
display: flex;
flex-direction: row;
background: hsl(0, 0%, 90%);
right: 0;
left: 0;
margin-left: auto;
@cindywu
cindywu / gist:fd622b908cb4a701c9f54999730c1ba9
Created May 13, 2022 00:30
creating manual payout for experiment using console
// find the project
p = Project.find [projectID]
// create and save the funds payout in db
po = Payout.new
po.project_id = p.id
po.credit_type = 0
po.amount = [amount]
po.token = "[tokenID]"
po.user_id = [userID] (mine is 5)
@cindywu
cindywu / htmlToText
Created May 3, 2022 02:54
htmlToText
export function htmlToText(html: string) {
return html && html.replace(/<[^>]+>/g, '').replace(/&nbsp;/g, ` `) || ''
}
import type { ReadTransaction, WriteTransaction } from "replicache";
import { nanoid } from "nanoid";
import { z } from "zod";
export const itemSchema = z.object({
type: z.literal(`item`),
createdAt: z.string(),
createdBy: z.string(),
title: z.string(),
content: z.string(),