Skip to content

Instantly share code, notes, and snippets.

@sebastiancarlos
sebastiancarlos / kanyeBleach.js
Last active August 1, 2021 17:28
Kanye and the ontology of bleached T-shirts. A JavaScript implementation.
// Let's start by defining the ontology of our universe.
const BLEACH_TRANSFERENCE_RATIO = 0.5
class TShirt {
constructor() {
// By default, a T-shirt is clean.
this.stains = []
}
import { useEffect, useRef } from "react";
// Render an SVG Circle Progress set to the provided progress percentage.
export const CircleProgress = ({ progress = 0 }) => {
const pieElement = useRef(null);
// Update SVG every time the progress prop changes.
useEffect(() => {
pieElement.current.style.setProperty("--progress", progress);
}, [progress]);
:root {
--PI: 3.14159265358979;
}
.pie {
--progress: 0;
--radius: 25;
--circumference: calc(2 * var(--radius) * var(--PI));
fill: transparent;
stroke: #ced4da;
import { useControls, button } from "leva";
import { ToastContainer, toast } from "react-toastify";
import "react-toastify/dist/ReactToastify.css";
import "./styles.css";
import { CircleProgress } from "./CircleProgress";
import { useEffect } from "react";
export default function App() {
const [{ readTime, progress }, set] = useControls(() => ({
readTime: { value: 10 * 1000, label: "Read Time (ms)" }, // Default to 10 seconds
@sebastiancarlos
sebastiancarlos / TechStackGenerator.js
Created October 3, 2021 19:52
Tech Stack Generator
import "./styles.css";
import { useState } from "react";
import Link from "@mui/material/Link";
import { Input } from "./Input";
import { InteractiveStackName } from "./InteractiveStackName";
import { Description } from "./Description";
import {
getRandomStackName,
sanitizeInputValue,
isStackNameValid,
@sebastiancarlos
sebastiancarlos / supermarket.js
Created December 2, 2021 15:07
Interface to buy food from the supermarket.
// interface for food
interface Food {
name: string;
calories: number;
}
// interface for refrigerator
interface Refrigerator {
food: Food[];
addFood(food: Food): void;
@sebastiancarlos
sebastiancarlos / gammaScript.js
Last active February 1, 2022 19:51
GammaScript
export default function (babel) {
return {
visitor: {
BooleanLiteral(path) {
// this code prevents stack overflow
// TODO: fix before IPO
if (path.parent.type === "ArrayExpression") {
return;
}
@sebastiancarlos
sebastiancarlos / bible.json
Created August 22, 2022 16:39
New Revised Standard Version Updated Edition (NRSVUE) of the Bible in JSON
This file has been truncated, but you can view the full file.
{
"Old Testament": {
"Genesis": {
"1": {
"1": "¹ When God began to create the heavens and the earth, ",
"2": "² the earth was complete chaos, and darkness covered the face of the deep, while a wind from God swept over the face of the waters. ",
"3": "³ Then God said, “Let there be light,” and there was light. ",
"4": "⁴ And God saw that the light was good, and God separated the light from the darkness. ",
"5": "⁵ God called the light Day, and the darkness he called Night. And there was evening and there was morning, the first day. \n",
"6": "⁶ And God said, “Let there be a dome in the midst of the waters, and let it separate the waters from the waters.” ",
@sebastiancarlos
sebastiancarlos / popular-npm-create-packages-2022-08.csv
Last active August 26, 2022 17:14
CSV of npm packages using the "create-" naming convention, and number of weekly downloads. Sorted by most downloads. Limited to packages with more than 150 weekly downloads.
@sebastiancarlos
sebastiancarlos / geforcenow_games_with_steam_appid_and_score_info.csv
Created August 27, 2022 20:08
Geforce Now games with Steam appid and score info
game steam appid review_score review_score_desc total_positive total_negative total_reviews review_ratio (total_positive/total_negative)
Factorio 427520 9 Overwhelmingly Positive 131278 1423 132701 92.25439213
ULTRAKILL 1229490 9 Overwhelmingly Positive 32445 366 32811 88.64754098
People Playground 1118200 9 Overwhelmingly Positive 132851 1501 134352 88.50832778
Portal 2 620 9 Overwhelmingly Positive 300945 3674 304619 81.91208492
Rhythm Doctor 774181 9 Overwhelmingly Positive 15628 241 15869 64.84647303
Portal 400 9 Overwhelmingly Positive 109555 1724 111279 63.54698376
RimWorld 294100 9 Overwhelmingly Positive 135718 2370 138088 57.2649789
Stardew Valley 413150 9 Overwhelmingly Positive 484280 9114 493394 53.13583498
Wobbledogs 1424330 9 Overwhelmingly Positive 4247 86 4333 49.38372093